@samebase/identity-broker 0.0.0-stage → 0.1.0
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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +90 -2
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +26 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/client/connectors/email.d.ts +6 -0
- package/dist/client/connectors/email.js +5 -0
- package/dist/client/connectors/email.js.map +1 -0
- package/dist/client/connectors/github.d.ts +7 -0
- package/dist/client/connectors/github.js +57 -0
- package/dist/client/connectors/github.js.map +1 -0
- package/dist/client/connectors/google.d.ts +7 -0
- package/dist/client/connectors/google.js +13 -0
- package/dist/client/connectors/google.js.map +1 -0
- package/dist/client/connectors/types.d.ts +47 -0
- package/dist/client/connectors/types.js +2 -0
- package/dist/client/connectors/types.js.map +1 -0
- package/dist/client/connectors/upstream.d.ts +25 -0
- package/dist/client/connectors/upstream.js +86 -0
- package/dist/client/connectors/upstream.js.map +1 -0
- package/dist/client/html.d.ts +30 -0
- package/dist/client/html.js +84 -0
- package/dist/client/html.js.map +1 -0
- package/dist/client/index.d.ts +78 -0
- package/dist/client/index.js +721 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/jwt.d.ts +31 -0
- package/dist/client/jwt.js +55 -0
- package/dist/client/jwt.js.map +1 -0
- package/dist/client/keys.d.ts +44 -0
- package/dist/client/keys.js +130 -0
- package/dist/client/keys.js.map +1 -0
- package/dist/client/protocol.d.ts +75 -0
- package/dist/client/protocol.js +259 -0
- package/dist/client/protocol.js.map +1 -0
- package/dist/client/responses.d.ts +24 -0
- package/dist/client/responses.js +57 -0
- package/dist/client/responses.js.map +1 -0
- package/dist/client/subject.d.ts +15 -0
- package/dist/client/subject.js +32 -0
- package/dist/client/subject.js.map +1 -0
- package/dist/component/_generated/api.d.ts +45 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +375 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +45 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +132 -0
- package/dist/component/_generated/server.js +80 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/apps.d.ts +36 -0
- package/dist/component/apps.js +124 -0
- package/dist/component/apps.js.map +1 -0
- package/dist/component/authRequests.d.ts +254 -0
- package/dist/component/authRequests.js +392 -0
- package/dist/component/authRequests.js.map +1 -0
- package/dist/component/clients.d.ts +43 -0
- package/dist/component/clients.js +95 -0
- package/dist/component/clients.js.map +1 -0
- package/dist/component/convex.config.d.ts +2 -0
- package/dist/component/convex.config.js +3 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/crypto.d.ts +2 -0
- package/dist/component/crypto.js +9 -0
- package/dist/component/crypto.js.map +1 -0
- package/dist/component/lifecycle.d.ts +15 -0
- package/dist/component/lifecycle.js +59 -0
- package/dist/component/lifecycle.js.map +1 -0
- package/dist/component/registration.d.ts +17 -0
- package/dist/component/registration.js +57 -0
- package/dist/component/registration.js.map +1 -0
- package/dist/component/schema.d.ts +650 -0
- package/dist/component/schema.js +122 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/signIns.d.ts +8 -0
- package/dist/component/signIns.js +26 -0
- package/dist/component/signIns.js.map +1 -0
- package/package.json +51 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Registers an app. Its clients come later, one per deployment, through registration tokens. */
|
|
2
|
+
export declare const create: import("convex/server").RegisteredMutation<"public", {
|
|
3
|
+
allowedCallbackHosts: string[];
|
|
4
|
+
appId: string;
|
|
5
|
+
createdAt: number;
|
|
6
|
+
firstParty: boolean;
|
|
7
|
+
name: string;
|
|
8
|
+
}, Promise<null>>;
|
|
9
|
+
export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
10
|
+
appId: string;
|
|
11
|
+
}, Promise<{
|
|
12
|
+
appId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
firstParty: boolean;
|
|
15
|
+
allowedCallbackHosts: string[];
|
|
16
|
+
createdAt: number;
|
|
17
|
+
} | null>>;
|
|
18
|
+
export declare const list: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
19
|
+
appId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
firstParty: boolean;
|
|
22
|
+
allowedCallbackHosts: string[];
|
|
23
|
+
createdAt: number;
|
|
24
|
+
}[]>>;
|
|
25
|
+
/** Replaces the hosts a client callback may use, for example when an app gets a custom domain. */
|
|
26
|
+
export declare const setAllowedCallbackHosts: import("convex/server").RegisteredMutation<"public", {
|
|
27
|
+
allowedCallbackHosts: string[];
|
|
28
|
+
appId: string;
|
|
29
|
+
}, Promise<null>>;
|
|
30
|
+
/**
|
|
31
|
+
* Deletes an app with its registration tokens and clients. This is the emergency revocation:
|
|
32
|
+
* every deployment of the app stops being able to start or finish a sign-in at once.
|
|
33
|
+
*/
|
|
34
|
+
export declare const remove: import("convex/server").RegisteredMutation<"public", {
|
|
35
|
+
appId: string;
|
|
36
|
+
}, Promise<null>>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { mutation, query } from "./_generated/server";
|
|
3
|
+
const { array, boolean, number, object, string } = v;
|
|
4
|
+
const vApp = object({
|
|
5
|
+
appId: string(),
|
|
6
|
+
name: string(),
|
|
7
|
+
firstParty: boolean(),
|
|
8
|
+
allowedCallbackHosts: array(string()),
|
|
9
|
+
createdAt: number(),
|
|
10
|
+
});
|
|
11
|
+
/** Registers an app. Its clients come later, one per deployment, through registration tokens. */
|
|
12
|
+
export const create = mutation({
|
|
13
|
+
args: {
|
|
14
|
+
appId: string(),
|
|
15
|
+
name: string(),
|
|
16
|
+
firstParty: boolean(),
|
|
17
|
+
allowedCallbackHosts: array(string()),
|
|
18
|
+
createdAt: number(),
|
|
19
|
+
},
|
|
20
|
+
returns: v.null(),
|
|
21
|
+
handler: async (ctx, args) => {
|
|
22
|
+
const existing = await ctx.db
|
|
23
|
+
.query("apps")
|
|
24
|
+
.withIndex("by_app_id", (q) => q.eq("appId", args.appId))
|
|
25
|
+
.unique();
|
|
26
|
+
if (existing !== null) {
|
|
27
|
+
throw new Error(`An app with id "${args.appId}" already exists`);
|
|
28
|
+
}
|
|
29
|
+
await ctx.db.insert("apps", {
|
|
30
|
+
appId: args.appId,
|
|
31
|
+
name: args.name,
|
|
32
|
+
firstParty: args.firstParty,
|
|
33
|
+
allowedCallbackHosts: args.allowedCallbackHosts,
|
|
34
|
+
createdAt: args.createdAt,
|
|
35
|
+
});
|
|
36
|
+
return null;
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
export const get = query({
|
|
40
|
+
args: { appId: string() },
|
|
41
|
+
returns: v.union(vApp, v.null()),
|
|
42
|
+
handler: async (ctx, args) => {
|
|
43
|
+
const app = await ctx.db
|
|
44
|
+
.query("apps")
|
|
45
|
+
.withIndex("by_app_id", (q) => q.eq("appId", args.appId))
|
|
46
|
+
.unique();
|
|
47
|
+
if (app === null) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
appId: app.appId,
|
|
52
|
+
name: app.name,
|
|
53
|
+
firstParty: app.firstParty,
|
|
54
|
+
allowedCallbackHosts: app.allowedCallbackHosts,
|
|
55
|
+
createdAt: app.createdAt,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
export const list = query({
|
|
60
|
+
args: {},
|
|
61
|
+
returns: array(vApp),
|
|
62
|
+
handler: async (ctx) => {
|
|
63
|
+
const apps = await ctx.db.query("apps").collect();
|
|
64
|
+
return apps
|
|
65
|
+
.map((app) => ({
|
|
66
|
+
appId: app.appId,
|
|
67
|
+
name: app.name,
|
|
68
|
+
firstParty: app.firstParty,
|
|
69
|
+
allowedCallbackHosts: app.allowedCallbackHosts,
|
|
70
|
+
createdAt: app.createdAt,
|
|
71
|
+
}))
|
|
72
|
+
.sort((a, b) => a.createdAt - b.createdAt || a.appId.localeCompare(b.appId));
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
/** Replaces the hosts a client callback may use, for example when an app gets a custom domain. */
|
|
76
|
+
export const setAllowedCallbackHosts = mutation({
|
|
77
|
+
args: { appId: string(), allowedCallbackHosts: array(string()) },
|
|
78
|
+
returns: v.null(),
|
|
79
|
+
handler: async (ctx, args) => {
|
|
80
|
+
const app = await ctx.db
|
|
81
|
+
.query("apps")
|
|
82
|
+
.withIndex("by_app_id", (q) => q.eq("appId", args.appId))
|
|
83
|
+
.unique();
|
|
84
|
+
if (app === null) {
|
|
85
|
+
throw new Error(`Unknown app "${args.appId}"`);
|
|
86
|
+
}
|
|
87
|
+
await ctx.db.patch("apps", app._id, { allowedCallbackHosts: args.allowedCallbackHosts });
|
|
88
|
+
return null;
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* Deletes an app with its registration tokens and clients. This is the emergency revocation:
|
|
93
|
+
* every deployment of the app stops being able to start or finish a sign-in at once.
|
|
94
|
+
*/
|
|
95
|
+
export const remove = mutation({
|
|
96
|
+
args: { appId: string() },
|
|
97
|
+
returns: v.null(),
|
|
98
|
+
handler: async (ctx, args) => {
|
|
99
|
+
const app = await ctx.db
|
|
100
|
+
.query("apps")
|
|
101
|
+
.withIndex("by_app_id", (q) => q.eq("appId", args.appId))
|
|
102
|
+
.unique();
|
|
103
|
+
if (app === null) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const tokens = await ctx.db
|
|
107
|
+
.query("registrationTokens")
|
|
108
|
+
.withIndex("by_app_id", (q) => q.eq("appId", args.appId))
|
|
109
|
+
.collect();
|
|
110
|
+
for (const token of tokens) {
|
|
111
|
+
await ctx.db.delete("registrationTokens", token._id);
|
|
112
|
+
}
|
|
113
|
+
const clients = await ctx.db
|
|
114
|
+
.query("clients")
|
|
115
|
+
.withIndex("by_app_id", (q) => q.eq("appId", args.appId))
|
|
116
|
+
.collect();
|
|
117
|
+
for (const client of clients) {
|
|
118
|
+
await ctx.db.delete("clients", client._id);
|
|
119
|
+
}
|
|
120
|
+
await ctx.db.delete("apps", app._id);
|
|
121
|
+
return null;
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
//# sourceMappingURL=apps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/component/apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;AAErD,MAAM,IAAI,GAAG,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE;IACf,IAAI,EAAE,MAAM,EAAE;IACd,UAAU,EAAE,OAAO,EAAE;IACrB,oBAAoB,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IACrC,SAAS,EAAE,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,iGAAiG;AACjG,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC;IAC7B,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,EAAE;QACf,IAAI,EAAE,MAAM,EAAE;QACd,UAAU,EAAE,OAAO,EAAE;QACrB,oBAAoB,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;QACrC,SAAS,EAAE,MAAM,EAAE;KACpB;IACD,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE;IACjB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,EAAE;aAC1B,KAAK,C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CAAC,CAAC;aACxD,OAAO,EAAE,CAAC;QACb,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QACvD,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,EAAE;aACzB,KAAK,CAAC,SAAS,CAAC;aAChB,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;aACxD,OAAO,EAAE,CAAC;QACb,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/** Stores a validated /authorize request. The caller has already checked the client and redirect URI. */
|
|
2
|
+
export declare const create: import("convex/server").RegisteredMutation<"public", {
|
|
3
|
+
appId: string;
|
|
4
|
+
clientId: string;
|
|
5
|
+
codeChallenge: string;
|
|
6
|
+
createdAt: number;
|
|
7
|
+
expiresAt: number;
|
|
8
|
+
freshLogin: boolean;
|
|
9
|
+
nonce?: string;
|
|
10
|
+
redirectUri: string;
|
|
11
|
+
requestId: string;
|
|
12
|
+
scope: string;
|
|
13
|
+
state?: string;
|
|
14
|
+
}, Promise<null>>;
|
|
15
|
+
export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
16
|
+
requestId: string;
|
|
17
|
+
}, Promise<{
|
|
18
|
+
appId: string;
|
|
19
|
+
clientId: string;
|
|
20
|
+
codeChallenge: string;
|
|
21
|
+
createdAt: number;
|
|
22
|
+
expiresAt: number;
|
|
23
|
+
freshLogin: boolean;
|
|
24
|
+
nonce?: string;
|
|
25
|
+
redirectUri: string;
|
|
26
|
+
requestId: string;
|
|
27
|
+
scope: string;
|
|
28
|
+
state?: string;
|
|
29
|
+
status: "pending";
|
|
30
|
+
} | {
|
|
31
|
+
appId: string;
|
|
32
|
+
clientId: string;
|
|
33
|
+
codeChallenge: string;
|
|
34
|
+
connector: string;
|
|
35
|
+
createdAt: number;
|
|
36
|
+
expiresAt: number;
|
|
37
|
+
freshLogin: boolean;
|
|
38
|
+
nonce?: string;
|
|
39
|
+
redirectUri: string;
|
|
40
|
+
requestId: string;
|
|
41
|
+
scope: string;
|
|
42
|
+
state?: string;
|
|
43
|
+
status: "upstream";
|
|
44
|
+
upstreamCodeVerifier: string;
|
|
45
|
+
upstreamNonce?: string;
|
|
46
|
+
upstreamStateHash: string;
|
|
47
|
+
} | {
|
|
48
|
+
appId: string;
|
|
49
|
+
clientId: string;
|
|
50
|
+
codeChallenge: string;
|
|
51
|
+
connector: string;
|
|
52
|
+
createdAt: number;
|
|
53
|
+
expiresAt: number;
|
|
54
|
+
freshLogin: boolean;
|
|
55
|
+
nonce?: string;
|
|
56
|
+
redirectUri: string;
|
|
57
|
+
requestId: string;
|
|
58
|
+
scope: string;
|
|
59
|
+
state?: string;
|
|
60
|
+
status: "claimed";
|
|
61
|
+
} | {
|
|
62
|
+
appId: string;
|
|
63
|
+
clientId: string;
|
|
64
|
+
codeChallenge: string;
|
|
65
|
+
connector: string;
|
|
66
|
+
createdAt: number;
|
|
67
|
+
email: string;
|
|
68
|
+
emailAttempts: number;
|
|
69
|
+
emailCodeExpiresAt: number;
|
|
70
|
+
emailCodeHash: string;
|
|
71
|
+
expiresAt: number;
|
|
72
|
+
freshLogin: boolean;
|
|
73
|
+
nonce?: string;
|
|
74
|
+
redirectUri: string;
|
|
75
|
+
requestId: string;
|
|
76
|
+
scope: string;
|
|
77
|
+
state?: string;
|
|
78
|
+
status: "emailSent";
|
|
79
|
+
} | {
|
|
80
|
+
appId: string;
|
|
81
|
+
authTime: number;
|
|
82
|
+
clientId: string;
|
|
83
|
+
codeChallenge: string;
|
|
84
|
+
createdAt: number;
|
|
85
|
+
expiresAt: number;
|
|
86
|
+
freshLogin: boolean;
|
|
87
|
+
identity: {
|
|
88
|
+
connector: string;
|
|
89
|
+
email?: string;
|
|
90
|
+
emailVerified?: boolean;
|
|
91
|
+
name?: string;
|
|
92
|
+
picture?: string;
|
|
93
|
+
upstreamId: string;
|
|
94
|
+
};
|
|
95
|
+
nonce?: string;
|
|
96
|
+
redirectUri: string;
|
|
97
|
+
requestId: string;
|
|
98
|
+
scope: string;
|
|
99
|
+
state?: string;
|
|
100
|
+
status: "completed";
|
|
101
|
+
} | null>>;
|
|
102
|
+
/** The user chose an OAuth or OIDC connector; the request now waits for that connector's callback. */
|
|
103
|
+
export declare const startUpstream: import("convex/server").RegisteredMutation<"public", {
|
|
104
|
+
connector: string;
|
|
105
|
+
now: number;
|
|
106
|
+
requestId: string;
|
|
107
|
+
upstreamCodeVerifier: string;
|
|
108
|
+
upstreamNonce?: string;
|
|
109
|
+
upstreamStateHash: string;
|
|
110
|
+
}, Promise<{
|
|
111
|
+
ok: true;
|
|
112
|
+
redirectUri: string;
|
|
113
|
+
state?: string;
|
|
114
|
+
} | {
|
|
115
|
+
error: "expired" | "wrong_status";
|
|
116
|
+
ok: false;
|
|
117
|
+
redirectUri: string;
|
|
118
|
+
state?: string;
|
|
119
|
+
} | {
|
|
120
|
+
error: "not_found";
|
|
121
|
+
ok: false;
|
|
122
|
+
}>>;
|
|
123
|
+
/**
|
|
124
|
+
* The connector callback arrived with its state. Claiming moves the request to `claimed` in the
|
|
125
|
+
* same mutation that finds it, so a replayed or raced callback finds nothing to claim.
|
|
126
|
+
*/
|
|
127
|
+
export declare const claimUpstream: import("convex/server").RegisteredMutation<"public", {
|
|
128
|
+
now: number;
|
|
129
|
+
upstreamStateHash: string;
|
|
130
|
+
}, Promise<{
|
|
131
|
+
connector: string;
|
|
132
|
+
freshLogin: boolean;
|
|
133
|
+
redirectUri: string;
|
|
134
|
+
requestId: string;
|
|
135
|
+
state?: string;
|
|
136
|
+
status: "claimed";
|
|
137
|
+
upstreamCodeVerifier: string;
|
|
138
|
+
upstreamNonce?: string;
|
|
139
|
+
} | {
|
|
140
|
+
redirectUri: string;
|
|
141
|
+
state?: string;
|
|
142
|
+
status: "expired";
|
|
143
|
+
} | {
|
|
144
|
+
status: "missing";
|
|
145
|
+
}>>;
|
|
146
|
+
/** The user chose the email connector and typed an address; a code was sent to it. */
|
|
147
|
+
export declare const startEmail: import("convex/server").RegisteredMutation<"public", {
|
|
148
|
+
connector: string;
|
|
149
|
+
email: string;
|
|
150
|
+
emailCodeExpiresAt: number;
|
|
151
|
+
emailCodeHash: string;
|
|
152
|
+
now: number;
|
|
153
|
+
requestId: string;
|
|
154
|
+
}, Promise<{
|
|
155
|
+
ok: true;
|
|
156
|
+
redirectUri: string;
|
|
157
|
+
state?: string;
|
|
158
|
+
} | {
|
|
159
|
+
error: "expired" | "wrong_status";
|
|
160
|
+
ok: false;
|
|
161
|
+
redirectUri: string;
|
|
162
|
+
state?: string;
|
|
163
|
+
} | {
|
|
164
|
+
error: "not_found";
|
|
165
|
+
ok: false;
|
|
166
|
+
}>>;
|
|
167
|
+
/**
|
|
168
|
+
* Checks a typed email code. A match completes the request with the canonical address as the
|
|
169
|
+
* upstream identity and issues the authorization code; a miss counts an attempt, and the request
|
|
170
|
+
* locks at `maxAttempts`.
|
|
171
|
+
*/
|
|
172
|
+
export declare const verifyEmailCode: import("convex/server").RegisteredMutation<"public", {
|
|
173
|
+
codeExpiresAt: number;
|
|
174
|
+
codeHash: string;
|
|
175
|
+
emailCodeHash: string;
|
|
176
|
+
maxAttempts: number;
|
|
177
|
+
now: number;
|
|
178
|
+
requestId: string;
|
|
179
|
+
}, Promise<{
|
|
180
|
+
ok: true;
|
|
181
|
+
redirectUri: string;
|
|
182
|
+
state?: string;
|
|
183
|
+
} | {
|
|
184
|
+
error: "code_expired" | "expired" | "locked" | "wrong_code" | "wrong_status";
|
|
185
|
+
ok: false;
|
|
186
|
+
redirectUri: string;
|
|
187
|
+
state?: string;
|
|
188
|
+
} | {
|
|
189
|
+
error: "not_found";
|
|
190
|
+
ok: false;
|
|
191
|
+
}>>;
|
|
192
|
+
/** The connector attested the identity after a claim; the authorization code can be handed out. */
|
|
193
|
+
export declare const complete: import("convex/server").RegisteredMutation<"public", {
|
|
194
|
+
authTime: number;
|
|
195
|
+
codeExpiresAt: number;
|
|
196
|
+
codeHash: string;
|
|
197
|
+
identity: {
|
|
198
|
+
connector: string;
|
|
199
|
+
email?: string;
|
|
200
|
+
emailVerified?: boolean;
|
|
201
|
+
name?: string;
|
|
202
|
+
picture?: string;
|
|
203
|
+
upstreamId: string;
|
|
204
|
+
};
|
|
205
|
+
now: number;
|
|
206
|
+
requestId: string;
|
|
207
|
+
}, Promise<{
|
|
208
|
+
ok: true;
|
|
209
|
+
redirectUri: string;
|
|
210
|
+
state?: string;
|
|
211
|
+
} | {
|
|
212
|
+
error: "expired" | "wrong_status";
|
|
213
|
+
ok: false;
|
|
214
|
+
redirectUri: string;
|
|
215
|
+
state?: string;
|
|
216
|
+
} | {
|
|
217
|
+
error: "not_found";
|
|
218
|
+
ok: false;
|
|
219
|
+
}>>;
|
|
220
|
+
/** Deletes a request the user abandoned at the hub, such as a declined consent. */
|
|
221
|
+
export declare const abandon: import("convex/server").RegisteredMutation<"public", {
|
|
222
|
+
requestId: string;
|
|
223
|
+
}, Promise<{
|
|
224
|
+
redirectUri: string;
|
|
225
|
+
} | null>>;
|
|
226
|
+
/**
|
|
227
|
+
* Redeems an authorization code: single use, bound to the client, the redirect URI and the PKCE
|
|
228
|
+
* challenge of its request (OAuth 2.1 section 4.1.3). On success the code and the request are gone.
|
|
229
|
+
*/
|
|
230
|
+
export declare const exchangeCode: import("convex/server").RegisteredMutation<"public", {
|
|
231
|
+
clientId: string;
|
|
232
|
+
codeHash: string;
|
|
233
|
+
codeVerifier: string;
|
|
234
|
+
now: number;
|
|
235
|
+
redirectUri?: string;
|
|
236
|
+
}, Promise<{
|
|
237
|
+
appId: string;
|
|
238
|
+
authTime: number;
|
|
239
|
+
clientId: string;
|
|
240
|
+
identity: {
|
|
241
|
+
connector: string;
|
|
242
|
+
email?: string;
|
|
243
|
+
emailVerified?: boolean;
|
|
244
|
+
name?: string;
|
|
245
|
+
picture?: string;
|
|
246
|
+
upstreamId: string;
|
|
247
|
+
};
|
|
248
|
+
nonce?: string;
|
|
249
|
+
ok: true;
|
|
250
|
+
scope: string;
|
|
251
|
+
} | {
|
|
252
|
+
description: string;
|
|
253
|
+
ok: false;
|
|
254
|
+
}>>;
|