Function MemoryCredentialStore.withSecret
Use a saved credential.
override CredentialStatus withSecret(
CredentialHandle handle,
scope @safe void delegate(scope const(ubyte)[]) callback
) @safe;
Put the operation that needs the credential inside callback. The callback is called only when the credential was found and made available.
Parameters
| Name | Description |
|---|---|
| handle | Handle returned by save() or restored with tryParse(). |
| callback | Code that uses the credential. |
Returns
ok when callback ran; otherwise the reason the credential could not be provided.
Examples
auto status = store .withSecret(
handle,
(scope const(ubyte)[] token) @safe
{
// Send the request that needs token.
}
);