@a0n/aeon 5.0.1

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.
Files changed (73) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +199 -0
  3. package/dist/CryptoProvider-SLWjqByk.d.cts +407 -0
  4. package/dist/CryptoProvider-SLWjqByk.d.ts +407 -0
  5. package/dist/compression/index.cjs +1445 -0
  6. package/dist/compression/index.cjs.map +1 -0
  7. package/dist/compression/index.d.cts +451 -0
  8. package/dist/compression/index.d.ts +451 -0
  9. package/dist/compression/index.js +1426 -0
  10. package/dist/compression/index.js.map +1 -0
  11. package/dist/core/index.cjs +4 -0
  12. package/dist/core/index.cjs.map +1 -0
  13. package/dist/core/index.d.cts +212 -0
  14. package/dist/core/index.d.ts +212 -0
  15. package/dist/core/index.js +3 -0
  16. package/dist/core/index.js.map +1 -0
  17. package/dist/crypto/index.cjs +130 -0
  18. package/dist/crypto/index.cjs.map +1 -0
  19. package/dist/crypto/index.d.cts +56 -0
  20. package/dist/crypto/index.d.ts +56 -0
  21. package/dist/crypto/index.js +124 -0
  22. package/dist/crypto/index.js.map +1 -0
  23. package/dist/distributed/index.cjs +2586 -0
  24. package/dist/distributed/index.cjs.map +1 -0
  25. package/dist/distributed/index.d.cts +1005 -0
  26. package/dist/distributed/index.d.ts +1005 -0
  27. package/dist/distributed/index.js +2580 -0
  28. package/dist/distributed/index.js.map +1 -0
  29. package/dist/index.cjs +10953 -0
  30. package/dist/index.cjs.map +1 -0
  31. package/dist/index.d.cts +1953 -0
  32. package/dist/index.d.ts +1953 -0
  33. package/dist/index.js +10828 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/offline/index.cjs +419 -0
  36. package/dist/offline/index.cjs.map +1 -0
  37. package/dist/offline/index.d.cts +148 -0
  38. package/dist/offline/index.d.ts +148 -0
  39. package/dist/offline/index.js +415 -0
  40. package/dist/offline/index.js.map +1 -0
  41. package/dist/optimization/index.cjs +800 -0
  42. package/dist/optimization/index.cjs.map +1 -0
  43. package/dist/optimization/index.d.cts +347 -0
  44. package/dist/optimization/index.d.ts +347 -0
  45. package/dist/optimization/index.js +790 -0
  46. package/dist/optimization/index.js.map +1 -0
  47. package/dist/persistence/index.cjs +207 -0
  48. package/dist/persistence/index.cjs.map +1 -0
  49. package/dist/persistence/index.d.cts +95 -0
  50. package/dist/persistence/index.d.ts +95 -0
  51. package/dist/persistence/index.js +204 -0
  52. package/dist/persistence/index.js.map +1 -0
  53. package/dist/presence/index.cjs +489 -0
  54. package/dist/presence/index.cjs.map +1 -0
  55. package/dist/presence/index.d.cts +283 -0
  56. package/dist/presence/index.d.ts +283 -0
  57. package/dist/presence/index.js +485 -0
  58. package/dist/presence/index.js.map +1 -0
  59. package/dist/types-CMxO7QF0.d.cts +33 -0
  60. package/dist/types-CMxO7QF0.d.ts +33 -0
  61. package/dist/utils/index.cjs +64 -0
  62. package/dist/utils/index.cjs.map +1 -0
  63. package/dist/utils/index.d.cts +38 -0
  64. package/dist/utils/index.d.ts +38 -0
  65. package/dist/utils/index.js +57 -0
  66. package/dist/utils/index.js.map +1 -0
  67. package/dist/versioning/index.cjs +1164 -0
  68. package/dist/versioning/index.cjs.map +1 -0
  69. package/dist/versioning/index.d.cts +537 -0
  70. package/dist/versioning/index.d.ts +537 -0
  71. package/dist/versioning/index.js +1159 -0
  72. package/dist/versioning/index.js.map +1 -0
  73. package/package.json +194 -0
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Copyright (c) 2026 Taylor William Buley (https://buley.fyi)
2
+
3
+ All rights reserved.
4
+
5
+ This software is provided for personal, non-commercial, and academic use only.
6
+ You may not use, modify, distribute, or sell this software, in whole or in part,
7
+ for any commercial purpose without explicit written permission from the copyright holder.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,199 @@
1
+ # Aeon
2
+
3
+ A TypeScript toolkit for collaborative systems. At its center: **Aeon Flow**, a multiplexed frame protocol for moving many independent streams over one transport.
4
+
5
+ The package covers ground teams usually assemble themselves: transport, sync, offline queues, compression, presence, versioning, persistence, crypto, and topology analysis.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ bun add @a0n/aeon
11
+ ```
12
+
13
+ ```bash
14
+ npm install @a0n/aeon # or yarn / pnpm
15
+ ```
16
+
17
+ ## Aeon Flow
18
+
19
+ One connection. Many independent streams. Less waiting behind unrelated work.
20
+
21
+ ```text
22
+ ┌──────────────────────────────────────────────────────────┐
23
+ │ 10-byte Flow Frame │
24
+ ├──────────┬──────────┬───────┬────────────────────────────┤
25
+ │ stream_id│ sequence │ flags │ length │ payload ... │
26
+ │ (u16) │ (u32) │ (u8) │ (u24) │ │
27
+ └──────────┴──────────┴───────┴────────────────────────────┘
28
+ ```
29
+
30
+ - Streams progress independently -- no head-of-line blocking
31
+ - Frames can arrive out of order and reassemble correctly
32
+ - Protocol overhead stays small (10 bytes per frame)
33
+ - Same framing works across UDP, WebSocket, WebTransport, IPC
34
+
35
+ The UDP path includes MTU-aware fragmentation, ACK bitmaps, AIMD congestion control, and per-stream reassembly.
36
+
37
+ ### Quick Start: Flow Protocol
38
+
39
+ ```ts
40
+ import { AeonFlowProtocol, UDPFlowTransport } from '@a0n/aeon';
41
+
42
+ // Set up transport
43
+ const transport = new UDPFlowTransport({
44
+ host: '0.0.0.0',
45
+ port: 4242,
46
+ remoteHost: 'target.example.com',
47
+ remotePort: 4242,
48
+ reliable: true,
49
+ });
50
+ await transport.bind();
51
+
52
+ // Create protocol instance
53
+ const flow = new AeonFlowProtocol(transport, {
54
+ role: 'client',
55
+ maxConcurrentStreams: 256,
56
+ });
57
+
58
+ // Open a parent stream and fork 3 children
59
+ const parentId = flow.open();
60
+ const childIds = flow.fork(parentId, 3);
61
+
62
+ // Race: first child to complete wins, losers are vented
63
+ const { winner, result } = await flow.race(childIds);
64
+
65
+ // Or fold: wait for all, merge results
66
+ const merged = await flow.fold(childIds, (results) => {
67
+ // results: Map<streamId, Uint8Array>
68
+ return concatBuffers([...results.values()]);
69
+ });
70
+ ```
71
+
72
+ ### Quick Start: Sync Coordination
73
+
74
+ ```ts
75
+ import { SyncCoordinator } from '@a0n/aeon';
76
+
77
+ const coordinator = new SyncCoordinator();
78
+
79
+ coordinator.registerNode({
80
+ id: 'node-1',
81
+ address: 'localhost',
82
+ port: 3000,
83
+ status: 'online',
84
+ lastHeartbeat: new Date().toISOString(),
85
+ version: '1.0.0',
86
+ capabilities: ['sync', 'replicate'],
87
+ });
88
+
89
+ const session = coordinator.createSyncSession('node-1', ['node-2', 'node-3']);
90
+ ```
91
+
92
+ ### Quick Start: Recovery Ledger
93
+
94
+ ```ts
95
+ import { RecoveryLedger } from '@a0n/aeon';
96
+
97
+ const ledger = new RecoveryLedger({
98
+ objectId: 'asset:app.bundle.js',
99
+ dataShardCount: 4,
100
+ parityShardCount: 2,
101
+ });
102
+
103
+ ledger.registerRequest('req-a');
104
+ ledger.registerRequest('req-b');
105
+
106
+ ledger.recordShardObservation({
107
+ shardRole: 'data',
108
+ shardIndex: 0,
109
+ digest: 'sha256:data-0',
110
+ observedBy: 'edge-a',
111
+ });
112
+
113
+ ledger.recordShardObservation({
114
+ shardRole: 'parity',
115
+ shardIndex: 0,
116
+ digest: 'sha256:parity-0',
117
+ observedBy: 'edge-b',
118
+ });
119
+
120
+ const status = ledger.getStatus();
121
+ if (status.canReconstruct) {
122
+ // Fold the request family once the merged shard ledger crosses threshold.
123
+ }
124
+ ```
125
+
126
+ ### Quick Start: Schema Migrations
127
+
128
+ ```ts
129
+ import { MigrationEngine } from '@a0n/aeon';
130
+
131
+ const engine = new MigrationEngine();
132
+
133
+ engine.registerMigration({
134
+ id: 'add-status-field',
135
+ version: '2.0.0',
136
+ name: 'Add user status field',
137
+ up: (data) => ({ ...data, status: 'active' }),
138
+ down: (data) => {
139
+ const { status, ...rest } = data;
140
+ return rest;
141
+ },
142
+ timestamp: new Date().toISOString(),
143
+ description: 'Adds status field to all user records',
144
+ });
145
+ ```
146
+
147
+ ## Modules
148
+
149
+ Everything is available from the root import. Subpath imports are available for tree-shaking:
150
+
151
+ | Import | What it does |
152
+ |--------|-------------|
153
+ | `@a0n/aeon` | Everything (barrel export) |
154
+ | `@a0n/aeon/core` | Core types and interfaces |
155
+ | `@a0n/aeon/distributed` | Sync coordination, replication, conflict resolution, and recovery ledgers |
156
+ | `@a0n/aeon/versioning` | Schema versions, migrations, tracking |
157
+ | `@a0n/aeon/offline` | Queued work for unreliable or offline periods |
158
+ | `@a0n/aeon/compression` | Compression and delta-sync helpers |
159
+ | `@a0n/aeon/persistence` | In-memory and storage adapter surfaces |
160
+ | `@a0n/aeon/presence` | Real-time node and session state |
161
+ | `@a0n/aeon/crypto` | Signing and UCAN-related primitives |
162
+
163
+ The flow protocol, topology analysis, transport helpers, and federation modules are exported from the root barrel.
164
+
165
+ ## Related Packages
166
+
167
+ | Package | Description |
168
+ |---------|-------------|
169
+ | [`@a0n/aeon-pipelines`](https://github.com/forkjoin-ai/aeon-pipelines) | Execution engine for fork/race/fold as computation primitives (race on speed, value, or any lambda) |
170
+ | [`packages/shootoff`](./packages/shootoff/README.md) | Side-by-side protocol benchmarks against HTTP/1.1 and HTTP/2 |
171
+ | [`packages/wall`](./packages/wall/README.md) | Command-line client and benchmark harness for Aeon Flow, including native raw-path Aeon blasts, preconnected launch-gate benchmarking, mixed UDP+TCP transport races, and direct bearer or `X-Aeon-*` auth injection |
172
+ | `packages/nginx-flow-aeon` | nginx bridge for Aeon Flow behind HTTP infrastructure |
173
+ | [`aeon-bazaar`](https://github.com/forkjoin-ai/aeon-bazaar) | Unbounded negotiation engine -- void walking, complement distributions |
174
+ | [`aeon-neutral`](https://github.com/forkjoin-ai/aeon-neutral) | Bounded dispute resolution -- three-walker Skyrms mediation with convergence certificates |
175
+
176
+ ## Formal Surface
177
+
178
+ TLA+ specifications for negotiation convergence (in `companion-tests/formal/`):
179
+
180
+ | Spec | What it models |
181
+ |------|---------------|
182
+ | `NegotiationConvergence.tla` | Single-party fork/race/fold with BATNA threshold |
183
+ | `MetacognitiveWalker.tla` | c0-c3 cognitive loop, kurtosis convergence |
184
+ | `SkyrmsNadir.tla` | Two walkers converging via accumulated failure |
185
+ | `SkyrmsThreeWalker.tla` | Mediator as third walker on the convergence site |
186
+
187
+ ## Documentation
188
+
189
+ - [docs/README.md](./docs/README.md) -- repo docs index
190
+ - [src/README.md](./src/README.md) -- source tree index
191
+ - [Manuscript source](./docs/ebooks/145-log-rolling-pipelined-prefill/ch17-arxiv-manuscript.md) -- Chapter 17 formal manuscript
192
+ - [Companion tests](./docs/ebooks/145-log-rolling-pipelined-prefill/companion-tests/README.md) -- reproducibility suite
193
+ - [ROADMAP.md](./ROADMAP.md) -- near-term direction
194
+
195
+ ## License
196
+
197
+ Copyright Taylor William Buley. All rights reserved.
198
+
199
+ MIT
@@ -0,0 +1,407 @@
1
+ /**
2
+ * Aeon Crypto Types
3
+ *
4
+ * Type definitions for cryptographic operations in Aeon.
5
+ * These are compatible with @affectively/auth and @affectively/auth.
6
+ */
7
+ /**
8
+ * Decentralized Identifier (DID)
9
+ * Format: did:method:identifier
10
+ */
11
+ type DID = `did:${string}:${string}`;
12
+ /**
13
+ * Supported signing algorithms
14
+ */
15
+ type SigningAlgorithm = 'ES256' | 'Ed25519' | 'ES384' | 'ES512';
16
+ /**
17
+ * Key pair for signing and verification
18
+ */
19
+ interface KeyPair {
20
+ algorithm: SigningAlgorithm;
21
+ publicKey: JsonWebKey;
22
+ privateKey?: JsonWebKey;
23
+ fingerprint: string;
24
+ }
25
+ /**
26
+ * Identity representing a user or node
27
+ */
28
+ interface Identity {
29
+ did: DID;
30
+ signingKey: KeyPair;
31
+ encryptionKey?: KeyPair;
32
+ createdAt: number;
33
+ displayName?: string;
34
+ }
35
+ /**
36
+ * UCAN Capability structure
37
+ */
38
+ interface Capability {
39
+ can: string;
40
+ with: string;
41
+ constraints?: Record<string, unknown>;
42
+ }
43
+ /**
44
+ * UCAN Token payload
45
+ */
46
+ interface UCANPayload {
47
+ iss: DID;
48
+ aud: DID;
49
+ exp: number;
50
+ nbf?: number;
51
+ iat?: number;
52
+ nonce?: string;
53
+ jti?: string;
54
+ att: Capability[];
55
+ prf?: string[];
56
+ fct?: Record<string, unknown>;
57
+ }
58
+ /**
59
+ * Parsed UCAN Token
60
+ */
61
+ interface UCANToken {
62
+ payload: UCANPayload;
63
+ raw: string;
64
+ signature: Uint8Array;
65
+ algorithm: string;
66
+ }
67
+ /**
68
+ * UCAN verification result
69
+ */
70
+ interface VerificationResult {
71
+ valid: boolean;
72
+ payload?: UCANPayload;
73
+ error?: string;
74
+ expired?: boolean;
75
+ shouldRotate?: boolean;
76
+ expiresIn?: number;
77
+ }
78
+ /**
79
+ * Encryption algorithms supported
80
+ */
81
+ type EncryptionAlgorithm = 'ECIES-P256' | 'AES-256-GCM';
82
+ /**
83
+ * HKDF domain separator categories
84
+ */
85
+ type DomainCategory = 'default' | 'sync' | 'message' | 'api-key' | 'personal-data' | string;
86
+ /**
87
+ * EC Key pair for ECDH operations
88
+ */
89
+ interface ECKeyPair {
90
+ publicKey: JsonWebKey;
91
+ privateKey: JsonWebKey;
92
+ keyId: string;
93
+ createdAt: string;
94
+ }
95
+ /**
96
+ * Encrypted data envelope
97
+ */
98
+ interface EncryptedPayload {
99
+ alg: EncryptionAlgorithm;
100
+ ct: string;
101
+ iv: string;
102
+ tag: string;
103
+ epk?: JsonWebKey;
104
+ category?: DomainCategory;
105
+ nonce?: string;
106
+ encryptedAt: number;
107
+ }
108
+ /**
109
+ * Decryption result
110
+ */
111
+ interface DecryptionResult {
112
+ plaintext: Uint8Array;
113
+ category?: DomainCategory;
114
+ encryptedAt: number;
115
+ }
116
+ /**
117
+ * Aeon encryption mode
118
+ */
119
+ type AeonEncryptionMode = 'none' | 'transport' | 'at-rest' | 'end-to-end';
120
+ /**
121
+ * Aeon sync capability namespace
122
+ */
123
+ declare const AEON_CAPABILITIES: {
124
+ readonly SYNC_READ: "aeon:sync:read";
125
+ readonly SYNC_WRITE: "aeon:sync:write";
126
+ readonly SYNC_ADMIN: "aeon:sync:admin";
127
+ readonly NODE_REGISTER: "aeon:node:register";
128
+ readonly NODE_HEARTBEAT: "aeon:node:heartbeat";
129
+ readonly REPLICATE_READ: "aeon:replicate:read";
130
+ readonly REPLICATE_WRITE: "aeon:replicate:write";
131
+ readonly STATE_READ: "aeon:state:read";
132
+ readonly STATE_WRITE: "aeon:state:write";
133
+ readonly STATE_RECONCILE: "aeon:state:reconcile";
134
+ };
135
+ type AeonCapability = (typeof AEON_CAPABILITIES)[keyof typeof AEON_CAPABILITIES];
136
+ /**
137
+ * Crypto configuration for Aeon
138
+ */
139
+ interface AeonCryptoConfig {
140
+ /** Default encryption mode for sync messages */
141
+ defaultEncryptionMode: AeonEncryptionMode;
142
+ /** Require all messages to be signed */
143
+ requireSignatures: boolean;
144
+ /** Require UCAN capability verification */
145
+ requireCapabilities: boolean;
146
+ /** Allowed signature algorithms */
147
+ allowedSignatureAlgorithms: string[];
148
+ /** Allowed encryption algorithms */
149
+ allowedEncryptionAlgorithms: string[];
150
+ /** UCAN audience DID for verification */
151
+ ucanAudience?: string;
152
+ /** Session key expiration (ms) */
153
+ sessionKeyExpiration?: number;
154
+ }
155
+ /**
156
+ * Default crypto configuration
157
+ */
158
+ declare const DEFAULT_CRYPTO_CONFIG: AeonCryptoConfig;
159
+ /**
160
+ * Authenticated sync message fields
161
+ */
162
+ interface AuthenticatedMessageFields {
163
+ /** Sender DID */
164
+ senderDID?: string;
165
+ /** Receiver DID */
166
+ receiverDID?: string;
167
+ /** UCAN token for capability verification */
168
+ ucan?: string;
169
+ /** Message signature (base64url) */
170
+ signature?: string;
171
+ /** Whether payload is encrypted */
172
+ encrypted?: boolean;
173
+ }
174
+ /**
175
+ * Secure sync session
176
+ */
177
+ interface SecureSyncSession {
178
+ id: string;
179
+ initiator: string;
180
+ participants: string[];
181
+ sessionKey?: Uint8Array;
182
+ encryptionMode: AeonEncryptionMode;
183
+ requiredCapabilities: string[];
184
+ status: 'pending' | 'active' | 'completed' | 'failed';
185
+ startTime: string;
186
+ endTime?: string;
187
+ }
188
+ /**
189
+ * Node with identity information
190
+ */
191
+ interface SecureNodeInfo {
192
+ id: string;
193
+ did?: string;
194
+ publicSigningKey?: JsonWebKey;
195
+ publicEncryptionKey?: JsonWebKey;
196
+ capabilities?: string[];
197
+ lastSeen?: number;
198
+ }
199
+ /**
200
+ * Capability verification result
201
+ */
202
+ interface AeonCapabilityResult {
203
+ authorized: boolean;
204
+ error?: string;
205
+ issuer?: string;
206
+ grantedCapabilities?: Array<{
207
+ can: string;
208
+ with: string;
209
+ }>;
210
+ }
211
+ /**
212
+ * Signed data envelope for sync operations
213
+ */
214
+ interface SignedSyncData<T = unknown> {
215
+ payload: T;
216
+ signature: string;
217
+ signer: string;
218
+ algorithm: string;
219
+ signedAt: number;
220
+ }
221
+
222
+ /**
223
+ * Aeon Crypto Provider Interface
224
+ *
225
+ * Abstract interface for cryptographic operations.
226
+ * Aeon core remains zero-dependency - crypto is injected through this interface.
227
+ */
228
+
229
+ /**
230
+ * Abstract crypto provider interface
231
+ *
232
+ * Implementations use @affectively/auth and @affectively/auth
233
+ * or other compatible libraries.
234
+ */
235
+ interface ICryptoProvider {
236
+ /**
237
+ * Generate a new identity with DID and key pairs
238
+ */
239
+ generateIdentity(displayName?: string): Promise<{
240
+ did: string;
241
+ publicSigningKey: JsonWebKey;
242
+ publicEncryptionKey?: JsonWebKey;
243
+ }>;
244
+ /**
245
+ * Get the local identity's DID
246
+ */
247
+ getLocalDID(): string | null;
248
+ /**
249
+ * Export local identity's public info for sharing
250
+ */
251
+ exportPublicIdentity(): Promise<SecureNodeInfo | null>;
252
+ /**
253
+ * Register a known remote node's public keys
254
+ */
255
+ registerRemoteNode(node: SecureNodeInfo): Promise<void>;
256
+ /**
257
+ * Get a remote node's public key
258
+ */
259
+ getRemotePublicKey(did: string): Promise<JsonWebKey | null>;
260
+ /**
261
+ * Sign data with local identity's private key
262
+ */
263
+ sign(data: Uint8Array): Promise<Uint8Array>;
264
+ /**
265
+ * Sign structured data and wrap in SignedSyncData envelope
266
+ */
267
+ signData<T>(data: T): Promise<SignedSyncData<T>>;
268
+ /**
269
+ * Verify a signature from a remote node
270
+ */
271
+ verify(did: string, signature: Uint8Array, data: Uint8Array): Promise<boolean>;
272
+ /**
273
+ * Verify a SignedSyncData envelope
274
+ */
275
+ verifySignedData<T>(signedData: SignedSyncData<T>): Promise<boolean>;
276
+ /**
277
+ * Encrypt data for a recipient
278
+ */
279
+ encrypt(plaintext: Uint8Array, recipientDID: string): Promise<{
280
+ alg: string;
281
+ ct: string;
282
+ iv: string;
283
+ tag: string;
284
+ epk?: JsonWebKey;
285
+ encryptedAt: number;
286
+ }>;
287
+ /**
288
+ * Decrypt data
289
+ */
290
+ decrypt(encrypted: {
291
+ alg: string;
292
+ ct: string;
293
+ iv: string;
294
+ tag: string;
295
+ epk?: JsonWebKey;
296
+ }, senderDID?: string): Promise<Uint8Array>;
297
+ /**
298
+ * Derive or get a session key for communication with a peer
299
+ */
300
+ getSessionKey(peerDID: string): Promise<Uint8Array>;
301
+ /**
302
+ * Encrypt with a session key
303
+ */
304
+ encryptWithSessionKey(plaintext: Uint8Array, sessionKey: Uint8Array): Promise<{
305
+ alg: string;
306
+ ct: string;
307
+ iv: string;
308
+ tag: string;
309
+ encryptedAt: number;
310
+ }>;
311
+ /**
312
+ * Decrypt with a session key
313
+ */
314
+ decryptWithSessionKey(encrypted: {
315
+ ct: string;
316
+ iv: string;
317
+ tag: string;
318
+ }, sessionKey: Uint8Array): Promise<Uint8Array>;
319
+ /**
320
+ * Create a UCAN token
321
+ */
322
+ createUCAN(audience: string, capabilities: Array<{
323
+ can: string;
324
+ with: string;
325
+ }>, options?: {
326
+ expirationSeconds?: number;
327
+ proofs?: string[];
328
+ }): Promise<string>;
329
+ /**
330
+ * Verify a UCAN token
331
+ */
332
+ verifyUCAN(token: string, options?: {
333
+ expectedAudience?: string;
334
+ requiredCapabilities?: Array<{
335
+ can: string;
336
+ with: string;
337
+ }>;
338
+ }): Promise<AeonCapabilityResult>;
339
+ /**
340
+ * Delegate capabilities
341
+ */
342
+ delegateCapabilities(parentToken: string, audience: string, capabilities: Array<{
343
+ can: string;
344
+ with: string;
345
+ }>, options?: {
346
+ expirationSeconds?: number;
347
+ }): Promise<string>;
348
+ /**
349
+ * Compute hash of data
350
+ */
351
+ hash(data: Uint8Array): Promise<Uint8Array>;
352
+ /**
353
+ * Generate random bytes
354
+ */
355
+ randomBytes(length: number): Uint8Array;
356
+ /**
357
+ * Check if crypto is properly initialized
358
+ */
359
+ isInitialized(): boolean;
360
+ }
361
+ /**
362
+ * Null crypto provider for when crypto is disabled
363
+ *
364
+ * All operations either throw or return permissive defaults.
365
+ */
366
+ declare class NullCryptoProvider implements ICryptoProvider {
367
+ private notConfiguredError;
368
+ generateIdentity(): Promise<{
369
+ did: string;
370
+ publicSigningKey: JsonWebKey;
371
+ publicEncryptionKey?: JsonWebKey;
372
+ }>;
373
+ getLocalDID(): string | null;
374
+ exportPublicIdentity(): Promise<SecureNodeInfo | null>;
375
+ registerRemoteNode(): Promise<void>;
376
+ getRemotePublicKey(): Promise<JsonWebKey | null>;
377
+ sign(): Promise<Uint8Array>;
378
+ signData<T>(_data: T): Promise<SignedSyncData<T>>;
379
+ verify(): Promise<boolean>;
380
+ verifySignedData(): Promise<boolean>;
381
+ encrypt(): Promise<{
382
+ alg: string;
383
+ ct: string;
384
+ iv: string;
385
+ tag: string;
386
+ epk?: JsonWebKey;
387
+ encryptedAt: number;
388
+ }>;
389
+ decrypt(): Promise<Uint8Array>;
390
+ getSessionKey(): Promise<Uint8Array>;
391
+ encryptWithSessionKey(): Promise<{
392
+ alg: string;
393
+ ct: string;
394
+ iv: string;
395
+ tag: string;
396
+ encryptedAt: number;
397
+ }>;
398
+ decryptWithSessionKey(): Promise<Uint8Array>;
399
+ createUCAN(): Promise<string>;
400
+ verifyUCAN(): Promise<AeonCapabilityResult>;
401
+ delegateCapabilities(): Promise<string>;
402
+ hash(): Promise<Uint8Array>;
403
+ randomBytes(length: number): Uint8Array;
404
+ isInitialized(): boolean;
405
+ }
406
+
407
+ export { AEON_CAPABILITIES as A, type Capability as C, DEFAULT_CRYPTO_CONFIG as D, type ECKeyPair as E, type ICryptoProvider as I, type KeyPair as K, NullCryptoProvider as N, type SecureNodeInfo as S, type UCANPayload as U, type VerificationResult as V, type AeonCapability as a, type AeonCapabilityResult as b, type AeonCryptoConfig as c, type AeonEncryptionMode as d, type AuthenticatedMessageFields as e, type DID as f, type DecryptionResult as g, type DomainCategory as h, type EncryptedPayload as i, type EncryptionAlgorithm as j, type Identity as k, type SecureSyncSession as l, type SignedSyncData as m, type SigningAlgorithm as n, type UCANToken as o };