From b4836dff46f0f2a4b6df69769459cf252bf3d32a Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 30 Nov 2023 13:51:48 -0600 Subject: [PATCH] fix: ensure slashes aren't part of topics --- src/Invitation.ts | 2 +- test/utils/topic.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Invitation.ts b/src/Invitation.ts index b9286d2b7..07cecd8f5 100644 --- a/src/Invitation.ts +++ b/src/Invitation.ts @@ -47,7 +47,7 @@ export class InvitationV1 implements invitation.InvitationV1 { .replace(/=*$/g, '') // Replace slashes with dashes so that the topic is still easily split by / // We do not treat this as needing to be valid Base64 anywhere - .replace('/', '-') + .replace(/\//g, '-') ) const keyMaterial = crypto.getRandomValues(new Uint8Array(32)) diff --git a/test/utils/topic.test.ts b/test/utils/topic.test.ts index 1f0879754..2baf3d6e0 100644 --- a/test/utils/topic.test.ts +++ b/test/utils/topic.test.ts @@ -36,7 +36,7 @@ describe('topic utils', () => { .replace(/=*$/g, '') // Replace slashes with dashes so that the topic is still easily split by / // We do not treat this as needing to be valid Base64 anywhere - .replace('/', '-') + .replace(/\//g, '-') ) )