Skip to content

Reference

wrapEd25519PublicKeyInDER

Encode raw 32-byte Ed25519 public keys into DER X.509 SubjectPublicKeyInfo buffers for Canton ledger APIs.

Wraps rawPublicKey with the canonical ASN.1 prefix for id-Ed25519 (1.3.101.112) followed by the raw key bits.

Throws ValidationError when buffer length differs from 32 bytes.

Setup

import { wrapEd25519PublicKeyInDER } from '@fairmint/canton-node-sdk';

Minimal example

const der = wrapEd25519PublicKeyInDER(Buffer.from(RAW_THIRTY_TWO_BYTE_HEX, 'hex'));
console.log(der.toString('base64'));

Parameters

  • rawPublicKeyBuffer containing exactly 32 bytes.

Returns

Buffer — DER-encoded SubjectPublicKeyInfo.

Errors

Throws ValidationError describing unexpected lengths.

Source

src/utils/external-signing/stellar-utils.ts