@qlever-llc/trellis 0.10.18 → 0.10.19
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.
- package/esm/auth/browser/login.d.ts +8 -7
- package/esm/auth/browser/login.d.ts.map +1 -1
- package/esm/auth/browser/logout.d.ts +23 -0
- package/esm/auth/browser/logout.d.ts.map +1 -0
- package/esm/auth/browser/logout.js +80 -0
- package/esm/auth/browser/session.d.ts +2 -0
- package/esm/auth/browser/session.d.ts.map +1 -1
- package/esm/auth/browser/session.js +6 -0
- package/esm/auth/browser.d.ts +3 -2
- package/esm/auth/browser.d.ts.map +1 -1
- package/esm/auth/browser.js +3 -2
- package/esm/auth/mod.d.ts +2 -2
- package/esm/auth/mod.d.ts.map +1 -1
- package/esm/auth/mod.js +2 -2
- package/esm/auth/schemas.d.ts +26 -0
- package/esm/auth/schemas.d.ts.map +1 -1
- package/esm/auth/schemas.js +35 -0
- package/esm/generated-sdk/auth/contract.d.ts +1 -1
- package/esm/generated-sdk/auth/contract.d.ts.map +1 -1
- package/esm/generated-sdk/auth/contract.js +7 -2
- package/esm/generated-sdk/auth/schemas.d.ts +2 -0
- package/esm/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/auth/schemas.js +2 -0
- package/esm/generated-sdk/auth/types.d.ts +4 -2
- package/esm/generated-sdk/auth/types.d.ts.map +1 -1
- package/esm/generated-sdk/auth/types.js +1 -1
- package/esm/models/auth/rpc/Logout.d.ts.map +1 -1
- package/esm/models/auth/rpc/Logout.js +2 -2
- package/package.json +2 -2
- package/script/auth/browser/login.d.ts +8 -7
- package/script/auth/browser/login.d.ts.map +1 -1
- package/script/auth/browser/logout.d.ts +23 -0
- package/script/auth/browser/logout.d.ts.map +1 -0
- package/script/auth/browser/logout.js +84 -0
- package/script/auth/browser/session.d.ts +2 -0
- package/script/auth/browser/session.d.ts.map +1 -1
- package/script/auth/browser/session.js +7 -0
- package/script/auth/browser.d.ts +3 -2
- package/script/auth/browser.d.ts.map +1 -1
- package/script/auth/browser.js +9 -1
- package/script/auth/mod.d.ts +2 -2
- package/script/auth/mod.d.ts.map +1 -1
- package/script/auth/mod.js +12 -5
- package/script/auth/schemas.d.ts +26 -0
- package/script/auth/schemas.d.ts.map +1 -1
- package/script/auth/schemas.js +37 -1
- package/script/generated-sdk/auth/contract.d.ts +1 -1
- package/script/generated-sdk/auth/contract.d.ts.map +1 -1
- package/script/generated-sdk/auth/contract.js +7 -2
- package/script/generated-sdk/auth/schemas.d.ts +2 -0
- package/script/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/script/generated-sdk/auth/schemas.js +2 -0
- package/script/generated-sdk/auth/types.d.ts +4 -2
- package/script/generated-sdk/auth/types.d.ts.map +1 -1
- package/script/generated-sdk/auth/types.js +1 -1
- package/script/models/auth/rpc/Logout.d.ts.map +1 -1
- package/script/models/auth/rpc/Logout.js +2 -2
- package/src/auth/browser/login.ts +12 -8
- package/src/auth/browser/logout.ts +114 -0
- package/src/auth/browser/session.ts +15 -0
- package/src/auth/browser.ts +14 -0
- package/src/auth/mod.ts +12 -0
- package/src/auth/schemas.ts +58 -0
- package/src/models/auth/rpc/Logout.ts +2 -0
- package/src/sdk/_generated/auth/contract.ts +7 -2
- package/src/sdk/_generated/auth/schemas.ts +2 -0
- package/src/sdk/_generated/auth/types.ts +2 -2
package/src/auth/mod.ts
CHANGED
|
@@ -48,6 +48,8 @@ export {
|
|
|
48
48
|
buildLoginUrl,
|
|
49
49
|
classifyBrowserAuthError,
|
|
50
50
|
clearSessionKey,
|
|
51
|
+
completeSessionLogout,
|
|
52
|
+
type CompleteSessionLogoutArgs,
|
|
51
53
|
createRpcProof,
|
|
52
54
|
fetchPortalFlowState,
|
|
53
55
|
generateSessionKey,
|
|
@@ -57,6 +59,8 @@ export {
|
|
|
57
59
|
isBindSuccessResponse,
|
|
58
60
|
isRecoverableBrowserAuthError,
|
|
59
61
|
loadSessionKey,
|
|
62
|
+
logoutSession,
|
|
63
|
+
logoutSessionSig,
|
|
60
64
|
natsConnectSigForIat,
|
|
61
65
|
portalFlowIdFromUrl,
|
|
62
66
|
portalProviderLoginUrl,
|
|
@@ -321,6 +325,12 @@ export {
|
|
|
321
325
|
approvalCapabilityKeys,
|
|
322
326
|
type ApprovalDecision,
|
|
323
327
|
ApprovalDecisionSchema,
|
|
328
|
+
type AuthLogoutRequest,
|
|
329
|
+
AuthLogoutRequestSchema,
|
|
330
|
+
type AuthLogoutResponse,
|
|
331
|
+
type AuthLogoutResponseMode,
|
|
332
|
+
AuthLogoutResponseModeSchema,
|
|
333
|
+
AuthLogoutResponseSchema,
|
|
324
334
|
type AuthStartFlowResponse,
|
|
325
335
|
AuthStartFlowResponseSchema,
|
|
326
336
|
type AuthStartRequest,
|
|
@@ -331,6 +341,7 @@ export {
|
|
|
331
341
|
BindResponseSchema,
|
|
332
342
|
type BindSuccessResponse,
|
|
333
343
|
BindSuccessResponseSchema,
|
|
344
|
+
buildLogoutSignaturePayload,
|
|
334
345
|
type ClientTransportEndpoints,
|
|
335
346
|
ClientTransportEndpointsSchema,
|
|
336
347
|
type ClientTransports,
|
|
@@ -338,6 +349,7 @@ export {
|
|
|
338
349
|
type ContractApproval,
|
|
339
350
|
type ContractApprovalCapability,
|
|
340
351
|
ContractApprovalSchema,
|
|
352
|
+
type LogoutSignaturePayloadInput,
|
|
341
353
|
type NatsAuthTokenV1,
|
|
342
354
|
NatsAuthTokenV1Schema,
|
|
343
355
|
type SentinelCreds,
|
package/src/auth/schemas.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StaticDecode } from "typebox";
|
|
2
2
|
import { Type } from "typebox";
|
|
3
|
+
import { canonicalizeJsonValue } from "./utils.js";
|
|
3
4
|
|
|
4
5
|
const SessionKeySchema = Type.String({
|
|
5
6
|
pattern: "^[A-Za-z0-9_-]{43}$",
|
|
@@ -9,6 +10,43 @@ const SignatureSchema = Type.String({
|
|
|
9
10
|
pattern: "^[A-Za-z0-9_-]{86}$",
|
|
10
11
|
});
|
|
11
12
|
|
|
13
|
+
export const AuthLogoutResponseModeSchema = Type.Union([
|
|
14
|
+
Type.Literal("json"),
|
|
15
|
+
Type.Literal("redirect"),
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
export type AuthLogoutResponseMode = StaticDecode<
|
|
19
|
+
typeof AuthLogoutResponseModeSchema
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
export type LogoutSignaturePayloadInput = {
|
|
23
|
+
iat: number;
|
|
24
|
+
providerLogout?: boolean;
|
|
25
|
+
federatedProviderLogout?: boolean;
|
|
26
|
+
returnTo?: string;
|
|
27
|
+
responseMode?: AuthLogoutResponseMode;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** Builds the canonical value signed for POST-based HTTP logout requests. */
|
|
31
|
+
export function buildLogoutSignaturePayload(
|
|
32
|
+
input: LogoutSignaturePayloadInput,
|
|
33
|
+
): string {
|
|
34
|
+
const payload: Record<string, boolean | number | string> = { iat: input.iat };
|
|
35
|
+
if (input.providerLogout !== undefined) {
|
|
36
|
+
payload.providerLogout = input.providerLogout;
|
|
37
|
+
}
|
|
38
|
+
if (input.federatedProviderLogout !== undefined) {
|
|
39
|
+
payload.federatedProviderLogout = input.federatedProviderLogout;
|
|
40
|
+
}
|
|
41
|
+
if (input.returnTo !== undefined) {
|
|
42
|
+
payload.returnTo = input.returnTo;
|
|
43
|
+
}
|
|
44
|
+
if (input.responseMode !== undefined) {
|
|
45
|
+
payload.responseMode = input.responseMode;
|
|
46
|
+
}
|
|
47
|
+
return canonicalizeJsonValue(payload);
|
|
48
|
+
}
|
|
49
|
+
|
|
12
50
|
export const ContractDigestSchema = Type.String({
|
|
13
51
|
pattern: "^[A-Za-z0-9_-]+$",
|
|
14
52
|
});
|
|
@@ -117,6 +155,26 @@ export const AuthStartRequestSchema = Type.Object({
|
|
|
117
155
|
context: Type.Optional(OpenObjectSchema),
|
|
118
156
|
});
|
|
119
157
|
|
|
158
|
+
export const AuthLogoutRequestSchema = Type.Object({
|
|
159
|
+
sessionKey: SessionKeySchema,
|
|
160
|
+
iat: Type.Integer(),
|
|
161
|
+
sig: SignatureSchema,
|
|
162
|
+
providerLogout: Type.Optional(Type.Boolean()),
|
|
163
|
+
federatedProviderLogout: Type.Optional(Type.Boolean()),
|
|
164
|
+
returnTo: Type.Optional(Type.String({ minLength: 1 })),
|
|
165
|
+
responseMode: Type.Optional(AuthLogoutResponseModeSchema),
|
|
166
|
+
}, { additionalProperties: true });
|
|
167
|
+
|
|
168
|
+
export const AuthLogoutResponseSchema = Type.Object({
|
|
169
|
+
success: Type.Literal(true),
|
|
170
|
+
redirectTo: Type.Optional(
|
|
171
|
+
Type.String({ format: "uri", pattern: "^https?://", minLength: 1 }),
|
|
172
|
+
),
|
|
173
|
+
}, { additionalProperties: false });
|
|
174
|
+
|
|
175
|
+
export type AuthLogoutRequest = StaticDecode<typeof AuthLogoutRequestSchema>;
|
|
176
|
+
export type AuthLogoutResponse = StaticDecode<typeof AuthLogoutResponseSchema>;
|
|
177
|
+
|
|
120
178
|
export const AuthStartFlowResponseSchema = Type.Object({
|
|
121
179
|
status: Type.Literal("flow_started"),
|
|
122
180
|
flowId: Type.String({ minLength: 1 }),
|
|
@@ -2,6 +2,7 @@ import Type, { type Static } from "typebox";
|
|
|
2
2
|
|
|
3
3
|
export const AuthSessionsLogoutSchema = Type.Object(
|
|
4
4
|
{},
|
|
5
|
+
{ additionalProperties: true },
|
|
5
6
|
);
|
|
6
7
|
export type AuthSessionsLogoutInput = Static<typeof AuthSessionsLogoutSchema>;
|
|
7
8
|
|
|
@@ -9,6 +10,7 @@ export const AuthSessionsLogoutResponseSchema = Type.Object(
|
|
|
9
10
|
{
|
|
10
11
|
success: Type.Boolean(),
|
|
11
12
|
},
|
|
13
|
+
{ additionalProperties: false },
|
|
12
14
|
);
|
|
13
15
|
export type AuthSessionsLogoutResponse = Static<
|
|
14
16
|
typeof AuthSessionsLogoutResponseSchema
|
|
@@ -13,7 +13,7 @@ const CONTRACT_MODULE_METADATA = Symbol.for(
|
|
|
13
13
|
|
|
14
14
|
export const CONTRACT_ID = "trellis.auth@v1" as const;
|
|
15
15
|
export const CONTRACT_DIGEST =
|
|
16
|
-
"
|
|
16
|
+
"x-9_MjfSThvbn1yc9jAWbaraniKLZ74oUeUqqtZijXQ" as const;
|
|
17
17
|
export const CONTRACT = {
|
|
18
18
|
"capabilities": {
|
|
19
19
|
"trellis.auth::device.review": {
|
|
@@ -7322,8 +7322,13 @@ export const CONTRACT = {
|
|
|
7322
7322
|
"required": ["entries", "count", "offset", "limit"],
|
|
7323
7323
|
"type": "object",
|
|
7324
7324
|
},
|
|
7325
|
-
"AuthSessionsLogoutRequest": {
|
|
7325
|
+
"AuthSessionsLogoutRequest": {
|
|
7326
|
+
"additionalProperties": true,
|
|
7327
|
+
"properties": {},
|
|
7328
|
+
"type": "object",
|
|
7329
|
+
},
|
|
7326
7330
|
"AuthSessionsLogoutResponse": {
|
|
7331
|
+
"additionalProperties": false,
|
|
7327
7332
|
"properties": { "success": { "type": "boolean" } },
|
|
7328
7333
|
"required": ["success"],
|
|
7329
7334
|
"type": "object",
|
|
@@ -6138,11 +6138,13 @@ export const AuthSessionsListResponseSchema = {
|
|
|
6138
6138
|
} as const;
|
|
6139
6139
|
|
|
6140
6140
|
export const AuthSessionsLogoutRequestSchema = {
|
|
6141
|
+
"additionalProperties": true,
|
|
6141
6142
|
"properties": {},
|
|
6142
6143
|
"type": "object",
|
|
6143
6144
|
} as const;
|
|
6144
6145
|
|
|
6145
6146
|
export const AuthSessionsLogoutResponseSchema = {
|
|
6147
|
+
"additionalProperties": false,
|
|
6146
6148
|
"properties": { "success": { "type": "boolean" } },
|
|
6147
6149
|
"required": ["success"],
|
|
6148
6150
|
"type": "object",
|
|
@@ -4,7 +4,7 @@ import type { API } from "./api.js";
|
|
|
4
4
|
|
|
5
5
|
export const CONTRACT_ID = "trellis.auth@v1" as const;
|
|
6
6
|
export const CONTRACT_DIGEST =
|
|
7
|
-
"
|
|
7
|
+
"x-9_MjfSThvbn1yc9jAWbaraniKLZ74oUeUqqtZijXQ" as const;
|
|
8
8
|
|
|
9
9
|
export type AuthCapabilitiesListInput = { limit: number; offset?: number };
|
|
10
10
|
export type AuthCapabilitiesListOutput = {
|
|
@@ -2083,7 +2083,7 @@ export type AuthSessionsListOutput = {
|
|
|
2083
2083
|
offset: number;
|
|
2084
2084
|
};
|
|
2085
2085
|
|
|
2086
|
-
export type AuthSessionsLogoutInput = {};
|
|
2086
|
+
export type AuthSessionsLogoutInput = { [k: string]: unknown };
|
|
2087
2087
|
export type AuthSessionsLogoutOutput = { success: boolean };
|
|
2088
2088
|
|
|
2089
2089
|
export type AuthSessionsMeInput = {};
|