Skip to content
On this page

Function: parseStamp()

TypeScript
function parseStamp(input: unknown): StampEnvelope;

Defined in: stamp-core/src/parse.ts:26 (opens in a new tab)

Parse an untrusted envelope and check every field's shape and type (SPEC §4.1, §4.2). Takes the JSON text, or a value already parsed from it. Returns the envelope typed, or throws a StampError: E_UNSUPPORTED_VERSION for a v other than 1, E_MALFORMED for anything else.

Shape only: verify() still checks the id, the signature and the anchor. Unknown top-level fields are kept (SPEC §4.3). A missing content.ref, stake or ots reads as null.

ParametersLink to this section

ParameterType
inputunknown

ReturnsLink to this section

StampEnvelope