addSecurityKeyUnlock - multiple declarations

Function addSecurityKeyUnlock

Add a connected security key as a way to unlock this vault.

credentials.store.CredentialStatus addSecurityKeyUnlock(
  credentials.backend.vault.posix_store.EncryptedCredentialVault vault,
  string keyId,
  SecurityKeyAccess access,
  out credentials.backend.vault.protector.VaultUnlockMethod method
) @safe;

Call this while vault is already unlocked. Persist method.serialize() on success so it can be used during a later application run.

Parameters

NameDescription
vault Currently unlocked vault.
keyId id returned by findSecurityKeys().
access Whether touch is enough or the user must be verified.
method Receives the unlock method to persist.

Returns

ok on success. userActionRequired means setup needs the overload that accepts a PIN.

Examples

VaultUnlockMethod method;

auto status = addSecurityKeyUnlock(
    vault,
    key.id,
    SecurityKeyAccess.touch,
    method
);

if (status == CredentialStatus.ok)
    settings.securityKeyUnlock = method.serialize();

Function addSecurityKeyUnlock

Add a security key when setup requires its PIN.

credentials.store.CredentialStatus addSecurityKeyUnlock(
  credentials.backend.vault.posix_store.EncryptedCredentialVault vault,
  string keyId,
  SecurityKeyAccess access,
  scope ref const(credentials.secret.SecretBuffer) pin,
  out credentials.backend.vault.protector.VaultUnlockMethod method
) @safe;

Use this overload after the no-PIN version returns userActionRequired, or when verifiedUser is intentionally PIN-backed.

Parameters

NameDescription
vault Currently unlocked vault.
keyId id returned by findSecurityKeys().
access Required user interaction.
pin PIN entered by the user.
method Receives the unlock method to persist.

Returns

ok on success.