managedCredentialHelper
A helper for managing a set of Credentials.
This helper provides a high-level way to manage credentials on a Document. Its goal is to always have a fixed number of credentials of a specific type available within the following constraints
If a credential is used more than
maxUsesPerCredential
times, a replacement is generated.If a credential expires within
minValidTimeMillis
milliseconds, a replacement is generated.
This is all implemented on top of Credential creation and Credential.certify. The application should examine the return value and if positive, collect the not-yet-certified credentials via Document.pendingCredentials, send them to the issuer for certification, and then call Credential.certify when receiving the certification from the issuer.
Return
the number of credentials created.
Parameters
the document to manage credentials for.
the domain to use for created credentials.
a lambda for creating the credential which only takes in an optional parameter for a replacement credential. This must not be null if dryRun is false.
the time right now, used for determining which existing credentials to replace.
the number of credentials that should be kept.
the maximum number of uses per credential.
requests a replacement for a credential if it expires within this window.
don't actually create the credentials, just return how many would be created.