Skip to content
Source
Sign inSign up

dpopCommon.ts

20 lines517 Bytes

1import * as Schema from "effect/Schema";
2​
3export const DpopPublicJwk = Schema.Struct({
4 kty: Schema.Literal("EC"),
5 crv: Schema.Literal("P-256"),
6 x: Schema.String.check(Schema.isNonEmpty()),
7 y: Schema.String.check(Schema.isNonEmpty()),
8});
9export type DpopPublicJwk = typeof DpopPublicJwk.Type;
10​
11export function normalizeDpopHtu(url: string): string | null {
12 try {
13 const parsed = new URL(url);
14 parsed.hash = "";
15 parsed.search = "";
16 return parsed.toString();
17 } catch {
18 return null;
19 }