Contracts 1.5.0: OIDC client paths, client secret from the link, church.changed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createHmac, generateKeyPairSync } from "node:crypto";
|
||||
import { hub, linkConnectSchema, linkConnectedSchema } from "../src";
|
||||
import { hub, linkConnectSchema, linkConnectedSchema, oidcClientAddresses } from "../src";
|
||||
import * as s from "../src/signing";
|
||||
import { HUB_HEADERS, LINK_HEADERS, sign, signedHeaders, verify } from "../src/signing";
|
||||
import { sample } from "./helpers";
|
||||
@@ -139,3 +139,21 @@ describe("product links (crosscode.link/1)", () => {
|
||||
expect(hub.heartbeatRequestSchema.safeParse({ ...sample("hub-heartbeat-events.json"), publicKey: "nope" }).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("signing in through Accounts (contracts 1.5.0)", () => {
|
||||
it("derives the OIDC client secret from the link secret, stably and per link", () => {
|
||||
const a = s.newLinkSecret();
|
||||
expect(s.oidcClientSecret(a)).toBe(s.oidcClientSecret(a));
|
||||
expect(s.oidcClientSecret(a)).toMatch(/^[A-Za-z0-9_-]{43}$/);
|
||||
expect(s.oidcClientSecret(a)).not.toBe(s.oidcClientSecret(s.newLinkSecret()));
|
||||
expect(s.oidcClientSecret(a)).not.toBe(a);
|
||||
});
|
||||
|
||||
it("gives every product the same fixed addresses", () => {
|
||||
expect(oidcClientAddresses("https://www.hope.co.za/")).toEqual({
|
||||
redirectUri: "https://www.hope.co.za/api/auth/callback",
|
||||
postLogoutRedirectUri: "https://www.hope.co.za/",
|
||||
backchannelLogoutUri: "https://www.hope.co.za/api/auth/backchannel-logout",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user