UNPKG

@fairmint/canton-node-sdk

Version:
58 lines 2.19 kB
import { Keypair } from '@stellar/stellar-base'; /** * Wraps a raw Ed25519 public key in DER X.509 SubjectPublicKeyInfo format * * The DER structure for Ed25519 public keys is: SEQUENCE { SEQUENCE { OBJECT IDENTIFIER id-Ed25519 (1.3.101.112) } BIT * STRING (raw public key) } * * @param rawPublicKey - Raw 32-byte Ed25519 public key * @returns DER-encoded public key in X.509 SubjectPublicKeyInfo format */ export declare function wrapEd25519PublicKeyInDER(rawPublicKey: Buffer): Buffer; /** * Converts a Stellar public key to base64 format for Canton (DER-wrapped) * * Stellar Ed25519 keys can be used for Canton external signing. This function extracts the raw 32-byte public key, * wraps it in DER X.509 SubjectPublicKeyInfo format, and converts to base64. * * @param keypair - Stellar Keypair object * @returns Base64-encoded DER-wrapped public key in X.509 SubjectPublicKeyInfo format */ export declare function stellarPublicKeyToBase64(keypair: Keypair): string; /** * Signs data with a Stellar keypair * * @param keypair - Stellar Keypair object * @param data - Data to sign (as Buffer or base64 string) * @returns Base64-encoded signature */ export declare function signWithStellarKeypair(keypair: Keypair, data: Buffer | string): string; /** * Load a Stellar keypair from a secret key * * @param secret - Stellar secret key (starts with 'S') * @returns Stellar Keypair object */ export declare function loadStellarKeypair(secret: string): Keypair; /** * Generate a new random Stellar keypair * * @returns Stellar Keypair object */ export declare function generateStellarKeypair(): Keypair; /** * Convert Stellar public key to hex string (for Validator API) * * @param keypair - Stellar keypair * @returns Hex-encoded public key */ export declare function stellarPublicKeyToHex(keypair: Keypair): string; /** * Sign hex-encoded hash with Stellar keypair (for Validator API) * * @param keypair - Stellar keypair to sign with * @param hexHash - Hex-encoded hash to sign * @returns Hex-encoded signature */ export declare function signHexWithStellarKeypair(keypair: Keypair, hexHash: string): string; //# sourceMappingURL=stellar-utils.d.ts.map