@atproto/oauth-provider-api 0.11.0 → 0.12.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 CHANGED
@@ -1,5 +1,52 @@
1
1
  # @atproto/oauth-provider-api
2
2
 
3
+ ## 0.12.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`ee63e5e`](https://github.com/bluesky-social/atproto/commit/ee63e5ede255e40251a9e761befec9d623dfb1ec), [`33d620b`](https://github.com/bluesky-social/atproto/commit/33d620b2ffc4b9a5b4959cbcc1262c5138c8a506)]:
8
+ - @atproto/syntax@0.7.9
9
+
10
+ ## 0.12.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [#5798](https://github.com/bluesky-social/atproto/pull/5798) [`bb765e9`](https://github.com/bluesky-social/atproto/commit/bb765e9bd2330900088755f29a6fb530138e39c4) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add rate limiting to the OAuth provider, with two tiers on account flows when hCaptcha is configured (captcha required, then blocked)
15
+
16
+ **Breaking changes** in `@atproto/oauth-provider`:
17
+
18
+ - `OAuthProvider.pushedAuthorizationRequest()` requires a new `deviceMetadata` argument (the PAR requests are rate limited).
19
+ - `AccountManager` no longer verifies hCaptcha tokens: the API routes do, through the rate limits, before calling it. `processHcaptchaToken()` and `buildSignupData()` were removed, and `authenticateAccount()` receives a `SignInInput`.
20
+ - The `SignInData` and `SignUpData` types were removed. Hooks and stores receive the form inputs instead (`SignInInput`, `SignUpInput`, `InitiatePasswordResetInput` and `ConfirmResetPasswordInput`, from `@atproto/oauth-provider-api`), including the `hcaptchaToken` when one was submitted:
21
+ - `onSignInAttempt`, `onSignedIn` and `onSignInFailed` receive `input` instead of `data`.
22
+ - `onSignedUp` receives `input` instead of `data`, the invite code being `input.inviteCode`. It no longer receives the hCaptcha verification result (`data.hcaptchaResult`): use the `onHcaptchaResult` hook (`action: 'sign-up'`) instead.
23
+ - `AccountStore.createAccount()` receives the `inviteCode` as submitted, even when invite codes are not required (it used to be omitted). The PDS now validates and uses an invite code submitted on an OAuth sign-up whatever its configuration, as `com.atproto.server.createAccount` does.
24
+ - The password reset hooks (`onResetPasswordRequest`, `onResetPasswordRequested`, `onResetPasswordConfirm` and `onResetPasswordConfirmed`), as well as `AccountStore.resetPasswordRequest()` and `AccountStore.resetPasswordConfirm()`, may receive an `hcaptchaToken`.
25
+ - The `onSignUpAttempt` hook is now called after the sign-up rate limits and captcha verification.
26
+ - The `onHcaptchaResult` hook data is a union discriminated on `action` (`sign-up`, `sign-in`, `reset-password-request` or `reset-password-confirm`), each carrying its form `input`, as the hook is now called whenever a captcha is verified.
27
+ - `HcaptchaClientTokens.hashedHandle` was renamed `hashedIdentifier`, and is only present when the form has an identifier (the handle on sign-up). The identifier is now trimmed, lowercased and stripped of any leading `@` before being hashed, and the sign-up email is hashed as `hashedEmail`. This changes the `client_tokens` sent to hCaptcha, and the `tokens` provided to the `onHcaptchaResult` hook.
28
+ - A failed hCaptcha verification (including on sign-up, and when hCaptcha can't be reached) is now reported as `captcha_rejected` instead of `invalid_request`.
29
+
30
+ New features in `@atproto/oauth-provider`:
31
+
32
+ - `rateLimits` option: the host provides a `RateLimiterFactory` backend, and may override the `DEFAULT_RATE_LIMIT_POLICIES`. Without it, no rate limiting is performed, though the rules that have no points still apply. Each rule computes its key with a `key` function, from the context its policy provides (see `RateLimitPolicyContexts`); `ipKey`, `identifierKey`, `identifierIpKey`, `authenticatedClientKey` and `publicClientIpKey` are provided. PAR requests are limited per authenticated client (shared by all its users, 3,000 per 5 minutes), and per client and IP address for public clients (which anyone can claim to be, 50 per 5 minutes).
33
+ - The sign-in, sign-up, password reset request and password reset confirmation policies support a captcha tier. Sign-ups requiring a captcha is now the default captcha tier of the `sign-up` policy: a rule with no points, which every request exceeds. Such rules need no storage, so they apply even without the `rateLimits` option.
34
+ - `captcha_required` (HTTP 400, no hCaptcha token was provided), `captcha_rejected` (HTTP 400, the hCaptcha token failed verification) and `rate_limit_exceeded` (HTTP 429, with a `Retry-After` header) errors.
35
+ - `OAuthError.getResponseHeaders()` lists the headers to send along an error response (e.g. `WWW-Authenticate`, `Retry-After`).
36
+
37
+ **Breaking changes** in `@atproto/oauth-provider-api`:
38
+
39
+ - The `EmailString` and `IdentifierString` types are exported, and used to type `SignInInput.identifier`, `InitiatePasswordResetInput.identifier`, `SignUpInput.email` and `Account.email`. `SignUpInput.handle` is a `HandleString`.
40
+ - `SignInInput`, `InitiatePasswordResetInput` and `ConfirmResetPasswordInput` accept an `hcaptchaToken`.
41
+
42
+ The sign-in and password reset forms (request and confirmation), including the account page's password change dialog, show an hCaptcha challenge when the server requires one, and how long to wait when rate limited. A 429 from a proxy in front of the server (e.g. a rate limiting edge) is reported as a rate limit whatever its body, and other error responses that are not JSON as unexpected server responses rather than as an invalid content type. That dialog no longer has an inline "Resend" button: "Back" returns to the request step, as in the signed-out flow. The PDS enables these rate limits along with its XRPC rate limits (`PDS_RATE_LIMITS_ENABLED`), using the same storage; the bypass settings (`PDS_RATE_LIMIT_BYPASS_IPS`, `PDS_RATE_LIMIT_BYPASS_KEY`) do not apply to them.
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [[`b9b1ca7`](https://github.com/bluesky-social/atproto/commit/b9b1ca7f176b93d12e39685799c5f2e1f9a63be7), [`bb765e9`](https://github.com/bluesky-social/atproto/commit/bb765e9bd2330900088755f29a6fb530138e39c4)]:
47
+ - @atproto/syntax@0.7.8
48
+ - @atproto/oauth-types@0.8.0
49
+
3
50
  ## 0.11.0
4
51
 
5
52
  ### Minor Changes
@@ -1,7 +1,7 @@
1
1
  import type { SignedJwt } from '@atproto/jwk';
2
2
  import type { OAuthClientMetadata } from '@atproto/oauth-types';
3
3
  import type { DidString, HandleString, ISODatetimeString } from '@atproto/syntax';
4
- import type { Account, DeviceMetadata, Session } from './types.js';
4
+ import type { Account, DeviceMetadata, EmailString, IdentifierString, Session } from './types.js';
5
5
  export type { DidString };
6
6
  export type ApiEndpoints = {
7
7
  '/verify-handle-availability': {
@@ -199,10 +199,11 @@ export type ApiEndpoints = {
199
199
  export type EphemeralToken = SignedJwt;
200
200
  export type SignInInput = {
201
201
  locale: string;
202
- identifier: string;
202
+ identifier: IdentifierString;
203
203
  password: string;
204
204
  emailOtp?: string;
205
205
  remember?: boolean;
206
+ hcaptchaToken?: string;
206
207
  };
207
208
  export type SignInOutput = {
208
209
  account: Account;
@@ -210,8 +211,8 @@ export type SignInOutput = {
210
211
  };
211
212
  export type SignUpInput = {
212
213
  locale: string;
213
- handle: string;
214
- email: string;
214
+ handle: HandleString;
215
+ email: EmailString;
215
216
  password: string;
216
217
  remember?: boolean;
217
218
  inviteCode?: string;
@@ -226,11 +227,13 @@ export type SignOutInput = {
226
227
  };
227
228
  export type InitiatePasswordResetInput = {
228
229
  locale: string;
229
- identifier: string;
230
+ identifier: IdentifierString;
231
+ hcaptchaToken?: string;
230
232
  };
231
233
  export type ConfirmResetPasswordInput = {
232
234
  token: string;
233
235
  password: string;
236
+ hcaptchaToken?: string;
234
237
  };
235
238
  export type InitiateEmailUpdateInput = {
236
239
  did: DidString;
@@ -1 +1 @@
1
- {"version":3,"file":"api-endpoints.d.ts","sourceRoot":"","sources":["../src/api-endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAElE,YAAY,EAAE,SAAS,EAAE,CAAA;AAKzB,MAAM,MAAM,YAAY,GAAG;IACzB,6BAA6B,EAAE;QAC7B,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,6BAA6B,CAAA;QACpC,MAAM,EA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A;CACf,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAE/C;;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,iBAAiB,CAAA;IAC5B,SAAS,EAAE,iBAAiB,CAAA;IAE5B,MAAM,EAAE,OAAO,CAAA;IAEf,QAAQ,EAAE,MAAM,CAAA;IAChB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,mBAAmB,CAAA;IAEpC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"api-endpoints.js","sourceRoot":"","sources":["../src/api-endpoints.ts"],"names":[],"mappings":"","sourcesContent":["import type { SignedJwt } from '@atproto/jwk'\nimport type { OAuthClientMetadata } from '@atproto/oauth-types'\nimport type {\n DidString,\n HandleString,\n ISODatetimeString,\n} from '@atproto/syntax'\nimport type { Account, DeviceMetadata, Session } from './types.js'\n\nexport type { DidString }\n\n// These are the endpoints implemented by the OAuth provider, for its UI to\n// call.\n\nexport type ApiEndpoints = {\n '/verify-handle-availability': {\n method: 'POST'\n input: VerifyHandleAvailabilityInput\n output: { available: true }\n }\n '/sign-up': {\n method: 'POST'\n input: SignUpInput\n output: SignUpOutput\n }\n '/sign-in': {\n method: 'POST'\n input: SignInInput\n output: SignInOutput\n }\n '/reset-password-request': {\n method: 'POST'\n input: InitiatePasswordResetInput\n output: { success: true }\n }\n '/reset-password-confirm': {\n method: 'POST'\n input: ConfirmResetPasswordInput\n output: { success: true }\n }\n '/sign-out': {\n method: 'POST'\n input: SignOutInput\n output: { success: true }\n }\n /**\n * Lists all the accounts that are currently active, on the current device.\n */\n '/device-sessions': {\n method: 'GET'\n output: Session[]\n }\n /**\n * Lists all the active OAuth sessions (access/refresh tokens) that where\n * issued to OAuth clients (apps).\n *\n * @NOTE can be revoked using the oauth revocation endpoint (json or form\n * encoded)\n *\n * ```http\n * POST /oauth/revoke\n * Content-Type: application/x-www-form-urlencoded\n *\n * token=<tokenId>\n * ```\n */\n '/oauth-sessions': {\n method: 'GET'\n params: OAuthSessionsInput\n output: OAuthSessionsOutput\n }\n '/revoke-oauth-session': {\n method: 'POST'\n input: RevokeOAuthSessionInput\n output: { success: true }\n }\n /**\n * Lists all the sessions that are currently active for a particular user, on\n * other devices.\n */\n '/account-sessions': {\n method: 'GET'\n params: AccountSessionsInput\n output: AccountSessionsOutput\n }\n '/revoke-account-session': {\n method: 'POST'\n input: RevokeAccountSessionInput\n output: { success: true }\n }\n '/update-email-request': {\n method: 'POST'\n input: InitiateEmailUpdateInput\n output: InitiateEmailUpdateOutput\n }\n '/update-email-confirm': {\n method: 'POST'\n input: ConfirmEmailUpdateInput\n output: ConfirmEmailUpdateOutput\n }\n '/verify-email-request': {\n method: 'POST'\n input: InitiateEmailVerificationInput\n output: { success: true }\n }\n '/verify-email-confirm': {\n method: 'POST'\n input: ConfirmEmailVerificationInput\n output: ConfirmEmailVerificationOutput\n }\n '/enable-email-otp': {\n method: 'POST'\n input: EnableEmailAuthFactorInput\n output: EnableEmailAuthFactorOutput\n }\n '/disable-email-otp': {\n method: 'POST'\n input: DisableEmailAuthFactorInput\n output: DisableEmailAuthFactorOutput\n }\n '/update-handle': {\n method: 'POST'\n input: UpdateHandleInput\n output: UpdateHandleOutput\n }\n /**\n * Marks the account as deactivated. The account remains recoverable — the\n * user can sign back in to reactivate via {@link ApiEndpoints['/reactivate-account']}.\n * Profile, posts, feeds and lists are hidden across the network until then.\n */\n '/deactivate-account': {\n method: 'POST'\n input: DeactivateAccountInput\n output: DeactivateAccountOutput\n }\n /**\n * Reactivates a previously-deactivated account. No-op when the account is\n * already active.\n */\n '/reactivate-account': {\n method: 'POST'\n input: ReactivateAccountInput\n output: ReactivateAccountOutput\n }\n /**\n * Initiates account deletion by sending a confirmation code to the account's\n * email address. The account is NOT deleted until\n * {@link ApiEndpoints['/delete-account-confirm']} is called with the matching\n * token and the user's current password.\n */\n '/delete-account-request': {\n method: 'POST'\n input: InitiateAccountDeletionInput\n output: { success: true }\n }\n /**\n * Confirms and finalizes account deletion. Requires both the email\n * confirmation token issued by {@link ApiEndpoints['/delete-account-request']}\n * and the user's current password. Deletion is irreversible.\n */\n '/delete-account-confirm': {\n method: 'POST'\n input: ConfirmAccountDeletionInput\n output: { success: true }\n }\n '/consent': {\n method: 'POST'\n input: ConsentInput\n output: { url: string }\n }\n '/reject': {\n method: 'POST'\n input: RejectInput\n output: { url: string }\n }\n}\n\n/**\n * When a user signs in without the \"remember me\" option, the server returns an\n * ephemeral token. When used as `Bearer` authorization header, the token will\n * be used in order to authenticate the users in place of using the user's\n * cookie based session (which are only created when \"remember me\" is checked).\n *\n * Only include this token in the `Authorization` header when making requests to\n * the OAuth provider API, **FOR THE ACCOUNT IT WAS GENERATED FOR**.\n */\nexport type EphemeralToken = SignedJwt\n\nexport type SignInInput = {\n locale: string\n identifier: string\n password: string\n emailOtp?: string\n remember?: boolean\n}\n\nexport type SignInOutput = {\n account: Account\n ephemeralToken?: EphemeralToken\n}\n\nexport type SignUpInput = {\n locale: string\n handle: string\n email: string\n password: string\n remember?: boolean\n inviteCode?: string\n hcaptchaToken?: string\n}\n\nexport type SignUpOutput = {\n account: Account\n ephemeralToken?: EphemeralToken\n}\n\nexport type SignOutInput = {\n did: DidString\n}\n\nexport type InitiatePasswordResetInput = {\n locale: string\n identifier: string\n}\n\nexport type ConfirmResetPasswordInput = {\n token: string\n password: string\n}\n\nexport type InitiateEmailUpdateInput = {\n did: DidString\n locale?: string\n}\n\nexport type InitiateEmailUpdateOutput = {\n tokenRequired: boolean\n}\n\nexport type ConfirmEmailUpdateInput = {\n did: DidString\n token?: string\n email: string\n locale?: string\n}\n\nexport type ConfirmEmailUpdateOutput = {\n account: Account\n}\n\nexport type InitiateEmailVerificationInput = {\n did: DidString\n locale?: string\n}\n\nexport type ConfirmEmailVerificationInput = {\n did: DidString\n token: string\n email: string\n}\n\nexport type ConfirmEmailVerificationOutput = {\n account: Account\n}\n\nexport type EnableEmailAuthFactorInput = {\n did: DidString\n locale?: string\n}\n\nexport type DisableEmailAuthFactorInput = {\n did: DidString\n token?: string\n locale?: string\n}\n\nexport type EnableEmailAuthFactorOutput = {\n account: Account\n}\n\nexport type DisableEmailAuthFactorOutput = {\n account: Account\n}\n\nexport type VerifyHandleAvailabilityInput = {\n handle: HandleString\n}\n\nexport type UpdateHandleInput = {\n did: DidString\n handle: HandleString\n}\n\nexport type UpdateHandleOutput = {\n account: Account\n}\n\nexport type DeactivateAccountInput = {\n did: DidString\n}\n\nexport type DeactivateAccountOutput = {\n account: Account\n}\n\nexport type ReactivateAccountInput = {\n did: DidString\n}\n\nexport type ReactivateAccountOutput = {\n account: Account\n}\n\nexport type InitiateAccountDeletionInput = {\n did: DidString\n locale?: string\n}\n\nexport type ConfirmAccountDeletionInput = {\n did: DidString\n token: string\n password: string\n}\n\nexport type RevokeAccountSessionInput = {\n did: DidString\n deviceId: string\n}\n\nexport type OAuthSessionsInput = {\n did: DidString\n}\n\nexport type OAuthSessionsOutput = ActiveOAuthSession[]\n\nexport type AccountSessionsInput = {\n did: DidString\n}\n\nexport type AccountSessionsOutput = ActiveAccountSession[]\n\nexport type RevokeOAuthSessionInput = {\n did: DidString\n tokenId: string\n}\n\nexport type ConsentInput = {\n did: DidString\n scope?: string\n}\n\nexport type RejectInput = Record<string, never>\n\n/**\n * Represents another device on which an account is currently signed-in.\n */\nexport type ActiveAccountSession = {\n deviceId: string\n deviceMetadata: DeviceMetadata\n\n isCurrentDevice: boolean\n}\n\n/**\n * Represents an active OAuth session (access token).\n */\nexport type ActiveOAuthSession = {\n tokenId: string\n\n createdAt: ISODatetimeString\n updatedAt: ISODatetimeString\n\n active: boolean\n\n clientId: string\n /** An \"undefined\" value means that the client metadata could not be fetched */\n clientMetadata?: OAuthClientMetadata\n\n scope?: string\n}\n"]}
1
+ {"version":3,"file":"api-endpoints.js","sourceRoot":"","sources":["../src/api-endpoints.ts"],"names":[],"mappings":"","sourcesContent":["import type { SignedJwt } from '@atproto/jwk'\nimport type { OAuthClientMetadata } from '@atproto/oauth-types'\nimport type {\n DidString,\n HandleString,\n ISODatetimeString,\n} from '@atproto/syntax'\nimport type {\n Account,\n DeviceMetadata,\n EmailString,\n IdentifierString,\n Session,\n} from './types.js'\n\nexport type { DidString }\n\n// These are the endpoints implemented by the OAuth provider, for its UI to\n// call.\n\nexport type ApiEndpoints = {\n '/verify-handle-availability': {\n method: 'POST'\n input: VerifyHandleAvailabilityInput\n output: { available: true }\n }\n '/sign-up': {\n method: 'POST'\n input: SignUpInput\n output: SignUpOutput\n }\n '/sign-in': {\n method: 'POST'\n input: SignInInput\n output: SignInOutput\n }\n '/reset-password-request': {\n method: 'POST'\n input: InitiatePasswordResetInput\n output: { success: true }\n }\n '/reset-password-confirm': {\n method: 'POST'\n input: ConfirmResetPasswordInput\n output: { success: true }\n }\n '/sign-out': {\n method: 'POST'\n input: SignOutInput\n output: { success: true }\n }\n /**\n * Lists all the accounts that are currently active, on the current device.\n */\n '/device-sessions': {\n method: 'GET'\n output: Session[]\n }\n /**\n * Lists all the active OAuth sessions (access/refresh tokens) that where\n * issued to OAuth clients (apps).\n *\n * @NOTE can be revoked using the oauth revocation endpoint (json or form\n * encoded)\n *\n * ```http\n * POST /oauth/revoke\n * Content-Type: application/x-www-form-urlencoded\n *\n * token=<tokenId>\n * ```\n */\n '/oauth-sessions': {\n method: 'GET'\n params: OAuthSessionsInput\n output: OAuthSessionsOutput\n }\n '/revoke-oauth-session': {\n method: 'POST'\n input: RevokeOAuthSessionInput\n output: { success: true }\n }\n /**\n * Lists all the sessions that are currently active for a particular user, on\n * other devices.\n */\n '/account-sessions': {\n method: 'GET'\n params: AccountSessionsInput\n output: AccountSessionsOutput\n }\n '/revoke-account-session': {\n method: 'POST'\n input: RevokeAccountSessionInput\n output: { success: true }\n }\n '/update-email-request': {\n method: 'POST'\n input: InitiateEmailUpdateInput\n output: InitiateEmailUpdateOutput\n }\n '/update-email-confirm': {\n method: 'POST'\n input: ConfirmEmailUpdateInput\n output: ConfirmEmailUpdateOutput\n }\n '/verify-email-request': {\n method: 'POST'\n input: InitiateEmailVerificationInput\n output: { success: true }\n }\n '/verify-email-confirm': {\n method: 'POST'\n input: ConfirmEmailVerificationInput\n output: ConfirmEmailVerificationOutput\n }\n '/enable-email-otp': {\n method: 'POST'\n input: EnableEmailAuthFactorInput\n output: EnableEmailAuthFactorOutput\n }\n '/disable-email-otp': {\n method: 'POST'\n input: DisableEmailAuthFactorInput\n output: DisableEmailAuthFactorOutput\n }\n '/update-handle': {\n method: 'POST'\n input: UpdateHandleInput\n output: UpdateHandleOutput\n }\n /**\n * Marks the account as deactivated. The account remains recoverable — the\n * user can sign back in to reactivate via {@link ApiEndpoints['/reactivate-account']}.\n * Profile, posts, feeds and lists are hidden across the network until then.\n */\n '/deactivate-account': {\n method: 'POST'\n input: DeactivateAccountInput\n output: DeactivateAccountOutput\n }\n /**\n * Reactivates a previously-deactivated account. No-op when the account is\n * already active.\n */\n '/reactivate-account': {\n method: 'POST'\n input: ReactivateAccountInput\n output: ReactivateAccountOutput\n }\n /**\n * Initiates account deletion by sending a confirmation code to the account's\n * email address. The account is NOT deleted until\n * {@link ApiEndpoints['/delete-account-confirm']} is called with the matching\n * token and the user's current password.\n */\n '/delete-account-request': {\n method: 'POST'\n input: InitiateAccountDeletionInput\n output: { success: true }\n }\n /**\n * Confirms and finalizes account deletion. Requires both the email\n * confirmation token issued by {@link ApiEndpoints['/delete-account-request']}\n * and the user's current password. Deletion is irreversible.\n */\n '/delete-account-confirm': {\n method: 'POST'\n input: ConfirmAccountDeletionInput\n output: { success: true }\n }\n '/consent': {\n method: 'POST'\n input: ConsentInput\n output: { url: string }\n }\n '/reject': {\n method: 'POST'\n input: RejectInput\n output: { url: string }\n }\n}\n\n/**\n * When a user signs in without the \"remember me\" option, the server returns an\n * ephemeral token. When used as `Bearer` authorization header, the token will\n * be used in order to authenticate the users in place of using the user's\n * cookie based session (which are only created when \"remember me\" is checked).\n *\n * Only include this token in the `Authorization` header when making requests to\n * the OAuth provider API, **FOR THE ACCOUNT IT WAS GENERATED FOR**.\n */\nexport type EphemeralToken = SignedJwt\n\nexport type SignInInput = {\n locale: string\n identifier: IdentifierString\n password: string\n emailOtp?: string\n remember?: boolean\n hcaptchaToken?: string\n}\n\nexport type SignInOutput = {\n account: Account\n ephemeralToken?: EphemeralToken\n}\n\nexport type SignUpInput = {\n locale: string\n handle: HandleString\n email: EmailString\n password: string\n remember?: boolean\n inviteCode?: string\n hcaptchaToken?: string\n}\n\nexport type SignUpOutput = {\n account: Account\n ephemeralToken?: EphemeralToken\n}\n\nexport type SignOutInput = {\n did: DidString\n}\n\nexport type InitiatePasswordResetInput = {\n locale: string\n identifier: IdentifierString\n hcaptchaToken?: string\n}\n\nexport type ConfirmResetPasswordInput = {\n token: string\n password: string\n hcaptchaToken?: string\n}\n\nexport type InitiateEmailUpdateInput = {\n did: DidString\n locale?: string\n}\n\nexport type InitiateEmailUpdateOutput = {\n tokenRequired: boolean\n}\n\nexport type ConfirmEmailUpdateInput = {\n did: DidString\n token?: string\n email: string\n locale?: string\n}\n\nexport type ConfirmEmailUpdateOutput = {\n account: Account\n}\n\nexport type InitiateEmailVerificationInput = {\n did: DidString\n locale?: string\n}\n\nexport type ConfirmEmailVerificationInput = {\n did: DidString\n token: string\n email: string\n}\n\nexport type ConfirmEmailVerificationOutput = {\n account: Account\n}\n\nexport type EnableEmailAuthFactorInput = {\n did: DidString\n locale?: string\n}\n\nexport type DisableEmailAuthFactorInput = {\n did: DidString\n token?: string\n locale?: string\n}\n\nexport type EnableEmailAuthFactorOutput = {\n account: Account\n}\n\nexport type DisableEmailAuthFactorOutput = {\n account: Account\n}\n\nexport type VerifyHandleAvailabilityInput = {\n handle: HandleString\n}\n\nexport type UpdateHandleInput = {\n did: DidString\n handle: HandleString\n}\n\nexport type UpdateHandleOutput = {\n account: Account\n}\n\nexport type DeactivateAccountInput = {\n did: DidString\n}\n\nexport type DeactivateAccountOutput = {\n account: Account\n}\n\nexport type ReactivateAccountInput = {\n did: DidString\n}\n\nexport type ReactivateAccountOutput = {\n account: Account\n}\n\nexport type InitiateAccountDeletionInput = {\n did: DidString\n locale?: string\n}\n\nexport type ConfirmAccountDeletionInput = {\n did: DidString\n token: string\n password: string\n}\n\nexport type RevokeAccountSessionInput = {\n did: DidString\n deviceId: string\n}\n\nexport type OAuthSessionsInput = {\n did: DidString\n}\n\nexport type OAuthSessionsOutput = ActiveOAuthSession[]\n\nexport type AccountSessionsInput = {\n did: DidString\n}\n\nexport type AccountSessionsOutput = ActiveAccountSession[]\n\nexport type RevokeOAuthSessionInput = {\n did: DidString\n tokenId: string\n}\n\nexport type ConsentInput = {\n did: DidString\n scope?: string\n}\n\nexport type RejectInput = Record<string, never>\n\n/**\n * Represents another device on which an account is currently signed-in.\n */\nexport type ActiveAccountSession = {\n deviceId: string\n deviceMetadata: DeviceMetadata\n\n isCurrentDevice: boolean\n}\n\n/**\n * Represents an active OAuth session (access token).\n */\nexport type ActiveOAuthSession = {\n tokenId: string\n\n createdAt: ISODatetimeString\n updatedAt: ISODatetimeString\n\n active: boolean\n\n clientId: string\n /** An \"undefined\" value means that the client metadata could not be fetched */\n clientMetadata?: OAuthClientMetadata\n\n scope?: string\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -1,11 +1,13 @@
1
- import type { DidString, HandleString, ISODatetimeString } from '@atproto/syntax';
1
+ import type { AtIdentifierString, DidString, HandleString, ISODatetimeString } from '@atproto/syntax';
2
+ export type EmailString = `${string}@${string}`;
3
+ export type IdentifierString = `${string}@${string}` | AtIdentifierString;
2
4
  export type { DidString };
3
5
  export type Account = {
4
6
  did: DidString;
5
7
  pds: DidString;
6
8
  deactivated: boolean;
7
9
  locale?: string;
8
- email?: string;
10
+ email?: EmailString;
9
11
  emailVerified?: boolean;
10
12
  emailAuthFactor?: boolean;
11
13
  name?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AAExB,YAAY,EAAE,SAAS,EAAE,CAAA;AAEzB,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,SAAS,CAAA;IACd,GAAG,EAAE,SAAS,CAAA;IACd,WAAW,EAAE,OAAO,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,KAAK,CAAA;IAEZ,aAAa,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;AAEhE,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,GAAG,eAAe,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,iBAAiB,CAAA;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AA;IACjB,UAAU,EAAE,iBAAiB,CAAA;CAC9B,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DidString,\n HandleString,\n ISODatetimeString,\n} from '@atproto/syntax'\n\nexport type { DidString }\n\nexport type Account = {\n did: DidString\n pds: DidString\n deactivated: boolean\n locale?: string\n email?: string\n emailVerified?: boolean\n emailAuthFactor?: boolean\n name?: string\n handle?: HandleString\n picture?: string\n}\n\n/**\n * Represents an account that is currently signed-in to the Authorization\n * Server. If the session was created too long ago, the user may be required to\n * re-authenticate ({@link Session.loginRequired}).\n */\nexport type Session = {\n account: Account\n info?: never // Prevent relying on this in the frontend\n\n loginRequired: boolean\n}\n\nexport type MultiLangString = Record<string, string | undefined>\n\nexport type LinkDefinition = {\n title: string | MultiLangString\n href: string\n rel?: string\n}\n\nexport type DeviceMetadata = {\n userAgent: string | null\n ipAddress: string\n lastSeenAt: ISODatetimeString\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AtIdentifierString,\n DidString,\n HandleString,\n ISODatetimeString,\n} from '@atproto/syntax'\n\nexport type EmailString = `${string}@${string}`\nexport type IdentifierString = `${string}@${string}` | AtIdentifierString\n\nexport type { DidString }\n\nexport type Account = {\n did: DidString\n pds: DidString\n deactivated: boolean\n locale?: string\n email?: EmailString\n emailVerified?: boolean\n emailAuthFactor?: boolean\n name?: string\n handle?: HandleString\n picture?: string\n}\n\n/**\n * Represents an account that is currently signed-in to the Authorization\n * Server. If the session was created too long ago, the user may be required to\n * re-authenticate ({@link Session.loginRequired}).\n */\nexport type Session = {\n account: Account\n info?: never // Prevent relying on this in the frontend\n\n loginRequired: boolean\n}\n\nexport type MultiLangString = Record<string, string | undefined>\n\nexport type LinkDefinition = {\n title: string | MultiLangString\n href: string\n rel?: string\n}\n\nexport type DeviceMetadata = {\n userAgent: string | null\n ipAddress: string\n lastSeenAt: ISODatetimeString\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/oauth-provider-api",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
4
4
  "license": "MIT",
5
5
  "description": "Shared data types for the @atproto/oauth-provider and @atproto/oauth-provider-ui packages",
6
6
  "keywords": [
@@ -31,8 +31,8 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@atproto/jwk": "^0.7.4",
34
- "@atproto/oauth-types": "^0.7.7",
35
- "@atproto/syntax": "^0.7.7"
34
+ "@atproto/oauth-types": "^0.8.0",
35
+ "@atproto/syntax": "^0.7.9"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsc --build tsconfig.build.json"