Skip to content

@lelantos-org/sdk / primitives / reduceSignatureToScalar

Function: reduceSignatureToScalar() ​

ts
function reduceSignatureToScalar(sigHex): bigint;

Defined in: @lelantos-org/sdk/dist/keys/metamask.d.ts:17

nsk from an EIP-712 signature, computed over a canonical form of that signature.

ECDSA admits several valid encodings of the same signature over the same digest: v is 27/28 or 0/1 depending on the wallet, and (r, s) and (r, n - s) are both valid. v is dropped and s folded into its low form before hashing, so every encoding derives the same nsk and address.

Two keccak blocks, not one: a bare 256-bit digest leaves 5 spare bits over the 251-bit subgroup order, which biases the result. See reduceWideToField.

Parameters ​

ParameterType
sigHexstring

Returns ​

bigint