@atproto/pds 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1670,6 +1670,8 @@ export declare const schemaDict: {
1670
1670
  };
1671
1671
  reason: {
1672
1672
  type: string;
1673
+ maxGraphemes: number;
1674
+ maxLength: number;
1673
1675
  };
1674
1676
  subject: {
1675
1677
  type: string;
@@ -2756,6 +2758,9 @@ export declare const schemaDict: {
2756
2758
  emailConfirmed: {
2757
2759
  type: string;
2758
2760
  };
2761
+ didDoc: {
2762
+ type: string;
2763
+ };
2759
2764
  };
2760
2765
  };
2761
2766
  };
@@ -2914,6 +2919,18 @@ export declare const schemaDict: {
2914
2919
  main: {
2915
2920
  type: string;
2916
2921
  description: string;
2922
+ input: {
2923
+ encoding: string;
2924
+ schema: {
2925
+ type: string;
2926
+ properties: {
2927
+ did: {
2928
+ type: string;
2929
+ description: string;
2930
+ };
2931
+ };
2932
+ };
2933
+ };
2917
2934
  output: {
2918
2935
  encoding: string;
2919
2936
  schema: {
@@ -3,13 +3,13 @@ import { HandlerAuth } from '@atproto/xrpc-server';
3
3
  export interface QueryParams {
4
4
  }
5
5
  export interface InputSchema {
6
- email: string;
6
+ email?: string;
7
7
  handle: string;
8
8
  did?: string;
9
9
  inviteCode?: string;
10
- password: string;
10
+ password?: string;
11
11
  recoveryKey?: string;
12
- plcOp?: Uint8Array;
12
+ plcOp?: {};
13
13
  [k: string]: unknown;
14
14
  }
15
15
  export interface OutputSchema {
@@ -8,6 +8,7 @@ export interface OutputSchema {
8
8
  did: string;
9
9
  email?: string;
10
10
  emailConfirmed?: boolean;
11
+ didDoc?: {};
11
12
  [k: string]: unknown;
12
13
  }
13
14
  export declare type HandlerInput = undefined;
@@ -2,12 +2,18 @@ import express from 'express';
2
2
  import { HandlerAuth } from '@atproto/xrpc-server';
3
3
  export interface QueryParams {
4
4
  }
5
- export declare type InputSchema = undefined;
5
+ export interface InputSchema {
6
+ did?: string;
7
+ [k: string]: unknown;
8
+ }
6
9
  export interface OutputSchema {
7
10
  signingKey: string;
8
11
  [k: string]: unknown;
9
12
  }
10
- export declare type HandlerInput = undefined;
13
+ export interface HandlerInput {
14
+ encoding: 'application/json';
15
+ body: InputSchema;
16
+ }
11
17
  export interface HandlerSuccess {
12
18
  encoding: 'application/json';
13
19
  body: OutputSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of atproto Personal Data Server (PDS)",
6
6
  "keywords": [
@@ -43,16 +43,16 @@
43
43
  "typed-emitter": "^2.1.0",
44
44
  "uint8arrays": "3.0.0",
45
45
  "zod": "^3.21.4",
46
- "@atproto/api": "^0.6.21",
47
- "@atproto/aws": "^0.1.3",
48
- "@atproto/common": "^0.3.2",
49
- "@atproto/crypto": "^0.2.2",
50
- "@atproto/identity": "^0.3.0",
51
- "@atproto/lexicon": "^0.2.3",
52
- "@atproto/repo": "^0.3.3",
53
- "@atproto/syntax": "^0.1.3",
54
- "@atproto/xrpc": "^0.3.3",
55
- "@atproto/xrpc-server": "^0.3.3"
46
+ "@atproto/api": "^0.6.23",
47
+ "@atproto/aws": "^0.1.4",
48
+ "@atproto/common": "^0.3.3",
49
+ "@atproto/crypto": "^0.2.3",
50
+ "@atproto/identity": "^0.3.1",
51
+ "@atproto/lexicon": "^0.3.0",
52
+ "@atproto/repo": "^0.3.4",
53
+ "@atproto/syntax": "^0.1.4",
54
+ "@atproto/xrpc": "^0.4.0",
55
+ "@atproto/xrpc-server": "^0.4.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@did-plc/server": "^0.0.1",
@@ -67,10 +67,10 @@
67
67
  "@types/sharp": "^0.31.0",
68
68
  "axios": "^0.27.2",
69
69
  "ws": "^8.12.0",
70
- "@atproto/api": "^0.6.21",
71
- "@atproto/bsky": "^0.0.12",
72
- "@atproto/dev-env": "^0.2.12",
73
- "@atproto/lex-cli": "^0.2.3"
70
+ "@atproto/api": "^0.6.23",
71
+ "@atproto/bsky": "^0.0.14",
72
+ "@atproto/dev-env": "^0.2.14",
73
+ "@atproto/lex-cli": "^0.2.4"
74
74
  },
75
75
  "scripts": {
76
76
  "codegen": "lex gen-server ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
@@ -21,7 +21,11 @@ export default function (server: Server, ctx: AppContext) {
21
21
  },
22
22
  handler: async ({ input, req }) => {
23
23
  const { email, password, inviteCode } = input.body
24
- if (input.body.plcOp) {
24
+ if (!email) {
25
+ throw new InvalidRequestError('Missing input: "email"')
26
+ } else if (!password) {
27
+ throw new InvalidRequestError('Missing input: "password"')
28
+ } else if (input.body.plcOp) {
25
29
  throw new InvalidRequestError('Unsupported input: "plcOp"')
26
30
  }
27
31
 
@@ -1,13 +1,17 @@
1
1
  import { InvalidRequestError } from '@atproto/xrpc-server'
2
2
  import AppContext from '../../../../context'
3
3
  import { Server } from '../../../../lexicon'
4
+ import { didDocForSession } from './util'
4
5
 
5
6
  export default function (server: Server, ctx: AppContext) {
6
7
  server.com.atproto.server.getSession({
7
8
  auth: ctx.authVerifier.access,
8
9
  handler: async ({ auth }) => {
9
10
  const did = auth.credentials.did
10
- const user = await ctx.services.account(ctx.db).getAccount(did)
11
+ const [user, didDoc] = await Promise.all([
12
+ ctx.services.account(ctx.db).getAccount(did),
13
+ didDocForSession(ctx, did),
14
+ ])
11
15
  if (!user) {
12
16
  throw new InvalidRequestError(
13
17
  `Could not find user info for account: ${did}`,
@@ -18,6 +22,7 @@ export default function (server: Server, ctx: AppContext) {
18
22
  body: {
19
23
  handle: user.handle,
20
24
  did: user.did,
25
+ didDoc,
21
26
  email: user.email,
22
27
  emailConfirmed: !!user.emailConfirmedAt,
23
28
  },
@@ -1826,6 +1826,8 @@ export const schemaDict = {
1826
1826
  },
1827
1827
  reason: {
1828
1828
  type: 'string',
1829
+ maxGraphemes: 2000,
1830
+ maxLength: 20000,
1829
1831
  },
1830
1832
  subject: {
1831
1833
  type: 'union',
@@ -2487,7 +2489,7 @@ export const schemaDict = {
2487
2489
  encoding: 'application/json',
2488
2490
  schema: {
2489
2491
  type: 'object',
2490
- required: ['handle', 'email', 'password'],
2492
+ required: ['handle'],
2491
2493
  properties: {
2492
2494
  email: {
2493
2495
  type: 'string',
@@ -2510,7 +2512,7 @@ export const schemaDict = {
2510
2512
  type: 'string',
2511
2513
  },
2512
2514
  plcOp: {
2513
- type: 'bytes',
2515
+ type: 'unknown',
2514
2516
  },
2515
2517
  },
2516
2518
  },
@@ -3005,6 +3007,9 @@ export const schemaDict = {
3005
3007
  emailConfirmed: {
3006
3008
  type: 'boolean',
3007
3009
  },
3010
+ didDoc: {
3011
+ type: 'unknown',
3012
+ },
3008
3013
  },
3009
3014
  },
3010
3015
  },
@@ -3168,6 +3173,18 @@ export const schemaDict = {
3168
3173
  main: {
3169
3174
  type: 'procedure',
3170
3175
  description: 'Reserve a repo signing key for account creation.',
3176
+ input: {
3177
+ encoding: 'application/json',
3178
+ schema: {
3179
+ type: 'object',
3180
+ properties: {
3181
+ did: {
3182
+ type: 'string',
3183
+ description: 'The did to reserve a new did:key for',
3184
+ },
3185
+ },
3186
+ },
3187
+ },
3171
3188
  output: {
3172
3189
  encoding: 'application/json',
3173
3190
  schema: {
@@ -11,13 +11,13 @@ import { HandlerAuth } from '@atproto/xrpc-server'
11
11
  export interface QueryParams {}
12
12
 
13
13
  export interface InputSchema {
14
- email: string
14
+ email?: string
15
15
  handle: string
16
16
  did?: string
17
17
  inviteCode?: string
18
- password: string
18
+ password?: string
19
19
  recoveryKey?: string
20
- plcOp?: Uint8Array
20
+ plcOp?: {}
21
21
  [k: string]: unknown
22
22
  }
23
23
 
@@ -17,6 +17,7 @@ export interface OutputSchema {
17
17
  did: string
18
18
  email?: string
19
19
  emailConfirmed?: boolean
20
+ didDoc?: {}
20
21
  [k: string]: unknown
21
22
  }
22
23
 
@@ -10,7 +10,11 @@ import { HandlerAuth } from '@atproto/xrpc-server'
10
10
 
11
11
  export interface QueryParams {}
12
12
 
13
- export type InputSchema = undefined
13
+ export interface InputSchema {
14
+ /** The did to reserve a new did:key for */
15
+ did?: string
16
+ [k: string]: unknown
17
+ }
14
18
 
15
19
  export interface OutputSchema {
16
20
  /** Public signing key in the form of a did:key. */
@@ -18,7 +22,10 @@ export interface OutputSchema {
18
22
  [k: string]: unknown
19
23
  }
20
24
 
21
- export type HandlerInput = undefined
25
+ export interface HandlerInput {
26
+ encoding: 'application/json'
27
+ body: InputSchema
28
+ }
22
29
 
23
30
  export interface HandlerSuccess {
24
31
  encoding: 'application/json'
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022-2023 Bluesky PBC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.