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