@atproto/pds 0.4.45 → 0.4.46
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -0
- package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.js +6 -2
- package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.js +2 -1
- package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
- package/dist/api/app/bsky/notification/registerPush.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/registerPush.js +2 -1
- package/dist/api/app/bsky/notification/registerPush.js.map +1 -1
- package/dist/api/com/atproto/admin/sendEmail.d.ts.map +1 -1
- package/dist/api/com/atproto/admin/sendEmail.js +2 -1
- package/dist/api/com/atproto/admin/sendEmail.js.map +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.js +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.js.map +1 -1
- package/dist/api/com/atproto/server/createAccount.js +2 -2
- package/dist/api/com/atproto/server/createAccount.js.map +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.js +13 -0
- package/dist/api/com/atproto/server/getServiceAuth.js.map +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +0 -2
- package/dist/api/index.js.map +1 -1
- package/dist/auth-verifier.d.ts +7 -5
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +25 -6
- package/dist/auth-verifier.js.map +1 -1
- package/dist/context.d.ts +2 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +4 -3
- package/dist/context.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +13 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +17 -2
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/label/defs.d.ts +1 -1
- package/dist/lexicon/types/com/atproto/server/getServiceAuth.d.ts +5 -0
- package/dist/lexicon/types/com/atproto/server/getServiceAuth.d.ts.map +1 -1
- package/dist/pipethrough.d.ts +11 -2
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/pipethrough.js +41 -14
- package/dist/pipethrough.js.map +1 -1
- package/dist/read-after-write/viewer.d.ts +1 -1
- package/dist/read-after-write/viewer.d.ts.map +1 -1
- package/dist/read-after-write/viewer.js +5 -4
- package/dist/read-after-write/viewer.js.map +1 -1
- package/package.json +5 -5
- package/src/api/app/bsky/feed/getFeed.ts +9 -2
- package/src/api/app/bsky/feed/getPostThread.ts +2 -1
- package/src/api/app/bsky/notification/registerPush.ts +6 -1
- package/src/api/com/atproto/admin/sendEmail.ts +3 -1
- package/src/api/com/atproto/repo/uploadBlob.ts +1 -1
- package/src/api/com/atproto/server/createAccount.ts +2 -2
- package/src/api/com/atproto/server/getServiceAuth.ts +20 -1
- package/src/api/index.ts +0 -2
- package/src/auth-verifier.ts +32 -10
- package/src/context.ts +4 -3
- package/src/lexicon/lexicons.ts +20 -2
- package/src/lexicon/types/app/bsky/feed/defs.ts +1 -1
- package/src/lexicon/types/com/atproto/label/defs.ts +1 -1
- package/src/lexicon/types/com/atproto/server/getServiceAuth.ts +5 -0
- package/src/pipethrough.ts +49 -15
- package/src/read-after-write/viewer.ts +8 -4
- package/tests/moderator-auth.test.ts +4 -0
- package/tests/proxied/notif.test.ts +1 -0
- package/tests/proxied/proxy-header.test.ts +1 -0
- package/dist/api/chat/index.d.ts +0 -4
- package/dist/api/chat/index.d.ts.map +0 -1
- package/dist/api/chat/index.js +0 -91
- package/dist/api/chat/index.js.map +0 -1
- package/src/api/chat/index.ts +0 -90
package/src/auth-verifier.ts
CHANGED
@@ -71,6 +71,7 @@ type AccessOutput = {
|
|
71
71
|
did: string
|
72
72
|
scope: AuthScope
|
73
73
|
audience: string | undefined
|
74
|
+
isPrivileged: boolean
|
74
75
|
}
|
75
76
|
artifacts: string
|
76
77
|
}
|
@@ -86,11 +87,11 @@ type RefreshOutput = {
|
|
86
87
|
artifacts: string
|
87
88
|
}
|
88
89
|
|
89
|
-
type
|
90
|
+
type UserServiceAuthOutput = {
|
90
91
|
credentials: {
|
91
|
-
type: '
|
92
|
+
type: 'user_service_auth'
|
92
93
|
aud: string
|
93
|
-
|
94
|
+
did: string
|
94
95
|
}
|
95
96
|
}
|
96
97
|
|
@@ -221,30 +222,40 @@ export class AuthVerifier {
|
|
221
222
|
}
|
222
223
|
}
|
223
224
|
|
224
|
-
|
225
|
+
userServiceAuth = async (ctx: ReqCtx): Promise<UserServiceAuthOutput> => {
|
225
226
|
const payload = await this.verifyServiceJwt(ctx, {
|
226
227
|
aud: this.dids.entryway ?? this.dids.pds,
|
227
228
|
iss: null,
|
228
229
|
})
|
229
230
|
return {
|
230
231
|
credentials: {
|
231
|
-
type: '
|
232
|
+
type: 'user_service_auth',
|
232
233
|
aud: payload.aud,
|
233
|
-
|
234
|
+
did: payload.iss,
|
234
235
|
},
|
235
236
|
}
|
236
237
|
}
|
237
238
|
|
238
|
-
|
239
|
+
userServiceAuthOptional = async (
|
239
240
|
ctx: ReqCtx,
|
240
|
-
): Promise<
|
241
|
+
): Promise<UserServiceAuthOutput | NullOutput> => {
|
241
242
|
if (isBearerToken(ctx.req)) {
|
242
|
-
return await this.
|
243
|
+
return await this.userServiceAuth(ctx)
|
243
244
|
} else {
|
244
245
|
return this.null(ctx)
|
245
246
|
}
|
246
247
|
}
|
247
248
|
|
249
|
+
accessOrUserServiceAuth =
|
250
|
+
(opts: Partial<AccessOpts> = {}) =>
|
251
|
+
async (ctx: ReqCtx): Promise<UserServiceAuthOutput | AccessOutput> => {
|
252
|
+
try {
|
253
|
+
return await this.accessStandard(opts)(ctx)
|
254
|
+
} catch {
|
255
|
+
return await this.userServiceAuth(ctx)
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
248
259
|
modService = async (ctx: ReqCtx): Promise<ModServiceOutput> => {
|
249
260
|
if (!this.dids.modService) {
|
250
261
|
throw new AuthRequiredError('Untrusted issuer', 'UntrustedIss')
|
@@ -470,6 +481,7 @@ export class AuthVerifier {
|
|
470
481
|
did: result.claims.sub,
|
471
482
|
scope: AuthScope.Access,
|
472
483
|
audience: this.dids.pds,
|
484
|
+
isPrivileged: true,
|
473
485
|
},
|
474
486
|
artifacts: result.token,
|
475
487
|
}
|
@@ -498,12 +510,17 @@ export class AuthVerifier {
|
|
498
510
|
scopes,
|
499
511
|
{ audience: this.dids.pds },
|
500
512
|
)
|
513
|
+
const isPrivileged = [
|
514
|
+
AuthScope.Access,
|
515
|
+
AuthScope.AppPassPrivileged,
|
516
|
+
].includes(scope)
|
501
517
|
return {
|
502
518
|
credentials: {
|
503
519
|
type: 'access',
|
504
520
|
did,
|
505
521
|
scope,
|
506
522
|
audience,
|
523
|
+
isPrivileged,
|
507
524
|
},
|
508
525
|
artifacts: token,
|
509
526
|
}
|
@@ -544,7 +561,12 @@ export class AuthVerifier {
|
|
544
561
|
if (!jwtStr) {
|
545
562
|
throw new AuthRequiredError('missing jwt', 'MissingJwt')
|
546
563
|
}
|
547
|
-
const payload = await verifyServiceJwt(
|
564
|
+
const payload = await verifyServiceJwt(
|
565
|
+
jwtStr,
|
566
|
+
opts.aud,
|
567
|
+
null,
|
568
|
+
getSigningKey,
|
569
|
+
)
|
548
570
|
return { iss: payload.iss, aud: payload.aud }
|
549
571
|
}
|
550
572
|
|
package/src/context.ts
CHANGED
@@ -342,16 +342,17 @@ export class AppContext {
|
|
342
342
|
})
|
343
343
|
}
|
344
344
|
|
345
|
-
async appviewAuthHeaders(did: string) {
|
345
|
+
async appviewAuthHeaders(did: string, lxm: string) {
|
346
346
|
assert(this.cfg.bskyAppView)
|
347
|
-
return this.serviceAuthHeaders(did, this.cfg.bskyAppView.did)
|
347
|
+
return this.serviceAuthHeaders(did, this.cfg.bskyAppView.did, lxm)
|
348
348
|
}
|
349
349
|
|
350
|
-
async serviceAuthHeaders(did: string, aud: string) {
|
350
|
+
async serviceAuthHeaders(did: string, aud: string, lxm: string) {
|
351
351
|
const keypair = await this.actorStore.keypair(did)
|
352
352
|
return createServiceAuthHeaders({
|
353
353
|
iss: did,
|
354
354
|
aud,
|
355
|
+
lxm,
|
355
356
|
keypair,
|
356
357
|
})
|
357
358
|
}
|
package/src/lexicon/lexicons.ts
CHANGED
@@ -891,7 +891,7 @@ export const schemaDict = {
|
|
891
891
|
labelValueDefinition: {
|
892
892
|
type: 'object',
|
893
893
|
description:
|
894
|
-
'Declares a label value and its expected
|
894
|
+
'Declares a label value and its expected interpretations and behaviors.',
|
895
895
|
required: ['identifier', 'severity', 'blurs', 'locales'],
|
896
896
|
properties: {
|
897
897
|
identifier: {
|
@@ -2607,6 +2607,17 @@ export const schemaDict = {
|
|
2607
2607
|
description:
|
2608
2608
|
'The DID of the service that the token will be used to authenticate with',
|
2609
2609
|
},
|
2610
|
+
exp: {
|
2611
|
+
type: 'integer',
|
2612
|
+
description:
|
2613
|
+
'The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope.',
|
2614
|
+
},
|
2615
|
+
lxm: {
|
2616
|
+
type: 'string',
|
2617
|
+
format: 'nsid',
|
2618
|
+
description:
|
2619
|
+
'Lexicon (XRPC) method to bind the requested token to',
|
2620
|
+
},
|
2610
2621
|
},
|
2611
2622
|
},
|
2612
2623
|
output: {
|
@@ -2621,6 +2632,13 @@ export const schemaDict = {
|
|
2621
2632
|
},
|
2622
2633
|
},
|
2623
2634
|
},
|
2635
|
+
errors: [
|
2636
|
+
{
|
2637
|
+
name: 'BadExpiration',
|
2638
|
+
description:
|
2639
|
+
'Indicates that the requested expiration date is not a valid. May be in the past or may be reliant on the requested scopes.',
|
2640
|
+
},
|
2641
|
+
],
|
2624
2642
|
},
|
2625
2643
|
},
|
2626
2644
|
},
|
@@ -5482,7 +5500,7 @@ export const schemaDict = {
|
|
5482
5500
|
feedContext: {
|
5483
5501
|
type: 'string',
|
5484
5502
|
description:
|
5485
|
-
'Context on a feed item that was
|
5503
|
+
'Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton.',
|
5486
5504
|
maxLength: 2000,
|
5487
5505
|
},
|
5488
5506
|
},
|
@@ -332,7 +332,7 @@ export interface Interaction {
|
|
332
332
|
| 'app.bsky.feed.defs#interactionQuote'
|
333
333
|
| 'app.bsky.feed.defs#interactionShare'
|
334
334
|
| (string & {})
|
335
|
-
/** Context on a feed item that was
|
335
|
+
/** Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. */
|
336
336
|
feedContext?: string
|
337
337
|
[k: string]: unknown
|
338
338
|
}
|
@@ -78,7 +78,7 @@ export function validateSelfLabel(v: unknown): ValidationResult {
|
|
78
78
|
return lexicons.validate('com.atproto.label.defs#selfLabel', v)
|
79
79
|
}
|
80
80
|
|
81
|
-
/** Declares a label value and its expected
|
81
|
+
/** Declares a label value and its expected interpretations and behaviors. */
|
82
82
|
export interface LabelValueDefinition {
|
83
83
|
/** The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). */
|
84
84
|
identifier: string
|
@@ -11,6 +11,10 @@ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
11
11
|
export interface QueryParams {
|
12
12
|
/** The DID of the service that the token will be used to authenticate with */
|
13
13
|
aud: string
|
14
|
+
/** The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. */
|
15
|
+
exp?: number
|
16
|
+
/** Lexicon (XRPC) method to bind the requested token to */
|
17
|
+
lxm?: string
|
14
18
|
}
|
15
19
|
|
16
20
|
export type InputSchema = undefined
|
@@ -31,6 +35,7 @@ export interface HandlerSuccess {
|
|
31
35
|
export interface HandlerError {
|
32
36
|
status: number
|
33
37
|
message?: string
|
38
|
+
error?: 'BadExpiration'
|
34
39
|
}
|
35
40
|
|
36
41
|
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
package/src/pipethrough.ts
CHANGED
@@ -14,14 +14,22 @@ import { ids, lexicons } from './lexicon/lexicons'
|
|
14
14
|
import { httpLogger } from './logger'
|
15
15
|
import { getServiceEndpoint, noUndefinedVals } from '@atproto/common'
|
16
16
|
import AppContext from './context'
|
17
|
+
import { parseReqNsid } from '@atproto/xrpc-server'
|
17
18
|
|
18
19
|
export const proxyHandler = (ctx: AppContext): CatchallHandler => {
|
19
20
|
const accessStandard = ctx.authVerifier.accessStandard()
|
20
21
|
return async (req, res, next) => {
|
21
22
|
try {
|
22
|
-
const { url, aud } = await formatUrlAndAud(ctx, req)
|
23
|
+
const { url, aud, nsid } = await formatUrlAndAud(ctx, req)
|
23
24
|
const auth = await accessStandard({ req })
|
24
|
-
|
25
|
+
if (!auth.credentials.isPrivileged && PRIVILEGED_METHODS.has(nsid)) {
|
26
|
+
throw new InvalidRequestError('Bad token method', 'InvalidToken')
|
27
|
+
}
|
28
|
+
const headers = await formatHeaders(ctx, req, {
|
29
|
+
aud,
|
30
|
+
lxm: nsid,
|
31
|
+
requester: auth.credentials.did,
|
32
|
+
})
|
25
33
|
const body: webStream.ReadableStream<Uint8Array> =
|
26
34
|
stream.Readable.toWeb(req)
|
27
35
|
const reqInit = formatReqInit(req, headers, body)
|
@@ -38,10 +46,14 @@ export const pipethrough = async (
|
|
38
46
|
ctx: AppContext,
|
39
47
|
req: express.Request,
|
40
48
|
requester: string | null,
|
41
|
-
|
49
|
+
override: {
|
50
|
+
aud?: string
|
51
|
+
lxm?: string
|
52
|
+
} = {},
|
42
53
|
): Promise<HandlerPipeThrough> => {
|
43
|
-
const { url, aud } = await formatUrlAndAud(ctx, req,
|
44
|
-
const
|
54
|
+
const { url, aud, nsid } = await formatUrlAndAud(ctx, req, override.aud)
|
55
|
+
const lxm = override.lxm ?? nsid
|
56
|
+
const headers = await formatHeaders(ctx, req, { aud, lxm, requester })
|
45
57
|
const reqInit = formatReqInit(req, headers)
|
46
58
|
const res = await makeRequest(url, reqInit)
|
47
59
|
return parseProxyRes(res)
|
@@ -53,8 +65,8 @@ export const pipethroughProcedure = async (
|
|
53
65
|
requester: string | null,
|
54
66
|
body?: LexValue,
|
55
67
|
): Promise<HandlerPipeThrough> => {
|
56
|
-
const { url, aud } = await formatUrlAndAud(ctx, req)
|
57
|
-
const headers = await formatHeaders(ctx, req, aud, requester)
|
68
|
+
const { url, aud, nsid: lxm } = await formatUrlAndAud(ctx, req)
|
69
|
+
const headers = await formatHeaders(ctx, req, { aud, lxm, requester })
|
58
70
|
const encodedBody = body
|
59
71
|
? new TextEncoder().encode(stringifyLex(body))
|
60
72
|
: undefined
|
@@ -77,9 +89,10 @@ export const formatUrlAndAud = async (
|
|
77
89
|
ctx: AppContext,
|
78
90
|
req: express.Request,
|
79
91
|
audOverride?: string,
|
80
|
-
): Promise<{ url: URL; aud: string }> => {
|
92
|
+
): Promise<{ url: URL; aud: string; nsid: string }> => {
|
81
93
|
const proxyTo = await parseProxyHeader(ctx, req)
|
82
|
-
const
|
94
|
+
const nsid = parseReqNsid(req)
|
95
|
+
const defaultProxy = defaultService(ctx, nsid)
|
83
96
|
const serviceUrl = proxyTo?.serviceUrl ?? defaultProxy?.url
|
84
97
|
const aud = audOverride ?? proxyTo?.did ?? defaultProxy?.did
|
85
98
|
if (!serviceUrl || !aud) {
|
@@ -89,17 +102,21 @@ export const formatUrlAndAud = async (
|
|
89
102
|
if (!ctx.cfg.service.devMode && !isSafeUrl(url)) {
|
90
103
|
throw new InvalidRequestError(`Invalid service url: ${url.toString()}`)
|
91
104
|
}
|
92
|
-
return { url, aud }
|
105
|
+
return { url, aud, nsid }
|
93
106
|
}
|
94
107
|
|
95
108
|
export const formatHeaders = async (
|
96
109
|
ctx: AppContext,
|
97
110
|
req: express.Request,
|
98
|
-
|
99
|
-
|
111
|
+
opts: {
|
112
|
+
aud: string
|
113
|
+
lxm: string
|
114
|
+
requester: string | null
|
115
|
+
},
|
100
116
|
): Promise<{ authorization?: string }> => {
|
117
|
+
const { aud, lxm, requester } = opts
|
101
118
|
const headers = requester
|
102
|
-
? (await ctx.serviceAuthHeaders(requester, aud)).headers
|
119
|
+
? (await ctx.serviceAuthHeaders(requester, aud, lxm)).headers
|
103
120
|
: {}
|
104
121
|
// forward select headers to upstream services
|
105
122
|
for (const header of REQ_HEADERS_TO_FORWARD) {
|
@@ -241,11 +258,28 @@ export const parseProxyRes = async (res: Response) => {
|
|
241
258
|
// Utils
|
242
259
|
// -------------------
|
243
260
|
|
261
|
+
export const PRIVILEGED_METHODS = new Set([
|
262
|
+
ids.ChatBskyActorDeleteAccount,
|
263
|
+
ids.ChatBskyActorExportAccountData,
|
264
|
+
ids.ChatBskyConvoDeleteMessageForSelf,
|
265
|
+
ids.ChatBskyConvoGetConvo,
|
266
|
+
ids.ChatBskyConvoGetConvoForMembers,
|
267
|
+
ids.ChatBskyConvoGetLog,
|
268
|
+
ids.ChatBskyConvoGetMessages,
|
269
|
+
ids.ChatBskyConvoLeaveConvo,
|
270
|
+
ids.ChatBskyConvoListConvos,
|
271
|
+
ids.ChatBskyConvoMuteConvo,
|
272
|
+
ids.ChatBskyConvoSendMessage,
|
273
|
+
ids.ChatBskyConvoSendMessageBatch,
|
274
|
+
ids.ChatBskyConvoUnmuteConvo,
|
275
|
+
ids.ChatBskyConvoUpdateRead,
|
276
|
+
ids.ComAtprotoServerCreateAccount,
|
277
|
+
])
|
278
|
+
|
244
279
|
const defaultService = (
|
245
280
|
ctx: AppContext,
|
246
|
-
|
281
|
+
nsid: string,
|
247
282
|
): { url: string; did: string } | null => {
|
248
|
-
const nsid = req.originalUrl.split('?')[0].replace('/xrpc/', '')
|
249
283
|
switch (nsid) {
|
250
284
|
case ids.ToolsOzoneTeamAddMember:
|
251
285
|
case ids.ToolsOzoneTeamDeleteMember:
|
@@ -89,7 +89,7 @@ export class LocalViewer {
|
|
89
89
|
return util.format(this.appviewCdnUrlPattern, pattern, this.did, cid)
|
90
90
|
}
|
91
91
|
|
92
|
-
async serviceAuthHeaders(did: string) {
|
92
|
+
async serviceAuthHeaders(did: string, lxm: string) {
|
93
93
|
if (!this.appviewDid) {
|
94
94
|
throw new Error('Could not find bsky appview did')
|
95
95
|
}
|
@@ -98,6 +98,7 @@ export class LocalViewer {
|
|
98
98
|
return createServiceAuthHeaders({
|
99
99
|
iss: did,
|
100
100
|
aud: this.appviewDid,
|
101
|
+
lxm,
|
101
102
|
keypair,
|
102
103
|
})
|
103
104
|
}
|
@@ -244,7 +245,7 @@ export class LocalViewer {
|
|
244
245
|
if (collection === ids.AppBskyFeedPost) {
|
245
246
|
const res = await this.appViewAgent.api.app.bsky.feed.getPosts(
|
246
247
|
{ uris: [embed.record.uri] },
|
247
|
-
await this.serviceAuthHeaders(this.did),
|
248
|
+
await this.serviceAuthHeaders(this.did, ids.AppBskyFeedGetPosts),
|
248
249
|
)
|
249
250
|
const post = res.data.posts[0]
|
250
251
|
if (!post) return null
|
@@ -261,7 +262,10 @@ export class LocalViewer {
|
|
261
262
|
} else if (collection === ids.AppBskyFeedGenerator) {
|
262
263
|
const res = await this.appViewAgent.api.app.bsky.feed.getFeedGenerator(
|
263
264
|
{ feed: embed.record.uri },
|
264
|
-
await this.serviceAuthHeaders(
|
265
|
+
await this.serviceAuthHeaders(
|
266
|
+
this.did,
|
267
|
+
ids.AppBskyFeedGetFeedGenerator,
|
268
|
+
),
|
265
269
|
)
|
266
270
|
return {
|
267
271
|
$type: 'app.bsky.feed.defs#generatorView',
|
@@ -270,7 +274,7 @@ export class LocalViewer {
|
|
270
274
|
} else if (collection === ids.AppBskyGraphList) {
|
271
275
|
const res = await this.appViewAgent.api.app.bsky.graph.getList(
|
272
276
|
{ list: embed.record.uri },
|
273
|
-
await this.serviceAuthHeaders(this.did),
|
277
|
+
await this.serviceAuthHeaders(this.did, ids.AppBskyGraphGetList),
|
274
278
|
)
|
275
279
|
return {
|
276
280
|
$type: 'app.bsky.graph.defs#listView',
|
@@ -76,6 +76,7 @@ describe('moderator auth', () => {
|
|
76
76
|
const headers = await createServiceAuthHeaders({
|
77
77
|
iss: modServiceDid,
|
78
78
|
aud: pdsDid,
|
79
|
+
lxm: null,
|
79
80
|
keypair: modServiceKey,
|
80
81
|
})
|
81
82
|
await agent.api.com.atproto.admin.updateSubjectStatus(
|
@@ -103,6 +104,7 @@ describe('moderator auth', () => {
|
|
103
104
|
const headers = await createServiceAuthHeaders({
|
104
105
|
iss: altModDid,
|
105
106
|
aud: pdsDid,
|
107
|
+
lxm: null,
|
106
108
|
keypair: modServiceKey,
|
107
109
|
})
|
108
110
|
const attempt = agent.api.com.atproto.admin.updateSubjectStatus(
|
@@ -123,6 +125,7 @@ describe('moderator auth', () => {
|
|
123
125
|
const headers = await createServiceAuthHeaders({
|
124
126
|
iss: modServiceDid,
|
125
127
|
aud: pdsDid,
|
128
|
+
lxm: null,
|
126
129
|
keypair: badKey,
|
127
130
|
})
|
128
131
|
const attempt = agent.api.com.atproto.admin.updateSubjectStatus(
|
@@ -145,6 +148,7 @@ describe('moderator auth', () => {
|
|
145
148
|
const headers = await createServiceAuthHeaders({
|
146
149
|
iss: modServiceDid,
|
147
150
|
aud: sc.dids.alice,
|
151
|
+
lxm: null,
|
148
152
|
keypair: modServiceKey,
|
149
153
|
})
|
150
154
|
const attempt = agent.api.com.atproto.admin.updateSubjectStatus(
|
package/dist/api/chat/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAGtC,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAqFvD"}
|
package/dist/api/chat/index.js
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const pipethrough_1 = require("../../pipethrough");
|
4
|
-
function default_1(server, ctx) {
|
5
|
-
server.chat.bsky.actor.deleteAccount({
|
6
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
7
|
-
handler: async ({ req, auth }) => {
|
8
|
-
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did);
|
9
|
-
},
|
10
|
-
});
|
11
|
-
server.chat.bsky.actor.exportAccountData({
|
12
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
13
|
-
handler: ({ req, auth }) => {
|
14
|
-
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
15
|
-
},
|
16
|
-
});
|
17
|
-
server.chat.bsky.convo.deleteMessageForSelf({
|
18
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
19
|
-
handler: ({ req, auth, input }) => {
|
20
|
-
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
21
|
-
},
|
22
|
-
});
|
23
|
-
server.chat.bsky.convo.getConvo({
|
24
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
25
|
-
handler: ({ req, auth }) => {
|
26
|
-
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
27
|
-
},
|
28
|
-
});
|
29
|
-
server.chat.bsky.convo.getConvoForMembers({
|
30
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
31
|
-
handler: ({ req, auth }) => {
|
32
|
-
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
33
|
-
},
|
34
|
-
});
|
35
|
-
server.chat.bsky.convo.getLog({
|
36
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
37
|
-
handler: ({ req, auth }) => {
|
38
|
-
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
39
|
-
},
|
40
|
-
});
|
41
|
-
server.chat.bsky.convo.getMessages({
|
42
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
43
|
-
handler: ({ req, auth }) => {
|
44
|
-
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
45
|
-
},
|
46
|
-
});
|
47
|
-
server.chat.bsky.convo.leaveConvo({
|
48
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
49
|
-
handler: ({ req, auth, input }) => {
|
50
|
-
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
51
|
-
},
|
52
|
-
});
|
53
|
-
server.chat.bsky.convo.listConvos({
|
54
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
55
|
-
handler: ({ req, auth }) => {
|
56
|
-
return (0, pipethrough_1.pipethrough)(ctx, req, auth.credentials.did);
|
57
|
-
},
|
58
|
-
});
|
59
|
-
server.chat.bsky.convo.muteConvo({
|
60
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
61
|
-
handler: ({ req, auth, input }) => {
|
62
|
-
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
63
|
-
},
|
64
|
-
});
|
65
|
-
server.chat.bsky.convo.sendMessage({
|
66
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
67
|
-
handler: ({ req, auth, input }) => {
|
68
|
-
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
69
|
-
},
|
70
|
-
});
|
71
|
-
server.chat.bsky.convo.sendMessageBatch({
|
72
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
73
|
-
handler: ({ req, auth, input }) => {
|
74
|
-
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
75
|
-
},
|
76
|
-
});
|
77
|
-
server.chat.bsky.convo.unmuteConvo({
|
78
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
79
|
-
handler: ({ req, auth, input }) => {
|
80
|
-
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
81
|
-
},
|
82
|
-
});
|
83
|
-
server.chat.bsky.convo.updateRead({
|
84
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
85
|
-
handler: ({ req, auth, input }) => {
|
86
|
-
return (0, pipethrough_1.pipethroughProcedure)(ctx, req, auth.credentials.did, input.body);
|
87
|
-
},
|
88
|
-
});
|
89
|
-
}
|
90
|
-
exports.default = default_1;
|
91
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/chat/index.ts"],"names":[],"mappings":";;AAEA,mDAAqE;AAErE,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QACnC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,gBAAgB,EAAE;QACzC,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;YAC/B,OAAO,IAAA,kCAAoB,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QAC7D,CAAC;KACF,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC;QACvC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,gBAAgB,EAAE;QACzC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;YACzB,OAAO,IAAA,yBAAW,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACpD,CAAC;KACF,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC;QAC1C,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,gBAAgB,EAAE;QACzC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;YAChC,OAAO,IAAA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,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;QACzE,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AArFD,4BAqFC"}
|
package/src/api/chat/index.ts
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
import AppContext from '../../context'
|
2
|
-
import { Server } from '../../lexicon'
|
3
|
-
import { pipethrough, pipethroughProcedure } from '../../pipethrough'
|
4
|
-
|
5
|
-
export default function (server: Server, ctx: AppContext) {
|
6
|
-
server.chat.bsky.actor.deleteAccount({
|
7
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
8
|
-
handler: async ({ req, auth }) => {
|
9
|
-
return pipethroughProcedure(ctx, req, auth.credentials.did)
|
10
|
-
},
|
11
|
-
})
|
12
|
-
server.chat.bsky.actor.exportAccountData({
|
13
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
14
|
-
handler: ({ req, auth }) => {
|
15
|
-
return pipethrough(ctx, req, auth.credentials.did)
|
16
|
-
},
|
17
|
-
})
|
18
|
-
server.chat.bsky.convo.deleteMessageForSelf({
|
19
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
20
|
-
handler: ({ req, auth, input }) => {
|
21
|
-
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
22
|
-
},
|
23
|
-
})
|
24
|
-
server.chat.bsky.convo.getConvo({
|
25
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
26
|
-
handler: ({ req, auth }) => {
|
27
|
-
return pipethrough(ctx, req, auth.credentials.did)
|
28
|
-
},
|
29
|
-
})
|
30
|
-
server.chat.bsky.convo.getConvoForMembers({
|
31
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
32
|
-
handler: ({ req, auth }) => {
|
33
|
-
return pipethrough(ctx, req, auth.credentials.did)
|
34
|
-
},
|
35
|
-
})
|
36
|
-
server.chat.bsky.convo.getLog({
|
37
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
38
|
-
handler: ({ req, auth }) => {
|
39
|
-
return pipethrough(ctx, req, auth.credentials.did)
|
40
|
-
},
|
41
|
-
})
|
42
|
-
server.chat.bsky.convo.getMessages({
|
43
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
44
|
-
handler: ({ req, auth }) => {
|
45
|
-
return pipethrough(ctx, req, auth.credentials.did)
|
46
|
-
},
|
47
|
-
})
|
48
|
-
server.chat.bsky.convo.leaveConvo({
|
49
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
50
|
-
handler: ({ req, auth, input }) => {
|
51
|
-
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
52
|
-
},
|
53
|
-
})
|
54
|
-
server.chat.bsky.convo.listConvos({
|
55
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
56
|
-
handler: ({ req, auth }) => {
|
57
|
-
return pipethrough(ctx, req, auth.credentials.did)
|
58
|
-
},
|
59
|
-
})
|
60
|
-
server.chat.bsky.convo.muteConvo({
|
61
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
62
|
-
handler: ({ req, auth, input }) => {
|
63
|
-
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
64
|
-
},
|
65
|
-
})
|
66
|
-
server.chat.bsky.convo.sendMessage({
|
67
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
68
|
-
handler: ({ req, auth, input }) => {
|
69
|
-
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
70
|
-
},
|
71
|
-
})
|
72
|
-
server.chat.bsky.convo.sendMessageBatch({
|
73
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
74
|
-
handler: ({ req, auth, input }) => {
|
75
|
-
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
76
|
-
},
|
77
|
-
})
|
78
|
-
server.chat.bsky.convo.unmuteConvo({
|
79
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
80
|
-
handler: ({ req, auth, input }) => {
|
81
|
-
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
82
|
-
},
|
83
|
-
})
|
84
|
-
server.chat.bsky.convo.updateRead({
|
85
|
-
auth: ctx.authVerifier.accessPrivileged(),
|
86
|
-
handler: ({ req, auth, input }) => {
|
87
|
-
return pipethroughProcedure(ctx, req, auth.credentials.did, input.body)
|
88
|
-
},
|
89
|
-
})
|
90
|
-
}
|