@atproto/pds 0.4.165 → 0.4.167
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 +20 -0
- package/dist/account-manager/account-manager.js +2 -2
- package/dist/account-manager/account-manager.js.map +1 -1
- package/dist/account-manager/helpers/account-device.d.ts +4 -4
- package/dist/account-manager/helpers/account.d.ts +1 -1
- package/dist/account-manager/helpers/auth.d.ts +1 -1
- package/dist/account-manager/helpers/auth.d.ts.map +1 -1
- package/dist/account-manager/helpers/auth.js +8 -8
- package/dist/account-manager/helpers/auth.js.map +1 -1
- package/dist/account-manager/helpers/authorization-request.d.ts +1 -1
- package/dist/account-manager/helpers/authorization-request.d.ts.map +1 -1
- package/dist/account-manager/helpers/authorization-request.js +16 -8
- package/dist/account-manager/helpers/authorization-request.js.map +1 -1
- package/dist/account-manager/helpers/token.d.ts +65 -65
- package/dist/actor-store/preference/reader.d.ts +2 -2
- package/dist/actor-store/preference/reader.d.ts.map +1 -1
- package/dist/actor-store/preference/reader.js +2 -2
- package/dist/actor-store/preference/reader.js.map +1 -1
- package/dist/actor-store/preference/transactor.d.ts +2 -2
- package/dist/actor-store/preference/transactor.d.ts.map +1 -1
- package/dist/actor-store/preference/transactor.js +5 -5
- package/dist/actor-store/preference/transactor.js.map +1 -1
- package/dist/actor-store/preference/util.d.ts +4 -2
- package/dist/actor-store/preference/util.d.ts.map +1 -1
- package/dist/actor-store/preference/util.js +9 -8
- package/dist/actor-store/preference/util.js.map +1 -1
- package/dist/actor-store/record/reader.d.ts +2 -2
- package/dist/api/app/bsky/actor/getPreferences.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getPreferences.js +29 -7
- package/dist/api/app/bsky/actor/getPreferences.js.map +1 -1
- package/dist/api/app/bsky/actor/getProfile.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getProfile.js +9 -1
- package/dist/api/app/bsky/actor/getProfile.js.map +1 -1
- package/dist/api/app/bsky/actor/getProfiles.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getProfiles.js +9 -1
- package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
- package/dist/api/app/bsky/actor/putPreferences.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/putPreferences.js +30 -8
- package/dist/api/app/bsky/actor/putPreferences.js.map +1 -1
- package/dist/api/app/bsky/feed/getActorLikes.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getActorLikes.js +9 -1
- package/dist/api/app/bsky/feed/getActorLikes.js.map +1 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.js +9 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.js +8 -1
- 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 +8 -1
- package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
- package/dist/api/app/bsky/feed/getTimeline.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getTimeline.js +9 -1
- package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
- package/dist/api/app/bsky/notification/registerPush.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/registerPush.js +16 -4
- package/dist/api/app/bsky/notification/registerPush.js.map +1 -1
- package/dist/api/com/atproto/identity/getRecommendedDidCredentials.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js +5 -1
- package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js.map +1 -1
- package/dist/api/com/atproto/identity/requestPlcOperationSignature.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/requestPlcOperationSignature.js +9 -2
- package/dist/api/com/atproto/identity/requestPlcOperationSignature.js.map +1 -1
- package/dist/api/com/atproto/identity/signPlcOperation.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/signPlcOperation.js +9 -1
- package/dist/api/com/atproto/identity/signPlcOperation.js.map +1 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.js +5 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.js.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.js +6 -1
- package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
- package/dist/api/com/atproto/moderation/createReport.d.ts.map +1 -1
- package/dist/api/com/atproto/moderation/createReport.js +8 -3
- package/dist/api/com/atproto/moderation/createReport.js.map +1 -1
- package/dist/api/com/atproto/repo/applyWrites.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/applyWrites.js +25 -19
- package/dist/api/com/atproto/repo/applyWrites.js.map +1 -1
- package/dist/api/com/atproto/repo/createRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/createRecord.js +10 -1
- package/dist/api/com/atproto/repo/createRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/deleteRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/deleteRecord.js +12 -1
- package/dist/api/com/atproto/repo/deleteRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/importRepo.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/importRepo.js +7 -2
- package/dist/api/com/atproto/repo/importRepo.js.map +1 -1
- package/dist/api/com/atproto/repo/listMissingBlobs.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/listMissingBlobs.js +6 -2
- package/dist/api/com/atproto/repo/listMissingBlobs.js.map +1 -1
- package/dist/api/com/atproto/repo/putRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/putRecord.js +17 -11
- package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.js +5 -1
- package/dist/api/com/atproto/repo/uploadBlob.js.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.js +7 -1
- package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
- package/dist/api/com/atproto/server/checkAccountStatus.d.ts.map +1 -1
- package/dist/api/com/atproto/server/checkAccountStatus.js +5 -1
- package/dist/api/com/atproto/server/checkAccountStatus.js.map +1 -1
- package/dist/api/com/atproto/server/confirmEmail.d.ts.map +1 -1
- package/dist/api/com/atproto/server/confirmEmail.js +6 -1
- package/dist/api/com/atproto/server/confirmEmail.js.map +1 -1
- package/dist/api/com/atproto/server/createAppPassword.d.ts.map +1 -1
- package/dist/api/com/atproto/server/createAppPassword.js +7 -1
- package/dist/api/com/atproto/server/createAppPassword.js.map +1 -1
- package/dist/api/com/atproto/server/deactivateAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/deactivateAccount.js +9 -2
- package/dist/api/com/atproto/server/deactivateAccount.js.map +1 -1
- package/dist/api/com/atproto/server/deleteSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/deleteSession.js +3 -1
- package/dist/api/com/atproto/server/deleteSession.js.map +1 -1
- package/dist/api/com/atproto/server/getAccountInviteCodes.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getAccountInviteCodes.js +8 -1
- package/dist/api/com/atproto/server/getAccountInviteCodes.js.map +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.js +24 -13
- package/dist/api/com/atproto/server/getServiceAuth.js.map +1 -1
- package/dist/api/com/atproto/server/getSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getSession.js +12 -19
- package/dist/api/com/atproto/server/getSession.js.map +1 -1
- package/dist/api/com/atproto/server/listAppPasswords.d.ts.map +1 -1
- package/dist/api/com/atproto/server/listAppPasswords.js +6 -1
- package/dist/api/com/atproto/server/listAppPasswords.js.map +1 -1
- package/dist/api/com/atproto/server/refreshSession.js +1 -1
- package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
- package/dist/api/com/atproto/server/requestAccountDelete.d.ts.map +1 -1
- package/dist/api/com/atproto/server/requestAccountDelete.js +8 -1
- package/dist/api/com/atproto/server/requestAccountDelete.js.map +1 -1
- package/dist/api/com/atproto/server/requestEmailConfirmation.d.ts.map +1 -1
- package/dist/api/com/atproto/server/requestEmailConfirmation.js +6 -1
- package/dist/api/com/atproto/server/requestEmailConfirmation.js.map +1 -1
- package/dist/api/com/atproto/server/requestEmailUpdate.d.ts.map +1 -1
- package/dist/api/com/atproto/server/requestEmailUpdate.js +6 -1
- package/dist/api/com/atproto/server/requestEmailUpdate.js.map +1 -1
- package/dist/api/com/atproto/server/revokeAppPassword.d.ts.map +1 -1
- package/dist/api/com/atproto/server/revokeAppPassword.js +6 -1
- package/dist/api/com/atproto/server/revokeAppPassword.js.map +1 -1
- package/dist/api/com/atproto/server/updateEmail.d.ts.map +1 -1
- package/dist/api/com/atproto/server/updateEmail.js +8 -1
- package/dist/api/com/atproto/server/updateEmail.js.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getCheckout.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getCheckout.js +7 -2
- package/dist/api/com/atproto/sync/deprecated/getCheckout.js.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getHead.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getHead.js +7 -2
- package/dist/api/com/atproto/sync/deprecated/getHead.js.map +1 -1
- package/dist/api/com/atproto/sync/getBlob.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getBlob.js +7 -3
- package/dist/api/com/atproto/sync/getBlob.js.map +1 -1
- package/dist/api/com/atproto/sync/getBlocks.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getBlocks.js +7 -2
- package/dist/api/com/atproto/sync/getBlocks.js.map +1 -1
- package/dist/api/com/atproto/sync/getLatestCommit.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getLatestCommit.js +7 -2
- package/dist/api/com/atproto/sync/getLatestCommit.js.map +1 -1
- package/dist/api/com/atproto/sync/getRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getRecord.js +7 -2
- package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
- package/dist/api/com/atproto/sync/getRepo.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getRepo.js +7 -3
- package/dist/api/com/atproto/sync/getRepo.js.map +1 -1
- package/dist/api/com/atproto/sync/listBlobs.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/listBlobs.js +7 -3
- package/dist/api/com/atproto/sync/listBlobs.js.map +1 -1
- package/dist/api/com/atproto/temp/checkSignupQueue.d.ts.map +1 -1
- package/dist/api/com/atproto/temp/checkSignupQueue.js +7 -3
- package/dist/api/com/atproto/temp/checkSignupQueue.js.map +1 -1
- package/dist/auth-output.d.ts +45 -0
- package/dist/auth-output.d.ts.map +1 -0
- package/dist/auth-output.js +3 -0
- package/dist/auth-output.js.map +1 -0
- package/dist/auth-scope.d.ts +16 -0
- package/dist/auth-scope.d.ts.map +1 -0
- package/dist/auth-scope.js +40 -0
- package/dist/auth-scope.js.map +1 -0
- package/dist/auth-verifier.d.ts +50 -115
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +275 -366
- package/dist/auth-verifier.js.map +1 -1
- package/dist/config/config.d.ts +2 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +2 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +1 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +3 -1
- package/dist/config/env.js.map +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +5 -5
- package/dist/context.js.map +1 -1
- package/dist/lexicon/index.d.ts +230 -230
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +687 -687
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +16650 -16650
- package/dist/lexicon/lexicons.js +9267 -9267
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/pipethrough.d.ts +5 -3
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/pipethrough.js +42 -15
- package/dist/pipethrough.js.map +1 -1
- package/dist/sequencer/events.d.ts +13 -13
- package/dist/util/http.d.ts +7 -0
- package/dist/util/http.d.ts.map +1 -0
- package/dist/util/http.js +31 -0
- package/dist/util/http.js.map +1 -0
- package/dist/util/types.d.ts +5 -0
- package/dist/util/types.d.ts.map +1 -0
- package/dist/util/types.js +3 -0
- package/dist/util/types.js.map +1 -0
- package/package.json +4 -3
- package/src/account-manager/account-manager.ts +1 -1
- package/src/account-manager/helpers/auth.ts +1 -1
- package/src/account-manager/helpers/authorization-request.ts +8 -4
- package/src/actor-store/preference/reader.ts +3 -4
- package/src/actor-store/preference/transactor.ts +6 -7
- package/src/actor-store/preference/util.ts +15 -5
- package/src/api/app/bsky/actor/getPreferences.ts +33 -8
- package/src/api/app/bsky/actor/getProfile.ts +9 -1
- package/src/api/app/bsky/actor/getProfiles.ts +9 -1
- package/src/api/app/bsky/actor/putPreferences.ts +35 -12
- package/src/api/app/bsky/feed/getActorLikes.ts +9 -1
- package/src/api/app/bsky/feed/getAuthorFeed.ts +9 -1
- package/src/api/app/bsky/feed/getFeed.ts +9 -2
- package/src/api/app/bsky/feed/getPostThread.ts +8 -1
- package/src/api/app/bsky/feed/getTimeline.ts +9 -1
- package/src/api/app/bsky/notification/registerPush.ts +16 -5
- package/src/api/com/atproto/identity/getRecommendedDidCredentials.ts +5 -1
- package/src/api/com/atproto/identity/requestPlcOperationSignature.ts +9 -2
- package/src/api/com/atproto/identity/signPlcOperation.ts +9 -1
- package/src/api/com/atproto/identity/submitPlcOperation.ts +5 -1
- package/src/api/com/atproto/identity/updateHandle.ts +6 -1
- package/src/api/com/atproto/moderation/createReport.ts +8 -3
- package/src/api/com/atproto/repo/applyWrites.ts +28 -20
- package/src/api/com/atproto/repo/createRecord.ts +12 -1
- package/src/api/com/atproto/repo/deleteRecord.ts +14 -1
- package/src/api/com/atproto/repo/importRepo.ts +9 -2
- package/src/api/com/atproto/repo/listMissingBlobs.ts +7 -2
- package/src/api/com/atproto/repo/putRecord.ts +18 -10
- package/src/api/com/atproto/repo/uploadBlob.ts +6 -2
- package/src/api/com/atproto/server/activateAccount.ts +10 -2
- package/src/api/com/atproto/server/checkAccountStatus.ts +5 -1
- package/src/api/com/atproto/server/confirmEmail.ts +6 -1
- package/src/api/com/atproto/server/createAppPassword.ts +9 -1
- package/src/api/com/atproto/server/deactivateAccount.ts +11 -2
- package/src/api/com/atproto/server/deleteSession.ts +3 -1
- package/src/api/com/atproto/server/getAccountInviteCodes.ts +11 -2
- package/src/api/com/atproto/server/getServiceAuth.ts +37 -18
- package/src/api/com/atproto/server/getSession.ts +20 -27
- package/src/api/com/atproto/server/listAppPasswords.ts +8 -1
- package/src/api/com/atproto/server/refreshSession.ts +1 -1
- package/src/api/com/atproto/server/requestAccountDelete.ts +11 -2
- package/src/api/com/atproto/server/requestEmailConfirmation.ts +6 -1
- package/src/api/com/atproto/server/requestEmailUpdate.ts +6 -1
- package/src/api/com/atproto/server/revokeAppPassword.ts +8 -1
- package/src/api/com/atproto/server/updateEmail.ts +11 -2
- package/src/api/com/atproto/sync/deprecated/getCheckout.ts +7 -6
- package/src/api/com/atproto/sync/deprecated/getHead.ts +7 -6
- package/src/api/com/atproto/sync/getBlob.ts +7 -7
- package/src/api/com/atproto/sync/getBlocks.ts +7 -6
- package/src/api/com/atproto/sync/getLatestCommit.ts +7 -6
- package/src/api/com/atproto/sync/getRecord.ts +7 -6
- package/src/api/com/atproto/sync/getRepo.ts +7 -7
- package/src/api/com/atproto/sync/listBlobs.ts +7 -7
- package/src/api/com/atproto/temp/checkSignupQueue.ts +8 -2
- package/src/auth-output.ts +51 -0
- package/src/auth-scope.ts +40 -0
- package/src/auth-verifier.ts +404 -520
- package/src/config/config.ts +7 -7
- package/src/config/env.ts +5 -1
- package/src/context.ts +6 -5
- package/src/lexicon/index.ts +1235 -1235
- package/src/lexicon/lexicons.ts +9416 -9416
- package/src/pipethrough.ts +61 -18
- package/src/util/http.ts +31 -0
- package/src/util/types.ts +7 -0
- package/tests/oauth.test.ts +11 -37
- package/tests/preferences.test.ts +7 -3
- package/tsconfig.build.tsbuildinfo +1 -1
@@ -4,7 +4,11 @@ import { isValidDidDocForService } from './util'
|
|
4
4
|
|
5
5
|
export default function (server: Server, ctx: AppContext) {
|
6
6
|
server.com.atproto.server.checkAccountStatus({
|
7
|
-
auth: ctx.authVerifier.
|
7
|
+
auth: ctx.authVerifier.authorization({
|
8
|
+
authorize: () => {
|
9
|
+
// always allow
|
10
|
+
},
|
11
|
+
}),
|
8
12
|
handler: async ({ auth }) => {
|
9
13
|
const requester = auth.credentials.did
|
10
14
|
const [
|
@@ -5,7 +5,12 @@ import { ids } from '../../../../lexicon/lexicons'
|
|
5
5
|
|
6
6
|
export default function (server: Server, ctx: AppContext) {
|
7
7
|
server.com.atproto.server.confirmEmail({
|
8
|
-
auth: ctx.authVerifier.
|
8
|
+
auth: ctx.authVerifier.authorization({
|
9
|
+
checkTakedown: true,
|
10
|
+
authorize: (permissions) => {
|
11
|
+
permissions.assertAccount({ attr: 'email', action: 'manage' })
|
12
|
+
},
|
13
|
+
}),
|
9
14
|
handler: async ({ auth, input, req }) => {
|
10
15
|
const did = auth.credentials.did
|
11
16
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { ForbiddenError } from '@atproto/xrpc-server'
|
2
|
+
import { ACCESS_FULL } from '../../../../auth-scope'
|
1
3
|
import { AppContext } from '../../../../context'
|
2
4
|
import { Server } from '../../../../lexicon'
|
3
5
|
import { ids } from '../../../../lexicon/lexicons'
|
@@ -5,8 +7,14 @@ import { resultPassthru } from '../../../proxy'
|
|
5
7
|
|
6
8
|
export default function (server: Server, ctx: AppContext) {
|
7
9
|
server.com.atproto.server.createAppPassword({
|
8
|
-
auth: ctx.authVerifier.
|
10
|
+
auth: ctx.authVerifier.authorization({
|
9
11
|
checkTakedown: true,
|
12
|
+
scopes: ACCESS_FULL,
|
13
|
+
authorize: () => {
|
14
|
+
throw new ForbiddenError(
|
15
|
+
'OAuth credentials are not supported for this endpoint',
|
16
|
+
)
|
17
|
+
},
|
10
18
|
}),
|
11
19
|
handler: async ({ auth, input, req }) => {
|
12
20
|
if (ctx.entrywayAgent) {
|
@@ -1,10 +1,19 @@
|
|
1
|
-
import {
|
1
|
+
import { ForbiddenError } from '@atproto/xrpc-server'
|
2
|
+
import { ACCESS_FULL, AuthScope } from '../../../../auth-scope'
|
2
3
|
import { AppContext } from '../../../../context'
|
3
4
|
import { Server } from '../../../../lexicon'
|
4
5
|
|
5
6
|
export default function (server: Server, ctx: AppContext) {
|
6
7
|
server.com.atproto.server.deactivateAccount({
|
7
|
-
auth: ctx.authVerifier.
|
8
|
+
auth: ctx.authVerifier.authorization({
|
9
|
+
additional: [AuthScope.Takendown],
|
10
|
+
scopes: ACCESS_FULL,
|
11
|
+
authorize: () => {
|
12
|
+
throw new ForbiddenError(
|
13
|
+
'OAuth credentials are not supported for this endpoint',
|
14
|
+
)
|
15
|
+
},
|
16
|
+
}),
|
8
17
|
handler: async ({ req, auth, input }) => {
|
9
18
|
// in the case of entryway, the full flow is deactivateAccount (PDS) -> deactivateAccount (Entryway) -> updateSubjectStatus(PDS)
|
10
19
|
if (ctx.entrywayAgent) {
|
@@ -12,7 +12,9 @@ export default function (server: Server, ctx: AppContext) {
|
|
12
12
|
})
|
13
13
|
} else {
|
14
14
|
server.com.atproto.server.deleteSession({
|
15
|
-
auth: ctx.authVerifier.
|
15
|
+
auth: ctx.authVerifier.refresh({
|
16
|
+
allowExpired: true,
|
17
|
+
}),
|
16
18
|
handler: async ({ auth }) => {
|
17
19
|
await ctx.accountManager.revokeRefreshToken(auth.credentials.tokenId)
|
18
20
|
},
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { InvalidRequestError } from '@atproto/xrpc-server'
|
1
|
+
import { ForbiddenError, InvalidRequestError } from '@atproto/xrpc-server'
|
2
2
|
import { CodeDetail } from '../../../../account-manager/helpers/invite'
|
3
|
+
import { ACCESS_FULL } from '../../../../auth-scope'
|
3
4
|
import { AppContext } from '../../../../context'
|
4
5
|
import { Server } from '../../../../lexicon'
|
5
6
|
import { ids } from '../../../../lexicon/lexicons'
|
@@ -8,7 +9,15 @@ import { genInvCodes } from './util'
|
|
8
9
|
|
9
10
|
export default function (server: Server, ctx: AppContext) {
|
10
11
|
server.com.atproto.server.getAccountInviteCodes({
|
11
|
-
auth: ctx.authVerifier.
|
12
|
+
auth: ctx.authVerifier.authorization({
|
13
|
+
checkTakedown: true,
|
14
|
+
scopes: ACCESS_FULL,
|
15
|
+
authorize: () => {
|
16
|
+
throw new ForbiddenError(
|
17
|
+
'OAuth credentials are not supported for this endpoint',
|
18
|
+
)
|
19
|
+
},
|
20
|
+
}),
|
12
21
|
handler: async ({ params, auth, req }) => {
|
13
22
|
if (ctx.entrywayAgent) {
|
14
23
|
return resultPassthru(
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import { HOUR, MINUTE } from '@atproto/common'
|
2
2
|
import { InvalidRequestError, createServiceJwt } from '@atproto/xrpc-server'
|
3
|
-
import {
|
3
|
+
import {
|
4
|
+
AuthScope,
|
5
|
+
isAccessPrivileged,
|
6
|
+
isTakendown,
|
7
|
+
} from '../../../../auth-scope'
|
4
8
|
import { AppContext } from '../../../../context'
|
5
9
|
import { Server } from '../../../../lexicon'
|
6
10
|
import { ids } from '../../../../lexicon/lexicons'
|
@@ -8,19 +12,41 @@ import { PRIVILEGED_METHODS, PROTECTED_METHODS } from '../../../../pipethrough'
|
|
8
12
|
|
9
13
|
export default function (server: Server, ctx: AppContext) {
|
10
14
|
server.com.atproto.server.getServiceAuth({
|
11
|
-
auth: ctx.authVerifier.
|
15
|
+
auth: ctx.authVerifier.authorization({
|
12
16
|
additional: [AuthScope.Takendown],
|
17
|
+
authorize: (permissions, ctx) => {
|
18
|
+
const { aud, lxm = '*' } = ctx.params
|
19
|
+
permissions.assertRpc({ aud, lxm })
|
20
|
+
},
|
13
21
|
}),
|
14
22
|
handler: async ({ params, auth }) => {
|
15
23
|
const did = auth.credentials.did
|
24
|
+
|
25
|
+
// @NOTE "exp" is expressed in seconds since epoch, not milliseconds
|
16
26
|
const { aud, exp, lxm = null } = params
|
17
27
|
|
18
28
|
// Takendown accounts should not be able to generate service auth tokens except for methods necessary for account migration
|
19
|
-
if (
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
29
|
+
if (auth.credentials.type === 'access') {
|
30
|
+
// @NOTE We should probably use "ForbiddenError" here. Using
|
31
|
+
// "InvalidRequestError" for legacy reasons.
|
32
|
+
if (
|
33
|
+
isTakendown(auth.credentials.scope) &&
|
34
|
+
lxm !== ids.ComAtprotoServerCreateAccount
|
35
|
+
) {
|
36
|
+
throw new InvalidRequestError('Bad token scope', 'InvalidToken')
|
37
|
+
}
|
38
|
+
|
39
|
+
// @NOTE "oauth" based credentials already checked through permission
|
40
|
+
// set in "authorize" method above.
|
41
|
+
if (
|
42
|
+
lxm != null &&
|
43
|
+
PRIVILEGED_METHODS.has(lxm) &&
|
44
|
+
!isAccessPrivileged(auth.credentials.scope)
|
45
|
+
) {
|
46
|
+
throw new InvalidRequestError(
|
47
|
+
`insufficient access to request a service auth token for the following method: ${lxm}`,
|
48
|
+
)
|
49
|
+
}
|
24
50
|
}
|
25
51
|
|
26
52
|
if (exp) {
|
@@ -43,17 +69,10 @@ export default function (server: Server, ctx: AppContext) {
|
|
43
69
|
}
|
44
70
|
}
|
45
71
|
|
46
|
-
if (lxm) {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
)
|
51
|
-
}
|
52
|
-
if (!auth.credentials.isPrivileged && PRIVILEGED_METHODS.has(lxm)) {
|
53
|
-
throw new InvalidRequestError(
|
54
|
-
`insufficient access to request a service auth token for the following method: ${lxm}`,
|
55
|
-
)
|
56
|
-
}
|
72
|
+
if (lxm && PROTECTED_METHODS.has(lxm)) {
|
73
|
+
throw new InvalidRequestError(
|
74
|
+
`cannot request a service auth token for the following protected method: ${lxm}`,
|
75
|
+
)
|
57
76
|
}
|
58
77
|
|
59
78
|
const keypair = await ctx.actorStore.keypair(did)
|
@@ -2,27 +2,27 @@ import { ComAtprotoServerGetSession } from '@atproto/api'
|
|
2
2
|
import { INVALID_HANDLE } from '@atproto/syntax'
|
3
3
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
4
4
|
import { formatAccountStatus } from '../../../../account-manager/account-manager'
|
5
|
-
import { AccessOutput,
|
5
|
+
import { AccessOutput, OAuthOutput } from '../../../../auth-output'
|
6
|
+
import { AuthScope } from '../../../../auth-scope'
|
6
7
|
import { AppContext } from '../../../../context'
|
7
8
|
import { Server } from '../../../../lexicon'
|
8
9
|
import { didDocForSession } from './util'
|
9
10
|
|
10
11
|
export default function (server: Server, ctx: AppContext) {
|
11
12
|
server.com.atproto.server.getSession({
|
12
|
-
auth: ctx.authVerifier.
|
13
|
+
auth: ctx.authVerifier.authorization({
|
13
14
|
additional: [AuthScope.SignupQueued],
|
15
|
+
authorize: () => {
|
16
|
+
// Always allowed. "email" access is checked in the handler.
|
17
|
+
},
|
14
18
|
}),
|
15
19
|
handler: async ({ auth, req }) => {
|
16
20
|
if (ctx.entrywayAgent) {
|
17
|
-
|
18
|
-
|
19
|
-
auth.credentials.
|
20
|
-
|
21
|
-
|
22
|
-
auth.credentials.did,
|
23
|
-
'com.atproto.server.getSession',
|
24
|
-
)
|
25
|
-
: ctx.entrywayPassthruHeaders(req)
|
21
|
+
const headers = await ctx.entrywayAuthHeaders(
|
22
|
+
req,
|
23
|
+
auth.credentials.did,
|
24
|
+
'com.atproto.server.getSession',
|
25
|
+
)
|
26
26
|
|
27
27
|
const res = await ctx.entrywayAgent.com.atproto.server.getSession(
|
28
28
|
undefined,
|
@@ -65,23 +65,16 @@ export default function (server: Server, ctx: AppContext) {
|
|
65
65
|
}
|
66
66
|
|
67
67
|
function output(
|
68
|
-
{ credentials }:
|
68
|
+
{ credentials }: OAuthOutput | AccessOutput,
|
69
69
|
data: ComAtprotoServerGetSession.OutputSchema,
|
70
70
|
): ComAtprotoServerGetSession.OutputSchema {
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
const { email, emailAuthFactor, emailConfirmed, ...rest } = data
|
78
|
-
return rest
|
79
|
-
}
|
80
|
-
|
81
|
-
return data
|
82
|
-
|
83
|
-
default:
|
84
|
-
// @ts-expect-error
|
85
|
-
throw new Error(`Unknown credentials type: ${credentials.type}`)
|
71
|
+
if (
|
72
|
+
credentials.type === 'oauth' &&
|
73
|
+
!credentials.permissions.allowsAccount({ attr: 'email', action: 'read' })
|
74
|
+
) {
|
75
|
+
const { email, emailAuthFactor, emailConfirmed, ...rest } = data
|
76
|
+
return rest
|
86
77
|
}
|
78
|
+
|
79
|
+
return data
|
87
80
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ForbiddenError } from '@atproto/xrpc-server'
|
1
2
|
import { AppContext } from '../../../../context'
|
2
3
|
import { Server } from '../../../../lexicon'
|
3
4
|
import { ids } from '../../../../lexicon/lexicons'
|
@@ -5,7 +6,13 @@ import { resultPassthru } from '../../../proxy'
|
|
5
6
|
|
6
7
|
export default function (server: Server, ctx: AppContext) {
|
7
8
|
server.com.atproto.server.listAppPasswords({
|
8
|
-
auth: ctx.authVerifier.
|
9
|
+
auth: ctx.authVerifier.authorization({
|
10
|
+
authorize: () => {
|
11
|
+
throw new ForbiddenError(
|
12
|
+
'OAuth credentials are not supported for this endpoint',
|
13
|
+
)
|
14
|
+
},
|
15
|
+
}),
|
9
16
|
handler: async ({ auth, req }) => {
|
10
17
|
if (ctx.entrywayAgent) {
|
11
18
|
return resultPassthru(
|
@@ -9,7 +9,7 @@ import { didDocForSession } from './util'
|
|
9
9
|
|
10
10
|
export default function (server: Server, ctx: AppContext) {
|
11
11
|
server.com.atproto.server.refreshSession({
|
12
|
-
auth: ctx.authVerifier.refresh,
|
12
|
+
auth: ctx.authVerifier.refresh(),
|
13
13
|
handler: async ({ auth, req }) => {
|
14
14
|
const did = auth.credentials.did
|
15
15
|
const user = await ctx.accountManager.getAccount(did, {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { DAY, HOUR } from '@atproto/common'
|
2
|
-
import { InvalidRequestError } from '@atproto/xrpc-server'
|
2
|
+
import { ForbiddenError, InvalidRequestError } from '@atproto/xrpc-server'
|
3
|
+
import { ACCESS_FULL } from '../../../../auth-scope'
|
3
4
|
import { AppContext } from '../../../../context'
|
4
5
|
import { Server } from '../../../../lexicon'
|
5
6
|
import { ids } from '../../../../lexicon/lexicons'
|
@@ -18,7 +19,15 @@ export default function (server: Server, ctx: AppContext) {
|
|
18
19
|
calcKey: ({ auth }) => auth.credentials.did,
|
19
20
|
},
|
20
21
|
],
|
21
|
-
auth: ctx.authVerifier.
|
22
|
+
auth: ctx.authVerifier.authorization({
|
23
|
+
checkTakedown: true,
|
24
|
+
scopes: ACCESS_FULL,
|
25
|
+
authorize: () => {
|
26
|
+
throw new ForbiddenError(
|
27
|
+
'OAuth credentials are not supported for this endpoint',
|
28
|
+
)
|
29
|
+
},
|
30
|
+
}),
|
22
31
|
handler: async ({ auth, req }) => {
|
23
32
|
const did = auth.credentials.did
|
24
33
|
const account = await ctx.accountManager.getAccount(did, {
|
@@ -18,7 +18,12 @@ export default function (server: Server, ctx: AppContext) {
|
|
18
18
|
calcKey: ({ auth }) => auth.credentials.did,
|
19
19
|
},
|
20
20
|
],
|
21
|
-
auth: ctx.authVerifier.
|
21
|
+
auth: ctx.authVerifier.authorization({
|
22
|
+
checkTakedown: true,
|
23
|
+
authorize: (permissions) => {
|
24
|
+
permissions.assertAccount({ attr: 'email', action: 'manage' })
|
25
|
+
},
|
26
|
+
}),
|
22
27
|
handler: async ({ auth, req }) => {
|
23
28
|
const did = auth.credentials.did
|
24
29
|
const account = await ctx.accountManager.getAccount(did, {
|
@@ -19,7 +19,12 @@ export default function (server: Server, ctx: AppContext) {
|
|
19
19
|
calcKey: ({ auth }) => auth.credentials.did,
|
20
20
|
},
|
21
21
|
],
|
22
|
-
auth: ctx.authVerifier.
|
22
|
+
auth: ctx.authVerifier.authorization({
|
23
|
+
checkTakedown: true,
|
24
|
+
authorize: (permissions) => {
|
25
|
+
permissions.assertAccount({ attr: 'email', action: 'manage' })
|
26
|
+
},
|
27
|
+
}),
|
23
28
|
handler: async ({ auth, req }) => {
|
24
29
|
const did = auth.credentials.did
|
25
30
|
const account = await ctx.accountManager.getAccount(did, {
|
@@ -1,10 +1,17 @@
|
|
1
|
+
import { ForbiddenError } from '@atproto/xrpc-server'
|
1
2
|
import { AppContext } from '../../../../context'
|
2
3
|
import { Server } from '../../../../lexicon'
|
3
4
|
import { ids } from '../../../../lexicon/lexicons'
|
4
5
|
|
5
6
|
export default function (server: Server, ctx: AppContext) {
|
6
7
|
server.com.atproto.server.revokeAppPassword({
|
7
|
-
auth: ctx.authVerifier.
|
8
|
+
auth: ctx.authVerifier.authorization({
|
9
|
+
authorize: () => {
|
10
|
+
throw new ForbiddenError(
|
11
|
+
'OAuth credentials are not supported for this endpoint',
|
12
|
+
)
|
13
|
+
},
|
14
|
+
}),
|
8
15
|
handler: async ({ auth, input, req }) => {
|
9
16
|
if (ctx.entrywayAgent) {
|
10
17
|
await ctx.entrywayAgent.com.atproto.server.revokeAppPassword(
|
@@ -1,14 +1,23 @@
|
|
1
1
|
import { isEmailValid } from '@hapi/address'
|
2
2
|
import { isDisposableEmail } from 'disposable-email-domains-js'
|
3
|
-
import { InvalidRequestError } from '@atproto/xrpc-server'
|
3
|
+
import { ForbiddenError, InvalidRequestError } from '@atproto/xrpc-server'
|
4
4
|
import { UserAlreadyExistsError } from '../../../../account-manager/helpers/account'
|
5
|
+
import { ACCESS_FULL } from '../../../../auth-scope'
|
5
6
|
import { AppContext } from '../../../../context'
|
6
7
|
import { Server } from '../../../../lexicon'
|
7
8
|
import { ids } from '../../../../lexicon/lexicons'
|
8
9
|
|
9
10
|
export default function (server: Server, ctx: AppContext) {
|
10
11
|
server.com.atproto.server.updateEmail({
|
11
|
-
auth: ctx.authVerifier.
|
12
|
+
auth: ctx.authVerifier.authorization({
|
13
|
+
checkTakedown: true,
|
14
|
+
scopes: ACCESS_FULL,
|
15
|
+
authorize: () => {
|
16
|
+
throw new ForbiddenError(
|
17
|
+
'OAuth credentials are not supported for this endpoint',
|
18
|
+
)
|
19
|
+
},
|
20
|
+
}),
|
12
21
|
handler: async ({ auth, input, req }) => {
|
13
22
|
const did = auth.credentials.did
|
14
23
|
const { token, email } = input.body
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { isUserOrAdmin } from '../../../../../auth-verifier'
|
1
2
|
import { AppContext } from '../../../../../context'
|
2
3
|
import { Server } from '../../../../../lexicon'
|
3
4
|
import { getCarStream } from '../getRepo'
|
@@ -5,14 +6,14 @@ import { assertRepoAvailability } from '../util'
|
|
5
6
|
|
6
7
|
export default function (server: Server, ctx: AppContext) {
|
7
8
|
server.com.atproto.sync.getCheckout({
|
8
|
-
auth: ctx.authVerifier.
|
9
|
+
auth: ctx.authVerifier.authorizationOrAdminTokenOptional({
|
10
|
+
authorize: () => {
|
11
|
+
// always allow
|
12
|
+
},
|
13
|
+
}),
|
9
14
|
handler: async ({ params, auth }) => {
|
10
15
|
const { did } = params
|
11
|
-
await assertRepoAvailability(
|
12
|
-
ctx,
|
13
|
-
did,
|
14
|
-
ctx.authVerifier.isUserOrAdmin(auth, did),
|
15
|
-
)
|
16
|
+
await assertRepoAvailability(ctx, did, isUserOrAdmin(auth, did))
|
16
17
|
|
17
18
|
const carStream = await getCarStream(ctx, did)
|
18
19
|
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
2
|
+
import { isUserOrAdmin } from '../../../../../auth-verifier'
|
2
3
|
import { AppContext } from '../../../../../context'
|
3
4
|
import { Server } from '../../../../../lexicon'
|
4
5
|
import { assertRepoAvailability } from '../util'
|
5
6
|
|
6
7
|
export default function (server: Server, ctx: AppContext) {
|
7
8
|
server.com.atproto.sync.getHead({
|
8
|
-
auth: ctx.authVerifier.
|
9
|
+
auth: ctx.authVerifier.authorizationOrAdminTokenOptional({
|
10
|
+
authorize: () => {
|
11
|
+
// always allow
|
12
|
+
},
|
13
|
+
}),
|
9
14
|
handler: async ({ params, auth }) => {
|
10
15
|
const { did } = params
|
11
|
-
await assertRepoAvailability(
|
12
|
-
ctx,
|
13
|
-
did,
|
14
|
-
ctx.authVerifier.isUserOrAdmin(auth, did),
|
15
|
-
)
|
16
|
+
await assertRepoAvailability(ctx, did, isUserOrAdmin(auth, did))
|
16
17
|
|
17
18
|
const root = await ctx.actorStore.read(did, (store) =>
|
18
19
|
store.repo.storage.getRoot(),
|
@@ -1,23 +1,23 @@
|
|
1
1
|
import { CID } from 'multiformats/cid'
|
2
2
|
import { BlobNotFoundError } from '@atproto/repo'
|
3
3
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
4
|
-
import { AuthScope } from '../../../../auth-
|
4
|
+
import { AuthScope } from '../../../../auth-scope'
|
5
|
+
import { isUserOrAdmin } from '../../../../auth-verifier'
|
5
6
|
import { AppContext } from '../../../../context'
|
6
7
|
import { Server } from '../../../../lexicon'
|
7
8
|
import { assertRepoAvailability } from './util'
|
8
9
|
|
9
10
|
export default function (server: Server, ctx: AppContext) {
|
10
11
|
server.com.atproto.sync.getBlob({
|
11
|
-
auth: ctx.authVerifier.
|
12
|
+
auth: ctx.authVerifier.authorizationOrAdminTokenOptional({
|
12
13
|
additional: [AuthScope.Takendown],
|
14
|
+
authorize: () => {
|
15
|
+
// always allow
|
16
|
+
},
|
13
17
|
}),
|
14
18
|
handler: async ({ params, res, auth }) => {
|
15
19
|
const { did } = params
|
16
|
-
await assertRepoAvailability(
|
17
|
-
ctx,
|
18
|
-
did,
|
19
|
-
ctx.authVerifier.isUserOrAdmin(auth, did),
|
20
|
-
)
|
20
|
+
await assertRepoAvailability(ctx, did, isUserOrAdmin(auth, did))
|
21
21
|
|
22
22
|
const cid = CID.parse(params.cid)
|
23
23
|
const found = await ctx.actorStore.read(params.did, async (store) => {
|
@@ -2,20 +2,21 @@ import { CID } from 'multiformats/cid'
|
|
2
2
|
import { byteIterableToStream } from '@atproto/common'
|
3
3
|
import { blocksToCarStream } from '@atproto/repo'
|
4
4
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
5
|
+
import { isUserOrAdmin } from '../../../../auth-verifier'
|
5
6
|
import { AppContext } from '../../../../context'
|
6
7
|
import { Server } from '../../../../lexicon'
|
7
8
|
import { assertRepoAvailability } from './util'
|
8
9
|
|
9
10
|
export default function (server: Server, ctx: AppContext) {
|
10
11
|
server.com.atproto.sync.getBlocks({
|
11
|
-
auth: ctx.authVerifier.
|
12
|
+
auth: ctx.authVerifier.authorizationOrAdminTokenOptional({
|
13
|
+
authorize: () => {
|
14
|
+
// always allow
|
15
|
+
},
|
16
|
+
}),
|
12
17
|
handler: async ({ params, auth }) => {
|
13
18
|
const { did } = params
|
14
|
-
await assertRepoAvailability(
|
15
|
-
ctx,
|
16
|
-
did,
|
17
|
-
ctx.authVerifier.isUserOrAdmin(auth, did),
|
18
|
-
)
|
19
|
+
await assertRepoAvailability(ctx, did, isUserOrAdmin(auth, did))
|
19
20
|
|
20
21
|
const cids = params.cids.map((c) => CID.parse(c))
|
21
22
|
const got = await ctx.actorStore.read(did, (store) =>
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
2
|
+
import { isUserOrAdmin } from '../../../../auth-verifier'
|
2
3
|
import { AppContext } from '../../../../context'
|
3
4
|
import { Server } from '../../../../lexicon'
|
4
5
|
import { assertRepoAvailability } from './util'
|
5
6
|
|
6
7
|
export default function (server: Server, ctx: AppContext) {
|
7
8
|
server.com.atproto.sync.getLatestCommit({
|
8
|
-
auth: ctx.authVerifier.
|
9
|
+
auth: ctx.authVerifier.authorizationOrAdminTokenOptional({
|
10
|
+
authorize: () => {
|
11
|
+
// always allow
|
12
|
+
},
|
13
|
+
}),
|
9
14
|
handler: async ({ params, auth }) => {
|
10
15
|
const { did } = params
|
11
|
-
await assertRepoAvailability(
|
12
|
-
ctx,
|
13
|
-
did,
|
14
|
-
ctx.authVerifier.isUserOrAdmin(auth, did),
|
15
|
-
)
|
16
|
+
await assertRepoAvailability(ctx, did, isUserOrAdmin(auth, did))
|
16
17
|
|
17
18
|
const root = await ctx.actorStore.read(did, (store) =>
|
18
19
|
store.repo.storage.getRootDetailed(),
|
@@ -3,20 +3,21 @@ import { byteIterableToStream } from '@atproto/common'
|
|
3
3
|
import * as repo from '@atproto/repo'
|
4
4
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
5
5
|
import { SqlRepoReader } from '../../../../actor-store/repo/sql-repo-reader'
|
6
|
+
import { isUserOrAdmin } from '../../../../auth-verifier'
|
6
7
|
import { AppContext } from '../../../../context'
|
7
8
|
import { Server } from '../../../../lexicon'
|
8
9
|
import { assertRepoAvailability } from './util'
|
9
10
|
|
10
11
|
export default function (server: Server, ctx: AppContext) {
|
11
12
|
server.com.atproto.sync.getRecord({
|
12
|
-
auth: ctx.authVerifier.
|
13
|
+
auth: ctx.authVerifier.authorizationOrAdminTokenOptional({
|
14
|
+
authorize: () => {
|
15
|
+
// always allow
|
16
|
+
},
|
17
|
+
}),
|
13
18
|
handler: async ({ params, auth }) => {
|
14
19
|
const { did, collection, rkey } = params
|
15
|
-
await assertRepoAvailability(
|
16
|
-
ctx,
|
17
|
-
did,
|
18
|
-
ctx.authVerifier.isUserOrAdmin(auth, did),
|
19
|
-
)
|
20
|
+
await assertRepoAvailability(ctx, did, isUserOrAdmin(auth, did))
|
20
21
|
|
21
22
|
// must open up the db outside of store interface so that we can close the file handle after finished streaming
|
22
23
|
const actorDb = await ctx.actorStore.openDb(did)
|
@@ -5,23 +5,23 @@ import {
|
|
5
5
|
RepoRootNotFoundError,
|
6
6
|
SqlRepoReader,
|
7
7
|
} from '../../../../actor-store/repo/sql-repo-reader'
|
8
|
-
import { AuthScope } from '../../../../auth-
|
8
|
+
import { AuthScope } from '../../../../auth-scope'
|
9
|
+
import { isUserOrAdmin } from '../../../../auth-verifier'
|
9
10
|
import { AppContext } from '../../../../context'
|
10
11
|
import { Server } from '../../../../lexicon'
|
11
12
|
import { assertRepoAvailability } from './util'
|
12
13
|
|
13
14
|
export default function (server: Server, ctx: AppContext) {
|
14
15
|
server.com.atproto.sync.getRepo({
|
15
|
-
auth: ctx.authVerifier.
|
16
|
+
auth: ctx.authVerifier.authorizationOrAdminTokenOptional({
|
16
17
|
additional: [AuthScope.Takendown],
|
18
|
+
authorize: () => {
|
19
|
+
// always allow
|
20
|
+
},
|
17
21
|
}),
|
18
22
|
handler: async ({ params, auth }) => {
|
19
23
|
const { did, since } = params
|
20
|
-
await assertRepoAvailability(
|
21
|
-
ctx,
|
22
|
-
did,
|
23
|
-
ctx.authVerifier.isUserOrAdmin(auth, did),
|
24
|
-
)
|
24
|
+
await assertRepoAvailability(ctx, did, isUserOrAdmin(auth, did))
|
25
25
|
|
26
26
|
const carStream = await getCarStream(ctx, did, since)
|
27
27
|
|
@@ -1,20 +1,20 @@
|
|
1
|
-
import { AuthScope } from '../../../../auth-
|
1
|
+
import { AuthScope } from '../../../../auth-scope'
|
2
|
+
import { isUserOrAdmin } from '../../../../auth-verifier'
|
2
3
|
import { AppContext } from '../../../../context'
|
3
4
|
import { Server } from '../../../../lexicon'
|
4
5
|
import { assertRepoAvailability } from './util'
|
5
6
|
|
6
7
|
export default function (server: Server, ctx: AppContext) {
|
7
8
|
server.com.atproto.sync.listBlobs({
|
8
|
-
auth: ctx.authVerifier.
|
9
|
+
auth: ctx.authVerifier.authorizationOrAdminTokenOptional({
|
9
10
|
additional: [AuthScope.Takendown],
|
11
|
+
authorize: () => {
|
12
|
+
// always allow
|
13
|
+
},
|
10
14
|
}),
|
11
15
|
handler: async ({ params, auth }) => {
|
12
16
|
const { did, since, limit, cursor } = params
|
13
|
-
await assertRepoAvailability(
|
14
|
-
ctx,
|
15
|
-
did,
|
16
|
-
ctx.authVerifier.isUserOrAdmin(auth, did),
|
17
|
-
)
|
17
|
+
await assertRepoAvailability(ctx, did, isUserOrAdmin(auth, did))
|
18
18
|
|
19
19
|
const blobCids = await ctx.actorStore.read(did, (store) =>
|
20
20
|
store.repo.blob.listBlobs({ since, limit, cursor }),
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { ForbiddenError } from '@atproto/xrpc-server'
|
2
|
+
import { AuthScope } from '../../../../auth-scope'
|
2
3
|
import { AppContext } from '../../../../context'
|
3
4
|
import { Server } from '../../../../lexicon'
|
4
5
|
import { resultPassthru } from '../../../proxy'
|
@@ -6,8 +7,13 @@ import { resultPassthru } from '../../../proxy'
|
|
6
7
|
// THIS IS A TEMPORARY UNSPECCED ROUTE
|
7
8
|
export default function (server: Server, ctx: AppContext) {
|
8
9
|
server.com.atproto.temp.checkSignupQueue({
|
9
|
-
auth: ctx.authVerifier.
|
10
|
+
auth: ctx.authVerifier.authorization({
|
10
11
|
additional: [AuthScope.SignupQueued],
|
12
|
+
authorize: () => {
|
13
|
+
throw new ForbiddenError(
|
14
|
+
'OAuth credentials are not supported for this endpoint',
|
15
|
+
)
|
16
|
+
},
|
11
17
|
}),
|
12
18
|
handler: async ({ req }) => {
|
13
19
|
if (!ctx.entrywayAgent) {
|