The verify() operation verifies a digital signature. It ensures that some data was signed by a known key and that the data has not been tampered with since it was signed.
Usage
Parameters
Name | Type | Description |
---|---|---|
algorithm | string or object with a single name string property | The algorithm to use. Currently supported: HMAC. |
key | CryptoKey | The key that will be used to verify the signature. |
signature | ArrayBuffer | The signature to verify. |
data | ArrayBuffer | The data whose signature is to be verified. |
Return Value
A Promise that resolves to a boolean value indicating if the signature is valid.
Throws
Type | Description |
---|---|
InvalidAccessError | Raised when the key either does not support the verify operation, or is incompatible with the selected algorithm. |
Example
example-webcrypto-verify.js