Skip to Content

Remove an enrolled WebAuthn security key.

Deletes an enrolled WebAuthn security key from a mailbox. The mailbox's own bearer must re-prove the current password (removing the second factor is how a stolen session would downgrade the account); an account admin need not, because they cannot know it and removing a lost key is their remedy.

openemail.securityKeys.remove(
  identityId: string,
  webauthnId: string,
  body?: SecurityKeysRemoveBody,
  options?: CallOptions,
): ApiPromise<void>

It calls DELETE /identities/{identityId}/webauthn/credentials/{webauthnId}: Remove an enrolled WebAuthn security key in the API reference.

Example

await openemail.securityKeys.remove(identityId, webauthnId, {})

Arguments

ArgumentTypeDescription
identityIdstringMailbox identity ULID. The path's {identityId}.
webauthnIdstringWebAuthn key ULID identifier. The path's {webauthnId}.
bodySecurityKeysRemoveBodyOptional. The request's body.

Options

It takes no options of its own. Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).

Answer

Awaited, it is nothing: the API answers no body. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.

Errors

StatusWhat it means
400password_required, for the mailbox's own bearer
401unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge
403invalid_password
404Mailbox or key not found
409no_password_credential: the mailbox's own bearer has no password to re-prove
413too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing
429rate_limited: too many password re-proofs for this mailbox (every guess spends budget, right or wrong)
503temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description)

A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.

Types

SecurityKeysRemoveBody

/** The body of `securityKeys.remove`. */
type SecurityKeysRemoveBody = {
  /** The mailbox's current password. Required for the mailbox's own bearer, ignored for an account admin */
  currentPassword?: string
}