Description
The SDK currently only supports in-memory keypairs for transaction signing, which is unsuitable for production environments where private keys must reside in hardware security modules, cloud KMS services, or AES-encrypted keystores. A pluggable vault adapter interface would decouple the signing operation from key storage, enabling callers to inject any backend conforming to a narrow Signer contract without modifying SDK internals.
Technical Context
New interface Signer in src/signing/signer.ts with a single method sign(txHash: Buffer): Promise<Buffer>. Concrete adapters in src/signing/adapters/: KeypairSigner (wraps Keypair from @stellar/stellar-sdk), EncryptedFileSigner (reads an AES-256-GCM encrypted PEM file, decrypts on first use), and a CloudKmsSigner that delegates to an injected KmsClient { sign(keyId: string, digest: Buffer): Promise<Buffer> } interface. StellarSplitClient constructor options in src/client.ts accept signer: Signer.
Acceptance Criteria
Description
The SDK currently only supports in-memory keypairs for transaction signing, which is unsuitable for production environments where private keys must reside in hardware security modules, cloud KMS services, or AES-encrypted keystores. A pluggable vault adapter interface would decouple the signing operation from key storage, enabling callers to inject any backend conforming to a narrow
Signercontract without modifying SDK internals.Technical Context
New interface
Signerinsrc/signing/signer.tswith a single methodsign(txHash: Buffer): Promise<Buffer>. Concrete adapters insrc/signing/adapters/:KeypairSigner(wrapsKeypairfrom@stellar/stellar-sdk),EncryptedFileSigner(reads an AES-256-GCM encrypted PEM file, decrypts on first use), and aCloudKmsSignerthat delegates to an injectedKmsClient { sign(keyId: string, digest: Buffer): Promise<Buffer> }interface.StellarSplitClientconstructor options insrc/client.tsacceptsigner: Signer.Acceptance Criteria
Signerinterface and all three concrete adapters are exported from the SDK's public API surface viasrc/index.tsKeypairSigner.signproduces a 64-byte ed25519 signature verifiable byKeypair.verifyon the corresponding public keyEncryptedFileSignerdecrypts the key file on first use, holds the plaintext in aWeakRefto allow GC pressure to clear it, and re-reads the file on the nextsigncall if the ref has been collectedCloudKmsSigneraccepts any object conforming to theKmsClientinterface, enabling easy test mocking without touching real KMS credentialsKeypairSignerround-trip signing,EncryptedFileSignerwith a test-generated AES key (including the re-read-after-GC path via explicit null), and a mockCloudKmsSigner