live · mainnetoc · docs
specs · api · guides
docs / documentation

@orangecheck/stamp-core


@orangecheck/stamp-core / validateCanonicalInput

Function: validateCanonicalInput()

function validateCanonicalInput(input: CanonicalMessageInput): 
  | {
  ok: true;
}
  | {
  ok: false;
  reason: string;
};

Defined in: stamp-core/src/canonical.ts:44

Check whether a CanonicalMessageInput is well-formed per the spec's field rules (§3, §4). Returns {ok: true} if every field is valid, or {ok: false, reason} pointing at the first violation.

Called by stamp() before producing the canonical bytes. Exposed for UIs that want to preview validity without throwing.

Parameters

ParameterType
inputCanonicalMessageInput

Returns

| { ok: true; } | { ok: false; reason: string; }