| 1 | import * as Schema from "effect/Schema"; |
| 2 | |
| 3 | export 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 | }); |
| 9 | export type DpopPublicJwk = typeof DpopPublicJwk.Type; |
| 10 | |
| 11 | export 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 | } |
| 20 | } |