SymmetricKey
Represents a symmetric key used for cryptographic operations. Symmetric keys are typically generated using a SymmetricKeyBuilder. This class also provides methods to export and check the properties of symmetric keys.
Extends
BaseCryptoClass
Accessors
exportable
Get Signature
get exportable():
boolean
Check whether the key is exportable or not.
Returns
boolean
true if the key is exportable, false otherwise.
purposes
Get Signature
get purposes():
KeyPurpose
[]
Get the purposes enabled for this key.
Returns
An array with the purposes enabled for this key.
Methods
exportRaw()
exportRaw():
Promise
<ArrayBuffer
>
Export the symmetric key as raw bytes. This method should only be called on keys that are marked as exportable.
Returns
Promise
<ArrayBuffer
>
A promise that resolves to the raw key bytes.
Throws
AccessDeniedError If the key is not exportable.
hasPurpose()
hasPurpose(
purpose
):boolean
Check if a particular purpose is enabled for this key.
Parameters
purpose
A key purpose to check.
Returns
boolean
true if the purpose is enabled for this key, false otherwise.
Throws
InvalidArgumentError If the argument is not a valid purpose.
Last updated: Sep 30, 2025