Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): pairing-link sessions renew with the device's DPoP key #37980

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/37980/headmerged by juliusmarminge View on GitHub

Showing 10 changed files with 107 additions and 0 deletions (loading 9).

x
0 of 10 viewed, 10 left
107 additions and 0 deletionsapps/server/src/auth/EnvironmentAuth.test.tsModified
View file
@@ -10,6 +10,7 @@
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Redacted from "effect/Redacted";
+import * as TestClock from "effect/testing/TestClock";
​
import * as ServerConfig from "../config.ts";
import { makeDpopKey } from "./dpop.testkit.ts";
@@ -415,6 +416,112 @@
}).pipe(Effect.provide(layerEnvironmentAuth())),
​
+ it.effect("renews a pairing-link DPoP session in place while its device keeps using it", () =>
+ Effect.gen(function* () {
+ const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;
+ const sessions = yield* SessionStore.SessionStore;
+ const admin = yield* serverAuth.issueSession({ label: "Owner" });
+ const key = makeDpopKey();
+ const other = makeDpopKey();
+ const pair = (proofKeyThumbprint?: string) =>
+ serverAuth
+ .issuePairingCredential({ scopes: ["orchestration:read"] })
+ .pipe(
+ Effect.flatMap((pairing) =>
+ serverAuth.exchangeBootstrapCredentialForAccessToken(
+ pairing.credential,
+ undefined,
+ requestMetadata,
+ proofKeyThumbprint ? { proofKeyThumbprint } : undefined,