isAuthenticated

Othent JS SDK isAuthenticated property

Indicates whether the user is currently authenticated.

API

isAuthenticated: boolean;

Example usage

import { Othent } from "@othent/kms";

const othent = new Othent({ appInfo, throwErrors: false, ... });

// ...

const storeSecret = async (key: string, plaintext: string) => {
    // Manually make sure the user is authenticated, or prompt them to authenticate:
    if (!othent.isAuthenticated) {
        await othent.connect();
    }

    // Now we can call other functions from Othent:
    const encryptedData = await othent.encrypt(plaintext);

    localStorage.set(key, encryptedData);
}

Last updated