@voidly/agent-sdk 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ export { decodeBase64, decodeUTF8, encodeBase64, encodeUTF8 } from 'tweetnacl-ut
8
8
  * All encryption and decryption happens CLIENT-SIDE.
9
9
  * The Voidly relay server NEVER sees private keys or plaintext.
10
10
  *
11
- * Crypto: X25519 key exchange + XSalsa20-Poly1305 + Ed25519 signatures
11
+ * Crypto: X25519 + ML-KEM-768 hybrid key exchange, XSalsa20-Poly1305, Ed25519 signatures
12
12
  * Identity: did:voidly:{base58-encoded-ed25519-pubkey}
13
13
  */
14
14
 
@@ -17,12 +17,17 @@ interface AgentIdentity {
17
17
  apiKey: string;
18
18
  signingKeyPair: nacl.SignKeyPair;
19
19
  encryptionKeyPair: nacl.BoxKeyPair;
20
+ /** ML-KEM-768 post-quantum keypair (optional — enables hybrid PQ encryption) */
21
+ mlkemPublicKey?: Uint8Array;
22
+ mlkemSecretKey?: Uint8Array;
20
23
  }
21
24
  interface AgentProfile {
22
25
  did: string;
23
26
  name: string | null;
24
27
  signing_public_key: string;
25
28
  encryption_public_key: string;
29
+ /** ML-KEM-768 public key (base64, 1184 bytes) — present if agent supports PQ */
30
+ mlkem_public_key?: string;
26
31
  capabilities: string[];
27
32
  message_count: number;
28
33
  }
@@ -64,6 +69,8 @@ interface VoidlyAgentConfig {
64
69
  requireSignatures?: boolean;
65
70
  /** Request timeout in milliseconds (default: 30000) */
66
71
  timeout?: number;
72
+ /** Enable post-quantum hybrid encryption — ML-KEM-768 + X25519 (default: true) */
73
+ postQuantum?: boolean;
67
74
  }
68
75
  interface ListenOptions {
69
76
  /** Milliseconds between polls (default: 2000, min: 500) */
@@ -143,6 +150,9 @@ declare class VoidlyAgent {
143
150
  private sealedSender;
144
151
  private requireSignatures;
145
152
  private timeout;
153
+ private postQuantum;
154
+ private mlkemPublicKey;
155
+ private mlkemSecretKey;
146
156
  private _pinnedDids;
147
157
  private _listeners;
148
158
  private _conversations;
@@ -169,6 +179,14 @@ declare class VoidlyAgent {
169
179
  apiKey: string;
170
180
  signingSecretKey: string;
171
181
  encryptionSecretKey: string;
182
+ ratchetStates?: Record<string, {
183
+ sendChainKey: string;
184
+ sendStep: number;
185
+ recvChainKey: string;
186
+ recvStep: number;
187
+ }>;
188
+ mlkemPublicKey?: string;
189
+ mlkemSecretKey?: string;
172
190
  }, config?: VoidlyAgentConfig): VoidlyAgent;
173
191
  /**
174
192
  * Export credentials for persistence.
@@ -181,6 +199,14 @@ declare class VoidlyAgent {
181
199
  encryptionSecretKey: string;
182
200
  signingPublicKey: string;
183
201
  encryptionPublicKey: string;
202
+ ratchetStates?: Record<string, {
203
+ sendChainKey: string;
204
+ sendStep: number;
205
+ recvChainKey: string;
206
+ recvStep: number;
207
+ }>;
208
+ mlkemPublicKey?: string;
209
+ mlkemSecretKey?: string;
184
210
  };
185
211
  /**
186
212
  * Get the number of messages that failed to decrypt.
@@ -878,6 +904,8 @@ declare class VoidlyAgent {
878
904
  * ```
879
905
  */
880
906
  conversation(peerDid: string, threadId?: string): Conversation;
907
+ /** @internal Fetch with timeout via AbortController */
908
+ private _timedFetch;
881
909
  /** @internal Auto-pin keys on first contact (TOFU) */
882
910
  private _autoPinKeys;
883
911
  /** @internal Fetch with exponential backoff retry */
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { decodeBase64, decodeUTF8, encodeBase64, encodeUTF8 } from 'tweetnacl-ut
8
8
  * All encryption and decryption happens CLIENT-SIDE.
9
9
  * The Voidly relay server NEVER sees private keys or plaintext.
10
10
  *
11
- * Crypto: X25519 key exchange + XSalsa20-Poly1305 + Ed25519 signatures
11
+ * Crypto: X25519 + ML-KEM-768 hybrid key exchange, XSalsa20-Poly1305, Ed25519 signatures
12
12
  * Identity: did:voidly:{base58-encoded-ed25519-pubkey}
13
13
  */
14
14
 
@@ -17,12 +17,17 @@ interface AgentIdentity {
17
17
  apiKey: string;
18
18
  signingKeyPair: nacl.SignKeyPair;
19
19
  encryptionKeyPair: nacl.BoxKeyPair;
20
+ /** ML-KEM-768 post-quantum keypair (optional — enables hybrid PQ encryption) */
21
+ mlkemPublicKey?: Uint8Array;
22
+ mlkemSecretKey?: Uint8Array;
20
23
  }
21
24
  interface AgentProfile {
22
25
  did: string;
23
26
  name: string | null;
24
27
  signing_public_key: string;
25
28
  encryption_public_key: string;
29
+ /** ML-KEM-768 public key (base64, 1184 bytes) — present if agent supports PQ */
30
+ mlkem_public_key?: string;
26
31
  capabilities: string[];
27
32
  message_count: number;
28
33
  }
@@ -64,6 +69,8 @@ interface VoidlyAgentConfig {
64
69
  requireSignatures?: boolean;
65
70
  /** Request timeout in milliseconds (default: 30000) */
66
71
  timeout?: number;
72
+ /** Enable post-quantum hybrid encryption — ML-KEM-768 + X25519 (default: true) */
73
+ postQuantum?: boolean;
67
74
  }
68
75
  interface ListenOptions {
69
76
  /** Milliseconds between polls (default: 2000, min: 500) */
@@ -143,6 +150,9 @@ declare class VoidlyAgent {
143
150
  private sealedSender;
144
151
  private requireSignatures;
145
152
  private timeout;
153
+ private postQuantum;
154
+ private mlkemPublicKey;
155
+ private mlkemSecretKey;
146
156
  private _pinnedDids;
147
157
  private _listeners;
148
158
  private _conversations;
@@ -169,6 +179,14 @@ declare class VoidlyAgent {
169
179
  apiKey: string;
170
180
  signingSecretKey: string;
171
181
  encryptionSecretKey: string;
182
+ ratchetStates?: Record<string, {
183
+ sendChainKey: string;
184
+ sendStep: number;
185
+ recvChainKey: string;
186
+ recvStep: number;
187
+ }>;
188
+ mlkemPublicKey?: string;
189
+ mlkemSecretKey?: string;
172
190
  }, config?: VoidlyAgentConfig): VoidlyAgent;
173
191
  /**
174
192
  * Export credentials for persistence.
@@ -181,6 +199,14 @@ declare class VoidlyAgent {
181
199
  encryptionSecretKey: string;
182
200
  signingPublicKey: string;
183
201
  encryptionPublicKey: string;
202
+ ratchetStates?: Record<string, {
203
+ sendChainKey: string;
204
+ sendStep: number;
205
+ recvChainKey: string;
206
+ recvStep: number;
207
+ }>;
208
+ mlkemPublicKey?: string;
209
+ mlkemSecretKey?: string;
184
210
  };
185
211
  /**
186
212
  * Get the number of messages that failed to decrypt.
@@ -878,6 +904,8 @@ declare class VoidlyAgent {
878
904
  * ```
879
905
  */
880
906
  conversation(peerDid: string, threadId?: string): Conversation;
907
+ /** @internal Fetch with timeout via AbortController */
908
+ private _timedFetch;
881
909
  /** @internal Auto-pin keys on first contact (TOFU) */
882
910
  private _autoPinKeys;
883
911
  /** @internal Fetch with exponential backoff retry */