@fungi.computer/one-key
Type Aliases
Section titled “Type Aliases”GenerateKeyOptions
Section titled “GenerateKeyOptions”GenerateKeyOptions =
Readonly<{length?:number;prefix?:string; }>
Options for generating a bearer key.
GeneratedKey
Section titled “GeneratedKey”GeneratedKey =
Readonly<{digest:string;key:string; }>
A newly generated bearer key and the digest safe to retain in storage.
Functions
Section titled “Functions”generateKey()
Section titled “generateKey()”generateKey(
options?):string
Generate a cryptographically random bearer key.
Parameters
Section titled “Parameters”options?
Section titled “options?”GenerateKeyOptions = {}
Returns
Section titled “Returns”string
hashKey()
Section titled “hashKey()”hashKey(
key):Promise<string>>
Hash a bearer key with Worker-compatible Web Crypto.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<string>
generateKeyAndHash()
Section titled “generateKeyAndHash()”generateKeyAndHash(
options?):Promise<Readonly<{digest:string;key:string; }>>
Generate a bearer key and the digest its owner should persist.
Parameters
Section titled “Parameters”options?
Section titled “options?”GenerateKeyOptions = {}
Returns
Section titled “Returns”Promise<Readonly<{ digest: string; key: string; }>>