Skip to content

Commit d698df8

Browse files
feat: add Aptos Keystore encrypted private key storage standard
Implement an encrypted credential management system based on Ethereum's Web3 Secret Storage Definition (keystore v3), adapted for all Aptos key types. The format is designed to be portable across Aptos SDKs. Key features: - Support for Ed25519, Secp256k1, and Secp256r1 private keys - Password-based or key-file-based encryption - scrypt (default) and PBKDF2-HMAC-SHA256 key derivation functions - AES-128-CTR symmetric cipher via Web Crypto API - SHA-256 MAC for password verification - Portable JSON format for cross-SDK interoperability New exports: - encryptKeystore(args): Encrypt a private key to keystore JSON - decryptKeystore(args): Decrypt keystore JSON to recover private key - AptosKeyStore: TypeScript interface for the keystore format - KeystorePrivateKey, KeystoreEncryptOptions: Supporting types Includes 23 unit tests covering all key types, both KDFs, round-trip encryption/decryption, error handling, and cryptographic verification. Co-authored-by: Greg Nazario <greg@gnazar.io>
1 parent e896d78 commit d698df8

File tree

4 files changed

+781
-0
lines changed

4 files changed

+781
-0
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to the Aptos TypeScript SDK will be captured in this file. T
44

55
# Unreleased
66

7+
## Added
8+
9+
- Add Aptos Keystore: encrypted private key storage standard based on Ethereum's Web3 Secret Storage Definition (keystore v3)
10+
- Supports all Aptos key types: Ed25519, Secp256k1, Secp256r1
11+
- Password-based or key-file-based encryption using scrypt (default) or PBKDF2-HMAC-SHA256 KDFs
12+
- AES-128-CTR cipher with SHA-256 MAC for password verification
13+
- Portable JSON format designed for cross-SDK compatibility (TypeScript, Rust, Python, Go, etc.)
14+
- New exports: `encryptKeystore`, `decryptKeystore`, `AptosKeyStore`, `KeystorePrivateKey`, `KeystoreEncryptOptions`
15+
716
# 6.2.0 (2026-03-22)
817

918
## Fixed

src/core/crypto/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export * from "./abstraction";
55
export * from "./ed25519";
66
export * from "./ephemeral";
77
export * from "./federatedKeyless";
8+
export * from "./keystore";
89
export * from "./hdKey";
910
export * from "./keyless";
1011
export * from "./multiEd25519";

0 commit comments

Comments
 (0)