From ea04c2bd330dc5b46d6f9df0d7d4619bbd8f56d0 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 5 Apr 2023 18:56:02 -0500 Subject: Add user invite codes (#393) * Add mobile UIs for invite codes * Update invite code UIs for web * Finish implementing invite code behaviors (including notifications of invited users) * Bump deps * Update web right nav to use real data; also fix lint --- jest/test-pds.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'jest') diff --git a/jest/test-pds.ts b/jest/test-pds.ts index 1e87df811..851775580 100644 --- a/jest/test-pds.ts +++ b/jest/test-pds.ts @@ -27,7 +27,9 @@ export interface TestPDS { close: () => Promise } -export async function createServer(): Promise { +export async function createServer( + {inviteRequired}: {inviteRequired: boolean} = {inviteRequired: false}, +): Promise { const repoSigningKey = await crypto.Secp256k1Keypair.create() const plcRotationKey = await crypto.Secp256k1Keypair.create() const port = await getPort() @@ -61,7 +63,7 @@ export async function createServer(): Promise { serverDid, recoveryKey, adminPassword: ADMIN_PASSWORD, - inviteRequired: false, + inviteRequired, didPlcUrl: plcUrl, jwtSecret: 'jwt-secret', availableUserDomains: ['.test'], @@ -76,6 +78,7 @@ export async function createServer(): Promise { blobstoreTmp: `${blobstoreLoc}/tmp`, maxSubscriptionBuffer: 200, repoBackfillLimitMs: HOUR, + userInviteInterval: 1, }) const db = @@ -131,8 +134,18 @@ class Mocker { async createUser(name: string) { const agent = new BskyAgent({service: this.agent.service}) + + const inviteRes = await agent.api.com.atproto.server.createInviteCode( + {useCount: 1}, + { + headers: {authorization: `Basic ${btoa(`admin:${ADMIN_PASSWORD}`)}`}, + encoding: 'application/json', + }, + ) + const email = `fake${Object.keys(this.users).length + 1}@fake.com` const res = await agent.createAccount({ + inviteCode: inviteRes.data.code, email, handle: name + '.test', password: 'hunter2', -- cgit 1.4.1