Skip to main content
Verify - node__crypto.d.ts - Node documentation
class Verify
extends stream.Writable

Usage in Deno

```typescript import { Verify } from "node:node__crypto.d.ts"; ```
The `Verify` class is a utility for verifying signatures. It can be used in one of two ways: * As a writable `stream` where written data is used to validate against the supplied signature, or * Using the `verify.update()` and `verify.verify()` methods to verify the signature. The [createVerify](../.././node__crypto.d.ts/~/createVerify) method is used to create `Verify` instances. `Verify` objects are not to be created directly using the `new` keyword. See `Sign` for examples.

Constructors

new
Verify()

Methods

Updates the `Verify` content with the given `data`, the encoding of which is given in `inputEncoding`. If `inputEncoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or `DataView`, then `inputEncoding` is ignored. This can be called many times with new data as it is streamed.
update(
data: string,
inputEncoding: Encoding,
): Verify
verify(): boolean
Verifies the provided data using the given `object` and `signature`. If `object` is not a `KeyObject`, this function behaves as if `object` had been passed to [createPublicKey](../.././node__crypto.d.ts/~/createPublicKey). If it is an object, the following additional properties can be passed: The `signature` argument is the previously calculated signature for the data, in the `signatureEncoding`. If a `signatureEncoding` is specified, the `signature` is expected to be a string; otherwise `signature` is expected to be a `Buffer`, `TypedArray`, or `DataView`. The `verify` object can not be used again after `verify.verify()` has been called. Multiple calls to `verify.verify()` will result in an error being thrown. Because public keys can be derived from private keys, a private key may be passed instead of a public key.
verify(): boolean