Programmatically updating a passkey on a user's local device
Becomes…
Updating names on the device
Section titled “Updating names on the device”Use the updatePasskey function in your frontend code to perform local (device) updates:
import { updatePasskey, isUpdateError } from "@passlock/client";
try { // this will update the names in the user's password manager await updatePasskey({ tenancyId, passkeyId, username: "newUsername@example.com", displayName: "My new username" });
alert("Passkey updated");} catch (e) { if (isUpdateError(e)) { alert("Unable to update your passkey"); }}import { updatePasskey } from "@passlock/client/safe";
// this will update the names in the user's password managerconst result = await updatePasskey({ tenancyId, passkeyId, username: "newUsername@example.com", displayName: "My new username"});
if (result.success) { alert("Passkey updated");} else { alert(result.error.message);}