INNER CODE UNIT · TypeScript
login
dfinity/examples · motoko/vetkeys/basic_ibe/frontend/src/main.ts:250
export async function login(client: AuthClient): Promise<void> {
try {
const identity = await client.signIn({
maxTimeToLive: BigInt(1800) * BigInt(1_000_000_000),
});
myPrincipal = identity.getPrincipal();
updateUI(true);
} catch (error: unknown) {
console.error("Authentication failed:", error);
alert("Authentication failed: " + error);
}
}
export function logout() {
void authClient?.signOut();
const messagesDiv = document.getElementById("messages")!;
messagesDiv.innerHTML = "";
ibePrivateKey = undefined;