Expand description
Byte/integer encodings used at the EdDSA boundary.
EdDSA-Poseidon (@zk-kit/eddsa-poseidon) is little-endian for all
buffer<->integer conversions (leBufferToBigInt / leBigIntToBuffer) - the
opposite of the note cipher, which is big-endian. Keeping the two explicit
here prevents accidental endianness flips.
Functions§
- biguint_
to_ be_ 32 - Integer -> fixed 32-byte big-endian bytes (
bigIntToBytes(value, 32)), used for the cipher key material andsha256BigInt. Packs the raw value with NO field reduction (left-padded with zeros). Panics if the value does not fit in 32 bytes (matches the TS overflow guard atvalue >= 2^256). - biguint_
to_ le_ bytes - Integer -> fixed-length little-endian bytes (
leBigIntToBuffer(value, len)). Panics if the value does not fit inlenbytes (matches the JS overflow guard). - dec_
to_ biguint - Parse a non-negative decimal string into a raw integer (no field reduction) -
the boundary for the cipher key material,
sha256BigInt, and the EdDSA message. - from_
hex - Decode a hex string into bytes with the lenient semantics of Node’s
Buffer.from(hex, "hex")(the EdDSA private-key encoding): parse byte pairs left-to-right, stop at the first invalid hex character, and drop a trailing odd nibble. No0xstripping -Buffer.fromdoes not strip it either (it would stop at thex). - le_
bytes_ to_ biguint - Little-endian bytes -> integer (
leBufferToBigInt).