The sign() operation generates a digital signature of the provided data, using the given CryptoKey object.
Usage
Parameters
Name | Type | Description |
---|---|---|
algorithm | string or object with a single name string property | The signature algorithm to use. Currently supported: HMAC. |
key | CryptoKey | The key to use for signing. |
data | ArrayBuffer, TypedArray, or DataView | The data to be signed. |
Return Value
A Promise that resolves with the signature as an ArrayBuffer.
Throws
Type | Description |
---|---|
InvalidAccessError | Raised when the signing key either does not support signing operation, or is incompatible with the selected algorithm. |
Example
example-webcrypto-sign.js