@atproto/ozone 0.1.107 → 0.1.108
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 +10 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +6 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/server/getConfig.d.ts.map +1 -1
- package/dist/api/server/getConfig.js +1 -0
- package/dist/api/server/getConfig.js.map +1 -1
- package/dist/api/setting/removeOptions.d.ts.map +1 -1
- package/dist/api/setting/removeOptions.js +1 -0
- package/dist/api/setting/removeOptions.js.map +1 -1
- package/dist/api/setting/upsertOption.js +7 -0
- package/dist/api/setting/upsertOption.js.map +1 -1
- package/dist/api/util.d.ts +1 -1
- package/dist/api/util.d.ts.map +1 -1
- package/dist/api/util.js +6 -1
- package/dist/api/util.js.map +1 -1
- package/dist/api/verification/grantVerifications.d.ts +4 -0
- package/dist/api/verification/grantVerifications.d.ts.map +1 -0
- package/dist/api/verification/grantVerifications.js +52 -0
- package/dist/api/verification/grantVerifications.js.map +1 -0
- package/dist/api/verification/listVerifications.d.ts +4 -0
- package/dist/api/verification/listVerifications.d.ts.map +1 -0
- package/dist/api/verification/listVerifications.js +32 -0
- package/dist/api/verification/listVerifications.js.map +1 -0
- package/dist/api/verification/revokeVerifications.d.ts +4 -0
- package/dist/api/verification/revokeVerifications.d.ts.map +1 -0
- package/dist/api/verification/revokeVerifications.js +36 -0
- package/dist/api/verification/revokeVerifications.js.map +1 -0
- package/dist/auth-verifier.d.ts +4 -1
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +4 -3
- package/dist/auth-verifier.js.map +1 -1
- package/dist/background.d.ts +3 -1
- package/dist/background.d.ts.map +1 -1
- package/dist/background.js +3 -2
- package/dist/background.js.map +1 -1
- package/dist/config/config.d.ts +9 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +10 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +5 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +5 -0
- package/dist/config/env.js.map +1 -1
- package/dist/context.d.ts +6 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +12 -0
- package/dist/context.js.map +1 -1
- package/dist/daemon/context.d.ts +3 -0
- package/dist/daemon/context.d.ts.map +1 -1
- package/dist/daemon/context.js +11 -0
- package/dist/daemon/context.js.map +1 -1
- package/dist/daemon/verification-listener.d.ts +29 -0
- package/dist/daemon/verification-listener.d.ts.map +1 -0
- package/dist/daemon/verification-listener.js +171 -0
- package/dist/daemon/verification-listener.js.map +1 -0
- package/dist/db/migrations/20250415T201720309Z-verification.d.ts +4 -0
- package/dist/db/migrations/20250415T201720309Z-verification.d.ts.map +1 -0
- package/dist/db/migrations/20250415T201720309Z-verification.js +35 -0
- package/dist/db/migrations/20250415T201720309Z-verification.js.map +1 -0
- package/dist/db/migrations/20250417T201720309Z-firehose-cursor.d.ts +4 -0
- package/dist/db/migrations/20250417T201720309Z-firehose-cursor.d.ts.map +1 -0
- package/dist/db/migrations/20250417T201720309Z-firehose-cursor.js +17 -0
- package/dist/db/migrations/20250417T201720309Z-firehose-cursor.js.map +1 -0
- package/dist/db/migrations/index.d.ts +2 -0
- package/dist/db/migrations/index.d.ts.map +1 -1
- package/dist/db/migrations/index.js +3 -1
- package/dist/db/migrations/index.js.map +1 -1
- package/dist/db/pagination.d.ts +15 -0
- package/dist/db/pagination.d.ts.map +1 -1
- package/dist/db/pagination.js +23 -1
- package/dist/db/pagination.js.map +1 -1
- package/dist/db/schema/firehose_cursor.d.ts +11 -0
- package/dist/db/schema/firehose_cursor.d.ts.map +1 -0
- package/dist/db/schema/firehose_cursor.js +5 -0
- package/dist/db/schema/firehose_cursor.js.map +1 -0
- package/dist/db/schema/index.d.ts +3 -1
- package/dist/db/schema/index.d.ts.map +1 -1
- package/dist/db/schema/member.d.ts +1 -1
- package/dist/db/schema/member.d.ts.map +1 -1
- package/dist/db/schema/verification.d.ts +19 -0
- package/dist/db/schema/verification.d.ts.map +1 -0
- package/dist/db/schema/verification.js +5 -0
- package/dist/db/schema/verification.js.map +1 -0
- package/dist/jetstream/service.d.ts +64 -0
- package/dist/jetstream/service.d.ts.map +1 -0
- package/dist/jetstream/service.js +65 -0
- package/dist/jetstream/service.js.map +1 -0
- package/dist/lexicon/index.d.ts +12 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +33 -1
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +672 -12
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +353 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/server/getConfig.d.ts +3 -1
- package/dist/lexicon/types/tools/ozone/server/getConfig.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/server/getConfig.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/setting/defs.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/setting/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/setting/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/setting/upsertOption.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/setting/upsertOption.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/addMember.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/team/addMember.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/defs.d.ts +3 -1
- package/dist/lexicon/types/tools/ozone/team/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/defs.js +3 -1
- package/dist/lexicon/types/tools/ozone/team/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/updateMember.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/team/updateMember.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/verification/defs.d.ts +43 -0
- package/dist/lexicon/types/tools/ozone/verification/defs.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/defs.js +16 -0
- package/dist/lexicon/types/tools/ozone/verification/defs.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/grantVerifications.d.ts +66 -0
- package/dist/lexicon/types/tools/ozone/verification/grantVerifications.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/grantVerifications.js +25 -0
- package/dist/lexicon/types/tools/ozone/verification/grantVerifications.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/listVerifications.d.ts +52 -0
- package/dist/lexicon/types/tools/ozone/verification/listVerifications.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/listVerifications.js +7 -0
- package/dist/lexicon/types/tools/ozone/verification/listVerifications.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/revokeVerifications.d.ts +56 -0
- package/dist/lexicon/types/tools/ozone/verification/revokeVerifications.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/verification/revokeVerifications.js +16 -0
- package/dist/lexicon/types/tools/ozone/verification/revokeVerifications.js.map +1 -0
- package/dist/logger.d.ts +1 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +2 -1
- package/dist/logger.js.map +1 -1
- package/dist/mod-service/status.d.ts +6 -0
- package/dist/mod-service/status.d.ts.map +1 -1
- package/dist/team/index.d.ts +1 -0
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/index.js +3 -0
- package/dist/team/index.js.map +1 -1
- package/dist/verification/issuer.d.ts +37 -0
- package/dist/verification/issuer.d.ts.map +1 -0
- package/dist/verification/issuer.js +119 -0
- package/dist/verification/issuer.js.map +1 -0
- package/dist/verification/service.d.ts +47 -0
- package/dist/verification/service.d.ts.map +1 -0
- package/dist/verification/service.js +141 -0
- package/dist/verification/service.js.map +1 -0
- package/dist/verification/util.d.ts +6 -0
- package/dist/verification/util.d.ts.map +1 -0
- package/dist/verification/util.js +32 -0
- package/dist/verification/util.js.map +1 -0
- package/package.json +5 -4
- package/src/api/index.ts +6 -0
- package/src/api/server/getConfig.ts +1 -0
- package/src/api/setting/removeOptions.ts +1 -0
- package/src/api/setting/upsertOption.ts +7 -0
- package/src/api/util.ts +7 -1
- package/src/api/verification/grantVerifications.ts +74 -0
- package/src/api/verification/listVerifications.ts +44 -0
- package/src/api/verification/revokeVerifications.ts +43 -0
- package/src/auth-verifier.ts +8 -4
- package/src/background.ts +7 -2
- package/src/config/config.ts +21 -0
- package/src/config/env.ts +10 -0
- package/src/context.ts +22 -0
- package/src/daemon/context.ts +19 -0
- package/src/daemon/verification-listener.ts +164 -0
- package/src/db/migrations/20250415T201720309Z-verification.ts +34 -0
- package/src/db/migrations/20250417T201720309Z-firehose-cursor.ts +16 -0
- package/src/db/migrations/index.ts +2 -0
- package/src/db/pagination.ts +31 -0
- package/src/db/schema/firehose_cursor.ts +13 -0
- package/src/db/schema/index.ts +5 -1
- package/src/db/schema/member.ts +1 -0
- package/src/db/schema/verification.ts +21 -0
- package/src/jetstream/service.ts +110 -0
- package/src/lexicon/index.ts +47 -0
- package/src/lexicon/lexicons.ts +372 -0
- package/src/lexicon/types/tools/ozone/server/getConfig.ts +3 -0
- package/src/lexicon/types/tools/ozone/setting/defs.ts +1 -0
- package/src/lexicon/types/tools/ozone/setting/upsertOption.ts +1 -0
- package/src/lexicon/types/tools/ozone/team/addMember.ts +1 -0
- package/src/lexicon/types/tools/ozone/team/defs.ts +3 -0
- package/src/lexicon/types/tools/ozone/team/updateMember.ts +1 -0
- package/src/lexicon/types/tools/ozone/verification/defs.ts +59 -0
- package/src/lexicon/types/tools/ozone/verification/grantVerifications.ts +100 -0
- package/src/lexicon/types/tools/ozone/verification/listVerifications.ts +70 -0
- package/src/lexicon/types/tools/ozone/verification/revokeVerifications.ts +81 -0
- package/src/logger.ts +2 -0
- package/src/team/index.ts +4 -0
- package/src/verification/issuer.ts +135 -0
- package/src/verification/service.ts +208 -0
- package/src/verification/util.ts +50 -0
- package/tests/__snapshots__/verification-listener.test.ts.snap +146 -0
- package/tests/__snapshots__/verification.test.ts.snap +288 -0
- package/tests/verification-listener.test.ts +102 -0
- package/tests/verification.test.ts +136 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.tsbuildinfo +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`verification-listener indexes new and revoked verifications 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
Object {
|
|
6
|
+
"$type": "tools.ozone.verification.defs#verificationView",
|
|
7
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
8
|
+
"displayName": "Alice",
|
|
9
|
+
"handle": "alice.test",
|
|
10
|
+
"issuer": "user(0)",
|
|
11
|
+
"issuerProfile": Object {
|
|
12
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
13
|
+
"associated": Object {
|
|
14
|
+
"feedgens": 0,
|
|
15
|
+
"labeler": false,
|
|
16
|
+
"lists": 0,
|
|
17
|
+
"starterPacks": 0,
|
|
18
|
+
},
|
|
19
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(3)/cids(0)@jpeg",
|
|
20
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
21
|
+
"description": "hi im bob label_me",
|
|
22
|
+
"did": "user(0)",
|
|
23
|
+
"displayName": "bobby",
|
|
24
|
+
"followersCount": 2,
|
|
25
|
+
"followsCount": 2,
|
|
26
|
+
"handle": "bob.test",
|
|
27
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
28
|
+
"labels": Array [],
|
|
29
|
+
"postsCount": 3,
|
|
30
|
+
"viewer": Object {
|
|
31
|
+
"blockedBy": false,
|
|
32
|
+
"muted": false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
"issuerRepo": Object {
|
|
36
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
37
|
+
"did": "user(0)",
|
|
38
|
+
"email": "bob@test.com",
|
|
39
|
+
"handle": "bob.test",
|
|
40
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
41
|
+
"invites": Array [],
|
|
42
|
+
"invitesDisabled": false,
|
|
43
|
+
"labels": Array [],
|
|
44
|
+
"moderation": Object {},
|
|
45
|
+
"relatedRecords": Array [
|
|
46
|
+
Object {
|
|
47
|
+
"$type": "app.bsky.actor.profile",
|
|
48
|
+
"avatar": Object {
|
|
49
|
+
"$type": "blob",
|
|
50
|
+
"mimeType": "image/jpeg",
|
|
51
|
+
"ref": Object {
|
|
52
|
+
"$link": "cids(0)",
|
|
53
|
+
},
|
|
54
|
+
"size": 3976,
|
|
55
|
+
},
|
|
56
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
57
|
+
"description": "hi im bob label_me",
|
|
58
|
+
"displayName": "bobby",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
"revokedAt": "1970-01-01T00:00:00.000Z",
|
|
63
|
+
"revokedBy": "user(0)",
|
|
64
|
+
"subject": "user(1)",
|
|
65
|
+
"subjectProfile": Object {
|
|
66
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
67
|
+
"associated": Object {
|
|
68
|
+
"feedgens": 0,
|
|
69
|
+
"labeler": false,
|
|
70
|
+
"lists": 0,
|
|
71
|
+
"starterPacks": 0,
|
|
72
|
+
},
|
|
73
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(2)/cids(0)@jpeg",
|
|
74
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
75
|
+
"description": "its me!",
|
|
76
|
+
"did": "user(1)",
|
|
77
|
+
"displayName": "ali",
|
|
78
|
+
"followersCount": 2,
|
|
79
|
+
"followsCount": 3,
|
|
80
|
+
"handle": "alice.test",
|
|
81
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
82
|
+
"labels": Array [
|
|
83
|
+
Object {
|
|
84
|
+
"cid": "cids(1)",
|
|
85
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
86
|
+
"src": "user(1)",
|
|
87
|
+
"uri": "record(1)",
|
|
88
|
+
"val": "self-label-a",
|
|
89
|
+
},
|
|
90
|
+
Object {
|
|
91
|
+
"cid": "cids(1)",
|
|
92
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
93
|
+
"src": "user(1)",
|
|
94
|
+
"uri": "record(1)",
|
|
95
|
+
"val": "self-label-b",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
"postsCount": 4,
|
|
99
|
+
"viewer": Object {
|
|
100
|
+
"blockedBy": false,
|
|
101
|
+
"muted": false,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
"subjectRepo": Object {
|
|
105
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
106
|
+
"did": "user(1)",
|
|
107
|
+
"email": "alice@test.com",
|
|
108
|
+
"handle": "alice.test",
|
|
109
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
110
|
+
"invites": Array [],
|
|
111
|
+
"invitesDisabled": false,
|
|
112
|
+
"labels": Array [],
|
|
113
|
+
"moderation": Object {},
|
|
114
|
+
"relatedRecords": Array [
|
|
115
|
+
Object {
|
|
116
|
+
"$type": "app.bsky.actor.profile",
|
|
117
|
+
"avatar": Object {
|
|
118
|
+
"$type": "blob",
|
|
119
|
+
"mimeType": "image/jpeg",
|
|
120
|
+
"ref": Object {
|
|
121
|
+
"$link": "cids(0)",
|
|
122
|
+
},
|
|
123
|
+
"size": 3976,
|
|
124
|
+
},
|
|
125
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
126
|
+
"description": "its me!",
|
|
127
|
+
"displayName": "ali",
|
|
128
|
+
"labels": Object {
|
|
129
|
+
"$type": "com.atproto.label.defs#selfLabels",
|
|
130
|
+
"values": Array [
|
|
131
|
+
Object {
|
|
132
|
+
"val": "self-label-a",
|
|
133
|
+
},
|
|
134
|
+
Object {
|
|
135
|
+
"val": "self-label-b",
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
"updatedAt": "1970-01-01T00:00:00.000Z",
|
|
143
|
+
"uri": "record(0)",
|
|
144
|
+
},
|
|
145
|
+
]
|
|
146
|
+
`;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`verification list returns paginated list of verifications 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"$type": "tools.ozone.verification.defs#verificationView",
|
|
6
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
7
|
+
"displayName": "bobby",
|
|
8
|
+
"handle": "bob.test",
|
|
9
|
+
"issuer": "user(0)",
|
|
10
|
+
"issuerProfile": Object {
|
|
11
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
12
|
+
"associated": Object {
|
|
13
|
+
"feedgens": 0,
|
|
14
|
+
"labeler": false,
|
|
15
|
+
"lists": 0,
|
|
16
|
+
"starterPacks": 0,
|
|
17
|
+
},
|
|
18
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(3)/cids(0)@jpeg",
|
|
19
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
20
|
+
"description": "its me!",
|
|
21
|
+
"did": "user(0)",
|
|
22
|
+
"displayName": "ali",
|
|
23
|
+
"followersCount": 2,
|
|
24
|
+
"followsCount": 3,
|
|
25
|
+
"handle": "alice.test",
|
|
26
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
27
|
+
"labels": Array [
|
|
28
|
+
Object {
|
|
29
|
+
"cid": "cids(1)",
|
|
30
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
31
|
+
"src": "user(0)",
|
|
32
|
+
"uri": "record(1)",
|
|
33
|
+
"val": "self-label-a",
|
|
34
|
+
},
|
|
35
|
+
Object {
|
|
36
|
+
"cid": "cids(1)",
|
|
37
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
38
|
+
"src": "user(0)",
|
|
39
|
+
"uri": "record(1)",
|
|
40
|
+
"val": "self-label-b",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
"postsCount": 4,
|
|
44
|
+
"verification": Object {
|
|
45
|
+
"trustedVerifierStatus": "valid",
|
|
46
|
+
"verifications": Array [],
|
|
47
|
+
"verifiedStatus": "none",
|
|
48
|
+
},
|
|
49
|
+
"viewer": Object {
|
|
50
|
+
"blockedBy": false,
|
|
51
|
+
"muted": false,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
"issuerRepo": Object {
|
|
55
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
56
|
+
"did": "user(0)",
|
|
57
|
+
"email": "alice@test.com",
|
|
58
|
+
"handle": "alice.test",
|
|
59
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
60
|
+
"invites": Array [],
|
|
61
|
+
"invitesDisabled": false,
|
|
62
|
+
"labels": Array [],
|
|
63
|
+
"moderation": Object {},
|
|
64
|
+
"relatedRecords": Array [
|
|
65
|
+
Object {
|
|
66
|
+
"$type": "app.bsky.actor.profile",
|
|
67
|
+
"avatar": Object {
|
|
68
|
+
"$type": "blob",
|
|
69
|
+
"mimeType": "image/jpeg",
|
|
70
|
+
"ref": Object {
|
|
71
|
+
"$link": "cids(0)",
|
|
72
|
+
},
|
|
73
|
+
"size": 3976,
|
|
74
|
+
},
|
|
75
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
76
|
+
"description": "its me!",
|
|
77
|
+
"displayName": "ali",
|
|
78
|
+
"labels": Object {
|
|
79
|
+
"$type": "com.atproto.label.defs#selfLabels",
|
|
80
|
+
"values": Array [
|
|
81
|
+
Object {
|
|
82
|
+
"val": "self-label-a",
|
|
83
|
+
},
|
|
84
|
+
Object {
|
|
85
|
+
"val": "self-label-b",
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
"subject": "user(1)",
|
|
93
|
+
"subjectProfile": Object {
|
|
94
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
95
|
+
"associated": Object {
|
|
96
|
+
"feedgens": 0,
|
|
97
|
+
"labeler": false,
|
|
98
|
+
"lists": 0,
|
|
99
|
+
"starterPacks": 0,
|
|
100
|
+
},
|
|
101
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(2)/cids(0)@jpeg",
|
|
102
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
103
|
+
"description": "hi im bob label_me",
|
|
104
|
+
"did": "user(1)",
|
|
105
|
+
"displayName": "bobby",
|
|
106
|
+
"followersCount": 2,
|
|
107
|
+
"followsCount": 2,
|
|
108
|
+
"handle": "bob.test",
|
|
109
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
110
|
+
"labels": Array [],
|
|
111
|
+
"postsCount": 3,
|
|
112
|
+
"verification": Object {
|
|
113
|
+
"trustedVerifierStatus": "none",
|
|
114
|
+
"verifications": Array [
|
|
115
|
+
Object {
|
|
116
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
117
|
+
"isValid": true,
|
|
118
|
+
"issuer": "user(0)",
|
|
119
|
+
"uri": "record(0)",
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
"verifiedStatus": "valid",
|
|
123
|
+
},
|
|
124
|
+
"viewer": Object {
|
|
125
|
+
"blockedBy": false,
|
|
126
|
+
"muted": false,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
"subjectRepo": Object {
|
|
130
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
131
|
+
"did": "user(1)",
|
|
132
|
+
"email": "bob@test.com",
|
|
133
|
+
"handle": "bob.test",
|
|
134
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
135
|
+
"invites": Array [],
|
|
136
|
+
"invitesDisabled": false,
|
|
137
|
+
"labels": Array [],
|
|
138
|
+
"moderation": Object {},
|
|
139
|
+
"relatedRecords": Array [
|
|
140
|
+
Object {
|
|
141
|
+
"$type": "app.bsky.actor.profile",
|
|
142
|
+
"avatar": Object {
|
|
143
|
+
"$type": "blob",
|
|
144
|
+
"mimeType": "image/jpeg",
|
|
145
|
+
"ref": Object {
|
|
146
|
+
"$link": "cids(0)",
|
|
147
|
+
},
|
|
148
|
+
"size": 3976,
|
|
149
|
+
},
|
|
150
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
151
|
+
"description": "hi im bob label_me",
|
|
152
|
+
"displayName": "bobby",
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
"updatedAt": "1970-01-01T00:00:00.000Z",
|
|
157
|
+
"uri": "record(0)",
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
|
|
161
|
+
exports[`verification list returns paginated list of verifications 2`] = `
|
|
162
|
+
Object {
|
|
163
|
+
"$type": "tools.ozone.verification.defs#verificationView",
|
|
164
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
165
|
+
"displayName": "",
|
|
166
|
+
"handle": "carol.test",
|
|
167
|
+
"issuer": "user(0)",
|
|
168
|
+
"issuerProfile": Object {
|
|
169
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
170
|
+
"associated": Object {
|
|
171
|
+
"feedgens": 0,
|
|
172
|
+
"labeler": false,
|
|
173
|
+
"lists": 0,
|
|
174
|
+
"starterPacks": 0,
|
|
175
|
+
},
|
|
176
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(2)/cids(0)@jpeg",
|
|
177
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
178
|
+
"description": "its me!",
|
|
179
|
+
"did": "user(0)",
|
|
180
|
+
"displayName": "ali",
|
|
181
|
+
"followersCount": 2,
|
|
182
|
+
"followsCount": 3,
|
|
183
|
+
"handle": "alice.test",
|
|
184
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
185
|
+
"labels": Array [
|
|
186
|
+
Object {
|
|
187
|
+
"cid": "cids(1)",
|
|
188
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
189
|
+
"src": "user(0)",
|
|
190
|
+
"uri": "record(1)",
|
|
191
|
+
"val": "self-label-a",
|
|
192
|
+
},
|
|
193
|
+
Object {
|
|
194
|
+
"cid": "cids(1)",
|
|
195
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
196
|
+
"src": "user(0)",
|
|
197
|
+
"uri": "record(1)",
|
|
198
|
+
"val": "self-label-b",
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
"postsCount": 4,
|
|
202
|
+
"verification": Object {
|
|
203
|
+
"trustedVerifierStatus": "valid",
|
|
204
|
+
"verifications": Array [],
|
|
205
|
+
"verifiedStatus": "none",
|
|
206
|
+
},
|
|
207
|
+
"viewer": Object {
|
|
208
|
+
"blockedBy": false,
|
|
209
|
+
"muted": false,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
"issuerRepo": Object {
|
|
213
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
214
|
+
"did": "user(0)",
|
|
215
|
+
"email": "alice@test.com",
|
|
216
|
+
"handle": "alice.test",
|
|
217
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
218
|
+
"invites": Array [],
|
|
219
|
+
"invitesDisabled": false,
|
|
220
|
+
"labels": Array [],
|
|
221
|
+
"moderation": Object {},
|
|
222
|
+
"relatedRecords": Array [
|
|
223
|
+
Object {
|
|
224
|
+
"$type": "app.bsky.actor.profile",
|
|
225
|
+
"avatar": Object {
|
|
226
|
+
"$type": "blob",
|
|
227
|
+
"mimeType": "image/jpeg",
|
|
228
|
+
"ref": Object {
|
|
229
|
+
"$link": "cids(0)",
|
|
230
|
+
},
|
|
231
|
+
"size": 3976,
|
|
232
|
+
},
|
|
233
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
234
|
+
"description": "its me!",
|
|
235
|
+
"displayName": "ali",
|
|
236
|
+
"labels": Object {
|
|
237
|
+
"$type": "com.atproto.label.defs#selfLabels",
|
|
238
|
+
"values": Array [
|
|
239
|
+
Object {
|
|
240
|
+
"val": "self-label-a",
|
|
241
|
+
},
|
|
242
|
+
Object {
|
|
243
|
+
"val": "self-label-b",
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
},
|
|
250
|
+
"revokeReason": "Testing",
|
|
251
|
+
"revokedAt": "1970-01-01T00:00:00.000Z",
|
|
252
|
+
"revokedBy": "user(0)",
|
|
253
|
+
"subject": "user(1)",
|
|
254
|
+
"subjectProfile": Object {
|
|
255
|
+
"$type": "app.bsky.actor.defs#profileViewDetailed",
|
|
256
|
+
"associated": Object {
|
|
257
|
+
"feedgens": 0,
|
|
258
|
+
"labeler": false,
|
|
259
|
+
"lists": 0,
|
|
260
|
+
"starterPacks": 0,
|
|
261
|
+
},
|
|
262
|
+
"did": "user(1)",
|
|
263
|
+
"followersCount": 2,
|
|
264
|
+
"followsCount": 1,
|
|
265
|
+
"handle": "carol.test",
|
|
266
|
+
"labels": Array [],
|
|
267
|
+
"postsCount": 2,
|
|
268
|
+
"viewer": Object {
|
|
269
|
+
"blockedBy": false,
|
|
270
|
+
"muted": false,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
"subjectRepo": Object {
|
|
274
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
275
|
+
"did": "user(1)",
|
|
276
|
+
"email": "carol@test.com",
|
|
277
|
+
"handle": "carol.test",
|
|
278
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
279
|
+
"invites": Array [],
|
|
280
|
+
"invitesDisabled": false,
|
|
281
|
+
"labels": Array [],
|
|
282
|
+
"moderation": Object {},
|
|
283
|
+
"relatedRecords": Array [],
|
|
284
|
+
},
|
|
285
|
+
"updatedAt": "1970-01-01T00:00:00.000Z",
|
|
286
|
+
"uri": "record(0)",
|
|
287
|
+
}
|
|
288
|
+
`;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Sender, WebSocketServer } from 'ws'
|
|
2
|
+
import { AppBskyGraphVerification, AtpAgent } from '@atproto/api'
|
|
3
|
+
import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
|
|
4
|
+
import { forSnapshot } from './_util'
|
|
5
|
+
|
|
6
|
+
describe('verification-listener', () => {
|
|
7
|
+
let network: TestNetwork
|
|
8
|
+
let sc: SeedClient
|
|
9
|
+
let adminAgent: AtpAgent
|
|
10
|
+
let jetstream: WebSocketServer
|
|
11
|
+
let relay: Sender
|
|
12
|
+
|
|
13
|
+
beforeAll(async () => {
|
|
14
|
+
const jetstreamPort = 2511
|
|
15
|
+
jetstream = new WebSocketServer({
|
|
16
|
+
port: jetstreamPort,
|
|
17
|
+
})
|
|
18
|
+
jetstream.on('connection', (ws) => {
|
|
19
|
+
relay = ws
|
|
20
|
+
})
|
|
21
|
+
network = await TestNetwork.create({
|
|
22
|
+
dbPostgresSchema: 'ozone_verification_listener_test',
|
|
23
|
+
ozone: {
|
|
24
|
+
verifierUrl: 'http://localhost:2583',
|
|
25
|
+
verifierDid: 'did:example:verifier',
|
|
26
|
+
verifierPassword: 'test',
|
|
27
|
+
jetstreamUrl: `ws://localhost:${jetstreamPort}`,
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
sc = network.getSeedClient()
|
|
31
|
+
await basicSeed(sc)
|
|
32
|
+
|
|
33
|
+
adminAgent = network.pds.getClient()
|
|
34
|
+
await adminAgent.login({
|
|
35
|
+
identifier: sc.accounts[sc.dids.alice].handle,
|
|
36
|
+
password: sc.accounts[sc.dids.alice].password,
|
|
37
|
+
})
|
|
38
|
+
await network.ozone.addAdminDid(sc.dids.alice)
|
|
39
|
+
|
|
40
|
+
await network.processAll()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
afterAll(async () => {
|
|
44
|
+
await jetstream.close()
|
|
45
|
+
await network.close()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('indexes new and revoked verifications', async () => {
|
|
49
|
+
const { verificationListener } = network.ozone.daemon.ctx
|
|
50
|
+
const createEvent = {
|
|
51
|
+
kind: 'commit',
|
|
52
|
+
did: sc.dids.bob,
|
|
53
|
+
time_us: 123456789,
|
|
54
|
+
commit: {
|
|
55
|
+
rev: 'xyz',
|
|
56
|
+
operation: 'create',
|
|
57
|
+
collection: 'app.bsky.graph.verification',
|
|
58
|
+
rkey: 'abcdefg',
|
|
59
|
+
cid: 'xyz',
|
|
60
|
+
record: {
|
|
61
|
+
$type: 'app.bsky.graph.verification',
|
|
62
|
+
subject: sc.dids.alice,
|
|
63
|
+
handle: sc.accounts[sc.dids.alice].handle,
|
|
64
|
+
displayName: 'Alice',
|
|
65
|
+
createdAt: new Date().toISOString(),
|
|
66
|
+
} satisfies AppBskyGraphVerification.Record,
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
const deleteEvent = {
|
|
70
|
+
kind: 'commit',
|
|
71
|
+
did: sc.dids.bob,
|
|
72
|
+
time_us: 123456799,
|
|
73
|
+
commit: {
|
|
74
|
+
rev: 'yza',
|
|
75
|
+
operation: 'delete',
|
|
76
|
+
collection: 'app.bsky.graph.verification',
|
|
77
|
+
rkey: 'abcdefg',
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
relay.send(JSON.stringify(createEvent))
|
|
81
|
+
relay.send(JSON.stringify(deleteEvent))
|
|
82
|
+
const verificationService = network.ozone.ctx.verificationService(
|
|
83
|
+
network.ozone.ctx.db,
|
|
84
|
+
)
|
|
85
|
+
// Wait for the listener to process the events
|
|
86
|
+
let hasCursorUpdated = false
|
|
87
|
+
let attempt = 0
|
|
88
|
+
do {
|
|
89
|
+
const cursor = await verificationService.getFirehoseCursor()
|
|
90
|
+
hasCursorUpdated = cursor === 123456799
|
|
91
|
+
attempt++
|
|
92
|
+
} while (!hasCursorUpdated && attempt < 20)
|
|
93
|
+
// Give the processor enough time to handle the events
|
|
94
|
+
const {
|
|
95
|
+
data: { verifications },
|
|
96
|
+
} = await adminAgent.tools.ozone.verification.listVerifications({})
|
|
97
|
+
const cursor = await verificationListener?.getCursor()
|
|
98
|
+
|
|
99
|
+
expect(forSnapshot(verifications)).toMatchSnapshot()
|
|
100
|
+
expect(cursor).toEqual(123456799)
|
|
101
|
+
})
|
|
102
|
+
})
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { AppBskyActorDefs, AtpAgent, asPredicate } from '@atproto/api'
|
|
2
|
+
import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
|
|
3
|
+
import { forSnapshot } from './_util'
|
|
4
|
+
|
|
5
|
+
const isValidProfile = asPredicate(AppBskyActorDefs.validateProfileViewDetailed)
|
|
6
|
+
|
|
7
|
+
describe('verification', () => {
|
|
8
|
+
let network: TestNetwork
|
|
9
|
+
let adminAgent: AtpAgent
|
|
10
|
+
let triageAgent: AtpAgent
|
|
11
|
+
let sc: SeedClient
|
|
12
|
+
|
|
13
|
+
beforeAll(async () => {
|
|
14
|
+
network = await TestNetwork.create({
|
|
15
|
+
dbPostgresSchema: 'ozone_verification_test',
|
|
16
|
+
})
|
|
17
|
+
adminAgent = network.pds.getClient()
|
|
18
|
+
sc = network.getSeedClient()
|
|
19
|
+
await basicSeed(sc)
|
|
20
|
+
await network.processAll()
|
|
21
|
+
|
|
22
|
+
await network.ozone.addAdminDid(sc.dids.alice)
|
|
23
|
+
await network.ozone.addModeratorDid(sc.dids.bob)
|
|
24
|
+
await network.ozone.addTriageDid(sc.dids.carol)
|
|
25
|
+
await adminAgent.login({
|
|
26
|
+
identifier: sc.accounts[sc.dids.alice].handle,
|
|
27
|
+
password: sc.accounts[sc.dids.alice].password,
|
|
28
|
+
})
|
|
29
|
+
triageAgent = network.pds.getClient()
|
|
30
|
+
await triageAgent.login({
|
|
31
|
+
identifier: sc.accounts[sc.dids.carol].handle,
|
|
32
|
+
password: sc.accounts[sc.dids.carol].password,
|
|
33
|
+
})
|
|
34
|
+
const {
|
|
35
|
+
data: { password },
|
|
36
|
+
} = await adminAgent.com.atproto.server.createAppPassword({
|
|
37
|
+
name: 'verifier',
|
|
38
|
+
})
|
|
39
|
+
network.ozone.ctx.cfg.verifier = {
|
|
40
|
+
url: network.pds.url,
|
|
41
|
+
did: sc.dids.alice,
|
|
42
|
+
password,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
await network.processAll()
|
|
46
|
+
await network.bsky.db.db
|
|
47
|
+
.updateTable('actor')
|
|
48
|
+
.set({ trustedVerifier: true })
|
|
49
|
+
.where('did', 'in', [sc.dids.alice])
|
|
50
|
+
.execute()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
afterAll(async () => {
|
|
54
|
+
await network.close()
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
describe('list', () => {
|
|
58
|
+
// @TODO: This tests encapsulates the entire grant->revoke->list flow. we should have more detailed test for each path
|
|
59
|
+
it('returns paginated list of verifications', async () => {
|
|
60
|
+
const {
|
|
61
|
+
data: { verifications },
|
|
62
|
+
} = await adminAgent.tools.ozone.verification.grantVerifications({
|
|
63
|
+
verifications: [
|
|
64
|
+
{
|
|
65
|
+
subject: sc.dids.bob,
|
|
66
|
+
handle: sc.accounts[sc.dids.bob].handle,
|
|
67
|
+
displayName: 'bobby',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
subject: sc.dids.carol,
|
|
71
|
+
handle: sc.accounts[sc.dids.carol].handle,
|
|
72
|
+
displayName: '',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const grantedVerificationUri = verifications.find(
|
|
78
|
+
(v) => v.subject === sc.dids.carol,
|
|
79
|
+
)?.uri
|
|
80
|
+
|
|
81
|
+
expect(grantedVerificationUri).toBeDefined()
|
|
82
|
+
|
|
83
|
+
if (grantedVerificationUri) {
|
|
84
|
+
await adminAgent.tools.ozone.verification.revokeVerifications({
|
|
85
|
+
uris: [grantedVerificationUri],
|
|
86
|
+
revokeReason: 'Testing',
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
await network.processAll()
|
|
91
|
+
|
|
92
|
+
const { data } =
|
|
93
|
+
await adminAgent.tools.ozone.verification.listVerifications({})
|
|
94
|
+
|
|
95
|
+
expect(data.verifications.find((v) => v.revokedAt)?.uri).toEqual(
|
|
96
|
+
grantedVerificationUri,
|
|
97
|
+
)
|
|
98
|
+
const bob = data.verifications.find((v) => v.subject === sc.dids.bob)
|
|
99
|
+
const carol = data.verifications.find((v) => v.subject === sc.dids.carol)
|
|
100
|
+
|
|
101
|
+
if (
|
|
102
|
+
!isValidProfile(bob?.subjectProfile) ||
|
|
103
|
+
!isValidProfile(carol?.subjectProfile)
|
|
104
|
+
) {
|
|
105
|
+
throw Error('Invalid profiles')
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
expect(forSnapshot(bob)).toMatchSnapshot()
|
|
109
|
+
expect(forSnapshot(carol)).toMatchSnapshot()
|
|
110
|
+
|
|
111
|
+
// Assert that profile record carries valid verification status for bob but not for carol
|
|
112
|
+
expect(carol.revokedAt).toBeDefined()
|
|
113
|
+
expect(carol.revokeReason).toEqual('Testing')
|
|
114
|
+
expect(carol.subjectProfile.verification).toBeUndefined()
|
|
115
|
+
expect(bob.subjectProfile?.verification?.verifiedStatus).toEqual('valid')
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
describe('grant', () => {
|
|
120
|
+
it('fails for non-admins and non-verifiers', async () => {
|
|
121
|
+
const attemptAsAdmin =
|
|
122
|
+
triageAgent.tools.ozone.verification.grantVerifications({
|
|
123
|
+
verifications: [
|
|
124
|
+
{
|
|
125
|
+
subject: sc.dids.bob,
|
|
126
|
+
handle: sc.accounts[sc.dids.bob].handle,
|
|
127
|
+
displayName: 'Bob',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
})
|
|
131
|
+
await expect(attemptAsAdmin).rejects.toThrow(
|
|
132
|
+
'Must be an admin or verifier to grant verifications',
|
|
133
|
+
)
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
})
|