From 4c511b3d9de41ffeae3fc11db941e7df04f4468a Mon Sep 17 00:00:00 2001 From: Daniel Holmgren Date: Tue, 20 Feb 2024 19:23:56 -0600 Subject: [PATCH] Account migration schemas (#2170) * draft of account migration lexicons * format * clean up schemas * second pass on schemas * small fix * move around checkImportStatus * getServiceAuth * schema tweaks * format * update schemas * email flow for signed plc operation * refactor listMissingBlobs a bit * codegen * return did in describeServer * changeset --- .changeset/slimy-games-breathe.md | 5 + .../getRecommendedDidCredentials.json | 29 ++ .../requestPlcOperationSignature.json | 10 + .../atproto/identity/signPlcOperation.json | 45 +++ .../atproto/identity/submitPlcOperation.json | 20 + lexicons/com/atproto/repo/importRepo.json | 13 + .../com/atproto/repo/listMissingBlobs.json | 44 +++ .../com/atproto/server/activateAccount.json | 10 + .../atproto/server/checkAccountStatus.json | 38 ++ .../com/atproto/server/deactivateAccount.json | 23 ++ .../com/atproto/server/describeServer.json | 6 +- .../com/atproto/server/getServiceAuth.json | 33 ++ packages/api/src/client/index.ts | 140 +++++++ packages/api/src/client/lexicons.ts | 348 +++++++++++++++++- .../identity/getRecommendedDidCredentials.ts | 37 ++ .../identity/requestPlcOperationSignature.ts | 28 ++ .../com/atproto/identity/signPlcOperation.ts | 44 +++ .../atproto/identity/submitPlcOperation.ts | 32 ++ .../types/com/atproto/repo/importRepo.ts | 29 ++ .../com/atproto/repo/listMissingBlobs.ts | 55 +++ .../com/atproto/server/activateAccount.ts | 28 ++ .../com/atproto/server/checkAccountStatus.ts | 41 +++ .../com/atproto/server/deactivateAccount.ts | 33 ++ .../com/atproto/server/describeServer.ts | 1 + .../com/atproto/server/getServiceAuth.ts | 36 ++ packages/bsky/src/lexicon/index.ts | 124 +++++++ packages/bsky/src/lexicon/lexicons.ts | 348 +++++++++++++++++- .../identity/getRecommendedDidCredentials.ts | 47 +++ .../identity/requestPlcOperationSignature.ts | 31 ++ .../com/atproto/identity/signPlcOperation.ts | 55 +++ .../atproto/identity/submitPlcOperation.ts | 38 ++ .../types/com/atproto/repo/importRepo.ts | 36 ++ .../com/atproto/repo/listMissingBlobs.ts | 65 ++++ .../com/atproto/server/activateAccount.ts | 31 ++ .../com/atproto/server/checkAccountStatus.ts | 51 +++ .../com/atproto/server/deactivateAccount.ts | 39 ++ .../com/atproto/server/describeServer.ts | 1 + .../com/atproto/server/getServiceAuth.ts | 46 +++ packages/ozone/src/lexicon/index.ts | 124 +++++++ packages/ozone/src/lexicon/lexicons.ts | 348 +++++++++++++++++- .../identity/getRecommendedDidCredentials.ts | 47 +++ .../identity/requestPlcOperationSignature.ts | 31 ++ .../com/atproto/identity/signPlcOperation.ts | 55 +++ .../atproto/identity/submitPlcOperation.ts | 38 ++ .../types/com/atproto/repo/importRepo.ts | 36 ++ .../com/atproto/repo/listMissingBlobs.ts | 65 ++++ .../com/atproto/server/activateAccount.ts | 31 ++ .../com/atproto/server/checkAccountStatus.ts | 51 +++ .../com/atproto/server/deactivateAccount.ts | 39 ++ .../com/atproto/server/describeServer.ts | 1 + .../com/atproto/server/getServiceAuth.ts | 46 +++ .../api/com/atproto/server/describeServer.ts | 1 + packages/pds/src/lexicon/index.ts | 124 +++++++ packages/pds/src/lexicon/lexicons.ts | 348 +++++++++++++++++- .../identity/getRecommendedDidCredentials.ts | 47 +++ .../identity/requestPlcOperationSignature.ts | 31 ++ .../com/atproto/identity/signPlcOperation.ts | 55 +++ .../atproto/identity/submitPlcOperation.ts | 38 ++ .../types/com/atproto/repo/importRepo.ts | 36 ++ .../com/atproto/repo/listMissingBlobs.ts | 65 ++++ .../com/atproto/server/activateAccount.ts | 31 ++ .../com/atproto/server/checkAccountStatus.ts | 51 +++ .../com/atproto/server/deactivateAccount.ts | 39 ++ .../com/atproto/server/describeServer.ts | 1 + .../com/atproto/server/getServiceAuth.ts | 46 +++ 65 files changed, 3860 insertions(+), 5 deletions(-) create mode 100644 .changeset/slimy-games-breathe.md create mode 100644 lexicons/com/atproto/identity/getRecommendedDidCredentials.json create mode 100644 lexicons/com/atproto/identity/requestPlcOperationSignature.json create mode 100644 lexicons/com/atproto/identity/signPlcOperation.json create mode 100644 lexicons/com/atproto/identity/submitPlcOperation.json create mode 100644 lexicons/com/atproto/repo/importRepo.json create mode 100644 lexicons/com/atproto/repo/listMissingBlobs.json create mode 100644 lexicons/com/atproto/server/activateAccount.json create mode 100644 lexicons/com/atproto/server/checkAccountStatus.json create mode 100644 lexicons/com/atproto/server/deactivateAccount.json create mode 100644 lexicons/com/atproto/server/getServiceAuth.json create mode 100644 packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts create mode 100644 packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts create mode 100644 packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts create mode 100644 packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts create mode 100644 packages/api/src/client/types/com/atproto/repo/importRepo.ts create mode 100644 packages/api/src/client/types/com/atproto/repo/listMissingBlobs.ts create mode 100644 packages/api/src/client/types/com/atproto/server/activateAccount.ts create mode 100644 packages/api/src/client/types/com/atproto/server/checkAccountStatus.ts create mode 100644 packages/api/src/client/types/com/atproto/server/deactivateAccount.ts create mode 100644 packages/api/src/client/types/com/atproto/server/getServiceAuth.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/identity/signPlcOperation.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/repo/importRepo.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/server/activateAccount.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/server/checkAccountStatus.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/server/deactivateAccount.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/server/getServiceAuth.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/identity/signPlcOperation.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/repo/importRepo.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/server/activateAccount.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/server/checkAccountStatus.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/server/deactivateAccount.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/server/getServiceAuth.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/identity/signPlcOperation.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/repo/importRepo.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/server/activateAccount.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/server/checkAccountStatus.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/server/deactivateAccount.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/server/getServiceAuth.ts diff --git a/.changeset/slimy-games-breathe.md b/.changeset/slimy-games-breathe.md new file mode 100644 index 00000000000..7551f0cb235 --- /dev/null +++ b/.changeset/slimy-games-breathe.md @@ -0,0 +1,5 @@ +--- +'@atproto/api': minor +--- + +Add lexicons and methods for account migration diff --git a/lexicons/com/atproto/identity/getRecommendedDidCredentials.json b/lexicons/com/atproto/identity/getRecommendedDidCredentials.json new file mode 100644 index 00000000000..3506dbec351 --- /dev/null +++ b/lexicons/com/atproto/identity/getRecommendedDidCredentials.json @@ -0,0 +1,29 @@ +{ + "lexicon": 1, + "id": "com.atproto.identity.getRecommendedDidCredentials", + "defs": { + "main": { + "type": "query", + "description": "Describe the credentials that should be included in the DID doc of an account that is migrating to this service.", + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "properties": { + "rotationKeys": { + "description": "Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs.", + "type": "array", + "items": { "type": "string" } + }, + "alsoKnownAs": { + "type": "array", + "items": { "type": "string" } + }, + "verificationMethods": { "type": "unknown" }, + "services": { "type": "unknown" } + } + } + } + } + } +} diff --git a/lexicons/com/atproto/identity/requestPlcOperationSignature.json b/lexicons/com/atproto/identity/requestPlcOperationSignature.json new file mode 100644 index 00000000000..4aa8b18fee9 --- /dev/null +++ b/lexicons/com/atproto/identity/requestPlcOperationSignature.json @@ -0,0 +1,10 @@ +{ + "lexicon": 1, + "id": "com.atproto.identity.requestPlcOperationSignature", + "defs": { + "main": { + "type": "procedure", + "description": "Request an email with a code to in order to request a signed PLC operation. Requires Auth." + } + } +} diff --git a/lexicons/com/atproto/identity/signPlcOperation.json b/lexicons/com/atproto/identity/signPlcOperation.json new file mode 100644 index 00000000000..05a952cab6c --- /dev/null +++ b/lexicons/com/atproto/identity/signPlcOperation.json @@ -0,0 +1,45 @@ +{ + "lexicon": 1, + "id": "com.atproto.identity.signPlcOperation", + "defs": { + "main": { + "type": "procedure", + "description": "Signs a PLC operation to update some value(s) in the requesting DID's document.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "properties": { + "token": { + "description": "A token received through com.atproto.identity.requestPlcOperationSignature", + "type": "string" + }, + "rotationKeys": { + "type": "array", + "items": { "type": "string" } + }, + "alsoKnownAs": { + "type": "array", + "items": { "type": "string" } + }, + "verificationMethods": { "type": "unknown" }, + "services": { "type": "unknown" } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["operation"], + "properties": { + "operation": { + "type": "unknown", + "description": "A signed DID PLC operation." + } + } + } + } + } + } +} diff --git a/lexicons/com/atproto/identity/submitPlcOperation.json b/lexicons/com/atproto/identity/submitPlcOperation.json new file mode 100644 index 00000000000..280f5003b0d --- /dev/null +++ b/lexicons/com/atproto/identity/submitPlcOperation.json @@ -0,0 +1,20 @@ +{ + "lexicon": 1, + "id": "com.atproto.identity.submitPlcOperation", + "defs": { + "main": { + "type": "procedure", + "description": "Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["operation"], + "properties": { + "operation": { "type": "unknown" } + } + } + } + } + } +} diff --git a/lexicons/com/atproto/repo/importRepo.json b/lexicons/com/atproto/repo/importRepo.json new file mode 100644 index 00000000000..fc850b1a2b6 --- /dev/null +++ b/lexicons/com/atproto/repo/importRepo.json @@ -0,0 +1,13 @@ +{ + "lexicon": 1, + "id": "com.atproto.repo.importRepo", + "defs": { + "main": { + "type": "procedure", + "description": "Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.", + "input": { + "encoding": "application/vnd.ipld.car" + } + } + } +} diff --git a/lexicons/com/atproto/repo/listMissingBlobs.json b/lexicons/com/atproto/repo/listMissingBlobs.json new file mode 100644 index 00000000000..c39913d566c --- /dev/null +++ b/lexicons/com/atproto/repo/listMissingBlobs.json @@ -0,0 +1,44 @@ +{ + "lexicon": 1, + "id": "com.atproto.repo.listMissingBlobs", + "defs": { + "main": { + "type": "query", + "description": "Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.", + "parameters": { + "type": "params", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 1000, + "default": 500 + }, + "cursor": { "type": "string" } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["blobs"], + "properties": { + "cursor": { "type": "string" }, + "blobs": { + "type": "array", + "items": { "type": "ref", "ref": "#recordBlob" } + } + } + } + } + }, + "recordBlob": { + "type": "object", + "required": ["cid", "recordUri"], + "properties": { + "cid": { "type": "string", "format": "cid" }, + "recordUri": { "type": "string", "format": "at-uri" } + } + } + } +} diff --git a/lexicons/com/atproto/server/activateAccount.json b/lexicons/com/atproto/server/activateAccount.json new file mode 100644 index 00000000000..e06935fcd07 --- /dev/null +++ b/lexicons/com/atproto/server/activateAccount.json @@ -0,0 +1,10 @@ +{ + "lexicon": 1, + "id": "com.atproto.server.activateAccount", + "defs": { + "main": { + "type": "procedure", + "description": "Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup." + } + } +} diff --git a/lexicons/com/atproto/server/checkAccountStatus.json b/lexicons/com/atproto/server/checkAccountStatus.json new file mode 100644 index 00000000000..d34596e60e1 --- /dev/null +++ b/lexicons/com/atproto/server/checkAccountStatus.json @@ -0,0 +1,38 @@ +{ + "lexicon": 1, + "id": "com.atproto.server.checkAccountStatus", + "defs": { + "main": { + "type": "query", + "description": "Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself.", + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "activated", + "validDid", + "repoCommit", + "repoRev", + "repoBlocks", + "indexedRecords", + "privateStateValues", + "expectedBlobs", + "importedBlobs" + ], + "properties": { + "activated": { "type": "boolean" }, + "validDid": { "type": "boolean" }, + "repoCommit": { "type": "string", "format": "cid" }, + "repoRev": { "type": "string" }, + "repoBlocks": { "type": "integer" }, + "indexedRecords": { "type": "integer" }, + "privateStateValues": { "type": "integer" }, + "expectedBlobs": { "type": "integer" }, + "importedBlobs": { "type": "integer" } + } + } + } + } + } +} diff --git a/lexicons/com/atproto/server/deactivateAccount.json b/lexicons/com/atproto/server/deactivateAccount.json new file mode 100644 index 00000000000..698fccf202e --- /dev/null +++ b/lexicons/com/atproto/server/deactivateAccount.json @@ -0,0 +1,23 @@ +{ + "lexicon": 1, + "id": "com.atproto.server.deactivateAccount", + "defs": { + "main": { + "type": "procedure", + "description": "Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "properties": { + "deleteAfter": { + "type": "string", + "format": "datetime", + "description": "A recommendation to server as to how long they should hold onto the deactivated account before deleting." + } + } + } + } + } + } +} diff --git a/lexicons/com/atproto/server/describeServer.json b/lexicons/com/atproto/server/describeServer.json index 908cb2127f9..d7bd4ab76f2 100644 --- a/lexicons/com/atproto/server/describeServer.json +++ b/lexicons/com/atproto/server/describeServer.json @@ -9,7 +9,7 @@ "encoding": "application/json", "schema": { "type": "object", - "required": ["availableUserDomains"], + "required": ["did", "availableUserDomains"], "properties": { "inviteCodeRequired": { "type": "boolean", @@ -28,6 +28,10 @@ "type": "ref", "description": "URLs of service policy documents.", "ref": "#links" + }, + "did": { + "type": "string", + "format": "did" } } } diff --git a/lexicons/com/atproto/server/getServiceAuth.json b/lexicons/com/atproto/server/getServiceAuth.json new file mode 100644 index 00000000000..95984c186ad --- /dev/null +++ b/lexicons/com/atproto/server/getServiceAuth.json @@ -0,0 +1,33 @@ +{ + "lexicon": 1, + "id": "com.atproto.server.getServiceAuth", + "defs": { + "main": { + "type": "query", + "description": "Get a signed token on behalf of the requesting DID for the requested service.", + "parameters": { + "type": "params", + "required": ["aud"], + "properties": { + "aud": { + "type": "string", + "format": "did", + "description": "The DID of the service that the token will be used to authenticate with" + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["token"], + "properties": { + "token": { + "type": "string" + } + } + } + } + } + } +} diff --git a/packages/api/src/client/index.ts b/packages/api/src/client/index.ts index 35c784cbea3..42f31866dae 100644 --- a/packages/api/src/client/index.ts +++ b/packages/api/src/client/index.ts @@ -31,7 +31,11 @@ import * as ComAtprotoAdminUpdateAccountEmail from './types/com/atproto/admin/up import * as ComAtprotoAdminUpdateAccountHandle from './types/com/atproto/admin/updateAccountHandle' import * as ComAtprotoAdminUpdateCommunicationTemplate from './types/com/atproto/admin/updateCommunicationTemplate' import * as ComAtprotoAdminUpdateSubjectStatus from './types/com/atproto/admin/updateSubjectStatus' +import * as ComAtprotoIdentityGetRecommendedDidCredentials from './types/com/atproto/identity/getRecommendedDidCredentials' +import * as ComAtprotoIdentityRequestPlcOperationSignature from './types/com/atproto/identity/requestPlcOperationSignature' import * as ComAtprotoIdentityResolveHandle from './types/com/atproto/identity/resolveHandle' +import * as ComAtprotoIdentitySignPlcOperation from './types/com/atproto/identity/signPlcOperation' +import * as ComAtprotoIdentitySubmitPlcOperation from './types/com/atproto/identity/submitPlcOperation' import * as ComAtprotoIdentityUpdateHandle from './types/com/atproto/identity/updateHandle' import * as ComAtprotoLabelDefs from './types/com/atproto/label/defs' import * as ComAtprotoLabelQueryLabels from './types/com/atproto/label/queryLabels' @@ -43,21 +47,27 @@ import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createReco import * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord' import * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo' import * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord' +import * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo' +import * as ComAtprotoRepoListMissingBlobs from './types/com/atproto/repo/listMissingBlobs' import * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords' import * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord' import * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef' import * as ComAtprotoRepoUploadBlob from './types/com/atproto/repo/uploadBlob' +import * as ComAtprotoServerActivateAccount from './types/com/atproto/server/activateAccount' +import * as ComAtprotoServerCheckAccountStatus from './types/com/atproto/server/checkAccountStatus' import * as ComAtprotoServerConfirmEmail from './types/com/atproto/server/confirmEmail' import * as ComAtprotoServerCreateAccount from './types/com/atproto/server/createAccount' import * as ComAtprotoServerCreateAppPassword from './types/com/atproto/server/createAppPassword' import * as ComAtprotoServerCreateInviteCode from './types/com/atproto/server/createInviteCode' import * as ComAtprotoServerCreateInviteCodes from './types/com/atproto/server/createInviteCodes' import * as ComAtprotoServerCreateSession from './types/com/atproto/server/createSession' +import * as ComAtprotoServerDeactivateAccount from './types/com/atproto/server/deactivateAccount' import * as ComAtprotoServerDefs from './types/com/atproto/server/defs' import * as ComAtprotoServerDeleteAccount from './types/com/atproto/server/deleteAccount' import * as ComAtprotoServerDeleteSession from './types/com/atproto/server/deleteSession' import * as ComAtprotoServerDescribeServer from './types/com/atproto/server/describeServer' import * as ComAtprotoServerGetAccountInviteCodes from './types/com/atproto/server/getAccountInviteCodes' +import * as ComAtprotoServerGetServiceAuth from './types/com/atproto/server/getServiceAuth' import * as ComAtprotoServerGetSession from './types/com/atproto/server/getSession' import * as ComAtprotoServerListAppPasswords from './types/com/atproto/server/listAppPasswords' import * as ComAtprotoServerRefreshSession from './types/com/atproto/server/refreshSession' @@ -177,7 +187,11 @@ export * as ComAtprotoAdminUpdateAccountEmail from './types/com/atproto/admin/up export * as ComAtprotoAdminUpdateAccountHandle from './types/com/atproto/admin/updateAccountHandle' export * as ComAtprotoAdminUpdateCommunicationTemplate from './types/com/atproto/admin/updateCommunicationTemplate' export * as ComAtprotoAdminUpdateSubjectStatus from './types/com/atproto/admin/updateSubjectStatus' +export * as ComAtprotoIdentityGetRecommendedDidCredentials from './types/com/atproto/identity/getRecommendedDidCredentials' +export * as ComAtprotoIdentityRequestPlcOperationSignature from './types/com/atproto/identity/requestPlcOperationSignature' export * as ComAtprotoIdentityResolveHandle from './types/com/atproto/identity/resolveHandle' +export * as ComAtprotoIdentitySignPlcOperation from './types/com/atproto/identity/signPlcOperation' +export * as ComAtprotoIdentitySubmitPlcOperation from './types/com/atproto/identity/submitPlcOperation' export * as ComAtprotoIdentityUpdateHandle from './types/com/atproto/identity/updateHandle' export * as ComAtprotoLabelDefs from './types/com/atproto/label/defs' export * as ComAtprotoLabelQueryLabels from './types/com/atproto/label/queryLabels' @@ -189,21 +203,27 @@ export * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createReco export * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord' export * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo' export * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord' +export * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo' +export * as ComAtprotoRepoListMissingBlobs from './types/com/atproto/repo/listMissingBlobs' export * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords' export * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord' export * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef' export * as ComAtprotoRepoUploadBlob from './types/com/atproto/repo/uploadBlob' +export * as ComAtprotoServerActivateAccount from './types/com/atproto/server/activateAccount' +export * as ComAtprotoServerCheckAccountStatus from './types/com/atproto/server/checkAccountStatus' export * as ComAtprotoServerConfirmEmail from './types/com/atproto/server/confirmEmail' export * as ComAtprotoServerCreateAccount from './types/com/atproto/server/createAccount' export * as ComAtprotoServerCreateAppPassword from './types/com/atproto/server/createAppPassword' export * as ComAtprotoServerCreateInviteCode from './types/com/atproto/server/createInviteCode' export * as ComAtprotoServerCreateInviteCodes from './types/com/atproto/server/createInviteCodes' export * as ComAtprotoServerCreateSession from './types/com/atproto/server/createSession' +export * as ComAtprotoServerDeactivateAccount from './types/com/atproto/server/deactivateAccount' export * as ComAtprotoServerDefs from './types/com/atproto/server/defs' export * as ComAtprotoServerDeleteAccount from './types/com/atproto/server/deleteAccount' export * as ComAtprotoServerDeleteSession from './types/com/atproto/server/deleteSession' export * as ComAtprotoServerDescribeServer from './types/com/atproto/server/describeServer' export * as ComAtprotoServerGetAccountInviteCodes from './types/com/atproto/server/getAccountInviteCodes' +export * as ComAtprotoServerGetServiceAuth from './types/com/atproto/server/getServiceAuth' export * as ComAtprotoServerGetSession from './types/com/atproto/server/getSession' export * as ComAtprotoServerListAppPasswords from './types/com/atproto/server/listAppPasswords' export * as ComAtprotoServerRefreshSession from './types/com/atproto/server/refreshSession' @@ -675,6 +695,38 @@ export class ComAtprotoIdentityNS { this._service = service } + getRecommendedDidCredentials( + params?: ComAtprotoIdentityGetRecommendedDidCredentials.QueryParams, + opts?: ComAtprotoIdentityGetRecommendedDidCredentials.CallOptions, + ): Promise { + return this._service.xrpc + .call( + 'com.atproto.identity.getRecommendedDidCredentials', + params, + undefined, + opts, + ) + .catch((e) => { + throw ComAtprotoIdentityGetRecommendedDidCredentials.toKnownErr(e) + }) + } + + requestPlcOperationSignature( + data?: ComAtprotoIdentityRequestPlcOperationSignature.InputSchema, + opts?: ComAtprotoIdentityRequestPlcOperationSignature.CallOptions, + ): Promise { + return this._service.xrpc + .call( + 'com.atproto.identity.requestPlcOperationSignature', + opts?.qp, + data, + opts, + ) + .catch((e) => { + throw ComAtprotoIdentityRequestPlcOperationSignature.toKnownErr(e) + }) + } + resolveHandle( params?: ComAtprotoIdentityResolveHandle.QueryParams, opts?: ComAtprotoIdentityResolveHandle.CallOptions, @@ -686,6 +738,28 @@ export class ComAtprotoIdentityNS { }) } + signPlcOperation( + data?: ComAtprotoIdentitySignPlcOperation.InputSchema, + opts?: ComAtprotoIdentitySignPlcOperation.CallOptions, + ): Promise { + return this._service.xrpc + .call('com.atproto.identity.signPlcOperation', opts?.qp, data, opts) + .catch((e) => { + throw ComAtprotoIdentitySignPlcOperation.toKnownErr(e) + }) + } + + submitPlcOperation( + data?: ComAtprotoIdentitySubmitPlcOperation.InputSchema, + opts?: ComAtprotoIdentitySubmitPlcOperation.CallOptions, + ): Promise { + return this._service.xrpc + .call('com.atproto.identity.submitPlcOperation', opts?.qp, data, opts) + .catch((e) => { + throw ComAtprotoIdentitySubmitPlcOperation.toKnownErr(e) + }) + } + updateHandle( data?: ComAtprotoIdentityUpdateHandle.InputSchema, opts?: ComAtprotoIdentityUpdateHandle.CallOptions, @@ -798,6 +872,28 @@ export class ComAtprotoRepoNS { }) } + importRepo( + data?: ComAtprotoRepoImportRepo.InputSchema, + opts?: ComAtprotoRepoImportRepo.CallOptions, + ): Promise { + return this._service.xrpc + .call('com.atproto.repo.importRepo', opts?.qp, data, opts) + .catch((e) => { + throw ComAtprotoRepoImportRepo.toKnownErr(e) + }) + } + + listMissingBlobs( + params?: ComAtprotoRepoListMissingBlobs.QueryParams, + opts?: ComAtprotoRepoListMissingBlobs.CallOptions, + ): Promise { + return this._service.xrpc + .call('com.atproto.repo.listMissingBlobs', params, undefined, opts) + .catch((e) => { + throw ComAtprotoRepoListMissingBlobs.toKnownErr(e) + }) + } + listRecords( params?: ComAtprotoRepoListRecords.QueryParams, opts?: ComAtprotoRepoListRecords.CallOptions, @@ -839,6 +935,28 @@ export class ComAtprotoServerNS { this._service = service } + activateAccount( + data?: ComAtprotoServerActivateAccount.InputSchema, + opts?: ComAtprotoServerActivateAccount.CallOptions, + ): Promise { + return this._service.xrpc + .call('com.atproto.server.activateAccount', opts?.qp, data, opts) + .catch((e) => { + throw ComAtprotoServerActivateAccount.toKnownErr(e) + }) + } + + checkAccountStatus( + params?: ComAtprotoServerCheckAccountStatus.QueryParams, + opts?: ComAtprotoServerCheckAccountStatus.CallOptions, + ): Promise { + return this._service.xrpc + .call('com.atproto.server.checkAccountStatus', params, undefined, opts) + .catch((e) => { + throw ComAtprotoServerCheckAccountStatus.toKnownErr(e) + }) + } + confirmEmail( data?: ComAtprotoServerConfirmEmail.InputSchema, opts?: ComAtprotoServerConfirmEmail.CallOptions, @@ -905,6 +1023,17 @@ export class ComAtprotoServerNS { }) } + deactivateAccount( + data?: ComAtprotoServerDeactivateAccount.InputSchema, + opts?: ComAtprotoServerDeactivateAccount.CallOptions, + ): Promise { + return this._service.xrpc + .call('com.atproto.server.deactivateAccount', opts?.qp, data, opts) + .catch((e) => { + throw ComAtprotoServerDeactivateAccount.toKnownErr(e) + }) + } + deleteAccount( data?: ComAtprotoServerDeleteAccount.InputSchema, opts?: ComAtprotoServerDeleteAccount.CallOptions, @@ -949,6 +1078,17 @@ export class ComAtprotoServerNS { }) } + getServiceAuth( + params?: ComAtprotoServerGetServiceAuth.QueryParams, + opts?: ComAtprotoServerGetServiceAuth.CallOptions, + ): Promise { + return this._service.xrpc + .call('com.atproto.server.getServiceAuth', params, undefined, opts) + .catch((e) => { + throw ComAtprotoServerGetServiceAuth.toKnownErr(e) + }) + } + getSession( params?: ComAtprotoServerGetSession.QueryParams, opts?: ComAtprotoServerGetSession.CallOptions, diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index 01a2f683d77..a3491462d50 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -1968,6 +1968,56 @@ export const schemaDict = { }, }, }, + ComAtprotoIdentityGetRecommendedDidCredentials: { + lexicon: 1, + id: 'com.atproto.identity.getRecommendedDidCredentials', + defs: { + main: { + type: 'query', + description: + 'Describe the credentials that should be included in the DID doc of an account that is migrating to this service.', + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + rotationKeys: { + description: + 'Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs.', + type: 'array', + items: { + type: 'string', + }, + }, + alsoKnownAs: { + type: 'array', + items: { + type: 'string', + }, + }, + verificationMethods: { + type: 'unknown', + }, + services: { + type: 'unknown', + }, + }, + }, + }, + }, + }, + }, + ComAtprotoIdentityRequestPlcOperationSignature: { + lexicon: 1, + id: 'com.atproto.identity.requestPlcOperationSignature', + defs: { + main: { + type: 'procedure', + description: + 'Request an email with a code to in order to request a signed PLC operation. Requires Auth.', + }, + }, + }, ComAtprotoIdentityResolveHandle: { lexicon: 1, id: 'com.atproto.identity.resolveHandle', @@ -2002,6 +2052,84 @@ export const schemaDict = { }, }, }, + ComAtprotoIdentitySignPlcOperation: { + lexicon: 1, + id: 'com.atproto.identity.signPlcOperation', + defs: { + main: { + type: 'procedure', + description: + "Signs a PLC operation to update some value(s) in the requesting DID's document.", + input: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + token: { + description: + 'A token received through com.atproto.identity.requestPlcOperationSignature', + type: 'string', + }, + rotationKeys: { + type: 'array', + items: { + type: 'string', + }, + }, + alsoKnownAs: { + type: 'array', + items: { + type: 'string', + }, + }, + verificationMethods: { + type: 'unknown', + }, + services: { + type: 'unknown', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['operation'], + properties: { + operation: { + type: 'unknown', + description: 'A signed DID PLC operation.', + }, + }, + }, + }, + }, + }, + }, + ComAtprotoIdentitySubmitPlcOperation: { + lexicon: 1, + id: 'com.atproto.identity.submitPlcOperation', + defs: { + main: { + type: 'procedure', + description: + "Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry", + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['operation'], + properties: { + operation: { + type: 'unknown', + }, + }, + }, + }, + }, + }, + }, ComAtprotoIdentityUpdateHandle: { lexicon: 1, id: 'com.atproto.identity.updateHandle', @@ -2710,6 +2838,78 @@ export const schemaDict = { }, }, }, + ComAtprotoRepoImportRepo: { + lexicon: 1, + id: 'com.atproto.repo.importRepo', + defs: { + main: { + type: 'procedure', + description: + 'Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.', + input: { + encoding: 'application/vnd.ipld.car', + }, + }, + }, + }, + ComAtprotoRepoListMissingBlobs: { + lexicon: 1, + id: 'com.atproto.repo.listMissingBlobs', + defs: { + main: { + type: 'query', + description: + 'Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.', + parameters: { + type: 'params', + properties: { + limit: { + type: 'integer', + minimum: 1, + maximum: 1000, + default: 500, + }, + cursor: { + type: 'string', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['blobs'], + properties: { + cursor: { + type: 'string', + }, + blobs: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:com.atproto.repo.listMissingBlobs#recordBlob', + }, + }, + }, + }, + }, + }, + recordBlob: { + type: 'object', + required: ['cid', 'recordUri'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + recordUri: { + type: 'string', + format: 'at-uri', + }, + }, + }, + }, + }, ComAtprotoRepoListRecords: { lexicon: 1, id: 'com.atproto.repo.listRecords', @@ -2925,6 +3125,75 @@ export const schemaDict = { }, }, }, + ComAtprotoServerActivateAccount: { + lexicon: 1, + id: 'com.atproto.server.activateAccount', + defs: { + main: { + type: 'procedure', + description: + "Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup.", + }, + }, + }, + ComAtprotoServerCheckAccountStatus: { + lexicon: 1, + id: 'com.atproto.server.checkAccountStatus', + defs: { + main: { + type: 'query', + description: + 'Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself.', + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: [ + 'activated', + 'validDid', + 'repoCommit', + 'repoRev', + 'repoBlocks', + 'indexedRecords', + 'privateStateValues', + 'expectedBlobs', + 'importedBlobs', + ], + properties: { + activated: { + type: 'boolean', + }, + validDid: { + type: 'boolean', + }, + repoCommit: { + type: 'string', + format: 'cid', + }, + repoRev: { + type: 'string', + }, + repoBlocks: { + type: 'integer', + }, + indexedRecords: { + type: 'integer', + }, + privateStateValues: { + type: 'integer', + }, + expectedBlobs: { + type: 'integer', + }, + importedBlobs: { + type: 'integer', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerConfirmEmail: { lexicon: 1, id: 'com.atproto.server.confirmEmail', @@ -3293,6 +3562,31 @@ export const schemaDict = { }, }, }, + ComAtprotoServerDeactivateAccount: { + lexicon: 1, + id: 'com.atproto.server.deactivateAccount', + defs: { + main: { + type: 'procedure', + description: + 'Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + deleteAfter: { + type: 'string', + format: 'datetime', + description: + 'A recommendation to server as to how long they should hold onto the deactivated account before deleting.', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerDefs: { lexicon: 1, id: 'com.atproto.server.defs', @@ -3413,7 +3707,7 @@ export const schemaDict = { encoding: 'application/json', schema: { type: 'object', - required: ['availableUserDomains'], + required: ['did', 'availableUserDomains'], properties: { inviteCodeRequired: { type: 'boolean', @@ -3438,6 +3732,10 @@ export const schemaDict = { description: 'URLs of service policy documents.', ref: 'lex:com.atproto.server.describeServer#links', }, + did: { + type: 'string', + format: 'did', + }, }, }, }, @@ -3502,6 +3800,41 @@ export const schemaDict = { }, }, }, + ComAtprotoServerGetServiceAuth: { + lexicon: 1, + id: 'com.atproto.server.getServiceAuth', + defs: { + main: { + type: 'query', + description: + 'Get a signed token on behalf of the requesting DID for the requested service.', + parameters: { + type: 'params', + required: ['aud'], + properties: { + aud: { + type: 'string', + format: 'did', + description: + 'The DID of the service that the token will be used to authenticate with', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['token'], + properties: { + token: { + type: 'string', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerGetSession: { lexicon: 1, id: 'com.atproto.server.getSession', @@ -8582,7 +8915,14 @@ export const ids = { ComAtprotoAdminUpdateCommunicationTemplate: 'com.atproto.admin.updateCommunicationTemplate', ComAtprotoAdminUpdateSubjectStatus: 'com.atproto.admin.updateSubjectStatus', + ComAtprotoIdentityGetRecommendedDidCredentials: + 'com.atproto.identity.getRecommendedDidCredentials', + ComAtprotoIdentityRequestPlcOperationSignature: + 'com.atproto.identity.requestPlcOperationSignature', ComAtprotoIdentityResolveHandle: 'com.atproto.identity.resolveHandle', + ComAtprotoIdentitySignPlcOperation: 'com.atproto.identity.signPlcOperation', + ComAtprotoIdentitySubmitPlcOperation: + 'com.atproto.identity.submitPlcOperation', ComAtprotoIdentityUpdateHandle: 'com.atproto.identity.updateHandle', ComAtprotoLabelDefs: 'com.atproto.label.defs', ComAtprotoLabelQueryLabels: 'com.atproto.label.queryLabels', @@ -8594,22 +8934,28 @@ export const ids = { ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord', ComAtprotoRepoDescribeRepo: 'com.atproto.repo.describeRepo', ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord', + ComAtprotoRepoImportRepo: 'com.atproto.repo.importRepo', + ComAtprotoRepoListMissingBlobs: 'com.atproto.repo.listMissingBlobs', ComAtprotoRepoListRecords: 'com.atproto.repo.listRecords', ComAtprotoRepoPutRecord: 'com.atproto.repo.putRecord', ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef', ComAtprotoRepoUploadBlob: 'com.atproto.repo.uploadBlob', + ComAtprotoServerActivateAccount: 'com.atproto.server.activateAccount', + ComAtprotoServerCheckAccountStatus: 'com.atproto.server.checkAccountStatus', ComAtprotoServerConfirmEmail: 'com.atproto.server.confirmEmail', ComAtprotoServerCreateAccount: 'com.atproto.server.createAccount', ComAtprotoServerCreateAppPassword: 'com.atproto.server.createAppPassword', ComAtprotoServerCreateInviteCode: 'com.atproto.server.createInviteCode', ComAtprotoServerCreateInviteCodes: 'com.atproto.server.createInviteCodes', ComAtprotoServerCreateSession: 'com.atproto.server.createSession', + ComAtprotoServerDeactivateAccount: 'com.atproto.server.deactivateAccount', ComAtprotoServerDefs: 'com.atproto.server.defs', ComAtprotoServerDeleteAccount: 'com.atproto.server.deleteAccount', ComAtprotoServerDeleteSession: 'com.atproto.server.deleteSession', ComAtprotoServerDescribeServer: 'com.atproto.server.describeServer', ComAtprotoServerGetAccountInviteCodes: 'com.atproto.server.getAccountInviteCodes', + ComAtprotoServerGetServiceAuth: 'com.atproto.server.getServiceAuth', ComAtprotoServerGetSession: 'com.atproto.server.getSession', ComAtprotoServerListAppPasswords: 'com.atproto.server.listAppPasswords', ComAtprotoServerRefreshSession: 'com.atproto.server.refreshSession', diff --git a/packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts b/packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts new file mode 100644 index 00000000000..dfa143e4ab3 --- /dev/null +++ b/packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts @@ -0,0 +1,37 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface OutputSchema { + /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ + rotationKeys?: string[] + alsoKnownAs?: string[] + verificationMethods?: {} + services?: {} + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers +} + +export interface Response { + success: boolean + headers: Headers + data: OutputSchema +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts b/packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts new file mode 100644 index 00000000000..ef2ed1ac47c --- /dev/null +++ b/packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts @@ -0,0 +1,28 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface CallOptions { + headers?: Headers + qp?: QueryParams +} + +export interface Response { + success: boolean + headers: Headers +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts b/packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts new file mode 100644 index 00000000000..3060c1e3f4d --- /dev/null +++ b/packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts @@ -0,0 +1,44 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export interface InputSchema { + /** A token received through com.atproto.identity.requestPlcOperationSignature */ + token?: string + rotationKeys?: string[] + alsoKnownAs?: string[] + verificationMethods?: {} + services?: {} + [k: string]: unknown +} + +export interface OutputSchema { + /** A signed DID PLC operation. */ + operation: {} + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers + qp?: QueryParams + encoding: 'application/json' +} + +export interface Response { + success: boolean + headers: Headers + data: OutputSchema +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts b/packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts new file mode 100644 index 00000000000..4ba52f74fc7 --- /dev/null +++ b/packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts @@ -0,0 +1,32 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export interface InputSchema { + operation: {} + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers + qp?: QueryParams + encoding: 'application/json' +} + +export interface Response { + success: boolean + headers: Headers +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/repo/importRepo.ts b/packages/api/src/client/types/com/atproto/repo/importRepo.ts new file mode 100644 index 00000000000..040cca671bf --- /dev/null +++ b/packages/api/src/client/types/com/atproto/repo/importRepo.ts @@ -0,0 +1,29 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export type InputSchema = string | Uint8Array + +export interface CallOptions { + headers?: Headers + qp?: QueryParams + encoding: 'application/vnd.ipld.car' +} + +export interface Response { + success: boolean + headers: Headers +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/repo/listMissingBlobs.ts b/packages/api/src/client/types/com/atproto/repo/listMissingBlobs.ts new file mode 100644 index 00000000000..b66f617eea7 --- /dev/null +++ b/packages/api/src/client/types/com/atproto/repo/listMissingBlobs.ts @@ -0,0 +1,55 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams { + limit?: number + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + blobs: RecordBlob[] + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers +} + +export interface Response { + success: boolean + headers: Headers + data: OutputSchema +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} + +export interface RecordBlob { + cid: string + recordUri: string + [k: string]: unknown +} + +export function isRecordBlob(v: unknown): v is RecordBlob { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'com.atproto.repo.listMissingBlobs#recordBlob' + ) +} + +export function validateRecordBlob(v: unknown): ValidationResult { + return lexicons.validate('com.atproto.repo.listMissingBlobs#recordBlob', v) +} diff --git a/packages/api/src/client/types/com/atproto/server/activateAccount.ts b/packages/api/src/client/types/com/atproto/server/activateAccount.ts new file mode 100644 index 00000000000..ef2ed1ac47c --- /dev/null +++ b/packages/api/src/client/types/com/atproto/server/activateAccount.ts @@ -0,0 +1,28 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface CallOptions { + headers?: Headers + qp?: QueryParams +} + +export interface Response { + success: boolean + headers: Headers +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/server/checkAccountStatus.ts b/packages/api/src/client/types/com/atproto/server/checkAccountStatus.ts new file mode 100644 index 00000000000..86a942f81f3 --- /dev/null +++ b/packages/api/src/client/types/com/atproto/server/checkAccountStatus.ts @@ -0,0 +1,41 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface OutputSchema { + activated: boolean + validDid: boolean + repoCommit: string + repoRev: string + repoBlocks: number + indexedRecords: number + privateStateValues: number + expectedBlobs: number + importedBlobs: number + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers +} + +export interface Response { + success: boolean + headers: Headers + data: OutputSchema +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/server/deactivateAccount.ts b/packages/api/src/client/types/com/atproto/server/deactivateAccount.ts new file mode 100644 index 00000000000..c88bd548243 --- /dev/null +++ b/packages/api/src/client/types/com/atproto/server/deactivateAccount.ts @@ -0,0 +1,33 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export interface InputSchema { + /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ + deleteAfter?: string + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers + qp?: QueryParams + encoding: 'application/json' +} + +export interface Response { + success: boolean + headers: Headers +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/server/describeServer.ts b/packages/api/src/client/types/com/atproto/server/describeServer.ts index 5aca005ec9f..c4b749c7ada 100644 --- a/packages/api/src/client/types/com/atproto/server/describeServer.ts +++ b/packages/api/src/client/types/com/atproto/server/describeServer.ts @@ -19,6 +19,7 @@ export interface OutputSchema { /** List of domain suffixes that can be used in account handles. */ availableUserDomains: string[] links?: Links + did: string [k: string]: unknown } diff --git a/packages/api/src/client/types/com/atproto/server/getServiceAuth.ts b/packages/api/src/client/types/com/atproto/server/getServiceAuth.ts new file mode 100644 index 00000000000..6056960effc --- /dev/null +++ b/packages/api/src/client/types/com/atproto/server/getServiceAuth.ts @@ -0,0 +1,36 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams { + /** The DID of the service that the token will be used to authenticate with */ + aud: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + token: string + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers +} + +export interface Response { + success: boolean + headers: Headers + data: OutputSchema +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + } + return e +} diff --git a/packages/bsky/src/lexicon/index.ts b/packages/bsky/src/lexicon/index.ts index ab207718006..ed08ff55702 100644 --- a/packages/bsky/src/lexicon/index.ts +++ b/packages/bsky/src/lexicon/index.ts @@ -32,7 +32,11 @@ import * as ComAtprotoAdminUpdateAccountEmail from './types/com/atproto/admin/up import * as ComAtprotoAdminUpdateAccountHandle from './types/com/atproto/admin/updateAccountHandle' import * as ComAtprotoAdminUpdateCommunicationTemplate from './types/com/atproto/admin/updateCommunicationTemplate' import * as ComAtprotoAdminUpdateSubjectStatus from './types/com/atproto/admin/updateSubjectStatus' +import * as ComAtprotoIdentityGetRecommendedDidCredentials from './types/com/atproto/identity/getRecommendedDidCredentials' +import * as ComAtprotoIdentityRequestPlcOperationSignature from './types/com/atproto/identity/requestPlcOperationSignature' import * as ComAtprotoIdentityResolveHandle from './types/com/atproto/identity/resolveHandle' +import * as ComAtprotoIdentitySignPlcOperation from './types/com/atproto/identity/signPlcOperation' +import * as ComAtprotoIdentitySubmitPlcOperation from './types/com/atproto/identity/submitPlcOperation' import * as ComAtprotoIdentityUpdateHandle from './types/com/atproto/identity/updateHandle' import * as ComAtprotoLabelQueryLabels from './types/com/atproto/label/queryLabels' import * as ComAtprotoLabelSubscribeLabels from './types/com/atproto/label/subscribeLabels' @@ -42,19 +46,25 @@ import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createReco import * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord' import * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo' import * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord' +import * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo' +import * as ComAtprotoRepoListMissingBlobs from './types/com/atproto/repo/listMissingBlobs' import * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords' import * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord' import * as ComAtprotoRepoUploadBlob from './types/com/atproto/repo/uploadBlob' +import * as ComAtprotoServerActivateAccount from './types/com/atproto/server/activateAccount' +import * as ComAtprotoServerCheckAccountStatus from './types/com/atproto/server/checkAccountStatus' import * as ComAtprotoServerConfirmEmail from './types/com/atproto/server/confirmEmail' import * as ComAtprotoServerCreateAccount from './types/com/atproto/server/createAccount' import * as ComAtprotoServerCreateAppPassword from './types/com/atproto/server/createAppPassword' import * as ComAtprotoServerCreateInviteCode from './types/com/atproto/server/createInviteCode' import * as ComAtprotoServerCreateInviteCodes from './types/com/atproto/server/createInviteCodes' import * as ComAtprotoServerCreateSession from './types/com/atproto/server/createSession' +import * as ComAtprotoServerDeactivateAccount from './types/com/atproto/server/deactivateAccount' import * as ComAtprotoServerDeleteAccount from './types/com/atproto/server/deleteAccount' import * as ComAtprotoServerDeleteSession from './types/com/atproto/server/deleteSession' import * as ComAtprotoServerDescribeServer from './types/com/atproto/server/describeServer' import * as ComAtprotoServerGetAccountInviteCodes from './types/com/atproto/server/getAccountInviteCodes' +import * as ComAtprotoServerGetServiceAuth from './types/com/atproto/server/getServiceAuth' import * as ComAtprotoServerGetSession from './types/com/atproto/server/getSession' import * as ComAtprotoServerListAppPasswords from './types/com/atproto/server/listAppPasswords' import * as ComAtprotoServerRefreshSession from './types/com/atproto/server/refreshSession' @@ -467,6 +477,32 @@ export class ComAtprotoIdentityNS { this._server = server } + getRecommendedDidCredentials( + cfg: ConfigOf< + AV, + ComAtprotoIdentityGetRecommendedDidCredentials.Handler>, + ComAtprotoIdentityGetRecommendedDidCredentials.HandlerReqCtx< + ExtractAuth + > + >, + ) { + const nsid = 'com.atproto.identity.getRecommendedDidCredentials' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + requestPlcOperationSignature( + cfg: ConfigOf< + AV, + ComAtprotoIdentityRequestPlcOperationSignature.Handler>, + ComAtprotoIdentityRequestPlcOperationSignature.HandlerReqCtx< + ExtractAuth + > + >, + ) { + const nsid = 'com.atproto.identity.requestPlcOperationSignature' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + resolveHandle( cfg: ConfigOf< AV, @@ -478,6 +514,28 @@ export class ComAtprotoIdentityNS { return this._server.xrpc.method(nsid, cfg) } + signPlcOperation( + cfg: ConfigOf< + AV, + ComAtprotoIdentitySignPlcOperation.Handler>, + ComAtprotoIdentitySignPlcOperation.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.identity.signPlcOperation' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + submitPlcOperation( + cfg: ConfigOf< + AV, + ComAtprotoIdentitySubmitPlcOperation.Handler>, + ComAtprotoIdentitySubmitPlcOperation.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.identity.submitPlcOperation' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + updateHandle( cfg: ConfigOf< AV, @@ -601,6 +659,28 @@ export class ComAtprotoRepoNS { return this._server.xrpc.method(nsid, cfg) } + importRepo( + cfg: ConfigOf< + AV, + ComAtprotoRepoImportRepo.Handler>, + ComAtprotoRepoImportRepo.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.repo.importRepo' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + listMissingBlobs( + cfg: ConfigOf< + AV, + ComAtprotoRepoListMissingBlobs.Handler>, + ComAtprotoRepoListMissingBlobs.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.repo.listMissingBlobs' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + listRecords( cfg: ConfigOf< AV, @@ -642,6 +722,28 @@ export class ComAtprotoServerNS { this._server = server } + activateAccount( + cfg: ConfigOf< + AV, + ComAtprotoServerActivateAccount.Handler>, + ComAtprotoServerActivateAccount.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.activateAccount' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + checkAccountStatus( + cfg: ConfigOf< + AV, + ComAtprotoServerCheckAccountStatus.Handler>, + ComAtprotoServerCheckAccountStatus.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.checkAccountStatus' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + confirmEmail( cfg: ConfigOf< AV, @@ -708,6 +810,17 @@ export class ComAtprotoServerNS { return this._server.xrpc.method(nsid, cfg) } + deactivateAccount( + cfg: ConfigOf< + AV, + ComAtprotoServerDeactivateAccount.Handler>, + ComAtprotoServerDeactivateAccount.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.deactivateAccount' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + deleteAccount( cfg: ConfigOf< AV, @@ -752,6 +865,17 @@ export class ComAtprotoServerNS { return this._server.xrpc.method(nsid, cfg) } + getServiceAuth( + cfg: ConfigOf< + AV, + ComAtprotoServerGetServiceAuth.Handler>, + ComAtprotoServerGetServiceAuth.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.getServiceAuth' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + getSession( cfg: ConfigOf< AV, diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index 01a2f683d77..a3491462d50 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -1968,6 +1968,56 @@ export const schemaDict = { }, }, }, + ComAtprotoIdentityGetRecommendedDidCredentials: { + lexicon: 1, + id: 'com.atproto.identity.getRecommendedDidCredentials', + defs: { + main: { + type: 'query', + description: + 'Describe the credentials that should be included in the DID doc of an account that is migrating to this service.', + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + rotationKeys: { + description: + 'Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs.', + type: 'array', + items: { + type: 'string', + }, + }, + alsoKnownAs: { + type: 'array', + items: { + type: 'string', + }, + }, + verificationMethods: { + type: 'unknown', + }, + services: { + type: 'unknown', + }, + }, + }, + }, + }, + }, + }, + ComAtprotoIdentityRequestPlcOperationSignature: { + lexicon: 1, + id: 'com.atproto.identity.requestPlcOperationSignature', + defs: { + main: { + type: 'procedure', + description: + 'Request an email with a code to in order to request a signed PLC operation. Requires Auth.', + }, + }, + }, ComAtprotoIdentityResolveHandle: { lexicon: 1, id: 'com.atproto.identity.resolveHandle', @@ -2002,6 +2052,84 @@ export const schemaDict = { }, }, }, + ComAtprotoIdentitySignPlcOperation: { + lexicon: 1, + id: 'com.atproto.identity.signPlcOperation', + defs: { + main: { + type: 'procedure', + description: + "Signs a PLC operation to update some value(s) in the requesting DID's document.", + input: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + token: { + description: + 'A token received through com.atproto.identity.requestPlcOperationSignature', + type: 'string', + }, + rotationKeys: { + type: 'array', + items: { + type: 'string', + }, + }, + alsoKnownAs: { + type: 'array', + items: { + type: 'string', + }, + }, + verificationMethods: { + type: 'unknown', + }, + services: { + type: 'unknown', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['operation'], + properties: { + operation: { + type: 'unknown', + description: 'A signed DID PLC operation.', + }, + }, + }, + }, + }, + }, + }, + ComAtprotoIdentitySubmitPlcOperation: { + lexicon: 1, + id: 'com.atproto.identity.submitPlcOperation', + defs: { + main: { + type: 'procedure', + description: + "Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry", + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['operation'], + properties: { + operation: { + type: 'unknown', + }, + }, + }, + }, + }, + }, + }, ComAtprotoIdentityUpdateHandle: { lexicon: 1, id: 'com.atproto.identity.updateHandle', @@ -2710,6 +2838,78 @@ export const schemaDict = { }, }, }, + ComAtprotoRepoImportRepo: { + lexicon: 1, + id: 'com.atproto.repo.importRepo', + defs: { + main: { + type: 'procedure', + description: + 'Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.', + input: { + encoding: 'application/vnd.ipld.car', + }, + }, + }, + }, + ComAtprotoRepoListMissingBlobs: { + lexicon: 1, + id: 'com.atproto.repo.listMissingBlobs', + defs: { + main: { + type: 'query', + description: + 'Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.', + parameters: { + type: 'params', + properties: { + limit: { + type: 'integer', + minimum: 1, + maximum: 1000, + default: 500, + }, + cursor: { + type: 'string', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['blobs'], + properties: { + cursor: { + type: 'string', + }, + blobs: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:com.atproto.repo.listMissingBlobs#recordBlob', + }, + }, + }, + }, + }, + }, + recordBlob: { + type: 'object', + required: ['cid', 'recordUri'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + recordUri: { + type: 'string', + format: 'at-uri', + }, + }, + }, + }, + }, ComAtprotoRepoListRecords: { lexicon: 1, id: 'com.atproto.repo.listRecords', @@ -2925,6 +3125,75 @@ export const schemaDict = { }, }, }, + ComAtprotoServerActivateAccount: { + lexicon: 1, + id: 'com.atproto.server.activateAccount', + defs: { + main: { + type: 'procedure', + description: + "Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup.", + }, + }, + }, + ComAtprotoServerCheckAccountStatus: { + lexicon: 1, + id: 'com.atproto.server.checkAccountStatus', + defs: { + main: { + type: 'query', + description: + 'Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself.', + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: [ + 'activated', + 'validDid', + 'repoCommit', + 'repoRev', + 'repoBlocks', + 'indexedRecords', + 'privateStateValues', + 'expectedBlobs', + 'importedBlobs', + ], + properties: { + activated: { + type: 'boolean', + }, + validDid: { + type: 'boolean', + }, + repoCommit: { + type: 'string', + format: 'cid', + }, + repoRev: { + type: 'string', + }, + repoBlocks: { + type: 'integer', + }, + indexedRecords: { + type: 'integer', + }, + privateStateValues: { + type: 'integer', + }, + expectedBlobs: { + type: 'integer', + }, + importedBlobs: { + type: 'integer', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerConfirmEmail: { lexicon: 1, id: 'com.atproto.server.confirmEmail', @@ -3293,6 +3562,31 @@ export const schemaDict = { }, }, }, + ComAtprotoServerDeactivateAccount: { + lexicon: 1, + id: 'com.atproto.server.deactivateAccount', + defs: { + main: { + type: 'procedure', + description: + 'Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + deleteAfter: { + type: 'string', + format: 'datetime', + description: + 'A recommendation to server as to how long they should hold onto the deactivated account before deleting.', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerDefs: { lexicon: 1, id: 'com.atproto.server.defs', @@ -3413,7 +3707,7 @@ export const schemaDict = { encoding: 'application/json', schema: { type: 'object', - required: ['availableUserDomains'], + required: ['did', 'availableUserDomains'], properties: { inviteCodeRequired: { type: 'boolean', @@ -3438,6 +3732,10 @@ export const schemaDict = { description: 'URLs of service policy documents.', ref: 'lex:com.atproto.server.describeServer#links', }, + did: { + type: 'string', + format: 'did', + }, }, }, }, @@ -3502,6 +3800,41 @@ export const schemaDict = { }, }, }, + ComAtprotoServerGetServiceAuth: { + lexicon: 1, + id: 'com.atproto.server.getServiceAuth', + defs: { + main: { + type: 'query', + description: + 'Get a signed token on behalf of the requesting DID for the requested service.', + parameters: { + type: 'params', + required: ['aud'], + properties: { + aud: { + type: 'string', + format: 'did', + description: + 'The DID of the service that the token will be used to authenticate with', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['token'], + properties: { + token: { + type: 'string', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerGetSession: { lexicon: 1, id: 'com.atproto.server.getSession', @@ -8582,7 +8915,14 @@ export const ids = { ComAtprotoAdminUpdateCommunicationTemplate: 'com.atproto.admin.updateCommunicationTemplate', ComAtprotoAdminUpdateSubjectStatus: 'com.atproto.admin.updateSubjectStatus', + ComAtprotoIdentityGetRecommendedDidCredentials: + 'com.atproto.identity.getRecommendedDidCredentials', + ComAtprotoIdentityRequestPlcOperationSignature: + 'com.atproto.identity.requestPlcOperationSignature', ComAtprotoIdentityResolveHandle: 'com.atproto.identity.resolveHandle', + ComAtprotoIdentitySignPlcOperation: 'com.atproto.identity.signPlcOperation', + ComAtprotoIdentitySubmitPlcOperation: + 'com.atproto.identity.submitPlcOperation', ComAtprotoIdentityUpdateHandle: 'com.atproto.identity.updateHandle', ComAtprotoLabelDefs: 'com.atproto.label.defs', ComAtprotoLabelQueryLabels: 'com.atproto.label.queryLabels', @@ -8594,22 +8934,28 @@ export const ids = { ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord', ComAtprotoRepoDescribeRepo: 'com.atproto.repo.describeRepo', ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord', + ComAtprotoRepoImportRepo: 'com.atproto.repo.importRepo', + ComAtprotoRepoListMissingBlobs: 'com.atproto.repo.listMissingBlobs', ComAtprotoRepoListRecords: 'com.atproto.repo.listRecords', ComAtprotoRepoPutRecord: 'com.atproto.repo.putRecord', ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef', ComAtprotoRepoUploadBlob: 'com.atproto.repo.uploadBlob', + ComAtprotoServerActivateAccount: 'com.atproto.server.activateAccount', + ComAtprotoServerCheckAccountStatus: 'com.atproto.server.checkAccountStatus', ComAtprotoServerConfirmEmail: 'com.atproto.server.confirmEmail', ComAtprotoServerCreateAccount: 'com.atproto.server.createAccount', ComAtprotoServerCreateAppPassword: 'com.atproto.server.createAppPassword', ComAtprotoServerCreateInviteCode: 'com.atproto.server.createInviteCode', ComAtprotoServerCreateInviteCodes: 'com.atproto.server.createInviteCodes', ComAtprotoServerCreateSession: 'com.atproto.server.createSession', + ComAtprotoServerDeactivateAccount: 'com.atproto.server.deactivateAccount', ComAtprotoServerDefs: 'com.atproto.server.defs', ComAtprotoServerDeleteAccount: 'com.atproto.server.deleteAccount', ComAtprotoServerDeleteSession: 'com.atproto.server.deleteSession', ComAtprotoServerDescribeServer: 'com.atproto.server.describeServer', ComAtprotoServerGetAccountInviteCodes: 'com.atproto.server.getAccountInviteCodes', + ComAtprotoServerGetServiceAuth: 'com.atproto.server.getServiceAuth', ComAtprotoServerGetSession: 'com.atproto.server.getSession', ComAtprotoServerListAppPasswords: 'com.atproto.server.listAppPasswords', ComAtprotoServerRefreshSession: 'com.atproto.server.refreshSession', diff --git a/packages/bsky/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts b/packages/bsky/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts new file mode 100644 index 00000000000..5fa374de737 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts @@ -0,0 +1,47 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface OutputSchema { + /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ + rotationKeys?: string[] + alsoKnownAs?: string[] + verificationMethods?: {} + services?: {} + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts b/packages/bsky/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts new file mode 100644 index 00000000000..82672f1d1c7 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts @@ -0,0 +1,31 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined +export type HandlerInput = undefined + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/identity/signPlcOperation.ts b/packages/bsky/src/lexicon/types/com/atproto/identity/signPlcOperation.ts new file mode 100644 index 00000000000..3c908c049f2 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/identity/signPlcOperation.ts @@ -0,0 +1,55 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + /** A token received through com.atproto.identity.requestPlcOperationSignature */ + token?: string + rotationKeys?: string[] + alsoKnownAs?: string[] + verificationMethods?: {} + services?: {} + [k: string]: unknown +} + +export interface OutputSchema { + /** A signed DID PLC operation. */ + operation: {} + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts b/packages/bsky/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts new file mode 100644 index 00000000000..5290b55d023 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts @@ -0,0 +1,38 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + operation: {} + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/repo/importRepo.ts b/packages/bsky/src/lexicon/types/com/atproto/repo/importRepo.ts new file mode 100644 index 00000000000..921798c0ded --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/repo/importRepo.ts @@ -0,0 +1,36 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import stream from 'stream' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = string | Uint8Array + +export interface HandlerInput { + encoding: 'application/vnd.ipld.car' + body: stream.Readable +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts b/packages/bsky/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts new file mode 100644 index 00000000000..40f4d385e47 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts @@ -0,0 +1,65 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams { + limit: number + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + blobs: RecordBlob[] + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput + +export interface RecordBlob { + cid: string + recordUri: string + [k: string]: unknown +} + +export function isRecordBlob(v: unknown): v is RecordBlob { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'com.atproto.repo.listMissingBlobs#recordBlob' + ) +} + +export function validateRecordBlob(v: unknown): ValidationResult { + return lexicons.validate('com.atproto.repo.listMissingBlobs#recordBlob', v) +} diff --git a/packages/bsky/src/lexicon/types/com/atproto/server/activateAccount.ts b/packages/bsky/src/lexicon/types/com/atproto/server/activateAccount.ts new file mode 100644 index 00000000000..82672f1d1c7 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/server/activateAccount.ts @@ -0,0 +1,31 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined +export type HandlerInput = undefined + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/server/checkAccountStatus.ts b/packages/bsky/src/lexicon/types/com/atproto/server/checkAccountStatus.ts new file mode 100644 index 00000000000..f17182a8dce --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/server/checkAccountStatus.ts @@ -0,0 +1,51 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface OutputSchema { + activated: boolean + validDid: boolean + repoCommit: string + repoRev: string + repoBlocks: number + indexedRecords: number + privateStateValues: number + expectedBlobs: number + importedBlobs: number + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/server/deactivateAccount.ts b/packages/bsky/src/lexicon/types/com/atproto/server/deactivateAccount.ts new file mode 100644 index 00000000000..b3793d6b2e0 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/server/deactivateAccount.ts @@ -0,0 +1,39 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ + deleteAfter?: string + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/server/describeServer.ts b/packages/bsky/src/lexicon/types/com/atproto/server/describeServer.ts index 0e64c9d9708..c2625347f20 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/server/describeServer.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/server/describeServer.ts @@ -20,6 +20,7 @@ export interface OutputSchema { /** List of domain suffixes that can be used in account handles. */ availableUserDomains: string[] links?: Links + did: string [k: string]: unknown } diff --git a/packages/bsky/src/lexicon/types/com/atproto/server/getServiceAuth.ts b/packages/bsky/src/lexicon/types/com/atproto/server/getServiceAuth.ts new file mode 100644 index 00000000000..73efe2313a9 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/server/getServiceAuth.ts @@ -0,0 +1,46 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams { + /** The DID of the service that the token will be used to authenticate with */ + aud: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + token: string + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/index.ts b/packages/ozone/src/lexicon/index.ts index ab207718006..ed08ff55702 100644 --- a/packages/ozone/src/lexicon/index.ts +++ b/packages/ozone/src/lexicon/index.ts @@ -32,7 +32,11 @@ import * as ComAtprotoAdminUpdateAccountEmail from './types/com/atproto/admin/up import * as ComAtprotoAdminUpdateAccountHandle from './types/com/atproto/admin/updateAccountHandle' import * as ComAtprotoAdminUpdateCommunicationTemplate from './types/com/atproto/admin/updateCommunicationTemplate' import * as ComAtprotoAdminUpdateSubjectStatus from './types/com/atproto/admin/updateSubjectStatus' +import * as ComAtprotoIdentityGetRecommendedDidCredentials from './types/com/atproto/identity/getRecommendedDidCredentials' +import * as ComAtprotoIdentityRequestPlcOperationSignature from './types/com/atproto/identity/requestPlcOperationSignature' import * as ComAtprotoIdentityResolveHandle from './types/com/atproto/identity/resolveHandle' +import * as ComAtprotoIdentitySignPlcOperation from './types/com/atproto/identity/signPlcOperation' +import * as ComAtprotoIdentitySubmitPlcOperation from './types/com/atproto/identity/submitPlcOperation' import * as ComAtprotoIdentityUpdateHandle from './types/com/atproto/identity/updateHandle' import * as ComAtprotoLabelQueryLabels from './types/com/atproto/label/queryLabels' import * as ComAtprotoLabelSubscribeLabels from './types/com/atproto/label/subscribeLabels' @@ -42,19 +46,25 @@ import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createReco import * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord' import * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo' import * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord' +import * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo' +import * as ComAtprotoRepoListMissingBlobs from './types/com/atproto/repo/listMissingBlobs' import * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords' import * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord' import * as ComAtprotoRepoUploadBlob from './types/com/atproto/repo/uploadBlob' +import * as ComAtprotoServerActivateAccount from './types/com/atproto/server/activateAccount' +import * as ComAtprotoServerCheckAccountStatus from './types/com/atproto/server/checkAccountStatus' import * as ComAtprotoServerConfirmEmail from './types/com/atproto/server/confirmEmail' import * as ComAtprotoServerCreateAccount from './types/com/atproto/server/createAccount' import * as ComAtprotoServerCreateAppPassword from './types/com/atproto/server/createAppPassword' import * as ComAtprotoServerCreateInviteCode from './types/com/atproto/server/createInviteCode' import * as ComAtprotoServerCreateInviteCodes from './types/com/atproto/server/createInviteCodes' import * as ComAtprotoServerCreateSession from './types/com/atproto/server/createSession' +import * as ComAtprotoServerDeactivateAccount from './types/com/atproto/server/deactivateAccount' import * as ComAtprotoServerDeleteAccount from './types/com/atproto/server/deleteAccount' import * as ComAtprotoServerDeleteSession from './types/com/atproto/server/deleteSession' import * as ComAtprotoServerDescribeServer from './types/com/atproto/server/describeServer' import * as ComAtprotoServerGetAccountInviteCodes from './types/com/atproto/server/getAccountInviteCodes' +import * as ComAtprotoServerGetServiceAuth from './types/com/atproto/server/getServiceAuth' import * as ComAtprotoServerGetSession from './types/com/atproto/server/getSession' import * as ComAtprotoServerListAppPasswords from './types/com/atproto/server/listAppPasswords' import * as ComAtprotoServerRefreshSession from './types/com/atproto/server/refreshSession' @@ -467,6 +477,32 @@ export class ComAtprotoIdentityNS { this._server = server } + getRecommendedDidCredentials( + cfg: ConfigOf< + AV, + ComAtprotoIdentityGetRecommendedDidCredentials.Handler>, + ComAtprotoIdentityGetRecommendedDidCredentials.HandlerReqCtx< + ExtractAuth + > + >, + ) { + const nsid = 'com.atproto.identity.getRecommendedDidCredentials' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + requestPlcOperationSignature( + cfg: ConfigOf< + AV, + ComAtprotoIdentityRequestPlcOperationSignature.Handler>, + ComAtprotoIdentityRequestPlcOperationSignature.HandlerReqCtx< + ExtractAuth + > + >, + ) { + const nsid = 'com.atproto.identity.requestPlcOperationSignature' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + resolveHandle( cfg: ConfigOf< AV, @@ -478,6 +514,28 @@ export class ComAtprotoIdentityNS { return this._server.xrpc.method(nsid, cfg) } + signPlcOperation( + cfg: ConfigOf< + AV, + ComAtprotoIdentitySignPlcOperation.Handler>, + ComAtprotoIdentitySignPlcOperation.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.identity.signPlcOperation' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + submitPlcOperation( + cfg: ConfigOf< + AV, + ComAtprotoIdentitySubmitPlcOperation.Handler>, + ComAtprotoIdentitySubmitPlcOperation.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.identity.submitPlcOperation' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + updateHandle( cfg: ConfigOf< AV, @@ -601,6 +659,28 @@ export class ComAtprotoRepoNS { return this._server.xrpc.method(nsid, cfg) } + importRepo( + cfg: ConfigOf< + AV, + ComAtprotoRepoImportRepo.Handler>, + ComAtprotoRepoImportRepo.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.repo.importRepo' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + listMissingBlobs( + cfg: ConfigOf< + AV, + ComAtprotoRepoListMissingBlobs.Handler>, + ComAtprotoRepoListMissingBlobs.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.repo.listMissingBlobs' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + listRecords( cfg: ConfigOf< AV, @@ -642,6 +722,28 @@ export class ComAtprotoServerNS { this._server = server } + activateAccount( + cfg: ConfigOf< + AV, + ComAtprotoServerActivateAccount.Handler>, + ComAtprotoServerActivateAccount.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.activateAccount' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + checkAccountStatus( + cfg: ConfigOf< + AV, + ComAtprotoServerCheckAccountStatus.Handler>, + ComAtprotoServerCheckAccountStatus.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.checkAccountStatus' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + confirmEmail( cfg: ConfigOf< AV, @@ -708,6 +810,17 @@ export class ComAtprotoServerNS { return this._server.xrpc.method(nsid, cfg) } + deactivateAccount( + cfg: ConfigOf< + AV, + ComAtprotoServerDeactivateAccount.Handler>, + ComAtprotoServerDeactivateAccount.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.deactivateAccount' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + deleteAccount( cfg: ConfigOf< AV, @@ -752,6 +865,17 @@ export class ComAtprotoServerNS { return this._server.xrpc.method(nsid, cfg) } + getServiceAuth( + cfg: ConfigOf< + AV, + ComAtprotoServerGetServiceAuth.Handler>, + ComAtprotoServerGetServiceAuth.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.getServiceAuth' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + getSession( cfg: ConfigOf< AV, diff --git a/packages/ozone/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts index 01a2f683d77..a3491462d50 100644 --- a/packages/ozone/src/lexicon/lexicons.ts +++ b/packages/ozone/src/lexicon/lexicons.ts @@ -1968,6 +1968,56 @@ export const schemaDict = { }, }, }, + ComAtprotoIdentityGetRecommendedDidCredentials: { + lexicon: 1, + id: 'com.atproto.identity.getRecommendedDidCredentials', + defs: { + main: { + type: 'query', + description: + 'Describe the credentials that should be included in the DID doc of an account that is migrating to this service.', + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + rotationKeys: { + description: + 'Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs.', + type: 'array', + items: { + type: 'string', + }, + }, + alsoKnownAs: { + type: 'array', + items: { + type: 'string', + }, + }, + verificationMethods: { + type: 'unknown', + }, + services: { + type: 'unknown', + }, + }, + }, + }, + }, + }, + }, + ComAtprotoIdentityRequestPlcOperationSignature: { + lexicon: 1, + id: 'com.atproto.identity.requestPlcOperationSignature', + defs: { + main: { + type: 'procedure', + description: + 'Request an email with a code to in order to request a signed PLC operation. Requires Auth.', + }, + }, + }, ComAtprotoIdentityResolveHandle: { lexicon: 1, id: 'com.atproto.identity.resolveHandle', @@ -2002,6 +2052,84 @@ export const schemaDict = { }, }, }, + ComAtprotoIdentitySignPlcOperation: { + lexicon: 1, + id: 'com.atproto.identity.signPlcOperation', + defs: { + main: { + type: 'procedure', + description: + "Signs a PLC operation to update some value(s) in the requesting DID's document.", + input: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + token: { + description: + 'A token received through com.atproto.identity.requestPlcOperationSignature', + type: 'string', + }, + rotationKeys: { + type: 'array', + items: { + type: 'string', + }, + }, + alsoKnownAs: { + type: 'array', + items: { + type: 'string', + }, + }, + verificationMethods: { + type: 'unknown', + }, + services: { + type: 'unknown', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['operation'], + properties: { + operation: { + type: 'unknown', + description: 'A signed DID PLC operation.', + }, + }, + }, + }, + }, + }, + }, + ComAtprotoIdentitySubmitPlcOperation: { + lexicon: 1, + id: 'com.atproto.identity.submitPlcOperation', + defs: { + main: { + type: 'procedure', + description: + "Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry", + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['operation'], + properties: { + operation: { + type: 'unknown', + }, + }, + }, + }, + }, + }, + }, ComAtprotoIdentityUpdateHandle: { lexicon: 1, id: 'com.atproto.identity.updateHandle', @@ -2710,6 +2838,78 @@ export const schemaDict = { }, }, }, + ComAtprotoRepoImportRepo: { + lexicon: 1, + id: 'com.atproto.repo.importRepo', + defs: { + main: { + type: 'procedure', + description: + 'Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.', + input: { + encoding: 'application/vnd.ipld.car', + }, + }, + }, + }, + ComAtprotoRepoListMissingBlobs: { + lexicon: 1, + id: 'com.atproto.repo.listMissingBlobs', + defs: { + main: { + type: 'query', + description: + 'Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.', + parameters: { + type: 'params', + properties: { + limit: { + type: 'integer', + minimum: 1, + maximum: 1000, + default: 500, + }, + cursor: { + type: 'string', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['blobs'], + properties: { + cursor: { + type: 'string', + }, + blobs: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:com.atproto.repo.listMissingBlobs#recordBlob', + }, + }, + }, + }, + }, + }, + recordBlob: { + type: 'object', + required: ['cid', 'recordUri'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + recordUri: { + type: 'string', + format: 'at-uri', + }, + }, + }, + }, + }, ComAtprotoRepoListRecords: { lexicon: 1, id: 'com.atproto.repo.listRecords', @@ -2925,6 +3125,75 @@ export const schemaDict = { }, }, }, + ComAtprotoServerActivateAccount: { + lexicon: 1, + id: 'com.atproto.server.activateAccount', + defs: { + main: { + type: 'procedure', + description: + "Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup.", + }, + }, + }, + ComAtprotoServerCheckAccountStatus: { + lexicon: 1, + id: 'com.atproto.server.checkAccountStatus', + defs: { + main: { + type: 'query', + description: + 'Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself.', + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: [ + 'activated', + 'validDid', + 'repoCommit', + 'repoRev', + 'repoBlocks', + 'indexedRecords', + 'privateStateValues', + 'expectedBlobs', + 'importedBlobs', + ], + properties: { + activated: { + type: 'boolean', + }, + validDid: { + type: 'boolean', + }, + repoCommit: { + type: 'string', + format: 'cid', + }, + repoRev: { + type: 'string', + }, + repoBlocks: { + type: 'integer', + }, + indexedRecords: { + type: 'integer', + }, + privateStateValues: { + type: 'integer', + }, + expectedBlobs: { + type: 'integer', + }, + importedBlobs: { + type: 'integer', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerConfirmEmail: { lexicon: 1, id: 'com.atproto.server.confirmEmail', @@ -3293,6 +3562,31 @@ export const schemaDict = { }, }, }, + ComAtprotoServerDeactivateAccount: { + lexicon: 1, + id: 'com.atproto.server.deactivateAccount', + defs: { + main: { + type: 'procedure', + description: + 'Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + deleteAfter: { + type: 'string', + format: 'datetime', + description: + 'A recommendation to server as to how long they should hold onto the deactivated account before deleting.', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerDefs: { lexicon: 1, id: 'com.atproto.server.defs', @@ -3413,7 +3707,7 @@ export const schemaDict = { encoding: 'application/json', schema: { type: 'object', - required: ['availableUserDomains'], + required: ['did', 'availableUserDomains'], properties: { inviteCodeRequired: { type: 'boolean', @@ -3438,6 +3732,10 @@ export const schemaDict = { description: 'URLs of service policy documents.', ref: 'lex:com.atproto.server.describeServer#links', }, + did: { + type: 'string', + format: 'did', + }, }, }, }, @@ -3502,6 +3800,41 @@ export const schemaDict = { }, }, }, + ComAtprotoServerGetServiceAuth: { + lexicon: 1, + id: 'com.atproto.server.getServiceAuth', + defs: { + main: { + type: 'query', + description: + 'Get a signed token on behalf of the requesting DID for the requested service.', + parameters: { + type: 'params', + required: ['aud'], + properties: { + aud: { + type: 'string', + format: 'did', + description: + 'The DID of the service that the token will be used to authenticate with', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['token'], + properties: { + token: { + type: 'string', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerGetSession: { lexicon: 1, id: 'com.atproto.server.getSession', @@ -8582,7 +8915,14 @@ export const ids = { ComAtprotoAdminUpdateCommunicationTemplate: 'com.atproto.admin.updateCommunicationTemplate', ComAtprotoAdminUpdateSubjectStatus: 'com.atproto.admin.updateSubjectStatus', + ComAtprotoIdentityGetRecommendedDidCredentials: + 'com.atproto.identity.getRecommendedDidCredentials', + ComAtprotoIdentityRequestPlcOperationSignature: + 'com.atproto.identity.requestPlcOperationSignature', ComAtprotoIdentityResolveHandle: 'com.atproto.identity.resolveHandle', + ComAtprotoIdentitySignPlcOperation: 'com.atproto.identity.signPlcOperation', + ComAtprotoIdentitySubmitPlcOperation: + 'com.atproto.identity.submitPlcOperation', ComAtprotoIdentityUpdateHandle: 'com.atproto.identity.updateHandle', ComAtprotoLabelDefs: 'com.atproto.label.defs', ComAtprotoLabelQueryLabels: 'com.atproto.label.queryLabels', @@ -8594,22 +8934,28 @@ export const ids = { ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord', ComAtprotoRepoDescribeRepo: 'com.atproto.repo.describeRepo', ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord', + ComAtprotoRepoImportRepo: 'com.atproto.repo.importRepo', + ComAtprotoRepoListMissingBlobs: 'com.atproto.repo.listMissingBlobs', ComAtprotoRepoListRecords: 'com.atproto.repo.listRecords', ComAtprotoRepoPutRecord: 'com.atproto.repo.putRecord', ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef', ComAtprotoRepoUploadBlob: 'com.atproto.repo.uploadBlob', + ComAtprotoServerActivateAccount: 'com.atproto.server.activateAccount', + ComAtprotoServerCheckAccountStatus: 'com.atproto.server.checkAccountStatus', ComAtprotoServerConfirmEmail: 'com.atproto.server.confirmEmail', ComAtprotoServerCreateAccount: 'com.atproto.server.createAccount', ComAtprotoServerCreateAppPassword: 'com.atproto.server.createAppPassword', ComAtprotoServerCreateInviteCode: 'com.atproto.server.createInviteCode', ComAtprotoServerCreateInviteCodes: 'com.atproto.server.createInviteCodes', ComAtprotoServerCreateSession: 'com.atproto.server.createSession', + ComAtprotoServerDeactivateAccount: 'com.atproto.server.deactivateAccount', ComAtprotoServerDefs: 'com.atproto.server.defs', ComAtprotoServerDeleteAccount: 'com.atproto.server.deleteAccount', ComAtprotoServerDeleteSession: 'com.atproto.server.deleteSession', ComAtprotoServerDescribeServer: 'com.atproto.server.describeServer', ComAtprotoServerGetAccountInviteCodes: 'com.atproto.server.getAccountInviteCodes', + ComAtprotoServerGetServiceAuth: 'com.atproto.server.getServiceAuth', ComAtprotoServerGetSession: 'com.atproto.server.getSession', ComAtprotoServerListAppPasswords: 'com.atproto.server.listAppPasswords', ComAtprotoServerRefreshSession: 'com.atproto.server.refreshSession', diff --git a/packages/ozone/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts b/packages/ozone/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts new file mode 100644 index 00000000000..5fa374de737 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts @@ -0,0 +1,47 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface OutputSchema { + /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ + rotationKeys?: string[] + alsoKnownAs?: string[] + verificationMethods?: {} + services?: {} + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts b/packages/ozone/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts new file mode 100644 index 00000000000..82672f1d1c7 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts @@ -0,0 +1,31 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined +export type HandlerInput = undefined + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/com/atproto/identity/signPlcOperation.ts b/packages/ozone/src/lexicon/types/com/atproto/identity/signPlcOperation.ts new file mode 100644 index 00000000000..3c908c049f2 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/identity/signPlcOperation.ts @@ -0,0 +1,55 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + /** A token received through com.atproto.identity.requestPlcOperationSignature */ + token?: string + rotationKeys?: string[] + alsoKnownAs?: string[] + verificationMethods?: {} + services?: {} + [k: string]: unknown +} + +export interface OutputSchema { + /** A signed DID PLC operation. */ + operation: {} + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts b/packages/ozone/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts new file mode 100644 index 00000000000..5290b55d023 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts @@ -0,0 +1,38 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + operation: {} + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/com/atproto/repo/importRepo.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/importRepo.ts new file mode 100644 index 00000000000..921798c0ded --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/repo/importRepo.ts @@ -0,0 +1,36 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import stream from 'stream' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = string | Uint8Array + +export interface HandlerInput { + encoding: 'application/vnd.ipld.car' + body: stream.Readable +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts new file mode 100644 index 00000000000..40f4d385e47 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts @@ -0,0 +1,65 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams { + limit: number + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + blobs: RecordBlob[] + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput + +export interface RecordBlob { + cid: string + recordUri: string + [k: string]: unknown +} + +export function isRecordBlob(v: unknown): v is RecordBlob { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'com.atproto.repo.listMissingBlobs#recordBlob' + ) +} + +export function validateRecordBlob(v: unknown): ValidationResult { + return lexicons.validate('com.atproto.repo.listMissingBlobs#recordBlob', v) +} diff --git a/packages/ozone/src/lexicon/types/com/atproto/server/activateAccount.ts b/packages/ozone/src/lexicon/types/com/atproto/server/activateAccount.ts new file mode 100644 index 00000000000..82672f1d1c7 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/server/activateAccount.ts @@ -0,0 +1,31 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined +export type HandlerInput = undefined + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/com/atproto/server/checkAccountStatus.ts b/packages/ozone/src/lexicon/types/com/atproto/server/checkAccountStatus.ts new file mode 100644 index 00000000000..f17182a8dce --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/server/checkAccountStatus.ts @@ -0,0 +1,51 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface OutputSchema { + activated: boolean + validDid: boolean + repoCommit: string + repoRev: string + repoBlocks: number + indexedRecords: number + privateStateValues: number + expectedBlobs: number + importedBlobs: number + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/com/atproto/server/deactivateAccount.ts b/packages/ozone/src/lexicon/types/com/atproto/server/deactivateAccount.ts new file mode 100644 index 00000000000..b3793d6b2e0 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/server/deactivateAccount.ts @@ -0,0 +1,39 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ + deleteAfter?: string + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/com/atproto/server/describeServer.ts b/packages/ozone/src/lexicon/types/com/atproto/server/describeServer.ts index 0e64c9d9708..c2625347f20 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/server/describeServer.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/server/describeServer.ts @@ -20,6 +20,7 @@ export interface OutputSchema { /** List of domain suffixes that can be used in account handles. */ availableUserDomains: string[] links?: Links + did: string [k: string]: unknown } diff --git a/packages/ozone/src/lexicon/types/com/atproto/server/getServiceAuth.ts b/packages/ozone/src/lexicon/types/com/atproto/server/getServiceAuth.ts new file mode 100644 index 00000000000..73efe2313a9 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/server/getServiceAuth.ts @@ -0,0 +1,46 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams { + /** The DID of the service that the token will be used to authenticate with */ + aud: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + token: string + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/api/com/atproto/server/describeServer.ts b/packages/pds/src/api/com/atproto/server/describeServer.ts index 0ad3b2d66eb..28037ba8a55 100644 --- a/packages/pds/src/api/com/atproto/server/describeServer.ts +++ b/packages/pds/src/api/com/atproto/server/describeServer.ts @@ -11,6 +11,7 @@ export default function (server: Server, ctx: AppContext) { return { encoding: 'application/json', body: { + did: ctx.cfg.service.did, availableUserDomains, inviteCodeRequired, links: { privacyPolicy, termsOfService }, diff --git a/packages/pds/src/lexicon/index.ts b/packages/pds/src/lexicon/index.ts index ab207718006..ed08ff55702 100644 --- a/packages/pds/src/lexicon/index.ts +++ b/packages/pds/src/lexicon/index.ts @@ -32,7 +32,11 @@ import * as ComAtprotoAdminUpdateAccountEmail from './types/com/atproto/admin/up import * as ComAtprotoAdminUpdateAccountHandle from './types/com/atproto/admin/updateAccountHandle' import * as ComAtprotoAdminUpdateCommunicationTemplate from './types/com/atproto/admin/updateCommunicationTemplate' import * as ComAtprotoAdminUpdateSubjectStatus from './types/com/atproto/admin/updateSubjectStatus' +import * as ComAtprotoIdentityGetRecommendedDidCredentials from './types/com/atproto/identity/getRecommendedDidCredentials' +import * as ComAtprotoIdentityRequestPlcOperationSignature from './types/com/atproto/identity/requestPlcOperationSignature' import * as ComAtprotoIdentityResolveHandle from './types/com/atproto/identity/resolveHandle' +import * as ComAtprotoIdentitySignPlcOperation from './types/com/atproto/identity/signPlcOperation' +import * as ComAtprotoIdentitySubmitPlcOperation from './types/com/atproto/identity/submitPlcOperation' import * as ComAtprotoIdentityUpdateHandle from './types/com/atproto/identity/updateHandle' import * as ComAtprotoLabelQueryLabels from './types/com/atproto/label/queryLabels' import * as ComAtprotoLabelSubscribeLabels from './types/com/atproto/label/subscribeLabels' @@ -42,19 +46,25 @@ import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createReco import * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord' import * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo' import * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord' +import * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo' +import * as ComAtprotoRepoListMissingBlobs from './types/com/atproto/repo/listMissingBlobs' import * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords' import * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord' import * as ComAtprotoRepoUploadBlob from './types/com/atproto/repo/uploadBlob' +import * as ComAtprotoServerActivateAccount from './types/com/atproto/server/activateAccount' +import * as ComAtprotoServerCheckAccountStatus from './types/com/atproto/server/checkAccountStatus' import * as ComAtprotoServerConfirmEmail from './types/com/atproto/server/confirmEmail' import * as ComAtprotoServerCreateAccount from './types/com/atproto/server/createAccount' import * as ComAtprotoServerCreateAppPassword from './types/com/atproto/server/createAppPassword' import * as ComAtprotoServerCreateInviteCode from './types/com/atproto/server/createInviteCode' import * as ComAtprotoServerCreateInviteCodes from './types/com/atproto/server/createInviteCodes' import * as ComAtprotoServerCreateSession from './types/com/atproto/server/createSession' +import * as ComAtprotoServerDeactivateAccount from './types/com/atproto/server/deactivateAccount' import * as ComAtprotoServerDeleteAccount from './types/com/atproto/server/deleteAccount' import * as ComAtprotoServerDeleteSession from './types/com/atproto/server/deleteSession' import * as ComAtprotoServerDescribeServer from './types/com/atproto/server/describeServer' import * as ComAtprotoServerGetAccountInviteCodes from './types/com/atproto/server/getAccountInviteCodes' +import * as ComAtprotoServerGetServiceAuth from './types/com/atproto/server/getServiceAuth' import * as ComAtprotoServerGetSession from './types/com/atproto/server/getSession' import * as ComAtprotoServerListAppPasswords from './types/com/atproto/server/listAppPasswords' import * as ComAtprotoServerRefreshSession from './types/com/atproto/server/refreshSession' @@ -467,6 +477,32 @@ export class ComAtprotoIdentityNS { this._server = server } + getRecommendedDidCredentials( + cfg: ConfigOf< + AV, + ComAtprotoIdentityGetRecommendedDidCredentials.Handler>, + ComAtprotoIdentityGetRecommendedDidCredentials.HandlerReqCtx< + ExtractAuth + > + >, + ) { + const nsid = 'com.atproto.identity.getRecommendedDidCredentials' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + requestPlcOperationSignature( + cfg: ConfigOf< + AV, + ComAtprotoIdentityRequestPlcOperationSignature.Handler>, + ComAtprotoIdentityRequestPlcOperationSignature.HandlerReqCtx< + ExtractAuth + > + >, + ) { + const nsid = 'com.atproto.identity.requestPlcOperationSignature' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + resolveHandle( cfg: ConfigOf< AV, @@ -478,6 +514,28 @@ export class ComAtprotoIdentityNS { return this._server.xrpc.method(nsid, cfg) } + signPlcOperation( + cfg: ConfigOf< + AV, + ComAtprotoIdentitySignPlcOperation.Handler>, + ComAtprotoIdentitySignPlcOperation.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.identity.signPlcOperation' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + submitPlcOperation( + cfg: ConfigOf< + AV, + ComAtprotoIdentitySubmitPlcOperation.Handler>, + ComAtprotoIdentitySubmitPlcOperation.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.identity.submitPlcOperation' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + updateHandle( cfg: ConfigOf< AV, @@ -601,6 +659,28 @@ export class ComAtprotoRepoNS { return this._server.xrpc.method(nsid, cfg) } + importRepo( + cfg: ConfigOf< + AV, + ComAtprotoRepoImportRepo.Handler>, + ComAtprotoRepoImportRepo.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.repo.importRepo' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + listMissingBlobs( + cfg: ConfigOf< + AV, + ComAtprotoRepoListMissingBlobs.Handler>, + ComAtprotoRepoListMissingBlobs.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.repo.listMissingBlobs' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + listRecords( cfg: ConfigOf< AV, @@ -642,6 +722,28 @@ export class ComAtprotoServerNS { this._server = server } + activateAccount( + cfg: ConfigOf< + AV, + ComAtprotoServerActivateAccount.Handler>, + ComAtprotoServerActivateAccount.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.activateAccount' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + checkAccountStatus( + cfg: ConfigOf< + AV, + ComAtprotoServerCheckAccountStatus.Handler>, + ComAtprotoServerCheckAccountStatus.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.checkAccountStatus' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + confirmEmail( cfg: ConfigOf< AV, @@ -708,6 +810,17 @@ export class ComAtprotoServerNS { return this._server.xrpc.method(nsid, cfg) } + deactivateAccount( + cfg: ConfigOf< + AV, + ComAtprotoServerDeactivateAccount.Handler>, + ComAtprotoServerDeactivateAccount.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.deactivateAccount' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + deleteAccount( cfg: ConfigOf< AV, @@ -752,6 +865,17 @@ export class ComAtprotoServerNS { return this._server.xrpc.method(nsid, cfg) } + getServiceAuth( + cfg: ConfigOf< + AV, + ComAtprotoServerGetServiceAuth.Handler>, + ComAtprotoServerGetServiceAuth.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.server.getServiceAuth' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + getSession( cfg: ConfigOf< AV, diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index 01a2f683d77..a3491462d50 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -1968,6 +1968,56 @@ export const schemaDict = { }, }, }, + ComAtprotoIdentityGetRecommendedDidCredentials: { + lexicon: 1, + id: 'com.atproto.identity.getRecommendedDidCredentials', + defs: { + main: { + type: 'query', + description: + 'Describe the credentials that should be included in the DID doc of an account that is migrating to this service.', + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + rotationKeys: { + description: + 'Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs.', + type: 'array', + items: { + type: 'string', + }, + }, + alsoKnownAs: { + type: 'array', + items: { + type: 'string', + }, + }, + verificationMethods: { + type: 'unknown', + }, + services: { + type: 'unknown', + }, + }, + }, + }, + }, + }, + }, + ComAtprotoIdentityRequestPlcOperationSignature: { + lexicon: 1, + id: 'com.atproto.identity.requestPlcOperationSignature', + defs: { + main: { + type: 'procedure', + description: + 'Request an email with a code to in order to request a signed PLC operation. Requires Auth.', + }, + }, + }, ComAtprotoIdentityResolveHandle: { lexicon: 1, id: 'com.atproto.identity.resolveHandle', @@ -2002,6 +2052,84 @@ export const schemaDict = { }, }, }, + ComAtprotoIdentitySignPlcOperation: { + lexicon: 1, + id: 'com.atproto.identity.signPlcOperation', + defs: { + main: { + type: 'procedure', + description: + "Signs a PLC operation to update some value(s) in the requesting DID's document.", + input: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + token: { + description: + 'A token received through com.atproto.identity.requestPlcOperationSignature', + type: 'string', + }, + rotationKeys: { + type: 'array', + items: { + type: 'string', + }, + }, + alsoKnownAs: { + type: 'array', + items: { + type: 'string', + }, + }, + verificationMethods: { + type: 'unknown', + }, + services: { + type: 'unknown', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['operation'], + properties: { + operation: { + type: 'unknown', + description: 'A signed DID PLC operation.', + }, + }, + }, + }, + }, + }, + }, + ComAtprotoIdentitySubmitPlcOperation: { + lexicon: 1, + id: 'com.atproto.identity.submitPlcOperation', + defs: { + main: { + type: 'procedure', + description: + "Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry", + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['operation'], + properties: { + operation: { + type: 'unknown', + }, + }, + }, + }, + }, + }, + }, ComAtprotoIdentityUpdateHandle: { lexicon: 1, id: 'com.atproto.identity.updateHandle', @@ -2710,6 +2838,78 @@ export const schemaDict = { }, }, }, + ComAtprotoRepoImportRepo: { + lexicon: 1, + id: 'com.atproto.repo.importRepo', + defs: { + main: { + type: 'procedure', + description: + 'Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.', + input: { + encoding: 'application/vnd.ipld.car', + }, + }, + }, + }, + ComAtprotoRepoListMissingBlobs: { + lexicon: 1, + id: 'com.atproto.repo.listMissingBlobs', + defs: { + main: { + type: 'query', + description: + 'Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.', + parameters: { + type: 'params', + properties: { + limit: { + type: 'integer', + minimum: 1, + maximum: 1000, + default: 500, + }, + cursor: { + type: 'string', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['blobs'], + properties: { + cursor: { + type: 'string', + }, + blobs: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:com.atproto.repo.listMissingBlobs#recordBlob', + }, + }, + }, + }, + }, + }, + recordBlob: { + type: 'object', + required: ['cid', 'recordUri'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + recordUri: { + type: 'string', + format: 'at-uri', + }, + }, + }, + }, + }, ComAtprotoRepoListRecords: { lexicon: 1, id: 'com.atproto.repo.listRecords', @@ -2925,6 +3125,75 @@ export const schemaDict = { }, }, }, + ComAtprotoServerActivateAccount: { + lexicon: 1, + id: 'com.atproto.server.activateAccount', + defs: { + main: { + type: 'procedure', + description: + "Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup.", + }, + }, + }, + ComAtprotoServerCheckAccountStatus: { + lexicon: 1, + id: 'com.atproto.server.checkAccountStatus', + defs: { + main: { + type: 'query', + description: + 'Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself.', + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: [ + 'activated', + 'validDid', + 'repoCommit', + 'repoRev', + 'repoBlocks', + 'indexedRecords', + 'privateStateValues', + 'expectedBlobs', + 'importedBlobs', + ], + properties: { + activated: { + type: 'boolean', + }, + validDid: { + type: 'boolean', + }, + repoCommit: { + type: 'string', + format: 'cid', + }, + repoRev: { + type: 'string', + }, + repoBlocks: { + type: 'integer', + }, + indexedRecords: { + type: 'integer', + }, + privateStateValues: { + type: 'integer', + }, + expectedBlobs: { + type: 'integer', + }, + importedBlobs: { + type: 'integer', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerConfirmEmail: { lexicon: 1, id: 'com.atproto.server.confirmEmail', @@ -3293,6 +3562,31 @@ export const schemaDict = { }, }, }, + ComAtprotoServerDeactivateAccount: { + lexicon: 1, + id: 'com.atproto.server.deactivateAccount', + defs: { + main: { + type: 'procedure', + description: + 'Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + deleteAfter: { + type: 'string', + format: 'datetime', + description: + 'A recommendation to server as to how long they should hold onto the deactivated account before deleting.', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerDefs: { lexicon: 1, id: 'com.atproto.server.defs', @@ -3413,7 +3707,7 @@ export const schemaDict = { encoding: 'application/json', schema: { type: 'object', - required: ['availableUserDomains'], + required: ['did', 'availableUserDomains'], properties: { inviteCodeRequired: { type: 'boolean', @@ -3438,6 +3732,10 @@ export const schemaDict = { description: 'URLs of service policy documents.', ref: 'lex:com.atproto.server.describeServer#links', }, + did: { + type: 'string', + format: 'did', + }, }, }, }, @@ -3502,6 +3800,41 @@ export const schemaDict = { }, }, }, + ComAtprotoServerGetServiceAuth: { + lexicon: 1, + id: 'com.atproto.server.getServiceAuth', + defs: { + main: { + type: 'query', + description: + 'Get a signed token on behalf of the requesting DID for the requested service.', + parameters: { + type: 'params', + required: ['aud'], + properties: { + aud: { + type: 'string', + format: 'did', + description: + 'The DID of the service that the token will be used to authenticate with', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['token'], + properties: { + token: { + type: 'string', + }, + }, + }, + }, + }, + }, + }, ComAtprotoServerGetSession: { lexicon: 1, id: 'com.atproto.server.getSession', @@ -8582,7 +8915,14 @@ export const ids = { ComAtprotoAdminUpdateCommunicationTemplate: 'com.atproto.admin.updateCommunicationTemplate', ComAtprotoAdminUpdateSubjectStatus: 'com.atproto.admin.updateSubjectStatus', + ComAtprotoIdentityGetRecommendedDidCredentials: + 'com.atproto.identity.getRecommendedDidCredentials', + ComAtprotoIdentityRequestPlcOperationSignature: + 'com.atproto.identity.requestPlcOperationSignature', ComAtprotoIdentityResolveHandle: 'com.atproto.identity.resolveHandle', + ComAtprotoIdentitySignPlcOperation: 'com.atproto.identity.signPlcOperation', + ComAtprotoIdentitySubmitPlcOperation: + 'com.atproto.identity.submitPlcOperation', ComAtprotoIdentityUpdateHandle: 'com.atproto.identity.updateHandle', ComAtprotoLabelDefs: 'com.atproto.label.defs', ComAtprotoLabelQueryLabels: 'com.atproto.label.queryLabels', @@ -8594,22 +8934,28 @@ export const ids = { ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord', ComAtprotoRepoDescribeRepo: 'com.atproto.repo.describeRepo', ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord', + ComAtprotoRepoImportRepo: 'com.atproto.repo.importRepo', + ComAtprotoRepoListMissingBlobs: 'com.atproto.repo.listMissingBlobs', ComAtprotoRepoListRecords: 'com.atproto.repo.listRecords', ComAtprotoRepoPutRecord: 'com.atproto.repo.putRecord', ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef', ComAtprotoRepoUploadBlob: 'com.atproto.repo.uploadBlob', + ComAtprotoServerActivateAccount: 'com.atproto.server.activateAccount', + ComAtprotoServerCheckAccountStatus: 'com.atproto.server.checkAccountStatus', ComAtprotoServerConfirmEmail: 'com.atproto.server.confirmEmail', ComAtprotoServerCreateAccount: 'com.atproto.server.createAccount', ComAtprotoServerCreateAppPassword: 'com.atproto.server.createAppPassword', ComAtprotoServerCreateInviteCode: 'com.atproto.server.createInviteCode', ComAtprotoServerCreateInviteCodes: 'com.atproto.server.createInviteCodes', ComAtprotoServerCreateSession: 'com.atproto.server.createSession', + ComAtprotoServerDeactivateAccount: 'com.atproto.server.deactivateAccount', ComAtprotoServerDefs: 'com.atproto.server.defs', ComAtprotoServerDeleteAccount: 'com.atproto.server.deleteAccount', ComAtprotoServerDeleteSession: 'com.atproto.server.deleteSession', ComAtprotoServerDescribeServer: 'com.atproto.server.describeServer', ComAtprotoServerGetAccountInviteCodes: 'com.atproto.server.getAccountInviteCodes', + ComAtprotoServerGetServiceAuth: 'com.atproto.server.getServiceAuth', ComAtprotoServerGetSession: 'com.atproto.server.getSession', ComAtprotoServerListAppPasswords: 'com.atproto.server.listAppPasswords', ComAtprotoServerRefreshSession: 'com.atproto.server.refreshSession', diff --git a/packages/pds/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts b/packages/pds/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts new file mode 100644 index 00000000000..5fa374de737 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts @@ -0,0 +1,47 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface OutputSchema { + /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ + rotationKeys?: string[] + alsoKnownAs?: string[] + verificationMethods?: {} + services?: {} + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts b/packages/pds/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts new file mode 100644 index 00000000000..82672f1d1c7 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts @@ -0,0 +1,31 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined +export type HandlerInput = undefined + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/identity/signPlcOperation.ts b/packages/pds/src/lexicon/types/com/atproto/identity/signPlcOperation.ts new file mode 100644 index 00000000000..3c908c049f2 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/identity/signPlcOperation.ts @@ -0,0 +1,55 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + /** A token received through com.atproto.identity.requestPlcOperationSignature */ + token?: string + rotationKeys?: string[] + alsoKnownAs?: string[] + verificationMethods?: {} + services?: {} + [k: string]: unknown +} + +export interface OutputSchema { + /** A signed DID PLC operation. */ + operation: {} + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts b/packages/pds/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts new file mode 100644 index 00000000000..5290b55d023 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts @@ -0,0 +1,38 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + operation: {} + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/repo/importRepo.ts b/packages/pds/src/lexicon/types/com/atproto/repo/importRepo.ts new file mode 100644 index 00000000000..921798c0ded --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/repo/importRepo.ts @@ -0,0 +1,36 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import stream from 'stream' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = string | Uint8Array + +export interface HandlerInput { + encoding: 'application/vnd.ipld.car' + body: stream.Readable +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts b/packages/pds/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts new file mode 100644 index 00000000000..40f4d385e47 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts @@ -0,0 +1,65 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams { + limit: number + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + blobs: RecordBlob[] + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput + +export interface RecordBlob { + cid: string + recordUri: string + [k: string]: unknown +} + +export function isRecordBlob(v: unknown): v is RecordBlob { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'com.atproto.repo.listMissingBlobs#recordBlob' + ) +} + +export function validateRecordBlob(v: unknown): ValidationResult { + return lexicons.validate('com.atproto.repo.listMissingBlobs#recordBlob', v) +} diff --git a/packages/pds/src/lexicon/types/com/atproto/server/activateAccount.ts b/packages/pds/src/lexicon/types/com/atproto/server/activateAccount.ts new file mode 100644 index 00000000000..82672f1d1c7 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/server/activateAccount.ts @@ -0,0 +1,31 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined +export type HandlerInput = undefined + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/server/checkAccountStatus.ts b/packages/pds/src/lexicon/types/com/atproto/server/checkAccountStatus.ts new file mode 100644 index 00000000000..f17182a8dce --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/server/checkAccountStatus.ts @@ -0,0 +1,51 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export type InputSchema = undefined + +export interface OutputSchema { + activated: boolean + validDid: boolean + repoCommit: string + repoRev: string + repoBlocks: number + indexedRecords: number + privateStateValues: number + expectedBlobs: number + importedBlobs: number + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/server/deactivateAccount.ts b/packages/pds/src/lexicon/types/com/atproto/server/deactivateAccount.ts new file mode 100644 index 00000000000..b3793d6b2e0 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/server/deactivateAccount.ts @@ -0,0 +1,39 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ + deleteAfter?: string + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | void +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/server/describeServer.ts b/packages/pds/src/lexicon/types/com/atproto/server/describeServer.ts index 0e64c9d9708..c2625347f20 100644 --- a/packages/pds/src/lexicon/types/com/atproto/server/describeServer.ts +++ b/packages/pds/src/lexicon/types/com/atproto/server/describeServer.ts @@ -20,6 +20,7 @@ export interface OutputSchema { /** List of domain suffixes that can be used in account handles. */ availableUserDomains: string[] links?: Links + did: string [k: string]: unknown } diff --git a/packages/pds/src/lexicon/types/com/atproto/server/getServiceAuth.ts b/packages/pds/src/lexicon/types/com/atproto/server/getServiceAuth.ts new file mode 100644 index 00000000000..73efe2313a9 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/server/getServiceAuth.ts @@ -0,0 +1,46 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams { + /** The DID of the service that the token will be used to authenticate with */ + aud: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + token: string + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput