After an account switch without logout the new session could not name the stored authority, so enable and reconcile stayed STALE_AUTHORITY. The port gains revokeForeign: it rotates a fence another fence generation holds and revokes its association, and leaves the caller's own fence alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import type {
|
|
PushAuthoritySnapshot,
|
|
WebPushReadiness,
|
|
WebPushResult,
|
|
} from "../../../contracts/web-push.ts";
|
|
|
|
export interface WebPushControlPort {
|
|
inspect(input: Readonly<{
|
|
authority: PushAuthoritySnapshot;
|
|
signal?: AbortSignal;
|
|
}>): Promise<WebPushResult<WebPushReadiness>>;
|
|
|
|
enable(input: Readonly<{
|
|
authority: PushAuthoritySnapshot;
|
|
signal: AbortSignal;
|
|
}>): Promise<WebPushResult<WebPushReadiness>>;
|
|
|
|
reconcile(input: Readonly<{
|
|
authority: PushAuthoritySnapshot;
|
|
signal?: AbortSignal;
|
|
}>): Promise<WebPushResult<WebPushReadiness>>;
|
|
|
|
revoke(input: Readonly<{
|
|
previousAuthority: PushAuthoritySnapshot;
|
|
nextAuthority: PushAuthoritySnapshot;
|
|
signal?: AbortSignal;
|
|
}>): Promise<WebPushResult<WebPushReadiness>>;
|
|
|
|
/**
|
|
* 06-06. The session changed without `revoke` (expiry, cleared cookies, a
|
|
* crash during logout), so the caller cannot name the stored authority. A
|
|
* fence held by another `fenceGeneration` is rotated to `nextAuthority` as
|
|
* REVOKED and the association it held is revoked, as `revoke` does. A fence
|
|
* `nextAuthority`'s generation already holds is left alone and reported as
|
|
* `inspect` reports it. Call it only with the authority the BFF has just
|
|
* confirmed for the current session: a tab holding a stale session would
|
|
* otherwise revoke the current account's association.
|
|
*/
|
|
revokeForeign(input: Readonly<{
|
|
nextAuthority: PushAuthoritySnapshot;
|
|
signal?: AbortSignal;
|
|
}>): Promise<WebPushResult<WebPushReadiness>>;
|
|
|
|
dispose(): void;
|
|
}
|
|
|