encrypt()
Othent JS SDK encrypt() function
API
encrypt(plaintext: string | BinaryDataType): Promise<Uint8Array>;plaintext: string | BinaryDataType
plaintext: string | BinaryDataTypereturn Promise<Uint8Array>
return Promise<Uint8Array>Example usage
import { Othent } from "@othent/kms";
const othent = new Othent({ appInfo, throwErrors: false, ... });
// Make sure the user is authenticated, or prompt them to authenticate:
await othent.requireAuth();
// Encrypt data using RSA:
const encrypted = await othent.encrypt("This message will be encrypted");
console.log("Encrypted bytes:", encrypted);Last updated