edgeport - v1.0.3
    Preparing search index...

    Function decodeSeed

    • 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.

      Parameters

      • seed: string

        The base32 seed string, e.g. SUAB....

      Returns DecodedSeed

      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');