INNER CODE UNIT · TypeScript

login

dfinity/examples · motoko/vetkeys/basic_bls_signing/frontend/src/main.ts:36

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) {
    alert("Authentication failed: " + error);
  }
}

export function logout() {
  void authClient?.signOut();
  myPrincipal = undefined;
  myVerificationKey = undefined;
  basicBlsSigningActor = undefined;
  updateUI(false);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…