@affectively/aeon 1.1.0 → 1.3.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/compression/index.cjs.map +1 -1
- package/dist/compression/index.js.map +1 -1
- package/dist/core/index.d.cts +136 -66
- package/dist/core/index.d.ts +136 -66
- package/dist/crypto/index.cjs.map +1 -1
- package/dist/crypto/index.d.cts +310 -271
- package/dist/crypto/index.d.ts +310 -271
- package/dist/crypto/index.js.map +1 -1
- package/dist/distributed/index.cjs +8 -2
- package/dist/distributed/index.cjs.map +1 -1
- package/dist/distributed/index.d.cts +871 -756
- package/dist/distributed/index.d.ts +871 -756
- package/dist/distributed/index.js +8 -2
- package/dist/distributed/index.js.map +1 -1
- package/dist/index.cjs +177 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +177 -10
- package/dist/index.js.map +1 -1
- package/dist/offline/index.cjs.map +1 -1
- package/dist/offline/index.d.cts +128 -122
- package/dist/offline/index.d.ts +128 -122
- package/dist/offline/index.js.map +1 -1
- package/dist/optimization/index.cjs.map +1 -1
- package/dist/optimization/index.js.map +1 -1
- package/dist/persistence/index.cjs.map +1 -1
- package/dist/persistence/index.d.cts +38 -38
- package/dist/persistence/index.d.ts +38 -38
- package/dist/persistence/index.js.map +1 -1
- package/dist/presence/index.cjs +151 -0
- package/dist/presence/index.cjs.map +1 -1
- package/dist/presence/index.d.cts +116 -1
- package/dist/presence/index.d.ts +116 -1
- package/dist/presence/index.js +151 -0
- package/dist/presence/index.js.map +1 -1
- package/dist/{types-CMxO7QF0.d.cts → types-B7gCpNX9.d.cts} +6 -6
- package/dist/{types-CMxO7QF0.d.ts → types-B7gCpNX9.d.ts} +6 -6
- package/dist/utils/index.d.cts +4 -4
- package/dist/utils/index.d.ts +4 -4
- package/dist/versioning/index.cjs +18 -8
- package/dist/versioning/index.cjs.map +1 -1
- package/dist/versioning/index.d.cts +1 -1
- package/dist/versioning/index.d.ts +1 -1
- package/dist/versioning/index.js +18 -8
- package/dist/versioning/index.js.map +1 -1
- package/package.json +6 -2
package/dist/crypto/index.d.cts
CHANGED
|
@@ -17,63 +17,63 @@ type SigningAlgorithm = 'ES256' | 'Ed25519' | 'ES384' | 'ES512';
|
|
|
17
17
|
* Key pair for signing and verification
|
|
18
18
|
*/
|
|
19
19
|
interface KeyPair {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
algorithm: SigningAlgorithm;
|
|
21
|
+
publicKey: JsonWebKey;
|
|
22
|
+
privateKey?: JsonWebKey;
|
|
23
|
+
fingerprint: string;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Identity representing a user or node
|
|
27
27
|
*/
|
|
28
28
|
interface Identity {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
did: DID;
|
|
30
|
+
signingKey: KeyPair;
|
|
31
|
+
encryptionKey?: KeyPair;
|
|
32
|
+
createdAt: number;
|
|
33
|
+
displayName?: string;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* UCAN Capability structure
|
|
37
37
|
*/
|
|
38
38
|
interface Capability {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
can: string;
|
|
40
|
+
with: string;
|
|
41
|
+
constraints?: Record<string, unknown>;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* UCAN Token payload
|
|
45
45
|
*/
|
|
46
46
|
interface UCANPayload {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Parsed UCAN Token
|
|
60
60
|
*/
|
|
61
61
|
interface UCANToken {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
payload: UCANPayload;
|
|
63
|
+
raw: string;
|
|
64
|
+
signature: Uint8Array;
|
|
65
|
+
algorithm: string;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* UCAN verification result
|
|
69
69
|
*/
|
|
70
70
|
interface VerificationResult {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
valid: boolean;
|
|
72
|
+
payload?: UCANPayload;
|
|
73
|
+
error?: string;
|
|
74
|
+
expired?: boolean;
|
|
75
|
+
shouldRotate?: boolean;
|
|
76
|
+
expiresIn?: number;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Encryption algorithms supported
|
|
@@ -82,75 +82,86 @@ type EncryptionAlgorithm = 'ECIES-P256' | 'AES-256-GCM';
|
|
|
82
82
|
/**
|
|
83
83
|
* HKDF domain separator categories
|
|
84
84
|
*/
|
|
85
|
-
type DomainCategory =
|
|
85
|
+
type DomainCategory =
|
|
86
|
+
| 'default'
|
|
87
|
+
| 'sync'
|
|
88
|
+
| 'message'
|
|
89
|
+
| 'api-key'
|
|
90
|
+
| 'personal-data'
|
|
91
|
+
| string;
|
|
86
92
|
/**
|
|
87
93
|
* EC Key pair for ECDH operations
|
|
88
94
|
*/
|
|
89
95
|
interface ECKeyPair {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
publicKey: JsonWebKey;
|
|
97
|
+
privateKey: JsonWebKey;
|
|
98
|
+
keyId: string;
|
|
99
|
+
createdAt: string;
|
|
94
100
|
}
|
|
95
101
|
/**
|
|
96
102
|
* Encrypted data envelope
|
|
97
103
|
*/
|
|
98
104
|
interface EncryptedPayload {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
alg: EncryptionAlgorithm;
|
|
106
|
+
ct: string;
|
|
107
|
+
iv: string;
|
|
108
|
+
tag: string;
|
|
109
|
+
epk?: JsonWebKey;
|
|
110
|
+
category?: DomainCategory;
|
|
111
|
+
nonce?: string;
|
|
112
|
+
encryptedAt: number;
|
|
107
113
|
}
|
|
108
114
|
/**
|
|
109
115
|
* Decryption result
|
|
110
116
|
*/
|
|
111
117
|
interface DecryptionResult {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
plaintext: Uint8Array;
|
|
119
|
+
category?: DomainCategory;
|
|
120
|
+
encryptedAt: number;
|
|
115
121
|
}
|
|
116
122
|
/**
|
|
117
123
|
* Aeon encryption mode
|
|
118
124
|
*/
|
|
119
|
-
type AeonEncryptionMode =
|
|
125
|
+
type AeonEncryptionMode =
|
|
126
|
+
| 'none'
|
|
127
|
+
| 'transport'
|
|
128
|
+
| 'at-rest'
|
|
129
|
+
| 'end-to-end';
|
|
120
130
|
/**
|
|
121
131
|
* Aeon sync capability namespace
|
|
122
132
|
*/
|
|
123
133
|
declare const AEON_CAPABILITIES: {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
readonly SYNC_READ: 'aeon:sync:read';
|
|
135
|
+
readonly SYNC_WRITE: 'aeon:sync:write';
|
|
136
|
+
readonly SYNC_ADMIN: 'aeon:sync:admin';
|
|
137
|
+
readonly NODE_REGISTER: 'aeon:node:register';
|
|
138
|
+
readonly NODE_HEARTBEAT: 'aeon:node:heartbeat';
|
|
139
|
+
readonly REPLICATE_READ: 'aeon:replicate:read';
|
|
140
|
+
readonly REPLICATE_WRITE: 'aeon:replicate:write';
|
|
141
|
+
readonly STATE_READ: 'aeon:state:read';
|
|
142
|
+
readonly STATE_WRITE: 'aeon:state:write';
|
|
143
|
+
readonly STATE_RECONCILE: 'aeon:state:reconcile';
|
|
134
144
|
};
|
|
135
|
-
type AeonCapability =
|
|
145
|
+
type AeonCapability =
|
|
146
|
+
(typeof AEON_CAPABILITIES)[keyof typeof AEON_CAPABILITIES];
|
|
136
147
|
/**
|
|
137
148
|
* Crypto configuration for Aeon
|
|
138
149
|
*/
|
|
139
150
|
interface AeonCryptoConfig {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
/** Default encryption mode for sync messages */
|
|
152
|
+
defaultEncryptionMode: AeonEncryptionMode;
|
|
153
|
+
/** Require all messages to be signed */
|
|
154
|
+
requireSignatures: boolean;
|
|
155
|
+
/** Require UCAN capability verification */
|
|
156
|
+
requireCapabilities: boolean;
|
|
157
|
+
/** Allowed signature algorithms */
|
|
158
|
+
allowedSignatureAlgorithms: string[];
|
|
159
|
+
/** Allowed encryption algorithms */
|
|
160
|
+
allowedEncryptionAlgorithms: string[];
|
|
161
|
+
/** UCAN audience DID for verification */
|
|
162
|
+
ucanAudience?: string;
|
|
163
|
+
/** Session key expiration (ms) */
|
|
164
|
+
sessionKeyExpiration?: number;
|
|
154
165
|
}
|
|
155
166
|
/**
|
|
156
167
|
* Default crypto configuration
|
|
@@ -160,63 +171,63 @@ declare const DEFAULT_CRYPTO_CONFIG: AeonCryptoConfig;
|
|
|
160
171
|
* Authenticated sync message fields
|
|
161
172
|
*/
|
|
162
173
|
interface AuthenticatedMessageFields {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
/** Sender DID */
|
|
175
|
+
senderDID?: string;
|
|
176
|
+
/** Receiver DID */
|
|
177
|
+
receiverDID?: string;
|
|
178
|
+
/** UCAN token for capability verification */
|
|
179
|
+
ucan?: string;
|
|
180
|
+
/** Message signature (base64url) */
|
|
181
|
+
signature?: string;
|
|
182
|
+
/** Whether payload is encrypted */
|
|
183
|
+
encrypted?: boolean;
|
|
173
184
|
}
|
|
174
185
|
/**
|
|
175
186
|
* Secure sync session
|
|
176
187
|
*/
|
|
177
188
|
interface SecureSyncSession {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
189
|
+
id: string;
|
|
190
|
+
initiator: string;
|
|
191
|
+
participants: string[];
|
|
192
|
+
sessionKey?: Uint8Array;
|
|
193
|
+
encryptionMode: AeonEncryptionMode;
|
|
194
|
+
requiredCapabilities: string[];
|
|
195
|
+
status: 'pending' | 'active' | 'completed' | 'failed';
|
|
196
|
+
startTime: string;
|
|
197
|
+
endTime?: string;
|
|
187
198
|
}
|
|
188
199
|
/**
|
|
189
200
|
* Node with identity information
|
|
190
201
|
*/
|
|
191
202
|
interface SecureNodeInfo {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
203
|
+
id: string;
|
|
204
|
+
did?: string;
|
|
205
|
+
publicSigningKey?: JsonWebKey;
|
|
206
|
+
publicEncryptionKey?: JsonWebKey;
|
|
207
|
+
capabilities?: string[];
|
|
208
|
+
lastSeen?: number;
|
|
198
209
|
}
|
|
199
210
|
/**
|
|
200
211
|
* Capability verification result
|
|
201
212
|
*/
|
|
202
213
|
interface AeonCapabilityResult {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
214
|
+
authorized: boolean;
|
|
215
|
+
error?: string;
|
|
216
|
+
issuer?: string;
|
|
217
|
+
grantedCapabilities?: Array<{
|
|
218
|
+
can: string;
|
|
219
|
+
with: string;
|
|
220
|
+
}>;
|
|
210
221
|
}
|
|
211
222
|
/**
|
|
212
223
|
* Signed data envelope for sync operations
|
|
213
224
|
*/
|
|
214
225
|
interface SignedSyncData<T = unknown> {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
226
|
+
payload: T;
|
|
227
|
+
signature: string;
|
|
228
|
+
signer: string;
|
|
229
|
+
algorithm: string;
|
|
230
|
+
signedAt: number;
|
|
220
231
|
}
|
|
221
232
|
|
|
222
233
|
/**
|
|
@@ -233,130 +244,158 @@ interface SignedSyncData<T = unknown> {
|
|
|
233
244
|
* or other compatible libraries.
|
|
234
245
|
*/
|
|
235
246
|
interface ICryptoProvider {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
247
|
+
/**
|
|
248
|
+
* Generate a new identity with DID and key pairs
|
|
249
|
+
*/
|
|
250
|
+
generateIdentity(displayName?: string): Promise<{
|
|
251
|
+
did: string;
|
|
252
|
+
publicSigningKey: JsonWebKey;
|
|
253
|
+
publicEncryptionKey?: JsonWebKey;
|
|
254
|
+
}>;
|
|
255
|
+
/**
|
|
256
|
+
* Get the local identity's DID
|
|
257
|
+
*/
|
|
258
|
+
getLocalDID(): string | null;
|
|
259
|
+
/**
|
|
260
|
+
* Export local identity's public info for sharing
|
|
261
|
+
*/
|
|
262
|
+
exportPublicIdentity(): Promise<SecureNodeInfo | null>;
|
|
263
|
+
/**
|
|
264
|
+
* Register a known remote node's public keys
|
|
265
|
+
*/
|
|
266
|
+
registerRemoteNode(node: SecureNodeInfo): Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* Get a remote node's public key
|
|
269
|
+
*/
|
|
270
|
+
getRemotePublicKey(did: string): Promise<JsonWebKey | null>;
|
|
271
|
+
/**
|
|
272
|
+
* Sign data with local identity's private key
|
|
273
|
+
*/
|
|
274
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
275
|
+
/**
|
|
276
|
+
* Sign structured data and wrap in SignedSyncData envelope
|
|
277
|
+
*/
|
|
278
|
+
signData<T>(data: T): Promise<SignedSyncData<T>>;
|
|
279
|
+
/**
|
|
280
|
+
* Verify a signature from a remote node
|
|
281
|
+
*/
|
|
282
|
+
verify(
|
|
283
|
+
did: string,
|
|
284
|
+
signature: Uint8Array,
|
|
285
|
+
data: Uint8Array
|
|
286
|
+
): Promise<boolean>;
|
|
287
|
+
/**
|
|
288
|
+
* Verify a SignedSyncData envelope
|
|
289
|
+
*/
|
|
290
|
+
verifySignedData<T>(signedData: SignedSyncData<T>): Promise<boolean>;
|
|
291
|
+
/**
|
|
292
|
+
* Encrypt data for a recipient
|
|
293
|
+
*/
|
|
294
|
+
encrypt(
|
|
295
|
+
plaintext: Uint8Array,
|
|
296
|
+
recipientDID: string
|
|
297
|
+
): Promise<{
|
|
298
|
+
alg: string;
|
|
299
|
+
ct: string;
|
|
300
|
+
iv: string;
|
|
301
|
+
tag: string;
|
|
302
|
+
epk?: JsonWebKey;
|
|
303
|
+
encryptedAt: number;
|
|
304
|
+
}>;
|
|
305
|
+
/**
|
|
306
|
+
* Decrypt data
|
|
307
|
+
*/
|
|
308
|
+
decrypt(
|
|
309
|
+
encrypted: {
|
|
310
|
+
alg: string;
|
|
311
|
+
ct: string;
|
|
312
|
+
iv: string;
|
|
313
|
+
tag: string;
|
|
314
|
+
epk?: JsonWebKey;
|
|
315
|
+
},
|
|
316
|
+
senderDID?: string
|
|
317
|
+
): Promise<Uint8Array>;
|
|
318
|
+
/**
|
|
319
|
+
* Derive or get a session key for communication with a peer
|
|
320
|
+
*/
|
|
321
|
+
getSessionKey(peerDID: string): Promise<Uint8Array>;
|
|
322
|
+
/**
|
|
323
|
+
* Encrypt with a session key
|
|
324
|
+
*/
|
|
325
|
+
encryptWithSessionKey(
|
|
326
|
+
plaintext: Uint8Array,
|
|
327
|
+
sessionKey: Uint8Array
|
|
328
|
+
): Promise<{
|
|
329
|
+
alg: string;
|
|
330
|
+
ct: string;
|
|
331
|
+
iv: string;
|
|
332
|
+
tag: string;
|
|
333
|
+
encryptedAt: number;
|
|
334
|
+
}>;
|
|
335
|
+
/**
|
|
336
|
+
* Decrypt with a session key
|
|
337
|
+
*/
|
|
338
|
+
decryptWithSessionKey(
|
|
339
|
+
encrypted: {
|
|
340
|
+
ct: string;
|
|
341
|
+
iv: string;
|
|
342
|
+
tag: string;
|
|
343
|
+
},
|
|
344
|
+
sessionKey: Uint8Array
|
|
345
|
+
): Promise<Uint8Array>;
|
|
346
|
+
/**
|
|
347
|
+
* Create a UCAN token
|
|
348
|
+
*/
|
|
349
|
+
createUCAN(
|
|
350
|
+
audience: string,
|
|
351
|
+
capabilities: Array<{
|
|
352
|
+
can: string;
|
|
353
|
+
with: string;
|
|
354
|
+
}>,
|
|
355
|
+
options?: {
|
|
356
|
+
expirationSeconds?: number;
|
|
357
|
+
proofs?: string[];
|
|
358
|
+
}
|
|
359
|
+
): Promise<string>;
|
|
360
|
+
/**
|
|
361
|
+
* Verify a UCAN token
|
|
362
|
+
*/
|
|
363
|
+
verifyUCAN(
|
|
364
|
+
token: string,
|
|
365
|
+
options?: {
|
|
366
|
+
expectedAudience?: string;
|
|
367
|
+
requiredCapabilities?: Array<{
|
|
343
368
|
can: string;
|
|
344
369
|
with: string;
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
370
|
+
}>;
|
|
371
|
+
}
|
|
372
|
+
): Promise<AeonCapabilityResult>;
|
|
373
|
+
/**
|
|
374
|
+
* Delegate capabilities
|
|
375
|
+
*/
|
|
376
|
+
delegateCapabilities(
|
|
377
|
+
parentToken: string,
|
|
378
|
+
audience: string,
|
|
379
|
+
capabilities: Array<{
|
|
380
|
+
can: string;
|
|
381
|
+
with: string;
|
|
382
|
+
}>,
|
|
383
|
+
options?: {
|
|
384
|
+
expirationSeconds?: number;
|
|
385
|
+
}
|
|
386
|
+
): Promise<string>;
|
|
387
|
+
/**
|
|
388
|
+
* Compute hash of data
|
|
389
|
+
*/
|
|
390
|
+
hash(data: Uint8Array): Promise<Uint8Array>;
|
|
391
|
+
/**
|
|
392
|
+
* Generate random bytes
|
|
393
|
+
*/
|
|
394
|
+
randomBytes(length: number): Uint8Array;
|
|
395
|
+
/**
|
|
396
|
+
* Check if crypto is properly initialized
|
|
397
|
+
*/
|
|
398
|
+
isInitialized(): boolean;
|
|
360
399
|
}
|
|
361
400
|
/**
|
|
362
401
|
* Null crypto provider for when crypto is disabled
|
|
@@ -364,44 +403,44 @@ interface ICryptoProvider {
|
|
|
364
403
|
* All operations either throw or return permissive defaults.
|
|
365
404
|
*/
|
|
366
405
|
declare class NullCryptoProvider implements ICryptoProvider {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
406
|
+
private notConfiguredError;
|
|
407
|
+
generateIdentity(): Promise<{
|
|
408
|
+
did: string;
|
|
409
|
+
publicSigningKey: JsonWebKey;
|
|
410
|
+
publicEncryptionKey?: JsonWebKey;
|
|
411
|
+
}>;
|
|
412
|
+
getLocalDID(): string | null;
|
|
413
|
+
exportPublicIdentity(): Promise<SecureNodeInfo | null>;
|
|
414
|
+
registerRemoteNode(): Promise<void>;
|
|
415
|
+
getRemotePublicKey(): Promise<JsonWebKey | null>;
|
|
416
|
+
sign(): Promise<Uint8Array>;
|
|
417
|
+
signData<T>(_data: T): Promise<SignedSyncData<T>>;
|
|
418
|
+
verify(): Promise<boolean>;
|
|
419
|
+
verifySignedData(): Promise<boolean>;
|
|
420
|
+
encrypt(): Promise<{
|
|
421
|
+
alg: string;
|
|
422
|
+
ct: string;
|
|
423
|
+
iv: string;
|
|
424
|
+
tag: string;
|
|
425
|
+
epk?: JsonWebKey;
|
|
426
|
+
encryptedAt: number;
|
|
427
|
+
}>;
|
|
428
|
+
decrypt(): Promise<Uint8Array>;
|
|
429
|
+
getSessionKey(): Promise<Uint8Array>;
|
|
430
|
+
encryptWithSessionKey(): Promise<{
|
|
431
|
+
alg: string;
|
|
432
|
+
ct: string;
|
|
433
|
+
iv: string;
|
|
434
|
+
tag: string;
|
|
435
|
+
encryptedAt: number;
|
|
436
|
+
}>;
|
|
437
|
+
decryptWithSessionKey(): Promise<Uint8Array>;
|
|
438
|
+
createUCAN(): Promise<string>;
|
|
439
|
+
verifyUCAN(): Promise<AeonCapabilityResult>;
|
|
440
|
+
delegateCapabilities(): Promise<string>;
|
|
441
|
+
hash(): Promise<Uint8Array>;
|
|
442
|
+
randomBytes(length: number): Uint8Array;
|
|
443
|
+
isInitialized(): boolean;
|
|
405
444
|
}
|
|
406
445
|
|
|
407
446
|
export { AEON_CAPABILITIES, type AeonCapability, type AeonCapabilityResult, type AeonCryptoConfig, type AeonEncryptionMode, type AuthenticatedMessageFields, type Capability, DEFAULT_CRYPTO_CONFIG, type DID, type DecryptionResult, type DomainCategory, type ECKeyPair, type EncryptedPayload, type EncryptionAlgorithm, type ICryptoProvider, type Identity, type KeyPair, NullCryptoProvider, type SecureNodeInfo, type SecureSyncSession, type SignedSyncData, type SigningAlgorithm, type UCANPayload, type UCANToken, type VerificationResult };
|