@atproto/pds 0.4.66 → 0.4.67
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +6 -0
- package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.js +15 -5
- package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
- package/dist/sequencer/events.d.ts.map +1 -1
- package/dist/sequencer/events.js +4 -1
- package/dist/sequencer/events.js.map +1 -1
- package/package.json +4 -4
- package/src/api/com/atproto/identity/updateHandle.ts +22 -4
- package/src/sequencer/events.ts +4 -1
- package/tests/sequencer.test.ts +46 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# @atproto/pds
|
2
2
|
|
3
|
+
## 0.4.67
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#2924](https://github.com/bluesky-social/atproto/pull/2924) [`c1b0e176a`](https://github.com/bluesky-social/atproto/commit/c1b0e176adbc5108bff49d74fbae18de60e86732) Thanks [@dholms](https://github.com/dholms)! - Support alternate did mehtods in update handle
|
8
|
+
|
3
9
|
## 0.4.66
|
4
10
|
|
5
11
|
### Patch Changes
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updateHandle.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/identity/updateHandle.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAI5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,
|
1
|
+
{"version":3,"file":"updateHandle.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/identity/updateHandle.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAI5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAoFvD"}
|
@@ -44,14 +44,24 @@ function default_1(server, ctx) {
|
|
44
44
|
const account = await ctx.accountManager.getAccount(handle, {
|
45
45
|
includeDeactivated: true,
|
46
46
|
});
|
47
|
-
if (account) {
|
48
|
-
if (
|
49
|
-
|
47
|
+
if (!account) {
|
48
|
+
if (requester.startsWith('did:plc:')) {
|
49
|
+
await ctx.plcClient.updateHandle(requester, ctx.plcRotationKey, handle);
|
50
50
|
}
|
51
|
+
else {
|
52
|
+
const resolved = await ctx.idResolver.did.resolveAtprotoData(requester, true);
|
53
|
+
if (resolved.handle !== handle) {
|
54
|
+
throw new xrpc_server_1.InvalidRequestError('DID is not properly configured for handle');
|
55
|
+
}
|
56
|
+
}
|
57
|
+
await ctx.accountManager.updateHandle(requester, handle);
|
51
58
|
}
|
52
59
|
else {
|
53
|
-
|
54
|
-
|
60
|
+
// if we found an account with matching handle, check if it is the same as requester
|
61
|
+
// if so emit an identity event, otherwise error.
|
62
|
+
if (account.did !== requester) {
|
63
|
+
throw new xrpc_server_1.InvalidRequestError(`Handle already taken: ${handle}`);
|
64
|
+
}
|
55
65
|
}
|
56
66
|
try {
|
57
67
|
await ctx.sequencer.sequenceHandleUpdate(requester, handle);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updateHandle.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/identity/updateHandle.ts"],"names":[],"mappings":";;;;;AASA,
|
1
|
+
{"version":3,"file":"updateHandle.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/identity/updateHandle.ts"],"names":[],"mappings":";;;;;AASA,4BAoFC;AA7FD,8DAAgC;AAChC,sDAA0D;AAC1D,4CAA6C;AAC7C,+CAA+D;AAG/D,+CAA+C;AAC/C,2DAAkD;AAElD,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;QACvC,IAAI,EAAE,GAAG,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AAA;AACJ,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/sequencer/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAIL,UAAU,EAEX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,eAAO,MAAM,eAAe,QACrB,MAAM,cACC,UAAU,UACd,aAAa,EAAE,KACtB,OAAO,CAAC,aAAa,
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/sequencer/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAIL,UAAU,EAEX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,eAAO,MAAM,eAAe,QACrB,MAAM,cACC,UAAU,UACd,aAAa,EAAE,KACtB,OAAO,CAAC,aAAa,CAmDvB,CAAA;AAED,eAAO,MAAM,qBAAqB,QAC3B,MAAM,UACH,MAAM,KACb,OAAO,CAAC,aAAa,CAWvB,CAAA;AAED,eAAO,MAAM,oBAAoB,QAC1B,MAAM,WACF,MAAM,KACd,OAAO,CAAC,aAAa,CAavB,CAAA;AAED,eAAO,MAAM,mBAAmB,QACzB,MAAM,UACH,aAAa,KACpB,OAAO,CAAC,aAAa,CAevB,CAAA;AAED,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A;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,WAAW,CAAA;CACjB,CAAA;AACD,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,SAAS,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,UAAU,CAAA;CAChB,CAAA;AACD,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,WAAW,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,YAAY,CAAA;CAClB,CAAA;AACD,MAAM,MAAM,MAAM,GACd,cAAc,GACd,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,iBAAiB,CAAA"}
|
package/dist/sequencer/events.js
CHANGED
@@ -14,7 +14,10 @@ const formatSeqCommit = async (did, commitData, writes) => {
|
|
14
14
|
if (writes.length > 200 || commitData.newBlocks.byteSize > 1000000) {
|
15
15
|
tooBig = true;
|
16
16
|
const justRoot = new repo_1.BlockMap();
|
17
|
-
|
17
|
+
const rootBlock = commitData.newBlocks.get(commitData.cid);
|
18
|
+
if (rootBlock) {
|
19
|
+
justRoot.set(commitData.cid, rootBlock);
|
20
|
+
}
|
18
21
|
carSlice = await (0, repo_1.blocksToCarFile)(commitData.cid, justRoot);
|
19
22
|
}
|
20
23
|
else {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/sequencer/events.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,4CAAoD;AACpD,wCAMsB;AAItB,wDAAkD;AAE3C,MAAM,eAAe,GAAG,KAAK,EAClC,GAAW,EACX,UAAsB,EACtB,MAAuB,EACC,EAAE;IAC1B,IAAI,MAAe,CAAA;IACnB,MAAM,GAAG,GAAkB,EAAE,CAAA;IAC7B,MAAM,KAAK,GAAG,IAAI,aAAM,EAAE,CAAA;IAC1B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AAE;CACnB,CAAC,CAAA;AAGW,QAAA,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAA;AAGW,QAAA,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,OAAC,CAAC,OAAO,EAAE;IACnB,MAAM,EAAE,OAAC;SACN,IAAI,CAAC;QACJ,+BAAa,CAAC,SAAS;QACvB,+BAAa,CAAC,SAAS;QACvB,+BAAa,CAAC,OAAO;QACrB,+BAAa,CAAC,WAAW;KAC1B,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAA;AAGW,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/pds",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.67",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Reference implementation of atproto Personal Data Server (PDS)",
|
6
6
|
"keywords": [
|
@@ -46,9 +46,9 @@
|
|
46
46
|
"zod": "^3.23.8",
|
47
47
|
"@atproto-labs/fetch-node": "0.1.3",
|
48
48
|
"@atproto/api": "^0.13.12",
|
49
|
-
"@atproto/aws": "^0.2.7",
|
50
49
|
"@atproto/common": "^0.4.4",
|
51
50
|
"@atproto/crypto": "^0.4.1",
|
51
|
+
"@atproto/aws": "^0.2.7",
|
52
52
|
"@atproto/identity": "^0.4.2",
|
53
53
|
"@atproto/lexicon": "^0.4.2",
|
54
54
|
"@atproto/oauth-provider": "^0.2.6",
|
@@ -77,8 +77,8 @@
|
|
77
77
|
"ws": "^8.12.0",
|
78
78
|
"@atproto/api": "^0.13.12",
|
79
79
|
"@atproto/bsky": "^0.0.90",
|
80
|
-
"@atproto/
|
81
|
-
"@atproto/
|
80
|
+
"@atproto/oauth-client-browser-example": "0.0.0",
|
81
|
+
"@atproto/lex-cli": "^0.5.1"
|
82
82
|
},
|
83
83
|
"scripts": {
|
84
84
|
"codegen": "lex gen-server --yes ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/* ../../lexicons/tools/ozone/*/*",
|
@@ -53,13 +53,31 @@ export default function (server: Server, ctx: AppContext) {
|
|
53
53
|
includeDeactivated: true,
|
54
54
|
})
|
55
55
|
|
56
|
-
if (account) {
|
56
|
+
if (!account) {
|
57
|
+
if (requester.startsWith('did:plc:')) {
|
58
|
+
await ctx.plcClient.updateHandle(
|
59
|
+
requester,
|
60
|
+
ctx.plcRotationKey,
|
61
|
+
handle,
|
62
|
+
)
|
63
|
+
} else {
|
64
|
+
const resolved = await ctx.idResolver.did.resolveAtprotoData(
|
65
|
+
requester,
|
66
|
+
true,
|
67
|
+
)
|
68
|
+
if (resolved.handle !== handle) {
|
69
|
+
throw new InvalidRequestError(
|
70
|
+
'DID is not properly configured for handle',
|
71
|
+
)
|
72
|
+
}
|
73
|
+
}
|
74
|
+
await ctx.accountManager.updateHandle(requester, handle)
|
75
|
+
} else {
|
76
|
+
// if we found an account with matching handle, check if it is the same as requester
|
77
|
+
// if so emit an identity event, otherwise error.
|
57
78
|
if (account.did !== requester) {
|
58
79
|
throw new InvalidRequestError(`Handle already taken: ${handle}`)
|
59
80
|
}
|
60
|
-
} else {
|
61
|
-
await ctx.plcClient.updateHandle(requester, ctx.plcRotationKey, handle)
|
62
|
-
await ctx.accountManager.updateHandle(requester, handle)
|
63
81
|
}
|
64
82
|
|
65
83
|
try {
|
package/src/sequencer/events.ts
CHANGED
@@ -26,7 +26,10 @@ export const formatSeqCommit = async (
|
|
26
26
|
if (writes.length > 200 || commitData.newBlocks.byteSize > 1000000) {
|
27
27
|
tooBig = true
|
28
28
|
const justRoot = new BlockMap()
|
29
|
-
|
29
|
+
const rootBlock = commitData.newBlocks.get(commitData.cid)
|
30
|
+
if (rootBlock) {
|
31
|
+
justRoot.set(commitData.cid, rootBlock)
|
32
|
+
}
|
30
33
|
carSlice = await blocksToCarFile(commitData.cid, justRoot)
|
31
34
|
} else {
|
32
35
|
tooBig = false
|
package/tests/sequencer.test.ts
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
import { TestNetworkNoAppView, SeedClient } from '@atproto/dev-env'
|
2
2
|
import { randomStr } from '@atproto/crypto'
|
3
|
-
import {
|
4
|
-
|
3
|
+
import {
|
4
|
+
cborDecode,
|
5
|
+
cborEncode,
|
6
|
+
readFromGenerator,
|
7
|
+
wait,
|
8
|
+
} from '@atproto/common'
|
9
|
+
import { Sequencer, SeqEvt, formatSeqCommit } from '../src/sequencer'
|
10
|
+
import { sequencer, repoPrepare } from '../../pds'
|
5
11
|
import Outbox from '../src/sequencer/outbox'
|
6
12
|
import userSeed from './seeds/users'
|
13
|
+
import { ids } from '../src/lexicon/lexicons'
|
14
|
+
import { readCarWithRoot } from '@atproto/repo'
|
7
15
|
|
8
16
|
describe('sequencer', () => {
|
9
17
|
let network: TestNetworkNoAppView
|
@@ -207,4 +215,40 @@ describe('sequencer', () => {
|
|
207
215
|
}
|
208
216
|
lastSeen = results[0].at(-1)?.seq ?? lastSeen
|
209
217
|
})
|
218
|
+
|
219
|
+
it('root block must be returned in tooBig seq commit', async () => {
|
220
|
+
// Create good records to exceed the event limit (the current limit is 200 events)
|
221
|
+
// it creates events completely locally, so it doesn't need to be in the network
|
222
|
+
const eventsToCreate = 250
|
223
|
+
const createPostRecord = () =>
|
224
|
+
repoPrepare.prepareCreate({
|
225
|
+
did: sc.dids.alice,
|
226
|
+
collection: ids.AppBskyFeedPost,
|
227
|
+
record: { text: 'valid', createdAt: new Date().toISOString() },
|
228
|
+
})
|
229
|
+
const writesPromises = Array.from(
|
230
|
+
{ length: eventsToCreate },
|
231
|
+
createPostRecord,
|
232
|
+
)
|
233
|
+
const writes = await Promise.all(writesPromises)
|
234
|
+
// just format commit without processing writes
|
235
|
+
const writeCommit = await network.pds.ctx.actorStore.transact(
|
236
|
+
sc.dids.alice,
|
237
|
+
(store) => store.repo.formatCommit(writes),
|
238
|
+
)
|
239
|
+
|
240
|
+
const repoSeqInsert = await formatSeqCommit(
|
241
|
+
sc.dids.alice,
|
242
|
+
writeCommit,
|
243
|
+
writes,
|
244
|
+
)
|
245
|
+
|
246
|
+
const evt = cborDecode<sequencer.CommitEvt>(repoSeqInsert.event)
|
247
|
+
expect(evt.tooBig).toBe(true)
|
248
|
+
|
249
|
+
const car = await readCarWithRoot(evt.blocks)
|
250
|
+
expect(car.root.toString()).toBe(writeCommit.cid.toString())
|
251
|
+
// in the case of tooBig, the blocks must contain the root block only
|
252
|
+
expect(car.blocks.size).toBe(1)
|
253
|
+
})
|
210
254
|
})
|