mirror of
https://github.com/danbulant/jose
synced 2026-05-19 04:18:52 +00:00
837 B
837 B
Function: generateSecret
▸ generateSecret(alg, options?): Promise<KeyLike | Uint8Array>
Generates a symmetric secret key for a given JWA algorithm identifier.
Note: Under Web Cryptography API runtime the secret key is generated with
extractable set to false by default.
example Usage
const secret = await jose.generateSecret('HS256')
console.log(secret)
Parameters
| Name | Type | Description |
|---|---|---|
alg |
string |
JWA Algorithm Identifier to be used with the generated secret. |
options? |
GenerateSecretOptions |
Additional options passed down to the secret generation. |
Returns
Promise<KeyLike | Uint8Array>