Products · Dash API
Crypto
Work out hashes and HMAC signatures, and make random bytes and UUIDs.
dash.crypto.sha256
dash.crypto.sha256(data: CryptoInput, options?: CryptoOutputOptions, callOptions?: CallOptions): DashRequest<string>The SHA-256 hash of data, in hex unless you ask for { as: 'base64' }. Pass text, or { base64 } for binary data such as a file's contents.
Types: CryptoInput, CryptoOutputOptions
dash.crypto.sha512
dash.crypto.sha512(data: CryptoInput, options?: CryptoOutputOptions, callOptions?: CallOptions): DashRequest<string>The SHA-512 hash of data, in hex unless you ask for { as: 'base64' }. Pass text, or { base64 } for binary data.
Types: CryptoInput, CryptoOutputOptions
dash.crypto.hmac
dash.crypto.hmac(options: HmacOptions, callOptions?: CallOptions): DashRequest<string>Signs data with key, as HMAC-SHA256 or HMAC-SHA512, such as hmac({ algorithm: 'sha256', key, data }).
Types: HmacOptions
dash.crypto.randomBytes
dash.crypto.randomBytes(count: number, options?: CryptoOutputOptions, callOptions?: CallOptions): DashRequest<string>count secure random bytes, from 1 to 1024.
Types: CryptoOutputOptions
dash.crypto.randomUUID
dash.crypto.randomUUID(callOptions?: CallOptions): DashRequest<string>A random version 4 UUID, such as "3f0e5c3a-6d1b-4c8e-9a2f-1b7d4e6a9c05".
Types
CryptoInput
Text is read as UTF-8. Binary data, such as a file's contents, comes as base64.
type CryptoInput = string | { base64: string };CryptoOutputOptions
Hex by default.
| Field | Type | What it is |
|---|---|---|
as (optional) | 'hex' | 'base64' |
HmacAlgorithm
type HmacAlgorithm = 'sha256' | 'sha512';HmacOptions
Also has the fields of CryptoOutputOptions.
| Field | Type | What it is |
|---|---|---|
algorithm | HmacAlgorithm | |
key | CryptoInput | |
data | CryptoInput |