@bsv/sdk 1.3.28 → 1.3.30

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 (32) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/auth/Peer.js +142 -91
  3. package/dist/cjs/src/auth/Peer.js.map +1 -1
  4. package/dist/cjs/src/auth/SessionManager.js +82 -21
  5. package/dist/cjs/src/auth/SessionManager.js.map +1 -1
  6. package/dist/cjs/src/auth/clients/AuthFetch.js +50 -41
  7. package/dist/cjs/src/auth/clients/AuthFetch.js.map +1 -1
  8. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  9. package/dist/esm/src/auth/Peer.js +138 -88
  10. package/dist/esm/src/auth/Peer.js.map +1 -1
  11. package/dist/esm/src/auth/SessionManager.js +88 -22
  12. package/dist/esm/src/auth/SessionManager.js.map +1 -1
  13. package/dist/esm/src/auth/clients/AuthFetch.js +49 -41
  14. package/dist/esm/src/auth/clients/AuthFetch.js.map +1 -1
  15. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  16. package/dist/types/src/auth/Peer.d.ts +21 -23
  17. package/dist/types/src/auth/Peer.d.ts.map +1 -1
  18. package/dist/types/src/auth/SessionManager.d.ts +25 -7
  19. package/dist/types/src/auth/SessionManager.d.ts.map +1 -1
  20. package/dist/types/src/auth/clients/AuthFetch.d.ts.map +1 -1
  21. package/dist/types/src/auth/types.d.ts +1 -0
  22. package/dist/types/src/auth/types.d.ts.map +1 -1
  23. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  24. package/dist/umd/bundle.js +1 -1
  25. package/docs/auth.md +33 -38
  26. package/package.json +1 -1
  27. package/src/auth/Peer.ts +186 -130
  28. package/src/auth/SessionManager.ts +89 -22
  29. package/src/auth/__tests/Peer.test.ts +66 -0
  30. package/src/auth/__tests/SessionManager.test.ts +3 -2
  31. package/src/auth/clients/AuthFetch.ts +53 -43
  32. package/src/auth/types.ts +1 -0
@@ -6,6 +6,8 @@ const AUTH_VERSION = '0.1';
6
6
  * Represents a peer capable of performing mutual authentication.
7
7
  * Manages sessions, handles authentication handshakes, certificate requests and responses,
8
8
  * and sending and receiving general messages over a transport layer.
9
+ *
10
+ * This version supports multiple concurrent sessions per peer identityKey.
9
11
  */
10
12
  export class Peer {
11
13
  sessionManager;
@@ -20,7 +22,7 @@ export class Peer {
20
22
  callbackIdCounter = 0;
21
23
  // Whether to auto-persist the session with the last-interacted-with peer
22
24
  autoPersistLastSession = true;
23
- // Last-interacted-with peer identity key
25
+ // Last-interacted-with peer identity key (if the user calls toPeer with no identityKey)
24
26
  lastInteractedWithPeer;
25
27
  /**
26
28
  * Creates a new Peer instance
@@ -39,7 +41,8 @@ export class Peer {
39
41
  types: {}
40
42
  };
41
43
  this.transport.onData(this.handleIncomingMessage.bind(this)).catch(console.error);
42
- this.sessionManager = sessionManager != null ? sessionManager : new SessionManager();
44
+ this.sessionManager =
45
+ sessionManager != null ? sessionManager : new SessionManager();
43
46
  if (autoPersistLastSession === false) {
44
47
  this.autoPersistLastSession = false;
45
48
  }
@@ -51,14 +54,14 @@ export class Peer {
51
54
  * Sends a general message to a peer, and initiates a handshake if necessary.
52
55
  *
53
56
  * @param {number[]} message - The message payload to send.
54
- * @param {string} [identityKey] - The identity public key of the peer. If not provided, a handshake will be initiated.
57
+ * @param {string} [identityKey] - The identity public key of the peer. If not provided, uses lastInteractedWithPeer (if any).
58
+ * @param {number} [maxWaitTime] - optional max wait time in ms
55
59
  * @returns {Promise<void>}
56
60
  * @throws Will throw an error if the message fails to send.
57
61
  */
58
62
  async toPeer(message, identityKey, maxWaitTime) {
59
63
  if (this.autoPersistLastSession &&
60
- this.lastInteractedWithPeer !== undefined &&
61
- this.lastInteractedWithPeer !== null &&
64
+ typeof this.lastInteractedWithPeer === 'string' &&
62
65
  typeof identityKey !== 'string') {
63
66
  identityKey = this.lastInteractedWithPeer;
64
67
  }
@@ -81,6 +84,8 @@ export class Peer {
81
84
  payload: message,
82
85
  signature
83
86
  };
87
+ peerSession.lastUpdate = Date.now();
88
+ this.sessionManager.updateSession(peerSession);
84
89
  try {
85
90
  await this.transport.send(generalMessage);
86
91
  }
@@ -96,14 +101,19 @@ export class Peer {
96
101
  * an initial handshake or message has been exchanged.
97
102
  *
98
103
  * @param {RequestedCertificateSet} certificatesToRequest - Specifies the certifiers and types of certificates required from the peer.
99
- * @param {string} [identityKey] - The identity public key of the peer. If not provided, the current session identity is used.
104
+ * @param {string} [identityKey] - The identity public key of the peer. If not provided, the current or last session identity is used.
100
105
  * @param {number} [maxWaitTime=10000] - Maximum time in milliseconds to wait for the peer session to be authenticated.
101
106
  * @returns {Promise<void>} Resolves if the certificate request message is successfully sent.
102
107
  * @throws Will throw an error if the peer session is not authenticated or if sending the request fails.
103
108
  */
104
109
  async requestCertificates(certificatesToRequest, identityKey, maxWaitTime = 10000) {
110
+ if (this.autoPersistLastSession &&
111
+ typeof this.lastInteractedWithPeer === 'string' &&
112
+ typeof identityKey !== 'string') {
113
+ identityKey = this.lastInteractedWithPeer;
114
+ }
105
115
  const peerSession = await this.getAuthenticatedSession(identityKey, maxWaitTime);
106
- // Prepare the general message
116
+ // Prepare the message
107
117
  const requestNonce = Utils.toBase64(Random(32));
108
118
  const { signature } = await this.wallet.createSignature({
109
119
  data: Utils.toArray(JSON.stringify(certificatesToRequest), 'utf8'),
@@ -122,6 +132,9 @@ export class Peer {
122
132
  requestedCertificates: certificatesToRequest,
123
133
  signature
124
134
  };
135
+ // Update last-used timestamp
136
+ peerSession.lastUpdate = Date.now();
137
+ this.sessionManager.updateSession(peerSession);
125
138
  try {
126
139
  await this.transport.send(certRequestMessage);
127
140
  }
@@ -133,24 +146,29 @@ export class Peer {
133
146
  * Retrieves an authenticated session for a given peer identity. If no session exists
134
147
  * or the session is not authenticated, initiates a handshake to create or authenticate the session.
135
148
  *
136
- * @param {string} [identityKey] - The identity public key of the peer. If provided, it attempts
137
- * to retrieve an existing session associated with this identity.
138
- * @param {number} [maxWaitTime] - The maximum time in milliseconds to wait for the handshake
139
- * to complete if a new session is required. Defaults to a pre-defined timeout if not specified.
149
+ * - If `identityKey` is provided, we look up any existing session for that identity key.
150
+ * - If none is found or not authenticated, we do a new handshake.
151
+ * - If `identityKey` is not provided, but we have a `lastInteractedWithPeer`, we try that key.
152
+ *
153
+ * @param {string} [identityKey] - The identity public key of the peer.
154
+ * @param {number} [maxWaitTime] - The maximum time in milliseconds to wait for the handshake.
140
155
  * @returns {Promise<PeerSession>} - A promise that resolves with an authenticated `PeerSession`.
141
- * @throws {Error} - Throws an error if the transport is not connected or if the handshake fails.
142
156
  */
143
157
  async getAuthenticatedSession(identityKey, maxWaitTime) {
144
158
  if (this.transport === undefined) {
145
159
  throw new Error('Peer transport is not connected!');
146
160
  }
147
- let peerSession = identityKey !== undefined && identityKey !== ''
148
- ? this.sessionManager.getSession(identityKey)
149
- : undefined;
150
- if (peerSession === undefined || !peerSession?.isAuthenticated) {
161
+ let peerSession;
162
+ if (typeof identityKey === 'string') {
163
+ peerSession = this.sessionManager.getSession(identityKey);
164
+ }
165
+ // If that session doesn't exist or isn't authenticated, initiate handshake
166
+ if ((peerSession == null) || !peerSession.isAuthenticated) {
167
+ // This will create a brand-new session
151
168
  const sessionNonce = await this.initiateHandshake(identityKey, maxWaitTime);
152
- peerSession = this.sessionManager.getSession(identityKey !== undefined && identityKey !== '' ? identityKey : sessionNonce);
153
- if (peerSession === undefined || !peerSession.isAuthenticated) {
169
+ // Now retrieve it by the sessionNonce
170
+ peerSession = this.sessionManager.getSession(sessionNonce);
171
+ if ((peerSession == null) || !peerSession.isAuthenticated) {
154
172
  throw new Error('Unable to establish mutual authentication with peer!');
155
173
  }
156
174
  }
@@ -178,7 +196,7 @@ export class Peer {
178
196
  /**
179
197
  * Registers a callback to listen for certificates received from peers.
180
198
  *
181
- * @param {(certs: VerifiableCertificate[]) => void} callback - The function to call when certificates are received.
199
+ * @param {(senderPublicKey: string, certs: VerifiableCertificate[]) => void} callback - The function to call when certificates are received.
182
200
  * @returns {number} The ID of the callback listener.
183
201
  */
184
202
  listenForCertificatesReceived(callback) {
@@ -218,14 +236,18 @@ export class Peer {
218
236
  *
219
237
  * @private
220
238
  * @param {string} [identityKey] - The identity public key of the peer.
239
+ * @param {number} [maxWaitTime=10000] - how long to wait for handshake
221
240
  * @returns {Promise<string>} A promise that resolves to the session nonce.
222
241
  */
223
242
  async initiateHandshake(identityKey, maxWaitTime = 10000) {
224
243
  const sessionNonce = await createNonce(this.wallet); // Initial request nonce
244
+ // Create the preliminary session (not yet authenticated)
245
+ const now = Date.now();
225
246
  this.sessionManager.addSession({
226
247
  isAuthenticated: false,
227
248
  sessionNonce,
228
- peerIdentityKey: identityKey
249
+ peerIdentityKey: identityKey,
250
+ lastUpdate: now
229
251
  });
230
252
  const initialRequest = {
231
253
  version: AUTH_VERSION,
@@ -246,10 +268,10 @@ export class Peer {
246
268
  */
247
269
  async waitForInitialResponse(sessionNonce, maxWaitTime = 10000) {
248
270
  return await new Promise((resolve, reject) => {
249
- const callbackID = this.listenForInitialResponse(sessionNonce, sessionNonce => {
271
+ const callbackID = this.listenForInitialResponse(sessionNonce, nonce => {
250
272
  clearTimeout(timeoutHandle);
251
273
  this.stopListeningForInitialResponses(callbackID);
252
- resolve(sessionNonce);
274
+ resolve(nonce);
253
275
  });
254
276
  const timeoutHandle = setTimeout(() => {
255
277
  this.stopListeningForInitialResponses(callbackID);
@@ -289,8 +311,8 @@ export class Peer {
289
311
  * @returns {Promise<void>}
290
312
  */
291
313
  async handleIncomingMessage(message) {
292
- if (message.version === undefined || message.version === '' || message.version !== AUTH_VERSION) {
293
- console.error(`Invalid message auth version! Received: ${message.version}, expected: ${AUTH_VERSION}`);
314
+ if (typeof message.version !== 'string' || message.version !== AUTH_VERSION) {
315
+ console.error(`Invalid or unsupported message auth version! Received: ${message.version}, expected: ${AUTH_VERSION}`);
294
316
  return;
295
317
  }
296
318
  switch (message.messageType) {
@@ -317,35 +339,41 @@ export class Peer {
317
339
  * Processes an initial request message from a peer.
318
340
  *
319
341
  * @param {AuthMessage} message - The incoming initial request message.
320
- * @returns {Promise<void>}
321
342
  */
322
343
  async processInitialRequest(message) {
323
- if (message.identityKey === undefined || message.identityKey === '' || message.initialNonce === undefined || message.initialNonce === '') {
324
- throw new Error('Missing required fields in initialResponse message.');
344
+ if (typeof message.identityKey !== 'string' ||
345
+ typeof message.initialNonce !== 'string' ||
346
+ message.initialNonce === '') {
347
+ throw new Error('Missing required fields in initialRequest message.');
325
348
  }
326
- // Create an initial session nonce
349
+ // Create a new sessionNonce for our side
327
350
  const sessionNonce = await createNonce(this.wallet);
351
+ const now = Date.now();
352
+ // We'll treat this as fully authenticated from *our* perspective (the responding side).
328
353
  this.sessionManager.addSession({
329
354
  isAuthenticated: true,
330
355
  sessionNonce,
331
356
  peerNonce: message.initialNonce,
332
- peerIdentityKey: message.identityKey
357
+ peerIdentityKey: message.identityKey,
358
+ lastUpdate: now
333
359
  });
334
- // Handle initial certificate requests
360
+ // Possibly handle the peer's requested certs
335
361
  let certificatesToInclude;
336
- if (message.requestedCertificates !== undefined && Array.isArray(message.requestedCertificates?.certifiers) && message.requestedCertificates?.certifiers?.length > 0) {
362
+ if ((message.requestedCertificates != null) &&
363
+ Array.isArray(message.requestedCertificates.certifiers) &&
364
+ message.requestedCertificates.certifiers.length > 0) {
337
365
  if (this.onCertificateRequestReceivedCallbacks.size > 0) {
338
- // The application wants to handle certificate requests
339
- this.onCertificateRequestReceivedCallbacks.forEach(callback => {
340
- callback(message.identityKey, message.requestedCertificates);
366
+ // Let the application handle it
367
+ this.onCertificateRequestReceivedCallbacks.forEach(cb => {
368
+ cb(message.identityKey, message.requestedCertificates);
341
369
  });
342
370
  }
343
371
  else {
344
- // Attempt to find exact matching certificates to return automatically to save round trips
372
+ // Attempt to find automatically
345
373
  certificatesToInclude = await getVerifiableCertificates(this.wallet, message.requestedCertificates, message.identityKey);
346
374
  }
347
375
  }
348
- // Create the signature for the message
376
+ // Create signature
349
377
  const { signature } = await this.wallet.createSignature({
350
378
  data: Utils.toArray(message.initialNonce + sessionNonce, 'base64'),
351
379
  protocolID: [2, 'auth message signature'],
@@ -363,10 +391,11 @@ export class Peer {
363
391
  requestedCertificates: this.certificatesToRequest,
364
392
  signature
365
393
  };
366
- // For security, only set the last-interacted-with peer here if this is the first peer we've interacted with.
367
- if (this.lastInteractedWithPeer === undefined || this.lastInteractedWithPeer === null) {
394
+ // If we haven't interacted with a peer yet, store this identity as "lastInteracted"
395
+ if (this.lastInteractedWithPeer === undefined) {
368
396
  this.lastInteractedWithPeer = message.identityKey;
369
397
  }
398
+ // Send the response
370
399
  await this.transport.send(initialResponseMessage);
371
400
  }
372
401
  /**
@@ -374,21 +403,22 @@ export class Peer {
374
403
  *
375
404
  * @private
376
405
  * @param {AuthMessage} message - The incoming initial response message.
377
- * @returns {Promise<void>}
378
- * @throws Will throw an error if nonce verification or signature verification fails.
406
+ * @throws Will throw an error if nonce or signature verification fails.
379
407
  */
380
408
  async processInitialResponse(message) {
381
409
  const validNonce = await verifyNonce(message.yourNonce, this.wallet);
382
410
  if (!validNonce) {
383
411
  throw new Error(`Initial response nonce verification failed from peer: ${message.identityKey}`);
384
412
  }
413
+ // This is the session we previously created by calling initiateHandshake
385
414
  const peerSession = this.sessionManager.getSession(message.yourNonce);
386
- if (peerSession === null || peerSession === undefined) {
415
+ if (peerSession == null) {
387
416
  throw new Error(`Peer session not found for peer: ${message.identityKey}`);
388
417
  }
389
418
  // Validate message signature
419
+ const dataToVerify = Utils.toArray((peerSession.sessionNonce ?? '') + (message.initialNonce ?? ''), 'base64');
390
420
  const { valid } = await this.wallet.verifySignature({
391
- data: Utils.toArray((peerSession.sessionNonce ?? '') + (message.initialNonce ?? ''), 'base64'),
421
+ data: dataToVerify,
392
422
  signature: message.signature,
393
423
  protocolID: [2, 'auth message signature'],
394
424
  keyID: `${peerSession.sessionNonce ?? ''} ${message.initialNonce ?? ''}`,
@@ -397,39 +427,39 @@ export class Peer {
397
427
  if (!valid) {
398
428
  throw new Error(`Unable to verify initial response signature for peer: ${message.identityKey}`);
399
429
  }
400
- // After signature and nonce verification is complete, the peer is considered authenticated
401
- // Save the peer's identity key and initial nonce
402
- // This allows future requests to be linked to the same session
430
+ // Now mark the session as authenticated
403
431
  peerSession.peerNonce = message.initialNonce;
404
432
  peerSession.peerIdentityKey = message.identityKey;
405
433
  peerSession.isAuthenticated = true;
406
- // Run update to ensure lookup is available by both peerIdentityKey and sessionNonce
434
+ peerSession.lastUpdate = Date.now();
407
435
  this.sessionManager.updateSession(peerSession);
408
- // Process certificates received
409
- if ((this.certificatesToRequest?.certifiers?.length ?? 0) > 0 &&
410
- (message.certificates !== null && message.certificates !== undefined && message.certificates.length > 0)) {
436
+ // If the handshake had requested certificates, validate them
437
+ if (this.certificatesToRequest?.certifiers?.length > 0 &&
438
+ message.certificates?.length > 0) {
411
439
  await validateCertificates(this.wallet, message, this.certificatesToRequest);
412
- const messageCertificates = message.certificates;
413
- if (message.certificates !== undefined) {
414
- this.onCertificatesReceivedCallbacks.forEach(callback => callback(message.identityKey, messageCertificates));
415
- }
440
+ // Notify listeners
441
+ this.onCertificatesReceivedCallbacks.forEach(cb => cb(message.identityKey, message.certificates));
416
442
  }
443
+ // Update lastInteractedWithPeer
417
444
  this.lastInteractedWithPeer = message.identityKey;
445
+ // Let the handshake wait-latch know we got our response
418
446
  this.onInitialResponseReceivedCallbacks.forEach(entry => {
419
- if (entry?.sessionNonce === peerSession.sessionNonce) {
447
+ if (entry.sessionNonce === peerSession.sessionNonce) {
420
448
  entry.callback(peerSession.sessionNonce);
421
449
  }
422
450
  });
423
- // Check if the peer requested certificates from us
424
- if (message.requestedCertificates !== undefined && Array.isArray(message.requestedCertificates?.certifiers) && message.requestedCertificates?.certifiers?.length > 0) {
451
+ // The peer might also request certificates from us
452
+ if ((message.requestedCertificates != null) &&
453
+ Array.isArray(message.requestedCertificates.certifiers) &&
454
+ message.requestedCertificates.certifiers.length > 0) {
425
455
  if (this.onCertificateRequestReceivedCallbacks.size > 0) {
426
- // Application wants to handle certificate requests
427
- this.onCertificateRequestReceivedCallbacks.forEach(callback => {
428
- callback(message.identityKey, message.requestedCertificates);
456
+ // Let the application handle it
457
+ this.onCertificateRequestReceivedCallbacks.forEach(cb => {
458
+ cb(message.identityKey, message.requestedCertificates);
429
459
  });
430
460
  }
431
461
  else {
432
- // Attempt to find exact matching certificates to respond automatically and save round trips
462
+ // Attempt auto
433
463
  const verifiableCertificates = await getVerifiableCertificates(this.wallet, message.requestedCertificates, message.identityKey);
434
464
  await this.sendCertificateResponse(message.identityKey, verifiableCertificates);
435
465
  }
@@ -437,11 +467,10 @@ export class Peer {
437
467
  }
438
468
  /**
439
469
  * Processes an incoming certificate request message from a peer.
440
- * Verifies the nonce and signature to ensure the authenticity of the request,
441
- * then initiates a response with any requested certificates that are available.
470
+ * Verifies nonce/signature and then possibly sends a certificateResponse.
442
471
  *
443
472
  * @param {AuthMessage} message - The certificate request message received from the peer.
444
- * @throws {Error} Throws an error if nonce verification fails, or the message signature is invalid.
473
+ * @throws {Error} if nonce or signature is invalid.
445
474
  */
446
475
  async processCertificateRequest(message) {
447
476
  const validNonce = await verifyNonce(message.yourNonce, this.wallet);
@@ -449,25 +478,33 @@ export class Peer {
449
478
  throw new Error(`Unable to verify nonce for certificate request message from: ${message.identityKey}`);
450
479
  }
451
480
  const peerSession = this.sessionManager.getSession(message.yourNonce);
481
+ if (peerSession == null) {
482
+ throw new Error(`Session not found for nonce: ${message.yourNonce}`);
483
+ }
452
484
  const { valid } = await this.wallet.verifySignature({
453
485
  data: Utils.toArray(JSON.stringify(message.requestedCertificates), 'utf8'),
454
486
  signature: message.signature,
455
487
  protocolID: [2, 'auth message signature'],
456
- keyID: `${message.nonce ?? ''} ${peerSession?.sessionNonce ?? ''}`,
457
- counterparty: peerSession?.peerIdentityKey
488
+ keyID: `${message.nonce ?? ''} ${peerSession.sessionNonce ?? ''}`,
489
+ counterparty: peerSession.peerIdentityKey
458
490
  });
459
491
  if (!valid) {
460
- throw new Error(`Invalid signature in certificate request message from ${peerSession?.peerIdentityKey ?? 'unknown'}`);
492
+ throw new Error(`Invalid signature in certificate request message from ${peerSession.peerIdentityKey}`);
461
493
  }
462
- if (message.requestedCertificates !== undefined && Array.isArray(message.requestedCertificates?.certifiers) && message.requestedCertificates?.certifiers?.length > 0) {
494
+ // Update usage
495
+ peerSession.lastUpdate = Date.now();
496
+ this.sessionManager.updateSession(peerSession);
497
+ if ((message.requestedCertificates != null) &&
498
+ Array.isArray(message.requestedCertificates.certifiers) &&
499
+ message.requestedCertificates.certifiers.length > 0) {
463
500
  if (this.onCertificateRequestReceivedCallbacks.size > 0) {
464
- // Application wants to handle certificate requests
465
- this.onCertificateRequestReceivedCallbacks.forEach(callback => {
466
- callback(message.identityKey, message.requestedCertificates);
501
+ // Let the application handle it
502
+ this.onCertificateRequestReceivedCallbacks.forEach(cb => {
503
+ cb(message.identityKey, message.requestedCertificates);
467
504
  });
468
505
  }
469
506
  else {
470
- // Attempt to find exact matching certificates to respond automatically and save round trips
507
+ // Attempt auto
471
508
  const verifiableCertificates = await getVerifiableCertificates(this.wallet, message.requestedCertificates, message.identityKey);
472
509
  await this.sendCertificateResponse(message.identityKey, verifiableCertificates);
473
510
  }
@@ -477,10 +514,8 @@ export class Peer {
477
514
  * Sends a certificate response message containing the specified certificates to a peer.
478
515
  *
479
516
  * @param {string} verifierIdentityKey - The identity key of the peer requesting the certificates.
480
- * @param {VerifiableCertificate[]} certificates - The list of certificates to be included in the response.
481
- * @returns {Promise<void>} - A promise that resolves once the certificate response has been sent successfully.
482
- *
483
- * @throws {Error} Throws an error if the peer session could not be authenticated or if message signing fails.
517
+ * @param {VerifiableCertificate[]} certificates - The list of certificates to include in the response.
518
+ * @throws Will throw an error if the transport fails to send the message.
484
519
  */
485
520
  async sendCertificateResponse(verifierIdentityKey, certificates) {
486
521
  const peerSession = await this.getAuthenticatedSession(verifierIdentityKey);
@@ -502,6 +537,9 @@ export class Peer {
502
537
  certificates,
503
538
  signature
504
539
  };
540
+ // Update usage
541
+ peerSession.lastUpdate = Date.now();
542
+ this.sessionManager.updateSession(peerSession);
505
543
  try {
506
544
  await this.transport.send(certificateResponse);
507
545
  }
@@ -515,39 +553,43 @@ export class Peer {
515
553
  *
516
554
  * @private
517
555
  * @param {AuthMessage} message - The incoming certificate response message.
518
- * @returns {Promise<void>}
519
556
  * @throws Will throw an error if nonce verification or signature verification fails.
520
557
  */
521
558
  async processCertificateResponse(message) {
522
559
  const validNonce = await verifyNonce(message.yourNonce, this.wallet);
523
560
  if (!validNonce) {
524
- throw new Error(`Unable to verify nonce for certificate response from: ${message.identityKey}!`);
561
+ throw new Error(`Unable to verify nonce for certificate response from: ${message.identityKey}`);
525
562
  }
526
563
  const peerSession = this.sessionManager.getSession(message.yourNonce);
564
+ if (peerSession == null) {
565
+ throw new Error(`Session not found for nonce: ${message.yourNonce}`);
566
+ }
527
567
  // Validate message signature
528
568
  const { valid } = await this.wallet.verifySignature({
529
569
  data: Utils.toArray(JSON.stringify(message.certificates), 'utf8'),
530
570
  signature: message.signature,
531
571
  protocolID: [2, 'auth message signature'],
532
- keyID: `${message.nonce ?? ''} ${peerSession?.sessionNonce ?? ''}`,
572
+ keyID: `${message.nonce ?? ''} ${peerSession.sessionNonce ?? ''}`,
533
573
  counterparty: message.identityKey
534
574
  });
535
575
  if (!valid) {
536
576
  throw new Error(`Unable to verify certificate response signature for peer: ${message.identityKey}`);
537
577
  }
538
- // Process and verify any certificates received
578
+ // We also handle optional validation if there's a requestedCertificates field
539
579
  await validateCertificates(this.wallet, message, message.requestedCertificates);
540
- this.onCertificatesReceivedCallbacks.forEach(callback => {
541
- callback(message.identityKey, message.certificates);
580
+ // Notify any listeners
581
+ this.onCertificatesReceivedCallbacks.forEach(cb => {
582
+ cb(message.identityKey, message.certificates ?? []);
542
583
  });
584
+ peerSession.lastUpdate = Date.now();
585
+ this.sessionManager.updateSession(peerSession);
543
586
  }
544
587
  /**
545
588
  * Processes a general message from a peer.
546
589
  *
547
590
  * @private
548
591
  * @param {AuthMessage} message - The incoming general message.
549
- * @returns {Promise<void>}
550
- * @throws Will throw an error if nonce verification or signature verification fails.
592
+ * @throws Will throw an error if nonce or signature verification fails.
551
593
  */
552
594
  async processGeneralMessage(message) {
553
595
  const validNonce = await verifyNonce(message.yourNonce, this.wallet);
@@ -555,19 +597,27 @@ export class Peer {
555
597
  throw new Error(`Unable to verify nonce for general message from: ${message.identityKey}`);
556
598
  }
557
599
  const peerSession = this.sessionManager.getSession(message.yourNonce);
600
+ if (peerSession == null) {
601
+ throw new Error(`Session not found for nonce: ${message.yourNonce}`);
602
+ }
558
603
  const { valid } = await this.wallet.verifySignature({
559
604
  data: message.payload,
560
605
  signature: message.signature,
561
606
  protocolID: [2, 'auth message signature'],
562
- keyID: `${message.nonce ?? ''} ${peerSession?.sessionNonce ?? ''}`,
563
- counterparty: peerSession?.peerIdentityKey
607
+ keyID: `${message.nonce ?? ''} ${peerSession.sessionNonce ?? ''}`,
608
+ counterparty: peerSession.peerIdentityKey
564
609
  });
565
610
  if (!valid) {
566
- throw new Error(`Invalid signature in generalMessage from ${peerSession?.peerIdentityKey ?? 'unknown'}`);
611
+ throw new Error(`Invalid signature in generalMessage from ${peerSession.peerIdentityKey}`);
567
612
  }
613
+ // Mark last usage
614
+ peerSession.lastUpdate = Date.now();
615
+ this.sessionManager.updateSession(peerSession);
616
+ // Update lastInteractedWithPeer
568
617
  this.lastInteractedWithPeer = message.identityKey;
569
- this.onGeneralMessageReceivedCallbacks.forEach(callback => {
570
- callback(message.identityKey, message.payload);
618
+ // Dispatch callbacks
619
+ this.onGeneralMessageReceivedCallbacks.forEach(cb => {
620
+ cb(message.identityKey, message.payload ?? []);
571
621
  });
572
622
  }
573
623
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Peer.js","sourceRoot":"","sources":["../../../../src/auth/Peer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAA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