Decodes a NATS seed string (the S... form) into its ed25519 seed and role.
S...
The first two decoded bytes pack the seed marker and the role prefix; the next 32 bytes are the ed25519 seed. The CRC-16 is verified before anything is returned.
The base32 seed string, e.g. SUAB....
SUAB...
The 32-byte seed and the recovered role byte.
If the string is malformed, fails its checksum, or is not a seed.
1.0.0
import { decodeSeed } from 'edgeport/nats';const { seed, roleByte } = decodeSeed('SUAEL6GG2L2HIF7DUGZJGMRUFKXELGGYFMHF76UO2AYBG3K4YLWR3FKC2Q'); Copy
import { decodeSeed } from 'edgeport/nats';const { seed, roleByte } = decodeSeed('SUAEL6GG2L2HIF7DUGZJGMRUFKXELGGYFMHF76UO2AYBG3K4YLWR3FKC2Q');
Decodes a NATS seed string (the
S...form) into its ed25519 seed and role.The first two decoded bytes pack the seed marker and the role prefix; the next 32 bytes are the ed25519 seed. The CRC-16 is verified before anything is returned.