From f450243a732f038e7c8f1741e93033ac89adc042 Mon Sep 17 00:00:00 2001 From: Tony D'Addeo Date: Wed, 17 Apr 2024 13:07:34 -0500 Subject: [PATCH] [relay] feat: support redirectUrl --- apps/relay/src/handlers.ts | 1 + apps/relay/src/schemas.ts | 3 +++ apps/relay/src/server.test.ts | 3 +++ docker-compose.yml | 2 -- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/relay/src/handlers.ts b/apps/relay/src/handlers.ts index 8081638..2a9c6ba 100644 --- a/apps/relay/src/handlers.ts +++ b/apps/relay/src/handlers.ts @@ -10,6 +10,7 @@ export type CreateChannelRequest = { notBefore?: string; expirationTime?: string; requestId?: string; + redirectUrl?: string; }; export type AuthenticateRequest = { diff --git a/apps/relay/src/schemas.ts b/apps/relay/src/schemas.ts index 112fae5..cfff3cb 100644 --- a/apps/relay/src/schemas.ts +++ b/apps/relay/src/schemas.ts @@ -24,6 +24,9 @@ export const createChannelRequestSchema = { requestId: { type: "string", }, + redirectUrl: { + type: "string", + }, }, required: ["siweUri", "domain"], additionalProperties: false, diff --git a/apps/relay/src/server.test.ts b/apps/relay/src/server.test.ts index 9bef4f8..1b58e04 100644 --- a/apps/relay/src/server.test.ts +++ b/apps/relay/src/server.test.ts @@ -85,12 +85,14 @@ describe("relay server", () => { const notBefore = "2023-01-01T00:00:00Z"; const expirationTime = "2023-12-31T00:00:00Z"; const requestId = "some-request-id"; + const redirectUrl = "http://some-redirect-url"; const response = await http.post(getFullUrl("/v1/channel"), { ...channelParams, nonce: customNonce, notBefore, expirationTime, requestId, + redirectUrl, }); expect(response.status).toBe(201); @@ -103,6 +105,7 @@ describe("relay server", () => { expect(params.get("notBefore")).toBe(notBefore); expect(params.get("expirationTime")).toBe(expirationTime); expect(params.get("requestId")).toBe(requestId); + expect(params.get("redirectUrl")).toBe(redirectUrl); expect(channelToken).toMatch(/[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}/); expect(nonce).toBe(customNonce); expect(url).toBe(connectUri); diff --git a/docker-compose.yml b/docker-compose.yml index b677257..1f63f89 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,6 @@ services: command: --save 1 1 --loglevel warning --maxmemory-policy noeviction volumes: - redis-data:/data - ports: - - "6379:6379" healthcheck: test: ["CMD-SHELL", "redis-cli", "ping"] interval: 10s