Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/server/src/auth/PairingGrantStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as Option from "effect/Option";
import * as PubSub from "effect/PubSub";
import * as Ref from "effect/Ref";
import * as Schema from "effect/Schema";
import * as Scope from "effect/Scope";
import * as Stream from "effect/Stream";

import * as ServerConfig from "../config.ts";
Expand Down Expand Up @@ -220,6 +221,12 @@ export class PairingGrantStore extends Context.Service<
BootstrapCredentialInternalError
>;
readonly streamChanges: Stream.Stream<BootstrapCredentialChange>;
/** Acquire before reading a snapshot to buffer changes until the stream starts. */
readonly subscribeChanges: Effect.Effect<
Stream.Stream<BootstrapCredentialChange>,
never,
Scope.Scope
>;
readonly revoke: (id: string) => Effect.Effect<boolean, BootstrapCredentialInternalError>;
readonly consume: (
credential: string,
Expand Down Expand Up @@ -619,6 +626,7 @@ const make = Effect.gen(function* () {
get streamChanges() {
return Stream.fromPubSub(changesPubSub);
},
subscribeChanges: PubSub.subscribe(changesPubSub).pipe(Effect.map(Stream.fromSubscription)),
revoke,
consume,
});
Expand Down
8 changes: 8 additions & 0 deletions apps/server/src/auth/SessionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as Layer from "effect/Layer";
import * as PubSub from "effect/PubSub";
import * as Ref from "effect/Ref";
import * as Schema from "effect/Schema";
import * as Scope from "effect/Scope";
import * as Stream from "effect/Stream";
import * as Option from "effect/Option";

Expand Down Expand Up @@ -409,6 +410,12 @@ export class SessionStore extends Context.Service<
SessionCredentialInternalError
>;
readonly streamChanges: Stream.Stream<SessionCredentialChange>;
/** Acquire before reading a snapshot to buffer changes until the stream starts. */
readonly subscribeChanges: Effect.Effect<
Stream.Stream<SessionCredentialChange>,
never,
Scope.Scope
>;
/** Completes when a live socket's session is revoked or expires without a renewal for its DPoP key. */
readonly awaitInvalidation: (
sessionId: AuthSessionId,
Expand Down Expand Up @@ -1111,6 +1118,7 @@ const make = Effect.gen(function* () {
get streamChanges() {
return Stream.fromPubSub(changesPubSub);
},
subscribeChanges: PubSub.subscribe(changesPubSub).pipe(Effect.map(Stream.fromSubscription)),
revoke,
revokeAllExcept,
markConnected,
Expand Down
Loading
Loading