@atproto/dev-env 0.3.33 → 0.3.34-rc.0

Sign up to get free protection for your applications and to get access to all the features.
package/src/mock/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AtUri } from '@atproto/syntax'
2
- import AtpAgent, { COM_ATPROTO_MODERATION } from '@atproto/api'
2
+ import { COM_ATPROTO_MODERATION, AtpAgent } from '@atproto/api'
3
3
  import { Database } from '@atproto/bsky'
4
4
  import { EXAMPLE_LABELER, RecordRef, TestNetwork } from '../index'
5
5
  import { postTexts, replyTexts } from './data'
@@ -30,90 +30,67 @@ export async function generateMockSetup(env: TestNetwork) {
30
30
  throw new Error('Not found')
31
31
  }
32
32
 
33
- const clients = {
34
- loggedout: env.pds.getClient(),
35
- alice: env.pds.getClient(),
36
- bob: env.pds.getClient(),
37
- carla: env.pds.getClient(),
38
- }
39
- interface User {
40
- email: string
41
- did: string
42
- handle: string
43
- password: string
44
- agent: AtpAgent
45
- }
46
- const users: User[] = [
33
+ const loggedOut = env.pds.getClient()
34
+
35
+ const users = [
47
36
  {
48
37
  email: 'alice@test.com',
49
- did: '',
50
38
  handle: `alice.test`,
51
39
  password: 'hunter2',
52
- agent: clients.alice,
53
40
  },
54
41
  {
55
42
  email: 'bob@test.com',
56
- did: '',
57
43
  handle: `bob.test`,
58
44
  password: 'hunter2',
59
- agent: clients.bob,
60
45
  },
61
46
  {
62
47
  email: 'carla@test.com',
63
- did: '',
64
48
  handle: `carla.test`,
65
49
  password: 'hunter2',
66
- agent: clients.carla,
67
50
  },
68
51
  ]
69
- const alice = users[0]
70
- const bob = users[1]
71
- const carla = users[2]
72
52
 
73
- let _i = 1
74
- for (const user of users) {
75
- const res = await clients.loggedout.api.com.atproto.server.createAccount({
76
- email: user.email,
77
- handle: user.handle,
78
- password: user.password,
79
- })
80
- user.agent.api.setHeader('Authorization', `Bearer ${res.data.accessJwt}`)
81
- user.did = res.data.did
82
- await user.agent.api.app.bsky.actor.profile.create(
83
- { repo: user.did },
84
- {
85
- displayName: ucfirst(user.handle).slice(0, -5),
86
- description: `Test user ${_i++}`,
87
- },
88
- )
89
- }
53
+ const userAgents = await Promise.all(
54
+ users.map(async (user, i) => {
55
+ const client: AtpAgent = env.pds.getClient()
56
+ await client.createAccount(user)
57
+ client.assertAuthenticated()
58
+ await client.app.bsky.actor.profile.create(
59
+ { repo: client.did },
60
+ {
61
+ displayName: ucfirst(user.handle).slice(0, -5),
62
+ description: `Test user ${i}`,
63
+ },
64
+ )
65
+ return client
66
+ }),
67
+ )
68
+
69
+ const [alice, bob, carla] = userAgents
90
70
 
91
71
  // Create moderator accounts
92
- const triageRes =
93
- await clients.loggedout.api.com.atproto.server.createAccount({
94
- email: 'triage@test.com',
95
- handle: 'triage.test',
96
- password: 'triage-pass',
97
- })
72
+ const triageRes = await loggedOut.com.atproto.server.createAccount({
73
+ email: 'triage@test.com',
74
+ handle: 'triage.test',
75
+ password: 'triage-pass',
76
+ })
98
77
  await env.ozone.addTriageDid(triageRes.data.did)
99
- const modRes = await clients.loggedout.api.com.atproto.server.createAccount({
78
+ const modRes = await loggedOut.com.atproto.server.createAccount({
100
79
  email: 'mod@test.com',
101
80
  handle: 'mod.test',
102
81
  password: 'mod-pass',
103
82
  })
104
83
  await env.ozone.addModeratorDid(modRes.data.did)
105
- const adminRes = await clients.loggedout.api.com.atproto.server.createAccount(
106
- {
107
- email: 'admin-mod@test.com',
108
- handle: 'admin-mod.test',
109
- password: 'admin-mod-pass',
110
- },
111
- )
84
+ const adminRes = await loggedOut.com.atproto.server.createAccount({
85
+ email: 'admin-mod@test.com',
86
+ handle: 'admin-mod.test',
87
+ password: 'admin-mod-pass',
88
+ })
112
89
  await env.ozone.addAdminDid(adminRes.data.did)
113
90
 
114
91
  // Report one user
115
- const reporter = picka(users)
116
- await reporter.agent.api.com.atproto.moderation.createReport({
92
+ const reporter = picka(userAgents)
93
+ await reporter.com.atproto.moderation.createReport({
117
94
  reasonType: picka([
118
95
  COM_ATPROTO_MODERATION.DefsReasonSpam,
119
96
  COM_ATPROTO_MODERATION.DefsReasonOther,
@@ -121,16 +98,16 @@ export async function generateMockSetup(env: TestNetwork) {
121
98
  reason: picka(["Didn't look right to me", undefined, undefined]),
122
99
  subject: {
123
100
  $type: 'com.atproto.admin.defs#repoRef',
124
- did: picka(users).did,
101
+ did: picka(userAgents).did,
125
102
  },
126
103
  })
127
104
 
128
105
  // everybody follows everybody
129
- const follow = async (author: User, subject: User) => {
130
- await author.agent.api.app.bsky.graph.follow.create(
131
- { repo: author.did },
106
+ const follow = async (author: AtpAgent, subject: AtpAgent) => {
107
+ await author.app.bsky.graph.follow.create(
108
+ { repo: author.accountDid },
132
109
  {
133
- subject: subject.did,
110
+ subject: subject.accountDid,
134
111
  createdAt: date.next().value,
135
112
  },
136
113
  )
@@ -145,8 +122,8 @@ export async function generateMockSetup(env: TestNetwork) {
145
122
  // a set of posts and reposts
146
123
  const posts: { uri: string; cid: string }[] = []
147
124
  for (let i = 0; i < postTexts.length; i++) {
148
- const author = picka(users)
149
- const post = await author.agent.api.app.bsky.feed.post.create(
125
+ const author = picka(userAgents)
126
+ const post = await author.app.bsky.feed.post.create(
150
127
  { repo: author.did },
151
128
  {
152
129
  text: postTexts[i],
@@ -155,8 +132,8 @@ export async function generateMockSetup(env: TestNetwork) {
155
132
  )
156
133
  posts.push(post)
157
134
  if (rand(10) === 0) {
158
- const reposter = picka(users)
159
- await reposter.agent.api.app.bsky.feed.repost.create(
135
+ const reposter = picka(userAgents)
136
+ await reposter.app.bsky.feed.repost.create(
160
137
  { repo: reposter.did },
161
138
  {
162
139
  subject: picka(posts),
@@ -165,8 +142,8 @@ export async function generateMockSetup(env: TestNetwork) {
165
142
  )
166
143
  }
167
144
  if (rand(6) === 0) {
168
- const reporter = picka(users)
169
- await reporter.agent.api.com.atproto.moderation.createReport({
145
+ const reporter = picka(userAgents)
146
+ await reporter.com.atproto.moderation.createReport({
170
147
  reasonType: picka([
171
148
  COM_ATPROTO_MODERATION.DefsReasonSpam,
172
149
  COM_ATPROTO_MODERATION.DefsReasonOther,
@@ -183,11 +160,11 @@ export async function generateMockSetup(env: TestNetwork) {
183
160
 
184
161
  // make some naughty posts & label them
185
162
  const file = Buffer.from(labeledImgB64, 'base64')
186
- const uploadedImg = await bob.agent.api.com.atproto.repo.uploadBlob(file, {
163
+ const uploadedImg = await bob.com.atproto.repo.uploadBlob(file, {
187
164
  encoding: 'image/png',
188
165
  })
189
- const labeledPost = await bob.agent.api.app.bsky.feed.post.create(
190
- { repo: bob.did },
166
+ const labeledPost = await bob.app.bsky.feed.post.create(
167
+ { repo: bob.accountDid },
191
168
  {
192
169
  text: 'naughty post',
193
170
  embed: {
@@ -203,8 +180,8 @@ export async function generateMockSetup(env: TestNetwork) {
203
180
  },
204
181
  )
205
182
 
206
- const filteredPost = await bob.agent.api.app.bsky.feed.post.create(
207
- { repo: bob.did },
183
+ const filteredPost = await bob.app.bsky.feed.post.create(
184
+ { repo: bob.accountDid },
208
185
  {
209
186
  text: 'reallly bad post should be deleted',
210
187
  createdAt: date.next().value,
@@ -226,13 +203,13 @@ export async function generateMockSetup(env: TestNetwork) {
226
203
  for (let i = 0; i < 100; i++) {
227
204
  const targetUri = picka(posts).uri
228
205
  const urip = new AtUri(targetUri)
229
- const target = await alice.agent.api.app.bsky.feed.post.get({
206
+ const target = await alice.app.bsky.feed.post.get({
230
207
  repo: urip.host,
231
208
  rkey: urip.rkey,
232
209
  })
233
- const author = picka(users)
210
+ const author = picka(userAgents)
234
211
  posts.push(
235
- await author.agent.api.app.bsky.feed.post.create(
212
+ await author.app.bsky.feed.post.create(
236
213
  { repo: author.did },
237
214
  {
238
215
  text: picka(replyTexts),
@@ -248,9 +225,9 @@ export async function generateMockSetup(env: TestNetwork) {
248
225
 
249
226
  // a set of likes
250
227
  for (const post of posts) {
251
- for (const user of users) {
228
+ for (const user of userAgents) {
252
229
  if (rand(3) === 0) {
253
- await user.agent.api.app.bsky.feed.like.create(
230
+ await user.app.bsky.feed.like.create(
254
231
  { repo: user.did },
255
232
  {
256
233
  subject: post,
@@ -262,7 +239,11 @@ export async function generateMockSetup(env: TestNetwork) {
262
239
  }
263
240
 
264
241
  // a couple feed generators that returns some posts
265
- const fg1Uri = AtUri.make(alice.did, 'app.bsky.feed.generator', 'alice-favs')
242
+ const fg1Uri = AtUri.make(
243
+ alice.accountDid,
244
+ 'app.bsky.feed.generator',
245
+ 'alice-favs',
246
+ )
266
247
  const fg1 = await env.createFeedGen({
267
248
  [fg1Uri.toString()]: async () => {
268
249
  const feed = posts
@@ -277,14 +258,11 @@ export async function generateMockSetup(env: TestNetwork) {
277
258
  },
278
259
  })
279
260
  const avatarImg = Buffer.from(blurHashB64, 'base64')
280
- const avatarRes = await alice.agent.api.com.atproto.repo.uploadBlob(
281
- avatarImg,
282
- {
283
- encoding: 'image/png',
284
- },
285
- )
286
- const fgAliceRes = await alice.agent.api.app.bsky.feed.generator.create(
287
- { repo: alice.did, rkey: fg1Uri.rkey },
261
+ const avatarRes = await alice.com.atproto.repo.uploadBlob(avatarImg, {
262
+ encoding: 'image/png',
263
+ })
264
+ const fgAliceRes = await alice.app.bsky.feed.generator.create(
265
+ { repo: alice.accountDid, rkey: fg1Uri.rkey },
288
266
  {
289
267
  did: fg1.did,
290
268
  displayName: 'alices feed',
@@ -294,8 +272,8 @@ export async function generateMockSetup(env: TestNetwork) {
294
272
  },
295
273
  )
296
274
 
297
- await alice.agent.api.app.bsky.feed.post.create(
298
- { repo: alice.did },
275
+ await alice.app.bsky.feed.post.create(
276
+ { repo: alice.accountDid },
299
277
  {
300
278
  text: 'check out my algorithm!',
301
279
  embed: {
@@ -306,7 +284,7 @@ export async function generateMockSetup(env: TestNetwork) {
306
284
  },
307
285
  )
308
286
  for (const user of [alice, bob, carla]) {
309
- await user.agent.api.app.bsky.feed.like.create(
287
+ await user.app.bsky.feed.like.create(
310
288
  { repo: user.did },
311
289
  {
312
290
  subject: fgAliceRes,
@@ -315,7 +293,11 @@ export async function generateMockSetup(env: TestNetwork) {
315
293
  )
316
294
  }
317
295
 
318
- const fg2Uri = AtUri.make(bob.did, 'app.bsky.feed.generator', 'bob-redux')
296
+ const fg2Uri = AtUri.make(
297
+ bob.accountDid,
298
+ 'app.bsky.feed.generator',
299
+ 'bob-redux',
300
+ )
319
301
  const fg2 = await env.createFeedGen({
320
302
  [fg2Uri.toString()]: async () => {
321
303
  const feed = posts
@@ -329,8 +311,8 @@ export async function generateMockSetup(env: TestNetwork) {
329
311
  }
330
312
  },
331
313
  })
332
- const fgBobRes = await bob.agent.api.app.bsky.feed.generator.create(
333
- { repo: bob.did, rkey: fg2Uri.rkey },
314
+ const fgBobRes = await bob.app.bsky.feed.generator.create(
315
+ { repo: bob.accountDid, rkey: fg2Uri.rkey },
334
316
  {
335
317
  did: fg2.did,
336
318
  displayName: 'Bobby boy hot new algo',
@@ -338,8 +320,8 @@ export async function generateMockSetup(env: TestNetwork) {
338
320
  },
339
321
  )
340
322
 
341
- await alice.agent.api.app.bsky.feed.post.create(
342
- { repo: alice.did },
323
+ await alice.app.bsky.feed.post.create(
324
+ { repo: alice.accountDid },
343
325
  {
344
326
  text: `bobs feed is neat too`,
345
327
  embed: {
@@ -352,14 +334,13 @@ export async function generateMockSetup(env: TestNetwork) {
352
334
 
353
335
  // create a labeler account
354
336
  {
355
- const res = await clients.loggedout.api.com.atproto.server.createAccount({
337
+ const labeler = env.pds.getClient()
338
+ const res = await labeler.createAccount({
356
339
  email: 'labeler@test.com',
357
340
  handle: 'labeler.test',
358
341
  password: 'hunter2',
359
342
  })
360
- const agent = env.pds.getClient()
361
- agent.api.setHeader('Authorization', `Bearer ${res.data.accessJwt}`)
362
- await agent.api.app.bsky.actor.profile.create(
343
+ await labeler.app.bsky.actor.profile.create(
363
344
  { repo: res.data.did },
364
345
  {
365
346
  displayName: 'Test Labeler',
@@ -367,7 +348,7 @@ export async function generateMockSetup(env: TestNetwork) {
367
348
  },
368
349
  )
369
350
 
370
- await agent.api.app.bsky.labeler.service.create(
351
+ await labeler.app.bsky.labeler.service.create(
371
352
  { repo: res.data.did, rkey: 'self' },
372
353
  {
373
354
  policies: {
@@ -455,25 +436,25 @@ export async function generateMockSetup(env: TestNetwork) {
455
436
  },
456
437
  )
457
438
  await createLabel(env.bsky.db, {
458
- uri: alice.did,
439
+ uri: alice.accountDid,
459
440
  cid: '',
460
441
  val: 'rude',
461
442
  src: res.data.did,
462
443
  })
463
444
  await createLabel(env.bsky.db, {
464
- uri: `at://${alice.did}/app.bsky.feed.generator/alice-favs`,
445
+ uri: `at://${alice.accountDid}/app.bsky.feed.generator/alice-favs`,
465
446
  cid: '',
466
447
  val: 'cool',
467
448
  src: res.data.did,
468
449
  })
469
450
  await createLabel(env.bsky.db, {
470
- uri: bob.did,
451
+ uri: bob.accountDid,
471
452
  cid: '',
472
453
  val: 'cool',
473
454
  src: res.data.did,
474
455
  })
475
456
  await createLabel(env.bsky.db, {
476
- uri: carla.did,
457
+ uri: carla.accountDid,
477
458
  cid: '',
478
459
  val: 'spam',
479
460
  src: res.data.did,
@@ -482,8 +463,8 @@ export async function generateMockSetup(env: TestNetwork) {
482
463
 
483
464
  // Create lists and add people to the lists
484
465
  {
485
- const flowerLovers = await alice.agent.api.app.bsky.graph.list.create(
486
- { repo: alice.did },
466
+ const flowerLovers = await alice.app.bsky.graph.list.create(
467
+ { repo: alice.accountDid },
487
468
  {
488
469
  name: 'Flower Lovers',
489
470
  purpose: 'app.bsky.graph.defs#curatelist',
@@ -491,8 +472,8 @@ export async function generateMockSetup(env: TestNetwork) {
491
472
  description: 'A list of posts about flowers',
492
473
  },
493
474
  )
494
- const labelHaters = await bob.agent.api.app.bsky.graph.list.create(
495
- { repo: bob.did },
475
+ const labelHaters = await bob.app.bsky.graph.list.create(
476
+ { repo: bob.accountDid },
496
477
  {
497
478
  name: 'Label Haters',
498
479
  purpose: 'app.bsky.graph.defs#modlist',
@@ -500,18 +481,18 @@ export async function generateMockSetup(env: TestNetwork) {
500
481
  description: 'A list of people who hate labels',
501
482
  },
502
483
  )
503
- await alice.agent.api.app.bsky.graph.listitem.create(
504
- { repo: alice.did },
484
+ await alice.app.bsky.graph.listitem.create(
485
+ { repo: alice.accountDid },
505
486
  {
506
- subject: bob.did,
487
+ subject: bob.accountDid,
507
488
  createdAt: new Date().toISOString(),
508
489
  list: new RecordRef(flowerLovers.uri, flowerLovers.cid).uriStr,
509
490
  },
510
491
  )
511
- await bob.agent.api.app.bsky.graph.listitem.create(
512
- { repo: bob.did },
492
+ await bob.app.bsky.graph.listitem.create(
493
+ { repo: bob.accountDid },
513
494
  {
514
- subject: alice.did,
495
+ subject: alice.accountDid,
515
496
  createdAt: new Date().toISOString(),
516
497
  list: new RecordRef(labelHaters.uri, labelHaters.cid).uriStr,
517
498
  },
@@ -1,4 +1,5 @@
1
- import AtpAgent, {
1
+ import {
2
+ AtpAgent,
2
3
  ToolsOzoneModerationEmitEvent as EmitModerationEvent,
3
4
  ToolsOzoneModerationQueryStatuses as QueryModerationStatuses,
4
5
  ToolsOzoneModerationQueryEvents as QueryModerationEvents,
@@ -17,7 +18,7 @@ export class ModeratorClient {
17
18
  }
18
19
 
19
20
  async getEvent(id: number, role?: ModLevel) {
20
- const result = await this.agent.api.tools.ozone.moderation.getEvent(
21
+ const result = await this.agent.tools.ozone.moderation.getEvent(
21
22
  { id },
22
23
  {
23
24
  headers: await this.ozone.modHeaders(role),
@@ -27,7 +28,7 @@ export class ModeratorClient {
27
28
  }
28
29
 
29
30
  async queryStatuses(input: QueryStatusesParams, role?: ModLevel) {
30
- const result = await this.agent.api.tools.ozone.moderation.queryStatuses(
31
+ const result = await this.agent.tools.ozone.moderation.queryStatuses(
31
32
  input,
32
33
  {
33
34
  headers: await this.ozone.modHeaders(role),
@@ -37,12 +38,9 @@ export class ModeratorClient {
37
38
  }
38
39
 
39
40
  async queryEvents(input: QueryEventsParams, role?: ModLevel) {
40
- const result = await this.agent.api.tools.ozone.moderation.queryEvents(
41
- input,
42
- {
43
- headers: await this.ozone.modHeaders(role),
44
- },
45
- )
41
+ const result = await this.agent.tools.ozone.moderation.queryEvents(input, {
42
+ headers: await this.ozone.modHeaders(role),
43
+ })
46
44
  return result.data
47
45
  }
48
46
 
@@ -64,7 +62,7 @@ export class ModeratorClient {
64
62
  reason = 'X',
65
63
  createdBy = 'did:example:admin',
66
64
  } = opts
67
- const result = await this.agent.api.tools.ozone.moderation.emitEvent(
65
+ const result = await this.agent.tools.ozone.moderation.emitEvent(
68
66
  { event, subject, subjectBlobCids, createdBy, reason },
69
67
  {
70
68
  encoding: 'application/json',
@@ -84,7 +82,7 @@ export class ModeratorClient {
84
82
  role?: ModLevel,
85
83
  ) {
86
84
  const { subject, reason = 'X', createdBy = 'did:example:admin' } = opts
87
- const result = await this.agent.api.tools.ozone.moderation.emitEvent(
85
+ const result = await this.agent.tools.ozone.moderation.emitEvent(
88
86
  {
89
87
  subject,
90
88
  event: {
@@ -18,16 +18,9 @@ export class OzoneServiceProfile {
18
18
  }
19
19
 
20
20
  async createDidAndKey() {
21
- const modUser =
22
- await this.thirdPartyPdsClient.api.com.atproto.server.createAccount(
23
- this.modUserDetails,
24
- )
25
- await this.thirdPartyPdsClient.login({
26
- identifier: this.modUserDetails.handle,
27
- password: this.modUserDetails.password,
28
- })
21
+ await this.thirdPartyPdsClient.createAccount(this.modUserDetails)
29
22
 
30
- this.did = modUser.data.did
23
+ this.did = this.thirdPartyPdsClient.accountDid
31
24
  this.key = await Secp256k1Keypair.create({ exportable: true })
32
25
  return { did: this.did, key: this.key }
33
26
  }
@@ -41,7 +34,7 @@ export class OzoneServiceProfile {
41
34
  throw new Error('No DID/key found!')
42
35
  }
43
36
  const pdsClient = pds.getClient()
44
- const describeRes = await pdsClient.api.com.atproto.server.describeServer()
37
+ const describeRes = await pdsClient.com.atproto.server.describeServer()
45
38
  const newServerDid = describeRes.data.did
46
39
 
47
40
  const serviceJwtRes =
@@ -50,24 +43,23 @@ export class OzoneServiceProfile {
50
43
  })
51
44
  const serviceJwt = serviceJwtRes.data.token
52
45
 
53
- const accountResponse =
54
- await pdsClient.api.com.atproto.server.createAccount(
55
- {
56
- ...this.modUserDetails,
57
- ...userDetails,
58
- did: this.did,
59
- },
60
- {
61
- headers: { authorization: `Bearer ${serviceJwt}` },
62
- encoding: 'application/json',
63
- },
64
- )
65
-
66
- pdsClient.api.setHeader(
67
- 'Authorization',
68
- `Bearer ${accountResponse.data.accessJwt}`,
46
+ await pdsClient.createAccount(
47
+ {
48
+ ...this.modUserDetails,
49
+ ...userDetails,
50
+ did: this.did,
51
+ },
52
+ {
53
+ headers: { authorization: `Bearer ${serviceJwt}` },
54
+ encoding: 'application/json',
55
+ },
69
56
  )
70
57
 
58
+ // For some reason, the tests fail if the client uses the PDS URL to make
59
+ // its requests. This is a workaround to make the tests pass by simulating
60
+ // old behavior (that was not relying on the session management).
61
+ pdsClient.sessionManager.pdsUrl = undefined
62
+
71
63
  const getDidCredentials =
72
64
  await pdsClient.com.atproto.identity.getRecommendedDidCredentials()
73
65
 
@@ -103,9 +95,9 @@ export class OzoneServiceProfile {
103
95
  operation: plcOp.data.operation,
104
96
  })
105
97
 
106
- await pdsClient.api.com.atproto.server.activateAccount()
98
+ await pdsClient.com.atproto.server.activateAccount()
107
99
 
108
- await pdsClient.api.app.bsky.actor.profile.create(
100
+ await pdsClient.app.bsky.actor.profile.create(
109
101
  { repo: this.did },
110
102
  {
111
103
  displayName: 'Dev-env Moderation',
@@ -113,7 +105,7 @@ export class OzoneServiceProfile {
113
105
  },
114
106
  )
115
107
 
116
- await pdsClient.api.app.bsky.labeler.service.create(
108
+ await pdsClient.app.bsky.labeler.service.create(
117
109
  { repo: this.did, rkey: 'self' },
118
110
  {
119
111
  policies: {
package/src/ozone.ts CHANGED
@@ -6,7 +6,7 @@ import { AtpAgent } from '@atproto/api'
6
6
  import { createServiceJwt } from '@atproto/xrpc-server'
7
7
  import { Keypair, Secp256k1Keypair } from '@atproto/crypto'
8
8
  import { DidAndKey, OzoneConfig } from './types'
9
- import { ADMIN_PASSWORD } from './const'
9
+ import { ADMIN_PASSWORD, EXAMPLE_LABELER } from './const'
10
10
  import { createDidAndKey } from './util'
11
11
  import { ModeratorClient } from './moderator-client'
12
12
 
@@ -103,8 +103,10 @@ export class TestOzone {
103
103
  return this.server.ctx
104
104
  }
105
105
 
106
- getClient() {
107
- return new AtpAgent({ service: this.url })
106
+ getClient(): AtpAgent {
107
+ const agent = new AtpAgent({ service: this.url })
108
+ agent.configureLabelers([EXAMPLE_LABELER])
109
+ return agent
108
110
  }
109
111
 
110
112
  getModClient() {
package/src/pds.ts CHANGED
@@ -73,7 +73,7 @@ export class TestPds {
73
73
 
74
74
  getClient(): AtpAgent {
75
75
  const agent = new AtpAgent({ service: this.url })
76
- agent.configureLabelersHeader([EXAMPLE_LABELER])
76
+ agent.configureLabelers([EXAMPLE_LABELER])
77
77
  return agent
78
78
  }
79
79