@atproto/pds 0.4.195 → 0.4.197
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 +28 -0
- package/dist/account-manager/db/schema/lexicon.d.ts +2 -2
- package/dist/account-manager/db/schema/lexicon.d.ts.map +1 -1
- package/dist/account-manager/db/schema/lexicon.js.map +1 -1
- package/dist/api/com/atproto/admin/getInviteCodes.d.ts +1 -1
- package/dist/api/com/atproto/sync/listRepos.d.ts +1 -1
- package/dist/config/config.d.ts +1 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +6 -3
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +100 -101
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +6 -5
- package/dist/config/env.js.map +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +23 -39
- package/dist/context.js.map +1 -1
- package/dist/db/pagination.d.ts +1 -1
- package/dist/handle/index.d.ts +1 -1
- package/dist/handle/index.d.ts.map +1 -1
- package/dist/lexicon/lexicons.d.ts +4 -4
- package/dist/lexicon/lexicons.js +8 -8
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/defs.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/team/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/defs.js.map +1 -1
- package/package.json +12 -13
- package/src/account-manager/db/schema/lexicon.ts +2 -2
- package/src/config/config.ts +7 -3
- package/src/config/env.ts +6 -150
- package/src/context.ts +39 -47
- package/src/lexicon/lexicons.ts +8 -8
- package/src/lexicon/types/tools/ozone/moderation/defs.ts +4 -4
- package/src/lexicon/types/tools/ozone/team/defs.ts +4 -4
package/src/config/env.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { envBool, envInt, envList, envStr } from '@atproto/common'
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function readEnv() {
|
|
4
4
|
return {
|
|
5
5
|
// service
|
|
6
6
|
port: envInt('PDS_PORT'),
|
|
@@ -73,7 +73,7 @@ export const readEnv = (): ServerEnvironment => {
|
|
|
73
73
|
didCacheMaxTTL: envInt('PDS_DID_CACHE_MAX_TTL'),
|
|
74
74
|
resolverTimeout: envInt('PDS_ID_RESOLVER_TIMEOUT'),
|
|
75
75
|
recoveryDidKey: envStr('PDS_RECOVERY_DID_KEY'),
|
|
76
|
-
serviceHandleDomains: envList('PDS_SERVICE_HANDLE_DOMAINS'),
|
|
76
|
+
serviceHandleDomains: envList('PDS_SERVICE_HANDLE_DOMAINS'), // public hostname by default
|
|
77
77
|
handleBackupNameservers: envList('PDS_HANDLE_BACKUP_NAMESERVERS'),
|
|
78
78
|
enableDidDocWithSession: envBool('PDS_ENABLE_DID_DOC_WITH_SESSION'),
|
|
79
79
|
|
|
@@ -151,154 +151,10 @@ export const readEnv = (): ServerEnvironment => {
|
|
|
151
151
|
proxyMaxResponseSize: envInt('PDS_PROXY_MAX_RESPONSE_SIZE'),
|
|
152
152
|
proxyMaxRetries: envInt('PDS_PROXY_MAX_RETRIES'),
|
|
153
153
|
proxyPreferCompressed: envBool('PDS_PROXY_PREFER_COMPRESSED'),
|
|
154
|
+
|
|
155
|
+
// lexicon resolution
|
|
156
|
+
lexiconDidAuthority: envStr('PDS_LEXICON_AUTHORITY_DID'),
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
159
|
|
|
157
|
-
export type ServerEnvironment =
|
|
158
|
-
// service
|
|
159
|
-
port?: number
|
|
160
|
-
hostname?: string
|
|
161
|
-
serviceDid?: string
|
|
162
|
-
serviceName?: string
|
|
163
|
-
version?: string
|
|
164
|
-
homeUrl?: string
|
|
165
|
-
logoUrl?: string
|
|
166
|
-
privacyPolicyUrl?: string
|
|
167
|
-
supportUrl?: string
|
|
168
|
-
termsOfServiceUrl?: string
|
|
169
|
-
contactEmailAddress?: string
|
|
170
|
-
acceptingImports?: boolean
|
|
171
|
-
maxImportSize?: number
|
|
172
|
-
blobUploadLimit?: number
|
|
173
|
-
devMode?: boolean
|
|
174
|
-
|
|
175
|
-
// OAuth
|
|
176
|
-
hcaptchaSiteKey?: string
|
|
177
|
-
hcaptchaSecretKey?: string
|
|
178
|
-
hcaptchaTokenSalt?: string
|
|
179
|
-
trustedOAuthClients?: string[]
|
|
180
|
-
|
|
181
|
-
// branding
|
|
182
|
-
lightColor?: string
|
|
183
|
-
darkColor?: string
|
|
184
|
-
primaryColor?: string
|
|
185
|
-
primaryColorContrast?: string
|
|
186
|
-
primaryColorHue?: number
|
|
187
|
-
errorColor?: string
|
|
188
|
-
errorColorContrast?: string
|
|
189
|
-
errorColorHue?: number
|
|
190
|
-
warningColor?: string
|
|
191
|
-
warningColorContrast?: string
|
|
192
|
-
warningColorHue?: number
|
|
193
|
-
successColor?: string
|
|
194
|
-
successColorContrast?: string
|
|
195
|
-
successColorHue?: number
|
|
196
|
-
|
|
197
|
-
// database
|
|
198
|
-
dataDirectory?: string
|
|
199
|
-
disableWalAutoCheckpoint?: boolean
|
|
200
|
-
accountDbLocation?: string
|
|
201
|
-
sequencerDbLocation?: string
|
|
202
|
-
didCacheDbLocation?: string
|
|
203
|
-
|
|
204
|
-
// actor store
|
|
205
|
-
actorStoreDirectory?: string
|
|
206
|
-
actorStoreCacheSize?: number
|
|
207
|
-
|
|
208
|
-
// blobstore: one required
|
|
209
|
-
blobstoreS3Bucket?: string
|
|
210
|
-
blobstoreDiskLocation?: string
|
|
211
|
-
blobstoreDiskTmpLocation?: string
|
|
212
|
-
|
|
213
|
-
// -- optional s3 parameters
|
|
214
|
-
blobstoreS3Region?: string
|
|
215
|
-
blobstoreS3Endpoint?: string
|
|
216
|
-
blobstoreS3ForcePathStyle?: boolean
|
|
217
|
-
blobstoreS3AccessKeyId?: string
|
|
218
|
-
blobstoreS3SecretAccessKey?: string
|
|
219
|
-
blobstoreS3UploadTimeoutMs?: number
|
|
220
|
-
|
|
221
|
-
// identity
|
|
222
|
-
didPlcUrl?: string
|
|
223
|
-
didCacheStaleTTL?: number
|
|
224
|
-
didCacheMaxTTL?: number
|
|
225
|
-
resolverTimeout?: number
|
|
226
|
-
recoveryDidKey?: string
|
|
227
|
-
serviceHandleDomains?: string[] // public hostname by default
|
|
228
|
-
handleBackupNameservers?: string[]
|
|
229
|
-
enableDidDocWithSession?: boolean
|
|
230
|
-
|
|
231
|
-
// entryway
|
|
232
|
-
entrywayUrl?: string
|
|
233
|
-
entrywayDid?: string
|
|
234
|
-
entrywayJwtVerifyKeyK256PublicKeyHex?: string
|
|
235
|
-
entrywayPlcRotationKey?: string
|
|
236
|
-
|
|
237
|
-
// invites
|
|
238
|
-
inviteRequired?: boolean
|
|
239
|
-
inviteInterval?: number
|
|
240
|
-
inviteEpoch?: number
|
|
241
|
-
|
|
242
|
-
// email
|
|
243
|
-
emailSmtpUrl?: string
|
|
244
|
-
emailFromAddress?: string
|
|
245
|
-
moderationEmailSmtpUrl?: string
|
|
246
|
-
moderationEmailAddress?: string
|
|
247
|
-
|
|
248
|
-
// subscription
|
|
249
|
-
maxSubscriptionBuffer?: number
|
|
250
|
-
repoBackfillLimitMs?: number
|
|
251
|
-
|
|
252
|
-
// appview
|
|
253
|
-
bskyAppViewUrl?: string
|
|
254
|
-
bskyAppViewDid?: string
|
|
255
|
-
bskyAppViewCdnUrlPattern?: string
|
|
256
|
-
|
|
257
|
-
// mod service
|
|
258
|
-
modServiceUrl?: string
|
|
259
|
-
modServiceDid?: string
|
|
260
|
-
|
|
261
|
-
// report service
|
|
262
|
-
reportServiceUrl?: string
|
|
263
|
-
reportServiceDid?: string
|
|
264
|
-
|
|
265
|
-
// rate limits
|
|
266
|
-
rateLimitsEnabled?: boolean
|
|
267
|
-
rateLimitBypassKey?: string
|
|
268
|
-
rateLimitBypassIps?: string[]
|
|
269
|
-
|
|
270
|
-
// redis
|
|
271
|
-
redisScratchAddress?: string
|
|
272
|
-
redisScratchPassword?: string
|
|
273
|
-
|
|
274
|
-
// crawler
|
|
275
|
-
crawlers?: string[]
|
|
276
|
-
|
|
277
|
-
// secrets
|
|
278
|
-
dpopSecret?: string
|
|
279
|
-
jwtSecret?: string
|
|
280
|
-
adminPassword?: string
|
|
281
|
-
entrywayAdminToken?: string
|
|
282
|
-
|
|
283
|
-
// keys
|
|
284
|
-
plcRotationKeyKmsKeyId?: string
|
|
285
|
-
plcRotationKeyK256PrivateKeyHex?: string
|
|
286
|
-
|
|
287
|
-
// user provided url http requests
|
|
288
|
-
disableSsrfProtection?: boolean
|
|
289
|
-
|
|
290
|
-
// fetch
|
|
291
|
-
fetchForceLogging?: boolean
|
|
292
|
-
fetchMaxResponseSize?: number
|
|
293
|
-
|
|
294
|
-
// lexicon resolver
|
|
295
|
-
lexiconDidAuthority?: string
|
|
296
|
-
|
|
297
|
-
// proxy
|
|
298
|
-
proxyAllowHTTP2?: boolean
|
|
299
|
-
proxyHeadersTimeout?: number
|
|
300
|
-
proxyBodyTimeout?: number
|
|
301
|
-
proxyMaxResponseSize?: number
|
|
302
|
-
proxyMaxRetries?: number
|
|
303
|
-
proxyPreferCompressed?: boolean
|
|
304
|
-
}
|
|
160
|
+
export type ServerEnvironment = Partial<ReturnType<typeof readEnv>>
|
package/src/context.ts
CHANGED
|
@@ -9,13 +9,10 @@ import { AtpAgent } from '@atproto/api'
|
|
|
9
9
|
import { KmsKeypair, S3BlobStore } from '@atproto/aws'
|
|
10
10
|
import * as crypto from '@atproto/crypto'
|
|
11
11
|
import { IdResolver } from '@atproto/identity'
|
|
12
|
-
import {
|
|
13
|
-
LexiconResolver,
|
|
14
|
-
buildLexiconResolver,
|
|
15
|
-
} from '@atproto/lexicon-resolver'
|
|
16
12
|
import {
|
|
17
13
|
AccessTokenMode,
|
|
18
14
|
JoseKey,
|
|
15
|
+
LexResolver,
|
|
19
16
|
OAuthProvider,
|
|
20
17
|
OAuthVerifier,
|
|
21
18
|
} from '@atproto/oauth-provider'
|
|
@@ -328,48 +325,6 @@ export class AppContext {
|
|
|
328
325
|
},
|
|
329
326
|
})
|
|
330
327
|
|
|
331
|
-
const baseLexiconResolver = buildLexiconResolver({
|
|
332
|
-
idResolver,
|
|
333
|
-
rpc: { fetch: safeFetch },
|
|
334
|
-
})
|
|
335
|
-
|
|
336
|
-
const getLexiconAuthority = (_nsid: string): string | undefined => {
|
|
337
|
-
// At the moment, only a single override strategy is supported by
|
|
338
|
-
// specifying a did through which all the lexicons will be resolved. We
|
|
339
|
-
// might need more granular control in the future (e.g. per-nsid
|
|
340
|
-
// overrides)
|
|
341
|
-
return cfg.lexicon.didAuthority
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
const lexiconResolver: LexiconResolver = async (input) => {
|
|
345
|
-
const nsid: string = String(input)
|
|
346
|
-
try {
|
|
347
|
-
const result = await baseLexiconResolver(input, {
|
|
348
|
-
didAuthority: getLexiconAuthority(nsid),
|
|
349
|
-
// Right now, the lexicon resolver is only used by the oauth-provider,
|
|
350
|
-
// which caches the responses internally (through the LexiconStore).
|
|
351
|
-
// Since the `LexiconResolver` does not allow specifying a
|
|
352
|
-
// `forceRefresh` option, we hard code it here. Should PDSs need to
|
|
353
|
-
// resolve lexicons for other purposes (e.g. record validation), we'd
|
|
354
|
-
// probably want to either implement caching as built into the
|
|
355
|
-
// lexiconResolver here, or allow the caller (oauth-provider, etc.) to
|
|
356
|
-
// specify a `forceRefresh` option by altering the LexiconResolver
|
|
357
|
-
// interface.
|
|
358
|
-
forceRefresh: true,
|
|
359
|
-
})
|
|
360
|
-
|
|
361
|
-
const cid = result.cid.toString()
|
|
362
|
-
const uri = result.uri.toString()
|
|
363
|
-
lexiconResolverLogger.info({ nsid, uri, cid }, 'Resolved lexicon')
|
|
364
|
-
|
|
365
|
-
return result
|
|
366
|
-
} catch (err) {
|
|
367
|
-
lexiconResolverLogger.error({ nsid, err }, 'Lexicon resolution failed')
|
|
368
|
-
|
|
369
|
-
throw err
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
328
|
const oauthProvider = cfg.oauth.provider
|
|
374
329
|
? new OAuthProvider({
|
|
375
330
|
issuer: cfg.oauth.issuer,
|
|
@@ -393,7 +348,44 @@ export class AppContext {
|
|
|
393
348
|
hcaptcha: cfg.oauth.provider.hcaptcha,
|
|
394
349
|
branding: cfg.oauth.provider.branding,
|
|
395
350
|
safeFetch,
|
|
396
|
-
|
|
351
|
+
lexResolver: new LexResolver({
|
|
352
|
+
fetch: safeFetch,
|
|
353
|
+
plcDirectoryUrl: cfg.identity.plcUrl,
|
|
354
|
+
hooks: {
|
|
355
|
+
onResolveAuthority: ({ nsid }) => {
|
|
356
|
+
lexiconResolverLogger.debug(
|
|
357
|
+
{ nsid: nsid.toString() },
|
|
358
|
+
'Resolving lexicon DID authority',
|
|
359
|
+
)
|
|
360
|
+
// Override the lexicon did resolution to point to a custom PDS
|
|
361
|
+
return cfg.lexicon.didAuthority
|
|
362
|
+
},
|
|
363
|
+
onResolveAuthorityResult({ nsid, did }) {
|
|
364
|
+
lexiconResolverLogger.info(
|
|
365
|
+
{ nsid: nsid.toString(), did },
|
|
366
|
+
'Resolved lexicon DID',
|
|
367
|
+
)
|
|
368
|
+
},
|
|
369
|
+
onResolveAuthorityError({ nsid, err }) {
|
|
370
|
+
lexiconResolverLogger.error(
|
|
371
|
+
{ nsid: nsid.toString(), err },
|
|
372
|
+
'Lexicon DID resolution error',
|
|
373
|
+
)
|
|
374
|
+
},
|
|
375
|
+
onFetchResult({ uri, cid }) {
|
|
376
|
+
lexiconResolverLogger.info(
|
|
377
|
+
{ uri: uri.toString(), cid: cid.toString() },
|
|
378
|
+
'Fetched lexicon',
|
|
379
|
+
)
|
|
380
|
+
},
|
|
381
|
+
onFetchError({ err, uri }) {
|
|
382
|
+
lexiconResolverLogger.error(
|
|
383
|
+
{ uri: uri.toString(), err },
|
|
384
|
+
'Lexicon fetch error',
|
|
385
|
+
)
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
}),
|
|
397
389
|
metadata: {
|
|
398
390
|
protected_resources: [new URL(cfg.oauth.issuer).origin],
|
|
399
391
|
},
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -15220,10 +15220,10 @@ export const schemaDict = {
|
|
|
15220
15220
|
subjectReviewState: {
|
|
15221
15221
|
type: 'string',
|
|
15222
15222
|
knownValues: [
|
|
15223
|
-
'
|
|
15224
|
-
'
|
|
15225
|
-
'
|
|
15226
|
-
'
|
|
15223
|
+
'tools.ozone.moderation.defs#reviewOpen',
|
|
15224
|
+
'tools.ozone.moderation.defs#reviewEscalated',
|
|
15225
|
+
'tools.ozone.moderation.defs#reviewClosed',
|
|
15226
|
+
'tools.ozone.moderation.defs#reviewNone',
|
|
15227
15227
|
],
|
|
15228
15228
|
},
|
|
15229
15229
|
reviewOpen: {
|
|
@@ -19008,10 +19008,10 @@ export const schemaDict = {
|
|
|
19008
19008
|
role: {
|
|
19009
19009
|
type: 'string',
|
|
19010
19010
|
knownValues: [
|
|
19011
|
-
'
|
|
19012
|
-
'
|
|
19013
|
-
'
|
|
19014
|
-
'
|
|
19011
|
+
'tools.ozone.team.defs#roleAdmin',
|
|
19012
|
+
'tools.ozone.team.defs#roleModerator',
|
|
19013
|
+
'tools.ozone.team.defs#roleTriage',
|
|
19014
|
+
'tools.ozone.team.defs#roleVerifier',
|
|
19015
19015
|
],
|
|
19016
19016
|
},
|
|
19017
19017
|
},
|
|
@@ -282,10 +282,10 @@ export function validateAccountStrike<V>(v: V) {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
export type SubjectReviewState =
|
|
285
|
-
| '
|
|
286
|
-
| '
|
|
287
|
-
| '
|
|
288
|
-
| '
|
|
285
|
+
| 'tools.ozone.moderation.defs#reviewOpen'
|
|
286
|
+
| 'tools.ozone.moderation.defs#reviewEscalated'
|
|
287
|
+
| 'tools.ozone.moderation.defs#reviewClosed'
|
|
288
|
+
| 'tools.ozone.moderation.defs#reviewNone'
|
|
289
289
|
| (string & {})
|
|
290
290
|
|
|
291
291
|
/** Moderator review status of a subject: Open. Indicates that the subject needs to be reviewed by a moderator */
|
|
@@ -24,10 +24,10 @@ export interface Member {
|
|
|
24
24
|
updatedAt?: string
|
|
25
25
|
lastUpdatedBy?: string
|
|
26
26
|
role:
|
|
27
|
-
| '
|
|
28
|
-
| '
|
|
29
|
-
| '
|
|
30
|
-
| '
|
|
27
|
+
| 'tools.ozone.team.defs#roleAdmin'
|
|
28
|
+
| 'tools.ozone.team.defs#roleModerator'
|
|
29
|
+
| 'tools.ozone.team.defs#roleTriage'
|
|
30
|
+
| 'tools.ozone.team.defs#roleVerifier'
|
|
31
31
|
| (string & {})
|
|
32
32
|
}
|
|
33
33
|
|