Interface CredentialStore
Common credential-store interface.
interface CredentialStore;
Use this type when application logic should not care whether credentials are stored by Linux, Windows, macOS, an encrypted vault or a test store.
Every store belongs to one CredentialNamespace and returns CredentialHandle values that can be persisted in normal application settings.
Properties
| Name | Type | Description |
|---|---|---|
capabilities[get]
|
StoreCapabilities | Describe how this store behaves. |
credentialNamespace[get]
|
CredentialNamespace | Application namespace this store belongs to. |
Methods
| Name | Description |
|---|---|
remove
(handle)
|
Remove a saved credential. |
save
(secret, handle)
|
Save a new credential. |
update
(handle, replacement)
|
Replace the value of an existing credential. |
withSecret
(handle, callback)
|
Use a saved credential. |
Examples
CredentialHandle handle;
auto status = store .save(secret, handle);
if (status == CredentialStatus .ok)
{
status = store .withSecret(
handle,
(scope const(ubyte)[] bytes) @safe
{
// Use the credential here.
}
);
}