Skip to content

@fungi.computer/one-key

GenerateKeyOptions = Readonly<{ length?: number; prefix?: string; }>

Options for generating a bearer key.


GeneratedKey = Readonly<{ digest: string; key: string; }>

A newly generated bearer key and the digest safe to retain in storage.

generateKey(options?): string

Generate a cryptographically random bearer key.

GenerateKeyOptions = {}

string


hashKey(key): Promise<string>>

Hash a bearer key with Worker-compatible Web Crypto.

string

Promise<string>


generateKeyAndHash(options?): Promise<Readonly<{ digest: string; key: string; }>>

Generate a bearer key and the digest its owner should persist.

GenerateKeyOptions = {}

Promise<Readonly<{ digest: string; key: string; }>>