@atproto/oauth-provider-api 0.0.1 → 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/CHANGELOG.md +12 -0
- package/dist/api-endpoints.d.ts +203 -0
- package/dist/api-endpoints.d.ts.map +1 -0
- package/dist/{api.js → api-endpoints.js} +1 -1
- package/dist/api-endpoints.js.map +1 -0
- package/dist/backend-types.d.ts +1 -17
- package/dist/backend-types.d.ts.map +1 -1
- package/dist/contants.d.ts +4 -0
- package/dist/contants.d.ts.map +1 -0
- package/dist/contants.js +7 -0
- package/dist/contants.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +10 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/api-endpoints.ts +207 -0
- package/src/backend-types.ts +1 -20
- package/src/contants.ts +4 -0
- package/src/index.ts +3 -1
- package/src/types.ts +15 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/api.d.ts +0 -62
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js.map +0 -1
- package/src/api.ts +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atproto/oauth-provider-api
|
|
2
2
|
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#3659](https://github.com/bluesky-social/atproto/pull/3659) [`371e04aad`](https://github.com/bluesky-social/atproto/commit/371e04aad2a3e8ae3fe185ce15fc8eb051cab78e) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Various adaptations
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`371e04aad`](https://github.com/bluesky-social/atproto/commit/371e04aad2a3e8ae3fe185ce15fc8eb051cab78e), [`26a077716`](https://github.com/bluesky-social/atproto/commit/26a07771673bf1090a61efb7c970235f0b2509fc)]:
|
|
12
|
+
- @atproto/oauth-types@0.2.5
|
|
13
|
+
- @atproto/jwk@0.1.5
|
|
14
|
+
|
|
3
15
|
## 0.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import type { SignedJwt } from '@atproto/jwk';
|
|
2
|
+
import type { OAuthClientMetadata } from '@atproto/oauth-types';
|
|
3
|
+
import type { Account, DeviceMetadata, ISODateString } from './types.js';
|
|
4
|
+
export type ApiEndpoints = {
|
|
5
|
+
'/verify-handle-availability': {
|
|
6
|
+
method: 'POST';
|
|
7
|
+
input: VerifyHandleAvailabilityInput;
|
|
8
|
+
output: {
|
|
9
|
+
available: true;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
'/sign-up': {
|
|
13
|
+
method: 'POST';
|
|
14
|
+
input: SignUpInput;
|
|
15
|
+
output: SignUpOutput;
|
|
16
|
+
};
|
|
17
|
+
'/sign-in': {
|
|
18
|
+
method: 'POST';
|
|
19
|
+
input: SignInInput;
|
|
20
|
+
output: SignInOutput;
|
|
21
|
+
};
|
|
22
|
+
'/reset-password-request': {
|
|
23
|
+
method: 'POST';
|
|
24
|
+
input: InitiatePasswordResetInput;
|
|
25
|
+
output: {
|
|
26
|
+
success: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
'/reset-password-confirm': {
|
|
30
|
+
method: 'POST';
|
|
31
|
+
input: ConfirmResetPasswordInput;
|
|
32
|
+
output: {
|
|
33
|
+
success: true;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
'/sign-out': {
|
|
37
|
+
method: 'POST';
|
|
38
|
+
input: SignOutInput;
|
|
39
|
+
output: {
|
|
40
|
+
success: true;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Lists all the accounts that are currently active, on the current device.
|
|
45
|
+
*/
|
|
46
|
+
'/device-sessions': {
|
|
47
|
+
method: 'GET';
|
|
48
|
+
output: ActiveDeviceSession[];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Lists all the active OAuth sessions (access/refresh tokens) that where
|
|
52
|
+
* issued to OAuth clients (apps).
|
|
53
|
+
*
|
|
54
|
+
* @NOTE can be revoked using the oauth revocation endpoint (json or form
|
|
55
|
+
* encoded)
|
|
56
|
+
*
|
|
57
|
+
* ```http
|
|
58
|
+
* POST /oauth/revoke
|
|
59
|
+
* Content-Type: application/x-www-form-urlencoded
|
|
60
|
+
*
|
|
61
|
+
* token=<tokenId>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
'/oauth-sessions': {
|
|
65
|
+
method: 'GET';
|
|
66
|
+
params: {
|
|
67
|
+
sub: string;
|
|
68
|
+
};
|
|
69
|
+
output: ActiveOAuthSession[];
|
|
70
|
+
};
|
|
71
|
+
'/revoke-oauth-session': {
|
|
72
|
+
method: 'POST';
|
|
73
|
+
input: RevokeOAuthSessionInput;
|
|
74
|
+
output: {
|
|
75
|
+
success: true;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Lists all the sessions that are currently active for a particular user, on
|
|
80
|
+
* other devices.
|
|
81
|
+
*/
|
|
82
|
+
'/account-sessions': {
|
|
83
|
+
method: 'GET';
|
|
84
|
+
params: {
|
|
85
|
+
sub: string;
|
|
86
|
+
};
|
|
87
|
+
output: ActiveAccountSession[];
|
|
88
|
+
};
|
|
89
|
+
'/revoke-account-session': {
|
|
90
|
+
method: 'POST';
|
|
91
|
+
input: RevokeAccountSessionInput;
|
|
92
|
+
output: {
|
|
93
|
+
success: true;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
'/accept': {
|
|
97
|
+
method: 'POST';
|
|
98
|
+
input: AcceptInput;
|
|
99
|
+
output: {
|
|
100
|
+
url: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
'/reject': {
|
|
104
|
+
method: 'POST';
|
|
105
|
+
input: RejectInput;
|
|
106
|
+
output: {
|
|
107
|
+
url: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* When a user signs in without the "remember me" option, the server returns an
|
|
113
|
+
* ephemeral token. When used as `Bearer` authorization header, the token will
|
|
114
|
+
* be used in order to authenticate the users in place of using the user's
|
|
115
|
+
* cookie based session (which are only created when "remember me" is checked).
|
|
116
|
+
*
|
|
117
|
+
* Only include this token in the `Authorization` header when making requests to
|
|
118
|
+
* the OAuth provider API, **FOR THE ACCOUNT IT WAS GENERATED FOR**.
|
|
119
|
+
*/
|
|
120
|
+
export type EphemeralToken = SignedJwt;
|
|
121
|
+
export type SignInInput = {
|
|
122
|
+
locale: string;
|
|
123
|
+
username: string;
|
|
124
|
+
password: string;
|
|
125
|
+
emailOtp?: string;
|
|
126
|
+
remember?: boolean;
|
|
127
|
+
};
|
|
128
|
+
export type SignInOutput = {
|
|
129
|
+
account: Account;
|
|
130
|
+
ephemeralToken?: EphemeralToken;
|
|
131
|
+
consentRequired?: boolean;
|
|
132
|
+
};
|
|
133
|
+
export type SignUpInput = {
|
|
134
|
+
locale: string;
|
|
135
|
+
handle: string;
|
|
136
|
+
email: string;
|
|
137
|
+
password: string;
|
|
138
|
+
inviteCode?: string;
|
|
139
|
+
hcaptchaToken?: string;
|
|
140
|
+
};
|
|
141
|
+
export type SignUpOutput = {
|
|
142
|
+
account: Account;
|
|
143
|
+
ephemeralToken?: EphemeralToken;
|
|
144
|
+
};
|
|
145
|
+
export type SignOutInput = {
|
|
146
|
+
sub: string | string[];
|
|
147
|
+
};
|
|
148
|
+
export type InitiatePasswordResetInput = {
|
|
149
|
+
locale: string;
|
|
150
|
+
email: string;
|
|
151
|
+
};
|
|
152
|
+
export type ConfirmResetPasswordInput = {
|
|
153
|
+
token: string;
|
|
154
|
+
password: string;
|
|
155
|
+
};
|
|
156
|
+
export type VerifyHandleAvailabilityInput = {
|
|
157
|
+
handle: string;
|
|
158
|
+
};
|
|
159
|
+
export type RevokeAccountSessionInput = {
|
|
160
|
+
sub: string;
|
|
161
|
+
deviceId: string;
|
|
162
|
+
};
|
|
163
|
+
export type RevokeOAuthSessionInput = {
|
|
164
|
+
sub: string;
|
|
165
|
+
tokenId: string;
|
|
166
|
+
};
|
|
167
|
+
export type AcceptInput = {
|
|
168
|
+
sub: string;
|
|
169
|
+
};
|
|
170
|
+
export type RejectInput = Record<string, never>;
|
|
171
|
+
/**
|
|
172
|
+
* Represents an account that is currently signed-in to the Authorization
|
|
173
|
+
* Server. If the session was created too long ago, the user may be required to
|
|
174
|
+
* re-authenticate ({@link ActiveDeviceSession.loginRequired}).
|
|
175
|
+
*/
|
|
176
|
+
export type ActiveDeviceSession = {
|
|
177
|
+
account: Account;
|
|
178
|
+
/**
|
|
179
|
+
* The session is too old and the user must re-authenticate.
|
|
180
|
+
*/
|
|
181
|
+
loginRequired: boolean;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Represents another device on which an account is currently signed-in.
|
|
185
|
+
*/
|
|
186
|
+
export type ActiveAccountSession = {
|
|
187
|
+
deviceId: string;
|
|
188
|
+
deviceMetadata: DeviceMetadata;
|
|
189
|
+
isCurrentDevice: boolean;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Represents an active OAuth session (access token).
|
|
193
|
+
*/
|
|
194
|
+
export type ActiveOAuthSession = {
|
|
195
|
+
tokenId: string;
|
|
196
|
+
createdAt: ISODateString;
|
|
197
|
+
updatedAt: ISODateString;
|
|
198
|
+
clientId: string;
|
|
199
|
+
/** An "undefined" value means that the client metadata could not be fetched */
|
|
200
|
+
clientMetadata?: OAuthClientMetadata;
|
|
201
|
+
scope?: string;
|
|
202
|
+
};
|
|
203
|
+
//# sourceMappingURL=api-endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-endpoints.d.ts","sourceRoot":"","sources":["../src/api-endpo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,OAAO,EAAE,OAAO,CAAA;IAEhB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,cAAc,CAAA;IAE9B,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAA;IAEf,SAAS,EAAE,aAAa,CAAA;IACxB,SAAS,EAAE,aAAa,CAAA;IAExB,QAAQ,EAAE,MAAM,CAAA;IAChB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,mBAAmB,CAAA;IAEpC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-endpoints.js","sourceRoot":"","sources":["../src/api-endpoints.ts"],"names":[],"mappings":""}
|
package/dist/backend-types.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { LinkDefinition, ScopeDetail, Session } from './types.js';
|
|
3
|
-
export type AvailableLocales = readonly string[];
|
|
1
|
+
import type { LinkDefinition } from './types.js';
|
|
4
2
|
export type CustomizationData = {
|
|
5
3
|
hcaptchaSiteKey?: string;
|
|
6
4
|
inviteCodeRequired?: boolean;
|
|
@@ -9,18 +7,4 @@ export type CustomizationData = {
|
|
|
9
7
|
logo?: string;
|
|
10
8
|
links?: LinkDefinition[];
|
|
11
9
|
};
|
|
12
|
-
export type ErrorData = {
|
|
13
|
-
error: string;
|
|
14
|
-
error_description: string;
|
|
15
|
-
};
|
|
16
|
-
export type AuthorizeData = {
|
|
17
|
-
clientId: string;
|
|
18
|
-
clientMetadata: OAuthClientMetadata;
|
|
19
|
-
clientTrusted: boolean;
|
|
20
|
-
requestUri: string;
|
|
21
|
-
loginHint?: string;
|
|
22
|
-
scopeDetails?: ScopeDetail[];
|
|
23
|
-
newSessionsRequireConsent: boolean;
|
|
24
|
-
sessions: Session[];
|
|
25
|
-
};
|
|
26
10
|
//# sourceMappingURL=backend-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend-types.d.ts","sourceRoot":"","sources":["../src/backend-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"backend-types.d.ts","sourceRoot":"","sources":["../src/backend-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,MAAM,MAAM,iBAAiB,GAAG;IAE9B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,cAAc,EAAE,CAAA;CACzB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contants.d.ts","sourceRoot":"","sources":["../src/contants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAC5C,eAAO,MAAM,gBAAgB,iBAAiB,CAAA;AAE9C,eAAO,MAAM,mBAAmB,kCAAkC,CAAA"}
|
package/dist/contants.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_ENDPOINT_PREFIX = exports.CSRF_HEADER_NAME = exports.CSRF_COOKIE_NAME = void 0;
|
|
4
|
+
exports.CSRF_COOKIE_NAME = 'csrf-token';
|
|
5
|
+
exports.CSRF_HEADER_NAME = 'x-csrf-token';
|
|
6
|
+
exports.API_ENDPOINT_PREFIX = '/@atproto/oauth-provider/~api';
|
|
7
|
+
//# sourceMappingURL=contants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contants.js","sourceRoot":"","sources":["../src/contants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,YAAY,CAAA;AAC/B,QAAA,gBAAgB,GAAG,cAAc,CAAA;AAEjC,QAAA,mBAAmB,GAAG,+BAA+B,CAAA"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,YAAY,CAAA;AAE/B,cAAc,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./contants.js"), exports);
|
|
3
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA,gDAA6B"}
|
package/dist/types.d.ts
CHANGED
|
@@ -14,9 +14,10 @@ export type Session = {
|
|
|
14
14
|
loginRequired: boolean;
|
|
15
15
|
consentRequired: boolean;
|
|
16
16
|
};
|
|
17
|
-
export type
|
|
17
|
+
export type MultiLangString = {
|
|
18
18
|
en: string;
|
|
19
|
-
} & Record<string, string | undefined
|
|
19
|
+
} & Record<string, string | undefined>;
|
|
20
|
+
export type LocalizedString = string | MultiLangString;
|
|
20
21
|
export type LinkDefinition = {
|
|
21
22
|
title: LocalizedString;
|
|
22
23
|
href: string;
|
|
@@ -24,6 +25,12 @@ export type LinkDefinition = {
|
|
|
24
25
|
};
|
|
25
26
|
export type ScopeDetail = {
|
|
26
27
|
scope: string;
|
|
27
|
-
description?:
|
|
28
|
+
description?: LocalizedString;
|
|
28
29
|
};
|
|
30
|
+
export type DeviceMetadata = {
|
|
31
|
+
userAgent: string | null;
|
|
32
|
+
ipAddress: string;
|
|
33
|
+
lastSeenAt: ISODateString;
|
|
34
|
+
};
|
|
35
|
+
export type ISODateString = `${string}T${string}Z`;
|
|
29
36
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;IAEnC,KAAK,CAAC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eAAe,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,eAAe,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,aAAa,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,GAAG,MAAM,IAAI,MAAM,GAAG,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/oauth-provider-api",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared data types for the @atproto/oauth-provider and @atproto/oauth-provider-ui packages",
|
|
6
6
|
"keywords": [
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atproto/
|
|
28
|
+
"@atproto/jwk": "0.1.5",
|
|
29
|
+
"@atproto/oauth-types": "0.2.5"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"typescript": "^5.6.3"
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type { SignedJwt } from '@atproto/jwk'
|
|
2
|
+
import type { OAuthClientMetadata } from '@atproto/oauth-types'
|
|
3
|
+
import type { Account, DeviceMetadata, ISODateString } from './types.js'
|
|
4
|
+
|
|
5
|
+
// These are the endpoints implemented by the OAuth provider, for its UI to
|
|
6
|
+
// call.
|
|
7
|
+
|
|
8
|
+
export type ApiEndpoints = {
|
|
9
|
+
'/verify-handle-availability': {
|
|
10
|
+
method: 'POST'
|
|
11
|
+
input: VerifyHandleAvailabilityInput
|
|
12
|
+
output: { available: true }
|
|
13
|
+
}
|
|
14
|
+
'/sign-up': {
|
|
15
|
+
method: 'POST'
|
|
16
|
+
input: SignUpInput
|
|
17
|
+
output: SignUpOutput
|
|
18
|
+
}
|
|
19
|
+
'/sign-in': {
|
|
20
|
+
method: 'POST'
|
|
21
|
+
input: SignInInput
|
|
22
|
+
output: SignInOutput
|
|
23
|
+
}
|
|
24
|
+
'/reset-password-request': {
|
|
25
|
+
method: 'POST'
|
|
26
|
+
input: InitiatePasswordResetInput
|
|
27
|
+
output: { success: true }
|
|
28
|
+
}
|
|
29
|
+
'/reset-password-confirm': {
|
|
30
|
+
method: 'POST'
|
|
31
|
+
input: ConfirmResetPasswordInput
|
|
32
|
+
output: { success: true }
|
|
33
|
+
}
|
|
34
|
+
'/sign-out': {
|
|
35
|
+
method: 'POST'
|
|
36
|
+
input: SignOutInput
|
|
37
|
+
output: { success: true }
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Lists all the accounts that are currently active, on the current device.
|
|
41
|
+
*/
|
|
42
|
+
'/device-sessions': {
|
|
43
|
+
method: 'GET'
|
|
44
|
+
output: ActiveDeviceSession[]
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Lists all the active OAuth sessions (access/refresh tokens) that where
|
|
48
|
+
* issued to OAuth clients (apps).
|
|
49
|
+
*
|
|
50
|
+
* @NOTE can be revoked using the oauth revocation endpoint (json or form
|
|
51
|
+
* encoded)
|
|
52
|
+
*
|
|
53
|
+
* ```http
|
|
54
|
+
* POST /oauth/revoke
|
|
55
|
+
* Content-Type: application/x-www-form-urlencoded
|
|
56
|
+
*
|
|
57
|
+
* token=<tokenId>
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
'/oauth-sessions': {
|
|
61
|
+
method: 'GET'
|
|
62
|
+
params: { sub: string }
|
|
63
|
+
output: ActiveOAuthSession[]
|
|
64
|
+
}
|
|
65
|
+
'/revoke-oauth-session': {
|
|
66
|
+
method: 'POST'
|
|
67
|
+
input: RevokeOAuthSessionInput
|
|
68
|
+
output: { success: true }
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Lists all the sessions that are currently active for a particular user, on
|
|
72
|
+
* other devices.
|
|
73
|
+
*/
|
|
74
|
+
'/account-sessions': {
|
|
75
|
+
method: 'GET'
|
|
76
|
+
params: { sub: string }
|
|
77
|
+
output: ActiveAccountSession[]
|
|
78
|
+
}
|
|
79
|
+
'/revoke-account-session': {
|
|
80
|
+
method: 'POST'
|
|
81
|
+
input: RevokeAccountSessionInput
|
|
82
|
+
output: { success: true }
|
|
83
|
+
}
|
|
84
|
+
'/accept': {
|
|
85
|
+
method: 'POST'
|
|
86
|
+
input: AcceptInput
|
|
87
|
+
output: { url: string }
|
|
88
|
+
}
|
|
89
|
+
'/reject': {
|
|
90
|
+
method: 'POST'
|
|
91
|
+
input: RejectInput
|
|
92
|
+
output: { url: string }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* When a user signs in without the "remember me" option, the server returns an
|
|
98
|
+
* ephemeral token. When used as `Bearer` authorization header, the token will
|
|
99
|
+
* be used in order to authenticate the users in place of using the user's
|
|
100
|
+
* cookie based session (which are only created when "remember me" is checked).
|
|
101
|
+
*
|
|
102
|
+
* Only include this token in the `Authorization` header when making requests to
|
|
103
|
+
* the OAuth provider API, **FOR THE ACCOUNT IT WAS GENERATED FOR**.
|
|
104
|
+
*/
|
|
105
|
+
export type EphemeralToken = SignedJwt
|
|
106
|
+
|
|
107
|
+
export type SignInInput = {
|
|
108
|
+
locale: string
|
|
109
|
+
username: string
|
|
110
|
+
password: string
|
|
111
|
+
emailOtp?: string
|
|
112
|
+
remember?: boolean
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type SignInOutput = {
|
|
116
|
+
account: Account
|
|
117
|
+
ephemeralToken?: EphemeralToken
|
|
118
|
+
consentRequired?: boolean
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type SignUpInput = {
|
|
122
|
+
locale: string
|
|
123
|
+
handle: string
|
|
124
|
+
email: string
|
|
125
|
+
password: string
|
|
126
|
+
inviteCode?: string
|
|
127
|
+
hcaptchaToken?: string
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export type SignUpOutput = {
|
|
131
|
+
account: Account
|
|
132
|
+
ephemeralToken?: EphemeralToken
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type SignOutInput = {
|
|
136
|
+
sub: string | string[]
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export type InitiatePasswordResetInput = {
|
|
140
|
+
locale: string
|
|
141
|
+
email: string
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type ConfirmResetPasswordInput = {
|
|
145
|
+
token: string
|
|
146
|
+
password: string
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export type VerifyHandleAvailabilityInput = {
|
|
150
|
+
handle: string
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export type RevokeAccountSessionInput = {
|
|
154
|
+
sub: string
|
|
155
|
+
deviceId: string
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type RevokeOAuthSessionInput = {
|
|
159
|
+
sub: string
|
|
160
|
+
tokenId: string
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export type AcceptInput = {
|
|
164
|
+
sub: string
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type RejectInput = Record<string, never>
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Represents an account that is currently signed-in to the Authorization
|
|
171
|
+
* Server. If the session was created too long ago, the user may be required to
|
|
172
|
+
* re-authenticate ({@link ActiveDeviceSession.loginRequired}).
|
|
173
|
+
*/
|
|
174
|
+
export type ActiveDeviceSession = {
|
|
175
|
+
account: Account
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The session is too old and the user must re-authenticate.
|
|
179
|
+
*/
|
|
180
|
+
loginRequired: boolean
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Represents another device on which an account is currently signed-in.
|
|
185
|
+
*/
|
|
186
|
+
export type ActiveAccountSession = {
|
|
187
|
+
deviceId: string
|
|
188
|
+
deviceMetadata: DeviceMetadata
|
|
189
|
+
|
|
190
|
+
isCurrentDevice: boolean
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Represents an active OAuth session (access token).
|
|
195
|
+
*/
|
|
196
|
+
export type ActiveOAuthSession = {
|
|
197
|
+
tokenId: string
|
|
198
|
+
|
|
199
|
+
createdAt: ISODateString
|
|
200
|
+
updatedAt: ISODateString
|
|
201
|
+
|
|
202
|
+
clientId: string
|
|
203
|
+
/** An "undefined" value means that the client metadata could not be fetched */
|
|
204
|
+
clientMetadata?: OAuthClientMetadata
|
|
205
|
+
|
|
206
|
+
scope?: string
|
|
207
|
+
}
|
package/src/backend-types.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { LinkDefinition, ScopeDetail, Session } from './types.js'
|
|
1
|
+
import type { LinkDefinition } from './types.js'
|
|
3
2
|
|
|
4
3
|
// These are the types of the variables that are injected into the HTML by the
|
|
5
4
|
// backend. They are used to configure the frontend.
|
|
6
5
|
|
|
7
|
-
export type AvailableLocales = readonly string[]
|
|
8
|
-
|
|
9
6
|
export type CustomizationData = {
|
|
10
7
|
// Functional customization
|
|
11
8
|
hcaptchaSiteKey?: string
|
|
@@ -17,19 +14,3 @@ export type CustomizationData = {
|
|
|
17
14
|
logo?: string
|
|
18
15
|
links?: LinkDefinition[]
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
export type ErrorData = {
|
|
22
|
-
error: string
|
|
23
|
-
error_description: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type AuthorizeData = {
|
|
27
|
-
clientId: string
|
|
28
|
-
clientMetadata: OAuthClientMetadata
|
|
29
|
-
clientTrusted: boolean
|
|
30
|
-
requestUri: string
|
|
31
|
-
loginHint?: string
|
|
32
|
-
scopeDetails?: ScopeDetail[]
|
|
33
|
-
newSessionsRequireConsent: boolean
|
|
34
|
-
sessions: Session[]
|
|
35
|
-
}
|
package/src/contants.ts
ADDED
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -18,9 +18,12 @@ export type Session = {
|
|
|
18
18
|
consentRequired: boolean
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export type
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
export type MultiLangString = { en: string } & Record<
|
|
22
|
+
string,
|
|
23
|
+
string | undefined
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
export type LocalizedString = string | MultiLangString
|
|
24
27
|
|
|
25
28
|
export type LinkDefinition = {
|
|
26
29
|
title: LocalizedString
|
|
@@ -30,5 +33,13 @@ export type LinkDefinition = {
|
|
|
30
33
|
|
|
31
34
|
export type ScopeDetail = {
|
|
32
35
|
scope: string
|
|
33
|
-
description?:
|
|
36
|
+
description?: LocalizedString
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type DeviceMetadata = {
|
|
40
|
+
userAgent: string | null
|
|
41
|
+
ipAddress: string
|
|
42
|
+
lastSeenAt: ISODateString
|
|
34
43
|
}
|
|
44
|
+
|
|
45
|
+
export type ISODateString = `${string}T${string}Z`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/api.ts","./src/backend-types.ts","./src/index.ts","./src/types.ts"],"version":"5.
|
|
1
|
+
{"root":["./src/api-endpoints.ts","./src/backend-types.ts","./src/contants.ts","./src/index.ts","./src/types.ts"],"version":"5.8.2"}
|
package/dist/api.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { Account } from './types.js';
|
|
2
|
-
export type ApiEndpoints = {
|
|
3
|
-
'/verify-handle-availability': {
|
|
4
|
-
input: VerifyHandleAvailabilityData;
|
|
5
|
-
output: {
|
|
6
|
-
available: true;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
'/sign-up': {
|
|
10
|
-
input: SignUpData;
|
|
11
|
-
output: {
|
|
12
|
-
account: Account;
|
|
13
|
-
consentRequired: boolean;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
'/sign-in': {
|
|
17
|
-
input: SignInData;
|
|
18
|
-
output: {
|
|
19
|
-
account: Account;
|
|
20
|
-
consentRequired: boolean;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
'/reset-password-request': {
|
|
24
|
-
input: InitiatePasswordResetData;
|
|
25
|
-
output: {
|
|
26
|
-
success: true;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
'/reset-password-confirm': {
|
|
30
|
-
input: ConfirmResetPasswordData;
|
|
31
|
-
output: {
|
|
32
|
-
success: true;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export type SignInData = {
|
|
37
|
-
locale: string;
|
|
38
|
-
username: string;
|
|
39
|
-
password: string;
|
|
40
|
-
emailOtp?: string;
|
|
41
|
-
remember?: boolean;
|
|
42
|
-
};
|
|
43
|
-
export type SignUpData = {
|
|
44
|
-
locale: string;
|
|
45
|
-
handle: string;
|
|
46
|
-
email: string;
|
|
47
|
-
password: string;
|
|
48
|
-
inviteCode?: string;
|
|
49
|
-
hcaptchaToken?: string;
|
|
50
|
-
};
|
|
51
|
-
export type InitiatePasswordResetData = {
|
|
52
|
-
locale: string;
|
|
53
|
-
email: string;
|
|
54
|
-
};
|
|
55
|
-
export type ConfirmResetPasswordData = {
|
|
56
|
-
token: string;
|
|
57
|
-
password: string;
|
|
58
|
-
};
|
|
59
|
-
export type VerifyHandleAvailabilityData = {
|
|
60
|
-
handle: string;
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.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,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,MAAM,EAAE,MAAM,CAAA;CACf,CAAA"}
|
package/dist/api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":""}
|
package/src/api.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { Account } from './types.js'
|
|
2
|
-
|
|
3
|
-
// These are the endpoints implemented by the OAuth provider, for it's UI to
|
|
4
|
-
// call.
|
|
5
|
-
|
|
6
|
-
export type ApiEndpoints = {
|
|
7
|
-
'/verify-handle-availability': {
|
|
8
|
-
input: VerifyHandleAvailabilityData
|
|
9
|
-
output: { available: true }
|
|
10
|
-
}
|
|
11
|
-
'/sign-up': {
|
|
12
|
-
input: SignUpData
|
|
13
|
-
output: {
|
|
14
|
-
account: Account
|
|
15
|
-
consentRequired: boolean
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
'/sign-in': {
|
|
19
|
-
input: SignInData
|
|
20
|
-
output: {
|
|
21
|
-
account: Account
|
|
22
|
-
consentRequired: boolean
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
'/reset-password-request': {
|
|
26
|
-
input: InitiatePasswordResetData
|
|
27
|
-
output: { success: true }
|
|
28
|
-
}
|
|
29
|
-
'/reset-password-confirm': {
|
|
30
|
-
input: ConfirmResetPasswordData
|
|
31
|
-
output: { success: true }
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type SignInData = {
|
|
36
|
-
locale: string
|
|
37
|
-
username: string
|
|
38
|
-
password: string
|
|
39
|
-
emailOtp?: string
|
|
40
|
-
remember?: boolean
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type SignUpData = {
|
|
44
|
-
locale: string
|
|
45
|
-
handle: string
|
|
46
|
-
email: string
|
|
47
|
-
password: string
|
|
48
|
-
inviteCode?: string
|
|
49
|
-
hcaptchaToken?: string
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type InitiatePasswordResetData = {
|
|
53
|
-
locale: string
|
|
54
|
-
email: string
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type ConfirmResetPasswordData = {
|
|
58
|
-
token: string
|
|
59
|
-
password: string
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type VerifyHandleAvailabilityData = {
|
|
63
|
-
handle: string
|
|
64
|
-
}
|