-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
14 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ | |
"@atproto/bsky": "workspace:^", | ||
"@atproto/dev-env": "workspace:^", | ||
"@atproto/lex-cli": "workspace:^", | ||
"@atproto/pds-entryway": "npm:@atproto/[email protected].1", | ||
"@atproto/pds-entryway": "npm:@atproto/[email protected].2", | ||
"@did-plc/server": "^0.0.1", | ||
"@types/cors": "^2.8.12", | ||
"@types/disposable-email": "^0.2.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import assert from 'node:assert' | ||
import * as os from 'node:os' | ||
import * as path from 'node:path' | ||
import AtpAgent from '@atproto/api' | ||
|
@@ -49,7 +48,7 @@ describe('entryway', () => { | |
.values({ | ||
did: pds.ctx.cfg.service.did, | ||
host: new URL(pds.ctx.cfg.service.publicUrl).host, | ||
weight: 0, | ||
weight: 1, | ||
}) | ||
.execute() | ||
pdsAgent = pds.getClient() | ||
|
@@ -65,22 +64,17 @@ describe('entryway', () => { | |
}) | ||
|
||
it('creates account.', async () => { | ||
const { | ||
data: { did }, | ||
} = await entrywayAgent.api.com.atproto.server.createAccount({ | ||
const res = await entrywayAgent.api.com.atproto.server.createAccount({ | ||
email: '[email protected]', | ||
handle: 'alice.test', | ||
password: 'test123', | ||
}) | ||
await moveAccountToPds(did, pds, { entryway, plc }) | ||
const { | ||
data: { accessJwt }, | ||
} = await entrywayAgent.api.com.atproto.server.createSession({ | ||
identifier: '[email protected]', | ||
password: 'test123', | ||
}) | ||
alice = did | ||
accessToken = accessJwt | ||
alice = res.data.did | ||
accessToken = res.data.accessJwt | ||
|
||
const account = await pds.ctx.accountManager.getAccount(alice) | ||
expect(account?.did).toEqual(alice) | ||
expect(account?.handle).toEqual('alice.test') | ||
}) | ||
|
||
it('auths with both services.', async () => { | ||
|
@@ -168,53 +162,6 @@ const createEntryway = async ( | |
return server | ||
} | ||
|
||
// @TODO temporary helper while createAccount flow isn't complete w/ reserveSigningKey | ||
const moveAccountToPds = async ( | ||
did: string, | ||
pds: TestPds, | ||
services: { entryway: pdsEntryway.PDS; plc: TestPlc }, | ||
) => { | ||
const { entryway, plc } = services | ||
const account = await entryway.ctx.services | ||
.account(entryway.ctx.db) | ||
.getAccount(did) | ||
assert(account) | ||
const signingKey = await Secp256k1Keypair.create({ exportable: true }) | ||
const commit = await pds.ctx.actorStore.create( | ||
did, | ||
signingKey, | ||
(actorTxn) => { | ||
return actorTxn.repo.createRepo([]) | ||
}, | ||
) | ||
await pds.ctx.accountManager.createAccount({ | ||
did, | ||
email: `${did}@email.invalid`, | ||
handle: account.handle, | ||
password: randomStr(8, 'base32'), | ||
repoCid: commit.cid, | ||
repoRev: commit.rev, | ||
inviteCode: undefined, | ||
}) | ||
const plcClient = plc.getClient() | ||
await plcClient.updatePds( | ||
did, | ||
entryway.ctx.plcRotationKey, | ||
pds.ctx.cfg.service.publicUrl, | ||
) | ||
await plcClient.updateAtprotoKey( | ||
did, | ||
entryway.ctx.plcRotationKey, | ||
signingKey.did(), | ||
) | ||
await entryway.ctx.services.repo(entryway.ctx.db).deleteRepo(did) | ||
await entryway.ctx.db.db | ||
.updateTable('user_account') | ||
.set({ pdsId: entryway.ctx.db.db.selectFrom('pds').select('id').limit(1) }) | ||
.where('did', '=', did) | ||
.execute() | ||
} | ||
|
||
const getPublicHex = (key: Secp256k1Keypair) => { | ||
return key.publicKeyStr('hex') | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.