Skip to content

@codesoul-co/hypha-core / modules/runtime/canonical-json

Using this module

Use the Canonical JSON module for executing runtime behavior at this boundary. It exports 2 functions, 1 type.

Import from the package entrypoint

ts
import {
  canonicalizeJson,
  hashCanonicalJson,
} from '@codesoul-co/hypha-core';

import type {
  CanonicalJsonValue,
} from '@codesoul-co/hypha-core';

Usage patterns

  • Use the 1 type/interface export as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 2 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
canonicalizeJsonfunctioncanonicalizeJson(value: unknown): stringCanonicalize JSON function with 1 public call signature; parameters and return types are listed below.
hashCanonicalJsonfunctionhashCanonicalJson(value: unknown): stringHash Canonical JSON function with 1 public call signature; parameters and return types are listed below.
CanonicalJsonValuetypetype CanonicalJsonValue = null | boolean | number | string | CanonicalJsonValue[] | { [key: string]: CanonicalJsonValue; }Public type alias for Canonical JSON Value; the declaration contains its complete type expression.

canonicalizeJson

Canonicalize JSON function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function canonicalizeJson(value: unknown): string;

Call signature

text
canonicalizeJson(value: unknown): string

Parameters

ParameterTypeRequiredDescription
valueunknownYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: string
  • Description: The return contract is defined by the type shown above.

hashCanonicalJson

Hash Canonical JSON function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function hashCanonicalJson(value: unknown): string;

Call signature

text
hashCanonicalJson(value: unknown): string

Parameters

ParameterTypeRequiredDescription
valueunknownYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: string
  • Description: The return contract is defined by the type shown above.

CanonicalJsonValue

Public type alias for Canonical JSON Value; the declaration contains its complete type expression.

Declaration

text
export type CanonicalJsonValue = null | boolean | number | string | CanonicalJsonValue[] | {
    [key: string]: CanonicalJsonValue;
};