Skip to content

Delete a passkey

Your users might want to delete their passkeys. You can do this using the @passlock/browser and @passlock/server libraries. For deletion, we flip the order of operations, although strictly this is not required. Delete the passkey in your vault, then delete it from the user’s password manager.

Use the @passlock/server library to delete the passkey from your vault.

import { Passlock } from "@passlock/server";
// get these from your development tenancy settings
const tenancyId = "myTenancyId";
const apiKey = "myApiKey";
const passlock = new Passlock({ tenancyId, apiKey });
const result = await passlock.deletePasskey({ passkeyId });
if (result.success) {
// remove the mapping between the passkey and your local user account
await unlinkPasskey(passkeyId);
console.log("deleted");
} else {
console.error(result.error.message);
}
Choose your code style

Use the @passlock/browser library to delete the passkey from the user’s device.

import { Passlock } from "@passlock/browser";
// get this from your development tenancy settings
const tenancyId = "myTenancyId";
const passlock = new Passlock({ tenancyId });
const result = await passlock.deletePasskey({ passkeyId }, { tenancyId });
if (result.success) {
console.log("deleted");
} else {
console.error(result.error.message);
alert("Please remove your jdoe@example.com passkey");
}
Choose your code style