Skip to content

CanonicalHash

Namespace: Vercel.AI.Util

public static class CanonicalHash

Canonical JSON and its SHA-256 base64url digest.

Inheritance: object

View source

public static string? CanonicalJson(object? value)

Serializes <code class=“paramref”>value</code> with object keys sorted. Value returns null, matching JSON.stringify(undefined).

Parameters

Name Type Description
value object

Returns: string

View source

public static string HashCanonical(object? value)

SHA-256 digest of CanonicalJson(object), encoded as base64url without padding.

Parameters

Name Type Description
value object

Returns: string

View source

public static string ToBase64Url(byte[] bytes)

Encodes <code class=“paramref”>bytes</code> as base64url without padding.

Parameters

Name Type Description
bytes byte[]

Returns: string

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product