Skip to content

Commit 2bdad81

Browse files
committed
wip: small test fixes
[ci skip]
1 parent 97e7c3f commit 2bdad81

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/nodes/NodeManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ class NodeManager {
201201
public readonly checkSeedConnectionsHandlerId: TaskHandlerId =
202202
`${this.basePath}.${this.checkSeedConnectionsHandler.name}.checkSeedConnectionsHandler` as TaskHandlerId;
203203

204-
protected handleNodeConnectionEvent = (
204+
protected handleNodeConnectionEvent = async (
205205
e: nodesEvents.EventNodeConnectionManagerConnection,
206206
) => {
207-
void this.setNode(
207+
await this.setNode(
208208
e.detail.remoteNodeId,
209209
{
210210
host: e.detail.remoteHost,

src/nodes/agent/utils.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import type { NodeId } from '../../ids/types';
2+
import type { CertificatePEM } from '../../keys/types';
23
import * as keysUtils from '../../keys/utils';
4+
import { utils as quicUtils } from '@matrixai/quic';
35

46
/**
57
* Used to extract the NodeId from the connection metadata.
68
* Used by the RPC handlers when they need to know the NodeId of the requester.
79
* @param meta
810
*/
911
function nodeIdFromMeta(meta: any): NodeId | undefined {
10-
const remoteCerts = meta.remoteCertificates;
12+
const remoteCerts = meta.remoteCertsChain;
1113
if (remoteCerts == null) return;
12-
const leafCertPEM = remoteCerts[0];
13-
if (leafCertPEM == null) return;
14-
const leafCert = keysUtils.certFromPEM(leafCertPEM);
14+
const leafCertDER = remoteCerts[0] as Uint8Array;
15+
if (leafCertDER == null) return;
16+
const leafCert = keysUtils.certFromPEM(quicUtils.derToPEM(leafCertDER) as CertificatePEM);
1517
if (leafCert == null) return;
1618
const nodeId = keysUtils.certNodeId(leafCert);
1719
if (nodeId == null) return;

tests/nodes/NodeConnectionManager.seednodes.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe(`${NodeConnectionManager.name} seednodes test`, () => {
8181
strictMemoryLock: false,
8282
},
8383
},
84-
logger: logger.getChild('AgentA'),
84+
logger: logger.getChild('Agent1'),
8585
});
8686
remoteNodeId1 = remotePolykeyAgent1.keyRing.getNodeId();
8787
remoteNodeIdEncoded1 = nodesUtils.encodeNodeId(remoteNodeId1);
@@ -103,7 +103,7 @@ describe(`${NodeConnectionManager.name} seednodes test`, () => {
103103
strictMemoryLock: false,
104104
},
105105
},
106-
logger: logger.getChild('AgentA'),
106+
logger: logger.getChild('Agent2'),
107107
});
108108
remoteNodeId2 = remotePolykeyAgent2.keyRing.getNodeId();
109109
remoteAddress2 = {

0 commit comments

Comments
 (0)