Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account deletion #488

Merged
merged 94 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 90 commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
7a0aa9a
wip
dholms Dec 21, 2022
6129e36
fleshing out repo storage
dholms Dec 21, 2022
f6e8b9f
fleshing out sql storage
dholms Dec 21, 2022
4f369f5
cleaning things up
dholms Dec 21, 2022
fb679e4
fix up tests
dholms Dec 21, 2022
ab06c1e
Merge branch 'main' into repo-storage-sync
dholms Dec 21, 2022
a6cf302
dumb bug - commit log reversed
dholms Dec 21, 2022
de0ed28
rm staging in favor of commiting diffs to blockstore
dholms Dec 22, 2022
1397b52
clean up benches
dholms Dec 22, 2022
98f43e2
fixing up sql storage
dholms Dec 22, 2022
32262cc
some caching for sql repo store
dholms Dec 22, 2022
814f5fe
pr feedback
dholms Dec 23, 2022
a5e2e8e
merge
dholms Dec 23, 2022
1497d05
migration
dholms Dec 23, 2022
432d53c
wip
dholms Dec 23, 2022
68bff2a
migraiton test
dholms Dec 26, 2022
6a983e4
unclear param
dholms Dec 26, 2022
abc3fec
Merge branch 'repo-storage-sync' into repo-mutation-diffs
dholms Dec 26, 2022
d66751f
Merge branch 'repo-mutation-diffs' into repo-storage-migration
dholms Dec 26, 2022
f03605c
sql repo storage tests
dholms Dec 26, 2022
5ccbfaf
rm unused code
dholms Dec 26, 2022
3ad85db
fix up some diff code
dholms Dec 26, 2022
a21fb66
pr feedback
dholms Dec 26, 2022
11241b2
Merge branch 'repo-mutation-diffs' into repo-storage-migration
dholms Dec 26, 2022
f1e5ed8
enum for action types
dholms Dec 26, 2022
7a287f1
missed some
dholms Dec 26, 2022
380ef96
Merge branch 'repo-mutation-diffs' into repo-storage-migration
dholms Dec 26, 2022
32a21ab
wip
dholms Dec 27, 2022
d643250
ripping out auth lib
dholms Dec 27, 2022
69be03f
more auth cleanup
dholms Dec 28, 2022
b55f9d4
another lurker
dholms Dec 28, 2022
4523cad
wip better sync primitives
dholms Dec 29, 2022
6b11ba4
wip
dholms Dec 29, 2022
a5c913f
Merge branch 'repo-storage-sync' into sync-revamp
dholms Dec 29, 2022
dfc887c
Merge pull request #441 from bluesky-social/repo-mutation-diffs
dholms Dec 29, 2022
f9fd8a2
Merge pull request #443 from bluesky-social/repo-storage-migration
dholms Dec 29, 2022
8e7131d
improving diffs & sync
dholms Dec 29, 2022
d6cd794
tests working!
dholms Dec 29, 2022
fe109c6
actually implemented checkout lol
dholms Dec 30, 2022
a1ed8c3
Merge branch 'sync-revamp' into repo-checkout
dholms Dec 30, 2022
fdd60f7
simplify interface & improve error handling
dholms Dec 30, 2022
87abad4
writing sql storage code
dholms Dec 30, 2022
473bc92
fixing up tests
dholms Dec 30, 2022
0781d90
testing & bugfixes
dholms Jan 3, 2023
9f25a26
checkouts return records instead of cids
dholms Jan 3, 2023
8c1e9d5
one last refactor lol
dholms Jan 3, 2023
11970ef
missed one
dholms Jan 3, 2023
cff5b63
handle other cid codecs on incoming car verification
dholms Jan 3, 2023
b9b83d0
tests + tricky bugs
dholms Jan 3, 2023
c37082a
unneeded blockstore method
dholms Jan 3, 2023
6e58a0f
trim mst on del instead of save
dholms Jan 4, 2023
3269ad6
cleanup comment
dholms Jan 4, 2023
b8cfb78
dont resolve did for every commit
dholms Jan 4, 2023
156b332
use "commit" instead of "root"
dholms Jan 4, 2023
4953189
getRoot -> getHead
dholms Jan 4, 2023
716fb8b
pr feedback
dholms Jan 4, 2023
f647640
very silly bug fix
dholms Jan 4, 2023
00590c7
improve sync output
dholms Jan 4, 2023
423b6ab
Merge pull request #444 from bluesky-social/repo-checkout
dholms Jan 5, 2023
c3dc0b3
Merge pull request #460 from bluesky-social/record-write-descripts
dholms Jan 5, 2023
277e4a8
reorging + sync of particular records
dholms Jan 5, 2023
72cef57
serve & verify proofs. also rename some ipld methods
dholms Jan 6, 2023
7d271b5
fix up sync issue in mst
dholms Jan 6, 2023
bac84ce
find reachable records form carfile
dholms Jan 6, 2023
62355f4
getRecord xrpc method
dholms Jan 6, 2023
265b278
pr feedback
dholms Jan 18, 2023
08db20e
merged main
dholms Jan 18, 2023
98ba390
merge feature branch
dholms Jan 18, 2023
3f04e32
Merge pull request #462 from bluesky-social/narrow-clones
dholms Jan 18, 2023
281bd7e
merged amin
dholms Jan 19, 2023
fed8d9e
better migration test
dholms Jan 19, 2023
7d8a82e
check migraiton result
dholms Jan 19, 2023
f55e443
fixing up a couple things for pg
dholms Jan 19, 2023
2837034
explicit migrateTo
dholms Jan 20, 2023
aab057f
async exceptions
dholms Jan 20, 2023
aba06d3
Merge pull request #473 from bluesky-social/migration-test
dholms Jan 24, 2023
a39c8bc
ipld car mimetype + remove updateRepo
dholms Jan 24, 2023
19c03d5
Merge pull request #485 from bluesky-social/sync-mime-types
dholms Jan 24, 2023
c98059b
Update module publish scripts (#478)
pfrazee Jan 24, 2023
94b499e
Sort "suggested follows" by number of posts (#477)
dholms Jan 24, 2023
deb9740
partiion commit-history & commit-blocks by user did
dholms Jan 25, 2023
c5adea4
some lexicons
dholms Jan 24, 2023
fb5f565
delete records & repos
dholms Jan 25, 2023
af6fef6
delete blobs
dholms Jan 25, 2023
d513c4b
hook it up in route
dholms Jan 25, 2023
f33ea0e
pettier ignore email templates
dholms Jan 25, 2023
8e93735
testing & bugfixes
dholms Jan 26, 2023
54c4373
testing blobs & bugfixes
dholms Jan 26, 2023
4d4a0c7
pr feedback
dholms Jan 26, 2023
d409acb
make deletion test more robust
dholms Jan 26, 2023
d76d577
merge main
dholms Jan 27, 2023
2125fa4
change out handle for did on account deletion
dholms Jan 27, 2023
96493bc
merged main
dholms Feb 2, 2023
a35eecb
small cleanup
dholms Feb 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lexicons/com/atproto/account/delete.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@
"defs": {
"main": {
"type": "procedure",
"description": "Delete an account."
"description": "Delete a user account with a token and password.",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["handle", "password", "token"],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires re-entering password & as such does not require any auth

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out #492— should we switch handle to identifier here to mirror it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm probably...

altho actually, maybe it makes more sense to do did. to impress on the caller that you're deleting, not just the PDS concept of the user but the repo itself as well 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw ended up switching out for did for the above reason^^
As well, I think generally, we should only use handle as an "entry point" (login/password reset/discovery) & did for everything else.

2125fa4

"properties": {
"handle": { "type": "string" },
"password": { "type": "string" },
"token": { "type": "string" }
}
}
},
"errors": [{ "name": "ExpiredToken" }, { "name": "InvalidToken" }]
}
}
}
10 changes: 10 additions & 0 deletions lexicons/com/atproto/account/requestDelete.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"lexicon": 1,
"id": "com.atproto.account.requestDelete",
"defs": {
"main": {
"type": "procedure",
"description": "Initiate a user account deletion via email."
}
}
}
21 changes: 21 additions & 0 deletions lexicons/com/atproto/sync/getCheckout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"lexicon": 1,
"id": "com.atproto.sync.getCheckout",
"defs": {
"main": {
"type": "query",
"description": "Gets the repo state.",
"parameters": {
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"commit": {"type": "string", "description": "The commit to get the checkout from. Defaults to current HEAD."}
}
},
"output": {
"encoding": "application/vnd.ipld.car"
}
}
}
}
32 changes: 32 additions & 0 deletions lexicons/com/atproto/sync/getCommitPath.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"lexicon": 1,
"id": "com.atproto.sync.getCommitPath",
"defs": {
"main": {
"type": "query",
"description": "Gets the path of repo commits",
"parameters": {
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"latest": { "type": "string", "description": "The most recent commit"},
"earliest": { "type": "string", "description": "The earliest commit to start from"}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["commits"],
"properties": {
"commits": {
"type": "array",
"items": { "type": "string" }
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"lexicon": 1,
"id": "com.atproto.sync.getRoot",
"id": "com.atproto.sync.getHead",
"defs": {
"main": {
"type": "query",
"description": "Gets the current root CID of a repo.",
"description": "Gets the current HEAD CID of a repo.",
"parameters": {
"type": "params",
"required": ["did"],
Expand Down
23 changes: 23 additions & 0 deletions lexicons/com/atproto/sync/getRecord.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"lexicon": 1,
"id": "com.atproto.sync.getRecord",
"defs": {
"main": {
"type": "query",
"description": "Gets blocks needed for existence or non-existence of record.",
"parameters": {
"type": "params",
"required": ["did", "collection", "rkey"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"collection": {"type": "string" },
"rkey": {"type": "string" },
"commit": {"type": "string", "description": "An optional past commit CID."}
}
},
"output": {
"encoding": "application/vnd.ipld.car"
}
}
}
}
2 changes: 1 addition & 1 deletion lexicons/com/atproto/sync/getRepo.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
},
"output": {
"encoding": "application/cbor"
"encoding": "application/vnd.ipld.car"
}
}
}
Expand Down
20 changes: 0 additions & 20 deletions lexicons/com/atproto/sync/updateRepo.json

This file was deleted.

1 change: 0 additions & 1 deletion packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
## Libraries

- [API](./api): A library for communicating with ATP servers.
- [Auth](./auth): ATP's core permissioning library (based on UCANs).
- [Common](./common): A library containing code which is shared between ATP packages.
- [Crypto](./crypto): ATP's common cryptographic operations.
- [DID Resolver](./did-resolver): A library for resolving ATP's Decentralized ID methods.
Expand Down
83 changes: 61 additions & 22 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as ComAtprotoAccountCreate from './types/com/atproto/account/create'
import * as ComAtprotoAccountCreateInviteCode from './types/com/atproto/account/createInviteCode'
import * as ComAtprotoAccountDelete from './types/com/atproto/account/delete'
import * as ComAtprotoAccountGet from './types/com/atproto/account/get'
import * as ComAtprotoAccountRequestDelete from './types/com/atproto/account/requestDelete'
import * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset'
import * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword'
import * as ComAtprotoAdminGetModerationAction from './types/com/atproto/admin/getModerationAction'
Expand Down Expand Up @@ -46,9 +47,11 @@ import * as ComAtprotoSessionCreate from './types/com/atproto/session/create'
import * as ComAtprotoSessionDelete from './types/com/atproto/session/delete'
import * as ComAtprotoSessionGet from './types/com/atproto/session/get'
import * as ComAtprotoSessionRefresh from './types/com/atproto/session/refresh'
import * as ComAtprotoSyncGetCheckout from './types/com/atproto/sync/getCheckout'
import * as ComAtprotoSyncGetCommitPath from './types/com/atproto/sync/getCommitPath'
import * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead'
import * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord'
import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo'
import * as ComAtprotoSyncGetRoot from './types/com/atproto/sync/getRoot'
import * as ComAtprotoSyncUpdateRepo from './types/com/atproto/sync/updateRepo'
import * as AppBskyActorCreateScene from './types/app/bsky/actor/createScene'
import * as AppBskyActorGetProfile from './types/app/bsky/actor/getProfile'
import * as AppBskyActorGetSuggestions from './types/app/bsky/actor/getSuggestions'
Expand Down Expand Up @@ -95,6 +98,7 @@ export * as ComAtprotoAccountCreate from './types/com/atproto/account/create'
export * as ComAtprotoAccountCreateInviteCode from './types/com/atproto/account/createInviteCode'
export * as ComAtprotoAccountDelete from './types/com/atproto/account/delete'
export * as ComAtprotoAccountGet from './types/com/atproto/account/get'
export * as ComAtprotoAccountRequestDelete from './types/com/atproto/account/requestDelete'
export * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset'
export * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword'
export * as ComAtprotoAdminGetModerationAction from './types/com/atproto/admin/getModerationAction'
Expand Down Expand Up @@ -131,9 +135,11 @@ export * as ComAtprotoSessionCreate from './types/com/atproto/session/create'
export * as ComAtprotoSessionDelete from './types/com/atproto/session/delete'
export * as ComAtprotoSessionGet from './types/com/atproto/session/get'
export * as ComAtprotoSessionRefresh from './types/com/atproto/session/refresh'
export * as ComAtprotoSyncGetCheckout from './types/com/atproto/sync/getCheckout'
export * as ComAtprotoSyncGetCommitPath from './types/com/atproto/sync/getCommitPath'
export * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead'
export * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord'
export * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo'
export * as ComAtprotoSyncGetRoot from './types/com/atproto/sync/getRoot'
export * as ComAtprotoSyncUpdateRepo from './types/com/atproto/sync/updateRepo'
export * as AppBskyActorCreateScene from './types/app/bsky/actor/createScene'
export * as AppBskyActorGetProfile from './types/app/bsky/actor/getProfile'
export * as AppBskyActorGetSuggestions from './types/app/bsky/actor/getSuggestions'
Expand Down Expand Up @@ -314,6 +320,17 @@ export class AccountNS {
})
}

requestDelete(
data?: ComAtprotoAccountRequestDelete.InputSchema,
opts?: ComAtprotoAccountRequestDelete.CallOptions,
): Promise<ComAtprotoAccountRequestDelete.Response> {
return this._service.xrpc
.call('com.atproto.account.requestDelete', opts?.qp, data, opts)
.catch((e) => {
throw ComAtprotoAccountRequestDelete.toKnownErr(e)
})
}

requestPasswordReset(
data?: ComAtprotoAccountRequestPasswordReset.InputSchema,
opts?: ComAtprotoAccountRequestPasswordReset.CallOptions,
Expand Down Expand Up @@ -675,36 +692,58 @@ export class SyncNS {
this._service = service
}

getRepo(
params?: ComAtprotoSyncGetRepo.QueryParams,
opts?: ComAtprotoSyncGetRepo.CallOptions,
): Promise<ComAtprotoSyncGetRepo.Response> {
getCheckout(
params?: ComAtprotoSyncGetCheckout.QueryParams,
opts?: ComAtprotoSyncGetCheckout.CallOptions,
): Promise<ComAtprotoSyncGetCheckout.Response> {
return this._service.xrpc
.call('com.atproto.sync.getRepo', params, undefined, opts)
.call('com.atproto.sync.getCheckout', params, undefined, opts)
.catch((e) => {
throw ComAtprotoSyncGetRepo.toKnownErr(e)
throw ComAtprotoSyncGetCheckout.toKnownErr(e)
})
}

getCommitPath(
params?: ComAtprotoSyncGetCommitPath.QueryParams,
opts?: ComAtprotoSyncGetCommitPath.CallOptions,
): Promise<ComAtprotoSyncGetCommitPath.Response> {
return this._service.xrpc
.call('com.atproto.sync.getCommitPath', params, undefined, opts)
.catch((e) => {
throw ComAtprotoSyncGetCommitPath.toKnownErr(e)
})
}

getHead(
params?: ComAtprotoSyncGetHead.QueryParams,
opts?: ComAtprotoSyncGetHead.CallOptions,
): Promise<ComAtprotoSyncGetHead.Response> {
return this._service.xrpc
.call('com.atproto.sync.getHead', params, undefined, opts)
.catch((e) => {
throw ComAtprotoSyncGetHead.toKnownErr(e)
})
}

getRoot(
params?: ComAtprotoSyncGetRoot.QueryParams,
opts?: ComAtprotoSyncGetRoot.CallOptions,
): Promise<ComAtprotoSyncGetRoot.Response> {
getRecord(
params?: ComAtprotoSyncGetRecord.QueryParams,
opts?: ComAtprotoSyncGetRecord.CallOptions,
): Promise<ComAtprotoSyncGetRecord.Response> {
return this._service.xrpc
.call('com.atproto.sync.getRoot', params, undefined, opts)
.call('com.atproto.sync.getRecord', params, undefined, opts)
.catch((e) => {
throw ComAtprotoSyncGetRoot.toKnownErr(e)
throw ComAtprotoSyncGetRecord.toKnownErr(e)
})
}

updateRepo(
data?: ComAtprotoSyncUpdateRepo.InputSchema,
opts?: ComAtprotoSyncUpdateRepo.CallOptions,
): Promise<ComAtprotoSyncUpdateRepo.Response> {
getRepo(
params?: ComAtprotoSyncGetRepo.QueryParams,
opts?: ComAtprotoSyncGetRepo.CallOptions,
): Promise<ComAtprotoSyncGetRepo.Response> {
return this._service.xrpc
.call('com.atproto.sync.updateRepo', opts?.qp, data, opts)
.call('com.atproto.sync.getRepo', params, undefined, opts)
.catch((e) => {
throw ComAtprotoSyncUpdateRepo.toKnownErr(e)
throw ComAtprotoSyncGetRepo.toKnownErr(e)
})
}
}
Expand Down
Loading