Skip to content

Commit

Permalink
[relay] feat: support redirectUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
deodad committed Apr 17, 2024
1 parent 1265f28 commit f450243
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/relay/src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type CreateChannelRequest = {
notBefore?: string;
expirationTime?: string;
requestId?: string;
redirectUrl?: string;
};

export type AuthenticateRequest = {
Expand Down
3 changes: 3 additions & 0 deletions apps/relay/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const createChannelRequestSchema = {
requestId: {
type: "string",
},
redirectUrl: {
type: "string",
},
},
required: ["siweUri", "domain"],
additionalProperties: false,
Expand Down
3 changes: 3 additions & 0 deletions apps/relay/src/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f450243

Please sign in to comment.