From 1439048ecd413036e9e56f3eb208e1be72e86868 Mon Sep 17 00:00:00 2001 From: Gus Narea Date: Mon, 16 Nov 2020 19:00:37 +0000 Subject: [PATCH] fix: Set id of initial session key to that of identity key As a workaround for #26 --- src/bin/generate-keypairs.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bin/generate-keypairs.ts b/src/bin/generate-keypairs.ts index 3413162d..e818af10 100644 --- a/src/bin/generate-keypairs.ts +++ b/src/bin/generate-keypairs.ts @@ -61,6 +61,12 @@ async function main(): Promise { subjectPublicKey: initialSessionKeyPair.publicKey, validityEndDate: sessionCertEndDate, }); + // Force the certificate to have the serial number specified in ENDPOINT_KEY_ID. This nasty + // hack won't be necessary once https://github.com/relaycorp/relaynet-pong/issues/26 is done. + // tslint:disable-next-line:no-object-mutation + (initialKeyCertificate as any).pkijsCertificate.serialNumber.valueBlock.valueHex = bufferToArray( + endpointKeyId, + ); await sessionStore.saveInitialSessionKey(initialSessionKeyPair.privateKey, initialKeyCertificate); console.log(