Skip to Content

parseMessage()

parseMessage(message): SiwxMessageFields

Defined in: parseMessage.ts:35 

Parses a CAIP-122 message string (as produced by buildMessage) back into its fields.

Pure function. It checks the message structure and the presence of the required fields (URI, Version, Chain ID, Nonce, Issued At) but not their format or timing; use validateMessage for that.

Parameters

message

string

The raw message string that was signed.

Returns

SiwxMessageFields

The fields found in the message. version and chainId are taken as written, without validation.

Throws

SiwxParseError If the header or the blank separator lines are malformed, or a required field is missing.

Example

const parsed = parseMessage(rawMessageString); console.log(parsed.address); // "eip155:1:0xAb5..."
Last updated on