@atproto/oauth-provider-api 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ # @atproto/oauth-provider-api
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3640](https://github.com/bluesky-social/atproto/pull/3640) [`cc4122652`](https://github.com/bluesky-social/atproto/commit/cc4122652ed42ba55826c019d0ec57bf25df1ecd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Exctracted types shared between OAuthProvider backand and it's UI into a separate package.
package/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Dual MIT/Apache-2.0 License
2
+
3
+ Copyright (c) 2022-2025 Bluesky PBC, and Contributors
4
+
5
+ Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
6
+
7
+ Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
package/dist/api.d.ts ADDED
@@ -0,0 +1,62 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAKzC,MAAM,MAAM,YAAY,GAAG;IACzB,6BAA6B,EAAE;QAC7B,KAAK,EAAE,4BAA4B,CAAA;QACnC,MAAM,EAAE;YAAE,SAAS,EAAE,IAAI,CAAA;SAAE,CAAA;KAC5B,CAAA;IACD,UAAU,EAAE;QACV,KAAK,EAAE,UAAU,CAAA;QACjB,MAAM,EAAE;YACN,OAAO,EAAE,OAAO,CAAA;YAChB,eAAe,EAAE,OAAO,CAAA;SACzB,CAAA;KACF,CAAA;IACD,UAAU,EAAE;QACV,KAAK,EAAE,UAAU,CAAA;QACjB,MAAM,EAAE;YACN,OAAO,EAAE,OAAO,CAAA;YAChB,eAAe,EAAE,OAAO,CAAA;SACzB,CAAA;KACF,CAAA;IACD,yBAAyB,EAAE;QACzB,KAAK,EAAE,yBAAyB,CAAA;QAChC,MAAM,EAAE;YAAE,OAAO,EAAE,IAAI,CAAA;SAAE,CAAA;KAC1B,CAAA;IACD,yBAAyB,EAAE;QACzB,KAAK,EAAE,wBAAwB,CAAA;QAC/B,MAAM,EAAE;YAAE,OAAO,EAAE,IAAI,CAAA;SAAE,CAAA;KAC1B,CAAA;CACF,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,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 ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import type { OAuthClientMetadata } from '@atproto/oauth-types';
2
+ import type { LinkDefinition, ScopeDetail, Session } from './types.js';
3
+ export type AvailableLocales = readonly string[];
4
+ export type CustomizationData = {
5
+ hcaptchaSiteKey?: string;
6
+ inviteCodeRequired?: boolean;
7
+ availableUserDomains?: string[];
8
+ name?: string;
9
+ logo?: string;
10
+ links?: LinkDefinition[];
11
+ };
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
+ //# sourceMappingURL=backend-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-types.d.ts","sourceRoot":"","sources":["../src/backend-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAKtE,MAAM,MAAM,gBAAgB,GAAG,SAAS,MAAM,EAAE,CAAA;AAEhD,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;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,mBAAmB,CAAA;IACnC,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAC5B,yBAAyB,EAAE,OAAO,CAAA;IAClC,QAAQ,EAAE,OAAO,EAAE,CAAA;CACpB,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=backend-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-types.js","sourceRoot":"","sources":["../src/backend-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type * from './api.js';
2
+ export type * from './backend-types.js';
3
+ export type * from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ export type Account = {
2
+ sub: string;
3
+ aud: string | [string, ...string[]];
4
+ email?: string;
5
+ email_verified?: boolean;
6
+ name?: string;
7
+ preferred_username?: string;
8
+ picture?: string;
9
+ };
10
+ export type Session = {
11
+ account: Account;
12
+ info?: never;
13
+ selected: boolean;
14
+ loginRequired: boolean;
15
+ consentRequired: boolean;
16
+ };
17
+ export type LocalizedString = string | ({
18
+ en: string;
19
+ } & Record<string, string | undefined>);
20
+ export type LinkDefinition = {
21
+ title: LocalizedString;
22
+ href: string;
23
+ rel?: string;
24
+ };
25
+ export type ScopeDetail = {
26
+ scope: string;
27
+ description?: string;
28
+ };
29
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,KAAK,CAAA;IAEZ,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,OAAO,CAAA;IACtB,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;AAEzD,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,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,MAAM,CAAA;CACrB,CAAA"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@atproto/oauth-provider-api",
3
+ "version": "0.0.1",
4
+ "license": "MIT",
5
+ "description": "Shared data types for the @atproto/oauth-provider and @atproto/oauth-provider-ui packages",
6
+ "keywords": [
7
+ "atproto",
8
+ "oauth",
9
+ "provider",
10
+ "types"
11
+ ],
12
+ "homepage": "https://atproto.com",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/bluesky-social/atproto",
16
+ "directory": "packages/oauth/oauth-provider-api"
17
+ },
18
+ "type": "commonjs",
19
+ "main": "dist/index.js",
20
+ "types": "dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "default": "./dist/index.js"
25
+ }
26
+ },
27
+ "dependencies": {
28
+ "@atproto/oauth-types": "0.2.4"
29
+ },
30
+ "devDependencies": {
31
+ "typescript": "^5.6.3"
32
+ },
33
+ "scripts": {
34
+ "build": "tsc --build tsconfig.build.json"
35
+ }
36
+ }
package/src/api.ts ADDED
@@ -0,0 +1,64 @@
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
+ }
@@ -0,0 +1,35 @@
1
+ import type { OAuthClientMetadata } from '@atproto/oauth-types'
2
+ import type { LinkDefinition, ScopeDetail, Session } from './types.js'
3
+
4
+ // These are the types of the variables that are injected into the HTML by the
5
+ // backend. They are used to configure the frontend.
6
+
7
+ export type AvailableLocales = readonly string[]
8
+
9
+ export type CustomizationData = {
10
+ // Functional customization
11
+ hcaptchaSiteKey?: string
12
+ inviteCodeRequired?: boolean
13
+ availableUserDomains?: string[]
14
+
15
+ // Aesthetic customization
16
+ name?: string
17
+ logo?: string
18
+ links?: LinkDefinition[]
19
+ }
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/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type * from './api.js'
2
+ export type * from './backend-types.js'
3
+ export type * from './types.js'
package/src/types.ts ADDED
@@ -0,0 +1,34 @@
1
+ export type Account = {
2
+ sub: string
3
+ aud: string | [string, ...string[]]
4
+
5
+ email?: string
6
+ email_verified?: boolean
7
+ name?: string
8
+ preferred_username?: string
9
+ picture?: string
10
+ }
11
+
12
+ export type Session = {
13
+ account: Account
14
+ info?: never // Prevent relying on this in the frontend
15
+
16
+ selected: boolean
17
+ loginRequired: boolean
18
+ consentRequired: boolean
19
+ }
20
+
21
+ export type LocalizedString =
22
+ | string
23
+ | ({ en: string } & Record<string, string | undefined>)
24
+
25
+ export type LinkDefinition = {
26
+ title: LocalizedString
27
+ href: string
28
+ rel?: string
29
+ }
30
+
31
+ export type ScopeDetail = {
32
+ scope: string
33
+ description?: string
34
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../../tsconfig/isomorphic.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "outDir": "./dist"
6
+ },
7
+ "include": ["./src"]
8
+ }
@@ -0,0 +1 @@
1
+ {"root":["./src/api.ts","./src/backend-types.ts","./src/index.ts","./src/types.ts"],"version":"5.6.3"}
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "include": [],
3
+ "references": [{ "path": "./tsconfig.build.json" }]
4
+ }