From 7090c90150fcb1e7166909b0bee88966f83d9818 Mon Sep 17 00:00:00 2001 From: horsefacts Date: Mon, 19 Aug 2024 16:51:33 -0400 Subject: [PATCH] fix: set generated nonce in signature params --- .changeset/long-islands-dream.md | 5 +++++ apps/relay/src/handlers.ts | 2 +- apps/relay/src/server.test.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/long-islands-dream.md diff --git a/.changeset/long-islands-dream.md b/.changeset/long-islands-dream.md new file mode 100644 index 0000000..b3374a8 --- /dev/null +++ b/.changeset/long-islands-dream.md @@ -0,0 +1,5 @@ +--- +"@farcaster/auth-relay": patch +--- + +fix: set generated nonce in signature params diff --git a/apps/relay/src/handlers.ts b/apps/relay/src/handlers.ts index 33748b2..5503156 100644 --- a/apps/relay/src/handlers.ts +++ b/apps/relay/src/handlers.ts @@ -58,7 +58,7 @@ export async function createChannel(request: FastifyRequest<{ Body: CreateChanne nonce, url, connectUri: url, - signatureParams: request.body, + signatureParams: { ...request.body, nonce }, }); if (update.isOk()) { return reply.code(201).send({ channelToken, url, connectUri: url, nonce }); diff --git a/apps/relay/src/server.test.ts b/apps/relay/src/server.test.ts index 2940d10..4b24087 100644 --- a/apps/relay/src/server.test.ts +++ b/apps/relay/src/server.test.ts @@ -374,6 +374,7 @@ describe("relay server", () => { expect(nonce).toMatch(/[a-zA-Z0-9]{16}/); expect(rest).toStrictEqual({ signatureParams: { + nonce, domain: "example.com", siweUri: "https://example.com", },