@vellumai/credential-executor 0.10.11-dev.202607220955.d4134f8 → 0.10.11-dev.202607221733.6d056db
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"./client-metadata": "./src/client-metadata.ts",
|
|
11
11
|
"./credential-rpc": "./src/credential-rpc.ts",
|
|
12
12
|
"./ingress": "./src/ingress.ts",
|
|
13
|
+
"./remote-web-pairing": "./src/remote-web-pairing.ts",
|
|
13
14
|
"./twilio-ingress": "./src/twilio-ingress.ts",
|
|
14
15
|
"./trust-rules": "./src/trust-rules.ts",
|
|
15
16
|
"./handles": "./src/handles.ts",
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire contracts for the remote-web pairing flow — the RFC 8628-style
|
|
3
|
+
* device-code exchange that connects a browser (or the iOS app) to a
|
|
4
|
+
* self-hosted assistant over its public ingress URL.
|
|
5
|
+
*
|
|
6
|
+
* The gateway routes are the authoritative serving side:
|
|
7
|
+
* - `POST /v1/remote-web/pairing-challenge` mint a challenge
|
|
8
|
+
* (`gateway/src/http/routes/remote-web-pairing-challenge.ts`,
|
|
9
|
+
* `gateway/src/remote-web/pairing-challenge-store.ts`)
|
|
10
|
+
* - `POST /v1/remote-web/pairing-verification` approve by user code
|
|
11
|
+
* (`gateway/src/http/routes/remote-web-pairing-verification.ts`)
|
|
12
|
+
* - `POST /v1/remote-web/pairing-token` poll + exchange device code
|
|
13
|
+
* (`gateway/src/http/routes/remote-web-pairing-token.ts`)
|
|
14
|
+
*
|
|
15
|
+
* These shapes mirror those handlers' request/response bodies exactly so the
|
|
16
|
+
* gateway, the `vellum pair` CLI (`cli/src/commands/pair.ts`), and the web SPA
|
|
17
|
+
* (`clients/web/src/lib/auth/remote-gateway-session.ts`) share one definition
|
|
18
|
+
* and cannot silently drift.
|
|
19
|
+
*
|
|
20
|
+
* Timestamps are ISO-8601 strings — every gateway response serializes them via
|
|
21
|
+
* `Date#toISOString()`.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** `POST /v1/remote-web/pairing-challenge` request body. */
|
|
25
|
+
export interface RemoteWebPairingChallengeRequest {
|
|
26
|
+
/** Public https base URL the scanning device can reach the assistant at. */
|
|
27
|
+
publicBaseUrl: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** `POST /v1/remote-web/pairing-challenge` success response body (200). */
|
|
31
|
+
export interface RemoteWebPairingChallengeResponse {
|
|
32
|
+
/** Opaque secret the paired device exchanges for a token. */
|
|
33
|
+
deviceCode: string;
|
|
34
|
+
/** Short human-readable code the host approves out of band. */
|
|
35
|
+
userCode: string;
|
|
36
|
+
/** URL the device opens to complete pairing. */
|
|
37
|
+
verificationUri: string;
|
|
38
|
+
/** ISO-8601 instant the challenge expires. */
|
|
39
|
+
expiresAt: string;
|
|
40
|
+
/** Seconds until the challenge expires. */
|
|
41
|
+
expiresInSeconds: number;
|
|
42
|
+
/** Recommended poll interval (seconds) for the token-exchange endpoint. */
|
|
43
|
+
intervalSeconds: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** `POST /v1/remote-web/pairing-verification` request body. */
|
|
47
|
+
export interface RemoteWebPairingVerificationRequest {
|
|
48
|
+
/** The `userCode` from the challenge, entered/scanned on the host. */
|
|
49
|
+
userCode: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* `POST /v1/remote-web/pairing-verification` success response body (200).
|
|
54
|
+
*
|
|
55
|
+
* The gateway maps the `expired` / `invalid` outcomes to error responses, so
|
|
56
|
+
* the only success shape on the wire is the approved variant.
|
|
57
|
+
*/
|
|
58
|
+
export interface RemoteWebPairingVerificationResponse {
|
|
59
|
+
status: "approved";
|
|
60
|
+
verificationUri: string;
|
|
61
|
+
/** ISO-8601 instant the approved challenge expires. */
|
|
62
|
+
expiresAt: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** `POST /v1/remote-web/pairing-token` request body. */
|
|
66
|
+
export interface RemoteWebPairingTokenRequest {
|
|
67
|
+
/** The `deviceCode` from the challenge. */
|
|
68
|
+
deviceCode: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* `POST /v1/remote-web/pairing-token` still-pending response body (202) — the
|
|
73
|
+
* challenge exists but has not been approved yet, so the client keeps polling.
|
|
74
|
+
*/
|
|
75
|
+
export interface RemoteWebPairingTokenPendingResponse {
|
|
76
|
+
status: "pending";
|
|
77
|
+
/** ISO-8601 instant the challenge expires. */
|
|
78
|
+
expiresAt: string;
|
|
79
|
+
/** Recommended poll interval (seconds) before the next exchange attempt. */
|
|
80
|
+
intervalSeconds: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* `POST /v1/remote-web/pairing-token` approved response body (200) — carries
|
|
85
|
+
* the minted browser session credentials. The refresh token is delivered out
|
|
86
|
+
* of band as an `HttpOnly` cookie, not in this body.
|
|
87
|
+
*/
|
|
88
|
+
export interface RemoteWebPairingTokenApprovedResponse {
|
|
89
|
+
status: "approved";
|
|
90
|
+
accessToken: string;
|
|
91
|
+
/** ISO-8601 instant the access token expires. */
|
|
92
|
+
accessTokenExpiresAt: string;
|
|
93
|
+
/** ISO-8601 instant after which the client should refresh the session. */
|
|
94
|
+
refreshAfter: string;
|
|
95
|
+
guardianId: string;
|
|
96
|
+
assistantId: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Union of the two terminal `pairing-token` response bodies. */
|
|
100
|
+
export type RemoteWebPairingTokenResponse =
|
|
101
|
+
| RemoteWebPairingTokenPendingResponse
|
|
102
|
+
| RemoteWebPairingTokenApprovedResponse;
|