UNPKG

@othent/kms-unbundled

Version:

Arweave Oauth Othent wallets enabled Google Key Management Service.

18 lines (14 loc) 561 B
import { encrypt as encryptFunction } from "../operations/encrypt"; import { userDetails } from "../auth/userDetails"; /** * Encrypt data with the users JWK. This function assumes (and requires) a user is logged in and a valid string to sign. * @param plaintext The data in string format to sign. * @returns The encrypted data. */ export async function encrypt( plaintext: string, ): Promise<Uint8Array | string | null> { const user = await userDetails(); const encryptedData = await encryptFunction(plaintext, user.sub); return encryptedData; }