From b685a08725e7df6809723690ad04741f3b178d5a Mon Sep 17 00:00:00 2001 From: Aramik Date: Fri, 27 Sep 2024 13:16:14 -0700 Subject: [PATCH] Account api context checks (#563) # Problem closes #493 # Changes - Added extra verification fro signatures and accountIds - Checks provided signatures in some endpoints - removed wrapped `` in endpoints that made sense. ## Steps to Verify: 1. run account-api 2. open swagger 3. try incorrect signatures or payloads --- .gitignore | 2 + .../controllers/v1/handles-v1.controller.ts | 17 +- .../src/controllers/v1/keys-v1.controller.ts | 13 + apps/account-api/src/metadata.ts | 10 +- .../src/services/delegation.service.ts | 19 +- .../src/services/handles.service.ts | 7 + apps/account-api/src/services/keys.service.ts | 27 +- .../test/delegations.controller.e2e-spec.ts | 14 +- apps/content-publishing-api/src/metadata.ts | 3 +- apps/graph-api/src/metadata.ts | 8 +- docs/account/index.html | 854 +++++++++--------- docs/account/webhooks.html | 644 ++++++------- docs/content-publishing/index.html | 8 +- docs/content-watcher/index.html | 722 +++++++-------- docs/content-watcher/webhooks.html | 618 ++++++------- .../src/blockchain/blockchain.service.ts | 21 +- libs/account-lib/src/utils/utility.ts | 37 +- .../src/content-announcement/types.gen.ts | 1 - .../src/dtos/account/graphs.request.dto.ts | 2 +- .../src/dtos/account/handles.request.dto.ts | 2 +- .../src/dtos/account/keys.request.dto.ts | 2 +- .../src/graph-webhook/webhook-types.d.ts | 66 +- .../is-account-id-address.decorator.ts | 20 +- .../src/decorators/is-signature.decorator.ts | 25 +- openapi-specs/content-publishing.openapi.json | 85 +- package-lock.json | 29 +- package.json | 2 +- 27 files changed, 1763 insertions(+), 1495 deletions(-) diff --git a/.gitignore b/.gitignore index 8e28caab..833f7f0c 100644 --- a/.gitignore +++ b/.gitignore @@ -131,3 +131,5 @@ dist .yarn/install-state.gz .pnp.* .idea/ + +.DS_Store \ No newline at end of file diff --git a/apps/account-api/src/controllers/v1/handles-v1.controller.ts b/apps/account-api/src/controllers/v1/handles-v1.controller.ts index ac69ece1..74dee5cc 100644 --- a/apps/account-api/src/controllers/v1/handles-v1.controller.ts +++ b/apps/account-api/src/controllers/v1/handles-v1.controller.ts @@ -9,6 +9,7 @@ import { HttpException, Body, UseGuards, + BadRequestException, } from '@nestjs/common'; import { ApiBody, ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger'; import { HandlesService } from '#account-api/services/handles.service'; @@ -22,7 +23,7 @@ import { import { TransactionResponse } from '#types/dtos/account/transaction.response.dto'; import { HandleResponseDto } from '#types/dtos/account/accounts.response.dto'; import { ReadOnlyGuard } from '#account-api/guards/read-only.guard'; -import { u8aToHex, u8aWrapBytes } from '@polkadot/util'; +import { u8aToHex } from '@polkadot/util'; import { TransactionType } from '#types/account-webhook'; import { HandleDto, MsaIdDto } from '#types/dtos/common'; @@ -52,6 +53,9 @@ export class HandlesControllerV1 { */ async createHandle(@Body() createHandleRequest: HandleRequestDto): Promise { try { + if (!this.handlesService.verifyHandleRequestSignature(createHandleRequest)) { + throw new BadRequestException('Provided signature is not valid for the payload!'); + } const response = await this.enqueueService.enqueueRequest({ ...createHandleRequest, type: TransactionType.CREATE_HANDLE, @@ -59,6 +63,9 @@ export class HandlesControllerV1 { this.logger.log(`createHandle in progress. referenceId: ${response.referenceId}`); return response; } catch (error) { + if (error instanceof BadRequestException) { + throw error; + } this.logger.error(error); throw new Error('Failed to create handle'); } @@ -77,6 +84,9 @@ export class HandlesControllerV1 { */ async changeHandle(@Body() changeHandleRequest: HandleRequestDto): Promise { try { + if (!this.handlesService.verifyHandleRequestSignature(changeHandleRequest)) { + throw new BadRequestException('Provided signature is not valid for the payload!'); + } const response = await this.enqueueService.enqueueRequest({ ...changeHandleRequest, type: TransactionType.CHANGE_HANDLE, @@ -84,6 +94,9 @@ export class HandlesControllerV1 { this.logger.log(`changeHandle in progress. referenceId: ${response.referenceId}`); return response; } catch (error) { + if (error instanceof BadRequestException) { + throw error; + } this.logger.error(error); throw new Error('Failed to change handle'); } @@ -103,7 +116,7 @@ export class HandlesControllerV1 { try { const expiration = await this.handlesService.getExpiration(); const payload = { baseHandle: newHandle, expiration }; - const encodedPayload = u8aToHex(u8aWrapBytes(this.handlesService.encodePayload(payload).toU8a())); + const encodedPayload = u8aToHex(this.handlesService.encodePayload(payload).toU8a()); return { payload, diff --git a/apps/account-api/src/controllers/v1/keys-v1.controller.ts b/apps/account-api/src/controllers/v1/keys-v1.controller.ts index 64a3d3da..a3d77c90 100644 --- a/apps/account-api/src/controllers/v1/keys-v1.controller.ts +++ b/apps/account-api/src/controllers/v1/keys-v1.controller.ts @@ -12,6 +12,7 @@ import { Post, UseGuards, Query, + BadRequestException, } from '@nestjs/common'; import { ApiBody, ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger'; import { KeysRequestDto, AddKeyRequestDto } from '#types/dtos/account/keys.request.dto'; @@ -53,6 +54,9 @@ export class KeysControllerV1 { */ async addKey(@Body() addKeysRequest: KeysRequestDto): Promise { try { + if (!this.keysService.verifyAddKeySignature(addKeysRequest)) { + throw new BadRequestException('Provided signature is not valid for the payload!'); + } const response = await this.enqueueService.enqueueRequest({ ...addKeysRequest, type: TransactionType.ADD_KEY, @@ -60,6 +64,9 @@ export class KeysControllerV1 { this.logger.log(`AddKey in progress. referenceId: ${response.referenceId}`); return response; } catch (error) { + if (error instanceof BadRequestException) { + throw error; + } this.logger.error(error); throw new HttpException('Failed to find public keys for the given MSA Id', HttpStatus.BAD_REQUEST); } @@ -114,6 +121,9 @@ export class KeysControllerV1 { */ async AddNewPublicKeyAgreements(@Body() request: AddNewPublicKeyAgreementRequestDto): Promise { try { + if (!this.keysService.verifyPublicKeyAgreementSignature(request)) { + throw new BadRequestException('Proof is not valid for the payload!'); + } const response = await this.enqueueService.enqueueRequest({ ...request, type: TransactionType.ADD_PUBLIC_KEY_AGREEMENT, @@ -121,6 +131,9 @@ export class KeysControllerV1 { this.logger.log(`Add graph key in progress. referenceId: ${response.referenceId}`); return response; } catch (error) { + if (error instanceof BadRequestException) { + throw error; + } this.logger.error(error); throw new Error('Failed to add new key'); } diff --git a/apps/account-api/src/metadata.ts b/apps/account-api/src/metadata.ts index a2d089e0..c23dcba1 100644 --- a/apps/account-api/src/metadata.ts +++ b/apps/account-api/src/metadata.ts @@ -5,7 +5,15 @@ export default async () => { ["@polkadot/types-codec/primitive/U32"]: await import("@polkadot/types-codec/primitive/U32"), ["../../../libs/types/src/dtos/account/delegation.response.dto"]: await import("../../../libs/types/src/dtos/account/delegation.response.dto"), ["../../../libs/types/src/dtos/account/graphs.request.dto"]: await import("../../../libs/types/src/dtos/account/graphs.request.dto"), + ["../../../libs/types/src/dtos/account/keys.request.dto"]: await import("../../../libs/types/src/dtos/account/keys.request.dto"), ["../../../libs/types/src/dtos/account/wallet.login.request.dto"]: await import("../../../libs/types/src/dtos/account/wallet.login.request.dto"), + ["../../../libs/types/src/dtos/content-publishing/activity.dto"]: await import("../../../libs/types/src/dtos/content-publishing/activity.dto"), + ["../../../libs/types/src/dtos/content-publishing/announcement.dto"]: await import("../../../libs/types/src/dtos/content-publishing/announcement.dto"), + ["../../../libs/types/src/dtos/graph/privacy-type.enum"]: await import("../../../libs/types/src/dtos/graph/privacy-type.enum"), + ["../../../libs/types/src/dtos/graph/direction.enum"]: await import("../../../libs/types/src/dtos/graph/direction.enum"), + ["../../../libs/types/src/dtos/graph/connection-type.enum"]: await import("../../../libs/types/src/dtos/graph/connection-type.enum"), + ["../../../libs/types/src/dtos/graph/connection.dto"]: await import("../../../libs/types/src/dtos/graph/connection.dto"), + ["../../../libs/types/src/dtos/graph/key-type.enum"]: await import("../../../libs/types/src/dtos/graph/key-type.enum"), ["../../../libs/types/src/dtos/account/wallet.login.config.response.dto"]: await import("../../../libs/types/src/dtos/account/wallet.login.config.response.dto"), ["../../../libs/types/src/dtos/account/wallet.login.response.dto"]: await import("../../../libs/types/src/dtos/account/wallet.login.response.dto"), ["../../../libs/types/src/dtos/account/transaction.response.dto"]: await import("../../../libs/types/src/dtos/account/transaction.response.dto"), @@ -13,5 +21,5 @@ export default async () => { ["../../../libs/types/src/dtos/account/handles.request.dto"]: await import("../../../libs/types/src/dtos/account/handles.request.dto"), ["../../../libs/types/src/dtos/account/keys.response.dto"]: await import("../../../libs/types/src/dtos/account/keys.response.dto") }; - return { "@nestjs/swagger": { "models": [[import("../../../libs/types/src/dtos/account/accounts.response.dto"), { "HandleResponseDto": { base_handle: { required: true, type: () => String }, canonical_base: { required: true, type: () => String }, suffix: { required: true, type: () => Number } }, "AccountResponseDto": { msaId: { required: true, type: () => String }, handle: { required: false, type: () => t["../../../libs/types/src/dtos/account/accounts.response.dto"].HandleResponseDto } }, "MsaIdResponseDto": { msaId: { required: true, type: () => String } }, "RetireMsaPayloadResponseDto": { encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/accounts.request.dto"), { "RetireMsaRequestDto": { signature: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/delegation.request.dto"), { "ProviderDelegationRequestDto": { msaId: { required: true, type: () => String }, providerId: { required: false, type: () => String } }, "DelegationRequestDto": {} }], [import("../../../libs/types/src/dtos/account/delegation.response.dto"), { "DelegationResponse": { providerId: { required: true, type: () => String }, schemaPermissions: { required: true }, revokedAt: { required: true, type: () => t["@polkadot/types-codec/primitive/U32"].u32 } }, "SchemaDelegation": { schemaId: { required: true, type: () => Number }, revokedAtBlock: { required: false, type: () => Number } }, "Delegation": { providerId: { required: true, type: () => String }, schemaDelegations: { required: true, type: () => [t["../../../libs/types/src/dtos/account/delegation.response.dto"].SchemaDelegation] }, revokedAtBlock: { required: false, type: () => Number } }, "DelegationResponseV2": { msaId: { required: true, type: () => String }, delegations: { required: true, type: () => [t["../../../libs/types/src/dtos/account/delegation.response.dto"].Delegation] } } }], [import("../../../libs/types/src/dtos/account/graphs.request.dto"), { "ItemActionDto": { type: { required: true, enum: t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionType }, encodedPayload: { required: false, type: () => String }, index: { required: false, type: () => Number } }, "ItemizedSignaturePayloadDto": { schemaId: { required: true, type: () => Number }, targetHash: { required: true, type: () => Number }, expiration: { required: true, type: () => Number }, actions: { required: true, type: () => [t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionDto] } }, "AddNewPublicKeyAgreementRequestDto": { accountId: { required: true, type: () => String }, payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, proof: { required: true, type: () => String } }, "AddNewPublicKeyAgreementPayloadRequest": { payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, encodedPayload: { required: true, type: () => String } }, "PublicKeyAgreementsKeyPayload": { msaId: { required: true, type: () => String }, newKey: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/handles.request.dto"), { "HandleRequestDto": { accountId: { required: true, type: () => String }, proof: { required: true, type: () => String } }, "ChangeHandlePayloadRequest": { encodedPayload: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/keys.request.dto"), { "KeysRequestDto": { msaOwnerAddress: { required: true, type: () => String }, msaOwnerSignature: { required: true, type: () => String }, newKeyOwnerSignature: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/keys.response.dto"), { "KeysResponse": { msaKeys: { required: true } } }], [import("../../../libs/types/src/dtos/account/revokeDelegation.request.dto"), { "RevokeDelegationPayloadResponseDto": { accountId: { required: true, type: () => String }, providerId: { required: true, type: () => String }, encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String } }, "RevokeDelegationPayloadRequestDto": { signature: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/wallet.login.request.dto"), { "ErrorResponseDto": { message: { required: true, type: () => String } }, "SiwsPayloadDto": { message: { required: true, type: () => String }, signature: { required: true, type: () => String } }, "SignInResponseDto": { siwsPayload: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SiwsPayloadDto }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "EncodedExtrinsicDto": { pallet: { required: true, type: () => String, minLength: 1 }, extrinsicName: { required: true, type: () => String, minLength: 1 }, encodedExtrinsic: { required: true, type: () => String } }, "SignUpResponseDto": { extrinsics: { required: false, type: () => [t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].EncodedExtrinsicDto] }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "WalletLoginRequestDto": { signIn: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignInResponseDto }, signUp: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignUpResponseDto } } }], [import("../../../libs/types/src/dtos/account/transaction.response.dto"), { "TransactionResponse": { referenceId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/wallet.login.config.response.dto"), { "WalletLoginConfigResponseDto": { providerId: { required: true, type: () => String }, siwfUrl: { required: true, type: () => String }, frequencyRpcUrl: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/wallet.login.response.dto"), { "WalletLoginResponseDto": { referenceId: { required: true, type: () => String }, msaId: { required: false, type: () => String }, publicKey: { required: false, type: () => String } } }], [import("../../../libs/types/src/dtos/common/params.dto"), { "MsaIdDto": { msaId: { required: true, type: () => String } }, "ProviderMsaIdDto": { providerId: { required: true, type: () => String } }, "UrlDto": { url: { required: true, type: () => String } }, "HandleDto": { newHandle: { required: true, type: () => String, minLength: 3 } }, "AccountIdDto": { accountId: { required: true, type: () => String } } }]], "controllers": [[import("./controllers/health.controller"), { "HealthController": { "healthz": {}, "livez": {}, "readyz": {} } }], [import("./controllers/v1/accounts-v1.controller"), { "AccountsControllerV1": { "getSIWFConfig": { type: t["../../../libs/types/src/dtos/account/wallet.login.config.response.dto"].WalletLoginConfigResponseDto }, "getAccountForMsa": { type: t["../../../libs/types/src/dtos/account/accounts.response.dto"].AccountResponseDto }, "getAccountForAccountId": { type: t["../../../libs/types/src/dtos/account/accounts.response.dto"].AccountResponseDto }, "postSignInWithFrequency": { type: t["../../../libs/types/src/dtos/account/wallet.login.response.dto"].WalletLoginResponseDto }, "getRetireMsaPayload": { type: t["../../../libs/types/src/dtos/account/accounts.response.dto"].RetireMsaPayloadResponseDto }, "postRetireMsa": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse } } }], [import("./controllers/v1/delegation-v1.controller"), { "DelegationControllerV1": { "getDelegation": { type: t["../../../libs/types/src/dtos/account/delegation.response.dto"].DelegationResponse }, "getRevokeDelegationPayload": { type: t["../../../libs/types/src/dtos/account/revokeDelegation.request.dto"].RevokeDelegationPayloadResponseDto }, "postRevokeDelegation": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse } } }], [import("./controllers/v1/handles-v1.controller"), { "HandlesControllerV1": { "createHandle": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse }, "changeHandle": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse }, "getChangeHandlePayload": { type: t["../../../libs/types/src/dtos/account/handles.request.dto"].ChangeHandlePayloadRequest }, "getHandle": { type: t["../../../libs/types/src/dtos/account/accounts.response.dto"].HandleResponseDto } } }], [import("./controllers/v1/keys-v1.controller"), { "KeysControllerV1": { "addKey": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse }, "getKeys": { type: t["../../../libs/types/src/dtos/account/keys.response.dto"].KeysResponse }, "getPublicKeyAgreementsKeyPayload": { type: t["../../../libs/types/src/dtos/account/graphs.request.dto"].AddNewPublicKeyAgreementPayloadRequest }, "AddNewPublicKeyAgreements": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse } } }], [import("./controllers/v2/delegation-v2.controller"), { "DelegationsControllerV2": { "getDelegation": { type: Object }, "getProviderDelegation": { type: t["../../../libs/types/src/dtos/account/delegation.response.dto"].DelegationResponseV2 } } }]] } }; + return { "@nestjs/swagger": { "models": [[import("../../../libs/types/src/dtos/account/accounts.response.dto"), { "HandleResponseDto": { base_handle: { required: true, type: () => String }, canonical_base: { required: true, type: () => String }, suffix: { required: true, type: () => Number } }, "AccountResponseDto": { msaId: { required: true, type: () => String }, handle: { required: false, type: () => t["../../../libs/types/src/dtos/account/accounts.response.dto"].HandleResponseDto } }, "MsaIdResponseDto": { msaId: { required: true, type: () => String } }, "RetireMsaPayloadResponseDto": { encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/accounts.request.dto"), { "RetireMsaRequestDto": { signature: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/delegation.request.dto"), { "ProviderDelegationRequestDto": { msaId: { required: true, type: () => String }, providerId: { required: false, type: () => String } }, "DelegationRequestDto": {} }], [import("../../../libs/types/src/dtos/account/delegation.response.dto"), { "DelegationResponse": { providerId: { required: true, type: () => String }, schemaPermissions: { required: true }, revokedAt: { required: true, type: () => t["@polkadot/types-codec/primitive/U32"].u32 } }, "SchemaDelegation": { schemaId: { required: true, type: () => Number }, revokedAtBlock: { required: false, type: () => Number } }, "Delegation": { providerId: { required: true, type: () => String }, schemaDelegations: { required: true, type: () => [t["../../../libs/types/src/dtos/account/delegation.response.dto"].SchemaDelegation] }, revokedAtBlock: { required: false, type: () => Number } }, "DelegationResponseV2": { msaId: { required: true, type: () => String }, delegations: { required: true, type: () => [t["../../../libs/types/src/dtos/account/delegation.response.dto"].Delegation] } } }], [import("../../../libs/types/src/dtos/account/graphs.request.dto"), { "ItemActionDto": { type: { required: true, enum: t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionType }, encodedPayload: { required: false, type: () => String }, index: { required: false, type: () => Number } }, "ItemizedSignaturePayloadDto": { schemaId: { required: true, type: () => Number }, targetHash: { required: true, type: () => Number }, expiration: { required: true, type: () => Number }, actions: { required: true, type: () => [t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionDto] } }, "AddNewPublicKeyAgreementRequestDto": { accountId: { required: true, type: () => String }, payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, proof: { required: true, type: () => String } }, "AddNewPublicKeyAgreementPayloadRequest": { payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, encodedPayload: { required: true, type: () => String } }, "PublicKeyAgreementsKeyPayload": { msaId: { required: true, type: () => String }, newKey: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/handles.request.dto"), { "HandleRequestDto": { accountId: { required: true, type: () => String }, proof: { required: true, type: () => String } }, "ChangeHandlePayloadRequest": { encodedPayload: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/keys.request.dto"), { "KeysRequestPayloadDto": { msaId: { required: true, type: () => String }, expiration: { required: true, type: () => Number }, newPublicKey: { required: true, type: () => String } }, "KeysRequestDto": { msaOwnerAddress: { required: true, type: () => String }, msaOwnerSignature: { required: true, type: () => String }, newKeyOwnerSignature: { required: true, type: () => String }, payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/keys.request.dto"].KeysRequestPayloadDto } } }], [import("../../../libs/types/src/dtos/account/keys.response.dto"), { "KeysResponse": { msaKeys: { required: true } } }], [import("../../../libs/types/src/dtos/account/revokeDelegation.request.dto"), { "RevokeDelegationPayloadResponseDto": { accountId: { required: true, type: () => String }, providerId: { required: true, type: () => String }, encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String } }, "RevokeDelegationPayloadRequestDto": { signature: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/wallet.login.request.dto"), { "ErrorResponseDto": { message: { required: true, type: () => String } }, "SiwsPayloadDto": { message: { required: true, type: () => String }, signature: { required: true, type: () => String } }, "SignInResponseDto": { siwsPayload: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SiwsPayloadDto }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "EncodedExtrinsicDto": { pallet: { required: true, type: () => String, minLength: 1 }, extrinsicName: { required: true, type: () => String, minLength: 1 }, encodedExtrinsic: { required: true, type: () => String } }, "SignUpResponseDto": { extrinsics: { required: false, type: () => [t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].EncodedExtrinsicDto] }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "WalletLoginRequestDto": { signIn: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignInResponseDto }, signUp: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignUpResponseDto } } }], [import("../../../libs/types/src/dtos/account/transaction.response.dto"), { "TransactionResponse": { referenceId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/wallet.login.config.response.dto"), { "WalletLoginConfigResponseDto": { providerId: { required: true, type: () => String }, siwfUrl: { required: true, type: () => String }, frequencyRpcUrl: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/wallet.login.response.dto"), { "WalletLoginResponseDto": { referenceId: { required: true, type: () => String }, msaId: { required: false, type: () => String }, publicKey: { required: false, type: () => String } } }], [import("../../../libs/types/src/dtos/content-publishing/activity.dto"), { "LocationDto": { name: { required: true, type: () => String, minLength: 1 }, accuracy: { required: false, type: () => Number, minimum: 0, maximum: 100 }, altitude: { required: false, type: () => Number }, latitude: { required: false, type: () => Number }, longitude: { required: false, type: () => Number }, radius: { required: false, type: () => Number, minimum: 0 }, units: { required: false, enum: t["../../../libs/types/src/dtos/content-publishing/activity.dto"].UnitTypeDto } }, "AssetReferenceDto": { referenceId: { required: true, type: () => String, minLength: 1 }, height: { required: false, type: () => Number }, width: { required: false, type: () => Number }, duration: { required: false, type: () => String, pattern: "DURATION_REGEX" } }, "TagDto": { type: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/activity.dto"].TagTypeDto }, name: { required: false, type: () => String, minLength: 1 }, mentionedId: { required: false, type: () => String } }, "AssetDto": { isLink: { required: false, type: () => Boolean }, references: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetReferenceDto] }, name: { required: false, type: () => String, minLength: 1 }, href: { required: false, type: () => String, minLength: 1 } }, "BaseActivityDto": { name: { required: false, type: () => String }, tag: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].TagDto] }, location: { required: false, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].LocationDto } }, "NoteActivityDto": { content: { required: true, type: () => String, minLength: 1 }, published: { required: true, type: () => String }, assets: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetDto] } }, "ProfileActivityDto": { icon: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetReferenceDto] }, summary: { required: false, type: () => String }, published: { required: false, type: () => String } } }], [import("../../../libs/types/src/dtos/content-publishing/announcement.dto"), { "BroadcastDto": { content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "ReplyDto": { inReplyTo: { required: true, type: () => String }, content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "TombstoneDto": { targetContentHash: { required: true, type: () => String }, targetAnnouncementType: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/announcement.dto"].ModifiableAnnouncementTypeDto } }, "UpdateDto": { targetContentHash: { required: true, type: () => String }, targetAnnouncementType: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/announcement.dto"].ModifiableAnnouncementTypeDto }, content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "ReactionDto": { emoji: { required: true, type: () => String, minLength: 1, pattern: "DSNP_EMOJI_REGEX" }, apply: { required: true, type: () => Number }, inReplyTo: { required: true, type: () => String } }, "ProfileDto": { profile: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].ProfileActivityDto } } }], [import("../../../libs/types/src/dtos/content-publishing/common.dto"), { "AnnouncementResponseDto": { referenceId: { required: true, type: () => String } }, "UploadResponseDto": { assetIds: { required: true, type: () => [String] } }, "FilesUploadDto": { files: { required: true, type: () => [Object] } } }], [import("../../../libs/types/src/dtos/graph/connection.dto"), { "ConnectionDto": { dsnpId: { required: true, type: () => String }, privacyType: { required: true, enum: t["../../../libs/types/src/dtos/graph/privacy-type.enum"].PrivacyType }, direction: { required: true, enum: t["../../../libs/types/src/dtos/graph/direction.enum"].Direction }, connectionType: { required: true, enum: t["../../../libs/types/src/dtos/graph/connection-type.enum"].ConnectionType } }, "ConnectionDtoWrapper": { data: { required: true, type: () => [t["../../../libs/types/src/dtos/graph/connection.dto"].ConnectionDto] } } }], [import("../../../libs/types/src/dtos/graph/graph-key-pair.dto"), { "GraphKeyPairDto": { publicKey: { required: true, type: () => String }, privateKey: { required: true, type: () => String }, keyType: { required: true, type: () => String, enum: t["../../../libs/types/src/dtos/graph/key-type.enum"].KeyType } } }], [import("../../../libs/types/src/dtos/common/params.dto"), { "MsaIdDto": { msaId: { required: true, type: () => String } }, "ProviderMsaIdDto": { providerId: { required: true, type: () => String } }, "UrlDto": { url: { required: true, type: () => String } }, "HandleDto": { newHandle: { required: true, type: () => String, minLength: 3 } }, "AccountIdDto": { accountId: { required: true, type: () => String } } }]], "controllers": [[import("./controllers/health.controller"), { "HealthController": { "healthz": {}, "livez": {}, "readyz": {} } }], [import("./controllers/v1/accounts-v1.controller"), { "AccountsControllerV1": { "getSIWFConfig": { type: t["../../../libs/types/src/dtos/account/wallet.login.config.response.dto"].WalletLoginConfigResponseDto }, "getAccountForMsa": { type: t["../../../libs/types/src/dtos/account/accounts.response.dto"].AccountResponseDto }, "getAccountForAccountId": { type: t["../../../libs/types/src/dtos/account/accounts.response.dto"].AccountResponseDto }, "postSignInWithFrequency": { type: t["../../../libs/types/src/dtos/account/wallet.login.response.dto"].WalletLoginResponseDto }, "getRetireMsaPayload": { type: t["../../../libs/types/src/dtos/account/accounts.response.dto"].RetireMsaPayloadResponseDto }, "postRetireMsa": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse } } }], [import("./controllers/v1/delegation-v1.controller"), { "DelegationControllerV1": { "getDelegation": { type: t["../../../libs/types/src/dtos/account/delegation.response.dto"].DelegationResponse }, "getRevokeDelegationPayload": { type: t["../../../libs/types/src/dtos/account/revokeDelegation.request.dto"].RevokeDelegationPayloadResponseDto }, "postRevokeDelegation": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse } } }], [import("./controllers/v1/handles-v1.controller"), { "HandlesControllerV1": { "createHandle": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse }, "changeHandle": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse }, "getChangeHandlePayload": { type: t["../../../libs/types/src/dtos/account/handles.request.dto"].ChangeHandlePayloadRequest }, "getHandle": { type: t["../../../libs/types/src/dtos/account/accounts.response.dto"].HandleResponseDto } } }], [import("./controllers/v1/keys-v1.controller"), { "KeysControllerV1": { "addKey": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse }, "getKeys": { type: t["../../../libs/types/src/dtos/account/keys.response.dto"].KeysResponse }, "getPublicKeyAgreementsKeyPayload": { type: t["../../../libs/types/src/dtos/account/graphs.request.dto"].AddNewPublicKeyAgreementPayloadRequest }, "AddNewPublicKeyAgreements": { type: t["../../../libs/types/src/dtos/account/transaction.response.dto"].TransactionResponse } } }], [import("./controllers/v2/delegation-v2.controller"), { "DelegationsControllerV2": { "getDelegation": { type: Object }, "getProviderDelegation": { type: t["../../../libs/types/src/dtos/account/delegation.response.dto"].DelegationResponseV2 } } }]] } }; }; \ No newline at end of file diff --git a/apps/account-api/src/services/delegation.service.ts b/apps/account-api/src/services/delegation.service.ts index 3c205168..f8bc05f5 100644 --- a/apps/account-api/src/services/delegation.service.ts +++ b/apps/account-api/src/services/delegation.service.ts @@ -9,7 +9,6 @@ import { } from '#types/dtos/account'; import { DelegationResponse, DelegationResponseV2 } from '#types/dtos/account/delegation.response.dto'; import { HttpException, HttpStatus, Inject, Injectable, Logger } from '@nestjs/common'; -import { isAddress } from '@polkadot/util-crypto'; import blockchainConfig, { IBlockchainConfig } from '#account-lib/blockchain/blockchain.config'; @Injectable() @@ -47,36 +46,36 @@ export class DelegationService { throw new Error('Invalid msaId.'); } - async getRevokeDelegationPayload(accountId: string, providerId: string): Promise { - if (!isAddress(accountId)) { - throw new HttpException('Invalid accountId', HttpStatus.BAD_REQUEST); - } + async getRevokeDelegationPayload( + accountId: string, + providerMsaId: string, + ): Promise { const msaId = await this.blockchainService.publicKeyToMsaId(accountId); if (!msaId) { throw new HttpException('MSA ID for account not found', HttpStatus.NOT_FOUND); } - if (providerId) { - const isValidProviderId = await this.blockchainService.isValidMsaId(providerId); + if (providerMsaId) { + const isValidProviderId = await this.blockchainService.isValidMsaId(providerMsaId); if (!isValidProviderId) { throw new HttpException('Invalid provider', HttpStatus.BAD_REQUEST); } - const providerInfo = await this.blockchainService.getProviderToRegistryEntry(providerId); + const providerInfo = await this.blockchainService.getProviderToRegistryEntry(providerMsaId); if (!providerInfo) { throw new HttpException('Supplied ID not a Provider', HttpStatus.BAD_REQUEST); } } // Validate that delegations exist for this msaId - const delegations = await this.blockchainService.getProviderDelegationForMsa(msaId, providerId); + const delegations = await this.blockchainService.getProviderDelegationForMsa(msaId, providerMsaId); if (!delegations) { throw new HttpException('No delegations found', HttpStatus.NOT_FOUND); } if (delegations.revokedAtBlock !== 0) { throw new HttpException('Delegation already revoked', HttpStatus.NOT_FOUND); } - return this.blockchainService.createRevokedDelegationPayload(accountId, providerId); + return this.blockchainService.createRevokedDelegationPayload(accountId, providerMsaId); } async postRevokeDelegation(revokeDelegationRequest: RevokeDelegationPayloadRequestDto): Promise { diff --git a/apps/account-api/src/services/handles.service.ts b/apps/account-api/src/services/handles.service.ts index a8adef06..2b951f08 100644 --- a/apps/account-api/src/services/handles.service.ts +++ b/apps/account-api/src/services/handles.service.ts @@ -3,6 +3,8 @@ import { BlockchainService } from '#account-lib/blockchain/blockchain.service'; import { HandleResponseDto } from '#types/dtos/account/accounts.response.dto'; import { BlockchainConstants } from '#account-lib/blockchain/blockchain-constants'; import { HandleRequestDto } from '#types/dtos/account'; +import { u8aToHex, u8aWrapBytes } from '@polkadot/util'; +import { verifySignature } from '#account-lib/utils/utility'; @Injectable() export class HandlesService { @@ -29,4 +31,9 @@ export class HandlesService { encodePayload(payload: HandleRequestDto['payload']) { return this.blockchainService.createClaimHandPayloadType(payload.baseHandle, payload.expiration); } + + verifyHandleRequestSignature(request: HandleRequestDto): boolean { + const encodedPayload = u8aToHex(u8aWrapBytes(this.encodePayload(request.payload).toU8a())); + return verifySignature(encodedPayload, request.proof, request.accountId).isValid; + } } diff --git a/apps/account-api/src/services/keys.service.ts b/apps/account-api/src/services/keys.service.ts index 99d8b937..f973785a 100644 --- a/apps/account-api/src/services/keys.service.ts +++ b/apps/account-api/src/services/keys.service.ts @@ -5,12 +5,15 @@ import { EnvironmentInterface, EnvironmentType, Graph } from '@dsnp/graph-sdk'; import { HexString } from '@polkadot/util/types'; import { AddNewPublicKeyAgreementPayloadRequest, + AddNewPublicKeyAgreementRequestDto, ItemActionType, ItemizedSignaturePayloadDto, } from '#types/dtos/account/graphs.request.dto'; import { u8aToHex, u8aWrapBytes } from '@polkadot/util'; import { BlockchainConstants } from '#account-lib/blockchain/blockchain-constants'; import apiConfig, { IAccountApiConfig } from '#account-api/api.config'; +import { verifySignature } from '#account-lib/utils/utility'; +import { KeysRequestDto } from '#types/dtos/account'; @Injectable() export class KeysService { @@ -71,9 +74,7 @@ export class KeysService { ], }; - const encodedPayload = u8aToHex( - u8aWrapBytes(this.blockchainService.createItemizedSignaturePayloadV2Type(payload).toU8a()), - ); + const encodedPayload = u8aToHex(this.blockchainService.createItemizedSignaturePayloadV2Type(payload).toU8a()); return { payload, encodedPayload, @@ -92,4 +93,24 @@ export class KeysService { // standard expiration in SIWF is 10 minutes return lastFinalizedBlockNumber + 600 / BlockchainConstants.SECONDS_PER_BLOCK; } + + verifyAddKeySignature(request: KeysRequestDto): boolean { + const encodedPayload = u8aToHex( + u8aWrapBytes(this.blockchainService.createAddPublicKeyToMsaPayload(request.payload).toU8a()), + ); + const msaOwnerVerification = verifySignature(encodedPayload, request.msaOwnerSignature, request.msaOwnerAddress); + const keyOwnerVerification = verifySignature( + encodedPayload, + request.newKeyOwnerSignature, + request.payload.newPublicKey, + ); + return msaOwnerVerification.isValid && keyOwnerVerification.isValid; + } + + verifyPublicKeyAgreementSignature(request: AddNewPublicKeyAgreementRequestDto): boolean { + const encodedPayload = u8aToHex( + u8aWrapBytes(this.blockchainService.createItemizedSignaturePayloadV2Type(request.payload).toU8a()), + ); + return verifySignature(encodedPayload, request.proof, request.accountId).isValid; + } } diff --git a/apps/account-api/test/delegations.controller.e2e-spec.ts b/apps/account-api/test/delegations.controller.e2e-spec.ts index 466d66ca..fc4865df 100644 --- a/apps/account-api/test/delegations.controller.e2e-spec.ts +++ b/apps/account-api/test/delegations.controller.e2e-spec.ts @@ -128,10 +128,16 @@ describe('Delegation Controller', () => { const { keypair } = users[1]; const invalidAccountId = `${keypair.address.slice(0, -1)}5H`; const getPath: string = `/v1/delegation/revokeDelegation/${invalidAccountId}/${providerId}`; - await request(httpServer).get(getPath).expect(HttpStatus.BAD_REQUEST).expect({ - statusCode: HttpStatus.BAD_REQUEST, - message: 'Invalid accountId', - }); + await request(httpServer) + .get(getPath) + .expect(HttpStatus.BAD_REQUEST) + .expect({ + statusCode: HttpStatus.BAD_REQUEST, + error: 'Bad Request', + message: [ + 'accountId should be a valid 32 bytes representing an account Id or address in Hex or SS58 format!', + ], + }); }); it('(GET) /v1/delegation/revokeDelegation/:accountId/:providerId with valid accountId: no msa', async () => { diff --git a/apps/content-publishing-api/src/metadata.ts b/apps/content-publishing-api/src/metadata.ts index a0a3e793..e482b5a0 100644 --- a/apps/content-publishing-api/src/metadata.ts +++ b/apps/content-publishing-api/src/metadata.ts @@ -5,6 +5,7 @@ export default async () => { ["../../../libs/types/src/dtos/content-publishing/announcement.dto"]: await import("../../../libs/types/src/dtos/content-publishing/announcement.dto"), ["../../../libs/types/src/dtos/account/graphs.request.dto"]: await import("../../../libs/types/src/dtos/account/graphs.request.dto"), ["../../../libs/types/src/dtos/account/wallet.login.request.dto"]: await import("../../../libs/types/src/dtos/account/wallet.login.request.dto"), + ["../../../libs/types/src/dtos/account/keys.request.dto"]: await import("../../../libs/types/src/dtos/account/keys.request.dto"), ["../../../libs/types/src/dtos/account/accounts.response.dto"]: await import("../../../libs/types/src/dtos/account/accounts.response.dto"), ["../../../libs/types/src/dtos/graph/privacy-type.enum"]: await import("../../../libs/types/src/dtos/graph/privacy-type.enum"), ["../../../libs/types/src/dtos/graph/direction.enum"]: await import("../../../libs/types/src/dtos/graph/direction.enum"), @@ -12,5 +13,5 @@ export default async () => { ["../../../libs/types/src/dtos/graph/connection.dto"]: await import("../../../libs/types/src/dtos/graph/connection.dto"), ["../../../libs/types/src/dtos/graph/key-type.enum"]: await import("../../../libs/types/src/dtos/graph/key-type.enum") }; - return { "@nestjs/swagger": { "models": [[import("../../../libs/types/src/dtos/content-publishing/activity.dto"), { "LocationDto": { name: { required: true, type: () => String, minLength: 1 }, accuracy: { required: false, type: () => Number, minimum: 0, maximum: 100 }, altitude: { required: false, type: () => Number }, latitude: { required: false, type: () => Number }, longitude: { required: false, type: () => Number }, radius: { required: false, type: () => Number, minimum: 0 }, units: { required: false, enum: t["../../../libs/types/src/dtos/content-publishing/activity.dto"].UnitTypeDto } }, "AssetReferenceDto": { referenceId: { required: true, type: () => String, minLength: 1 }, height: { required: false, type: () => Number }, width: { required: false, type: () => Number }, duration: { required: false, type: () => String, pattern: "DURATION_REGEX" } }, "TagDto": { type: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/activity.dto"].TagTypeDto }, name: { required: false, type: () => String, minLength: 1 }, mentionedId: { required: false, type: () => String } }, "AssetDto": { isLink: { required: false, type: () => Boolean }, references: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetReferenceDto] }, name: { required: false, type: () => String, minLength: 1 }, href: { required: false, type: () => String, minLength: 1 } }, "BaseActivityDto": { name: { required: false, type: () => String }, tag: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].TagDto] }, location: { required: false, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].LocationDto } }, "NoteActivityDto": { content: { required: true, type: () => String, minLength: 1 }, published: { required: true, type: () => String }, assets: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetDto] } }, "ProfileActivityDto": { icon: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetReferenceDto] }, summary: { required: false, type: () => String }, published: { required: false, type: () => String } } }], [import("../../../libs/types/src/dtos/content-publishing/announcement.dto"), { "BroadcastDto": { content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "ReplyDto": { inReplyTo: { required: true, type: () => String }, content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "TombstoneDto": { targetContentHash: { required: true, type: () => String }, targetAnnouncementType: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/announcement.dto"].ModifiableAnnouncementTypeDto } }, "UpdateDto": { targetContentHash: { required: true, type: () => String }, targetAnnouncementType: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/announcement.dto"].ModifiableAnnouncementTypeDto }, content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "ReactionDto": { emoji: { required: true, type: () => String, minLength: 1, pattern: "DSNP_EMOJI_REGEX" }, apply: { required: true, type: () => Number }, inReplyTo: { required: true, type: () => String } }, "ProfileDto": { profile: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].ProfileActivityDto } } }], [import("../../../libs/types/src/dtos/content-publishing/common.dto"), { "AnnouncementResponseDto": { referenceId: { required: true, type: () => String } }, "UploadResponseDto": { assetIds: { required: true, type: () => [String] } }, "FilesUploadDto": { files: { required: true, type: () => [Object] } } }], [import("../../../libs/types/src/dtos/common/params.dto"), { "MsaIdDto": { msaId: { required: true, type: () => String } }, "ProviderMsaIdDto": { providerId: { required: true, type: () => String } }, "UrlDto": { url: { required: true, type: () => String } }, "HandleDto": { newHandle: { required: true, type: () => String, minLength: 3 } }, "AccountIdDto": { accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/graphs.request.dto"), { "ItemActionDto": { type: { required: true, enum: t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionType }, encodedPayload: { required: false, type: () => String }, index: { required: false, type: () => Number } }, "ItemizedSignaturePayloadDto": { schemaId: { required: true, type: () => Number }, targetHash: { required: true, type: () => Number }, expiration: { required: true, type: () => Number }, actions: { required: true, type: () => [t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionDto] } }, "AddNewPublicKeyAgreementRequestDto": { accountId: { required: true, type: () => String }, payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, proof: { required: true, type: () => String } }, "AddNewPublicKeyAgreementPayloadRequest": { payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, encodedPayload: { required: true, type: () => String } }, "PublicKeyAgreementsKeyPayload": { msaId: { required: true, type: () => String }, newKey: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/handles.request.dto"), { "HandleRequestDto": { accountId: { required: true, type: () => String }, proof: { required: true, type: () => String } }, "ChangeHandlePayloadRequest": { encodedPayload: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/wallet.login.request.dto"), { "ErrorResponseDto": { message: { required: true, type: () => String } }, "SiwsPayloadDto": { message: { required: true, type: () => String }, signature: { required: true, type: () => String } }, "SignInResponseDto": { siwsPayload: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SiwsPayloadDto }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "EncodedExtrinsicDto": { pallet: { required: true, type: () => String, minLength: 1 }, extrinsicName: { required: true, type: () => String, minLength: 1 }, encodedExtrinsic: { required: true, type: () => String } }, "SignUpResponseDto": { extrinsics: { required: false, type: () => [t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].EncodedExtrinsicDto] }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "WalletLoginRequestDto": { signIn: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignInResponseDto }, signUp: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignUpResponseDto } } }], [import("../../../libs/types/src/dtos/account/keys.request.dto"), { "KeysRequestDto": { msaOwnerAddress: { required: true, type: () => String }, msaOwnerSignature: { required: true, type: () => String }, newKeyOwnerSignature: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/accounts.response.dto"), { "HandleResponseDto": { base_handle: { required: true, type: () => String }, canonical_base: { required: true, type: () => String }, suffix: { required: true, type: () => Number } }, "AccountResponseDto": { msaId: { required: true, type: () => String }, handle: { required: false, type: () => t["../../../libs/types/src/dtos/account/accounts.response.dto"].HandleResponseDto } }, "MsaIdResponseDto": { msaId: { required: true, type: () => String } }, "RetireMsaPayloadResponseDto": { encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/accounts.request.dto"), { "RetireMsaRequestDto": { signature: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/revokeDelegation.request.dto"), { "RevokeDelegationPayloadResponseDto": { accountId: { required: true, type: () => String }, providerId: { required: true, type: () => String }, encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String } }, "RevokeDelegationPayloadRequestDto": { signature: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/graph/connection.dto"), { "ConnectionDto": { dsnpId: { required: true, type: () => String }, privacyType: { required: true, enum: t["../../../libs/types/src/dtos/graph/privacy-type.enum"].PrivacyType }, direction: { required: true, enum: t["../../../libs/types/src/dtos/graph/direction.enum"].Direction }, connectionType: { required: true, enum: t["../../../libs/types/src/dtos/graph/connection-type.enum"].ConnectionType } }, "ConnectionDtoWrapper": { data: { required: true, type: () => [t["../../../libs/types/src/dtos/graph/connection.dto"].ConnectionDto] } } }], [import("../../../libs/types/src/dtos/graph/graph-key-pair.dto"), { "GraphKeyPairDto": { publicKey: { required: true, type: () => String }, privateKey: { required: true, type: () => String }, keyType: { required: true, type: () => String, enum: t["../../../libs/types/src/dtos/graph/key-type.enum"].KeyType } } }]], "controllers": [[import("./controllers/health.controller"), { "HealthController": { "healthz": {}, "livez": {}, "readyz": {} } }]] } }; + return { "@nestjs/swagger": { "models": [[import("../../../libs/types/src/dtos/content-publishing/activity.dto"), { "LocationDto": { name: { required: true, type: () => String, minLength: 1 }, accuracy: { required: false, type: () => Number, minimum: 0, maximum: 100 }, altitude: { required: false, type: () => Number }, latitude: { required: false, type: () => Number }, longitude: { required: false, type: () => Number }, radius: { required: false, type: () => Number, minimum: 0 }, units: { required: false, enum: t["../../../libs/types/src/dtos/content-publishing/activity.dto"].UnitTypeDto } }, "AssetReferenceDto": { referenceId: { required: true, type: () => String, minLength: 1 }, height: { required: false, type: () => Number }, width: { required: false, type: () => Number }, duration: { required: false, type: () => String, pattern: "DURATION_REGEX" } }, "TagDto": { type: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/activity.dto"].TagTypeDto }, name: { required: false, type: () => String, minLength: 1 }, mentionedId: { required: false, type: () => String } }, "AssetDto": { isLink: { required: false, type: () => Boolean }, references: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetReferenceDto] }, name: { required: false, type: () => String, minLength: 1 }, href: { required: false, type: () => String, minLength: 1 } }, "BaseActivityDto": { name: { required: false, type: () => String }, tag: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].TagDto] }, location: { required: false, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].LocationDto } }, "NoteActivityDto": { content: { required: true, type: () => String, minLength: 1 }, published: { required: true, type: () => String }, assets: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetDto] } }, "ProfileActivityDto": { icon: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetReferenceDto] }, summary: { required: false, type: () => String }, published: { required: false, type: () => String } } }], [import("../../../libs/types/src/dtos/content-publishing/announcement.dto"), { "BroadcastDto": { content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "ReplyDto": { inReplyTo: { required: true, type: () => String }, content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "TombstoneDto": { targetContentHash: { required: true, type: () => String }, targetAnnouncementType: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/announcement.dto"].ModifiableAnnouncementTypeDto } }, "UpdateDto": { targetContentHash: { required: true, type: () => String }, targetAnnouncementType: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/announcement.dto"].ModifiableAnnouncementTypeDto }, content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "ReactionDto": { emoji: { required: true, type: () => String, minLength: 1, pattern: "DSNP_EMOJI_REGEX" }, apply: { required: true, type: () => Number }, inReplyTo: { required: true, type: () => String } }, "ProfileDto": { profile: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].ProfileActivityDto } } }], [import("../../../libs/types/src/dtos/content-publishing/common.dto"), { "AnnouncementResponseDto": { referenceId: { required: true, type: () => String } }, "UploadResponseDto": { assetIds: { required: true, type: () => [String] } }, "FilesUploadDto": { files: { required: true, type: () => [Object] } } }], [import("../../../libs/types/src/dtos/common/params.dto"), { "MsaIdDto": { msaId: { required: true, type: () => String } }, "ProviderMsaIdDto": { providerId: { required: true, type: () => String } }, "UrlDto": { url: { required: true, type: () => String } }, "HandleDto": { newHandle: { required: true, type: () => String, minLength: 3 } }, "AccountIdDto": { accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/graphs.request.dto"), { "ItemActionDto": { type: { required: true, enum: t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionType }, encodedPayload: { required: false, type: () => String }, index: { required: false, type: () => Number } }, "ItemizedSignaturePayloadDto": { schemaId: { required: true, type: () => Number }, targetHash: { required: true, type: () => Number }, expiration: { required: true, type: () => Number }, actions: { required: true, type: () => [t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionDto] } }, "AddNewPublicKeyAgreementRequestDto": { accountId: { required: true, type: () => String }, payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, proof: { required: true, type: () => String } }, "AddNewPublicKeyAgreementPayloadRequest": { payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, encodedPayload: { required: true, type: () => String } }, "PublicKeyAgreementsKeyPayload": { msaId: { required: true, type: () => String }, newKey: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/handles.request.dto"), { "HandleRequestDto": { accountId: { required: true, type: () => String }, proof: { required: true, type: () => String } }, "ChangeHandlePayloadRequest": { encodedPayload: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/wallet.login.request.dto"), { "ErrorResponseDto": { message: { required: true, type: () => String } }, "SiwsPayloadDto": { message: { required: true, type: () => String }, signature: { required: true, type: () => String } }, "SignInResponseDto": { siwsPayload: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SiwsPayloadDto }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "EncodedExtrinsicDto": { pallet: { required: true, type: () => String, minLength: 1 }, extrinsicName: { required: true, type: () => String, minLength: 1 }, encodedExtrinsic: { required: true, type: () => String } }, "SignUpResponseDto": { extrinsics: { required: false, type: () => [t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].EncodedExtrinsicDto] }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "WalletLoginRequestDto": { signIn: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignInResponseDto }, signUp: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignUpResponseDto } } }], [import("../../../libs/types/src/dtos/account/keys.request.dto"), { "KeysRequestPayloadDto": { msaId: { required: true, type: () => String }, expiration: { required: true, type: () => Number }, newPublicKey: { required: true, type: () => String } }, "KeysRequestDto": { msaOwnerAddress: { required: true, type: () => String }, msaOwnerSignature: { required: true, type: () => String }, newKeyOwnerSignature: { required: true, type: () => String }, payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/keys.request.dto"].KeysRequestPayloadDto } } }], [import("../../../libs/types/src/dtos/account/accounts.response.dto"), { "HandleResponseDto": { base_handle: { required: true, type: () => String }, canonical_base: { required: true, type: () => String }, suffix: { required: true, type: () => Number } }, "AccountResponseDto": { msaId: { required: true, type: () => String }, handle: { required: false, type: () => t["../../../libs/types/src/dtos/account/accounts.response.dto"].HandleResponseDto } }, "MsaIdResponseDto": { msaId: { required: true, type: () => String } }, "RetireMsaPayloadResponseDto": { encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/accounts.request.dto"), { "RetireMsaRequestDto": { signature: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/revokeDelegation.request.dto"), { "RevokeDelegationPayloadResponseDto": { accountId: { required: true, type: () => String }, providerId: { required: true, type: () => String }, encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String } }, "RevokeDelegationPayloadRequestDto": { signature: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/graph/connection.dto"), { "ConnectionDto": { dsnpId: { required: true, type: () => String }, privacyType: { required: true, enum: t["../../../libs/types/src/dtos/graph/privacy-type.enum"].PrivacyType }, direction: { required: true, enum: t["../../../libs/types/src/dtos/graph/direction.enum"].Direction }, connectionType: { required: true, enum: t["../../../libs/types/src/dtos/graph/connection-type.enum"].ConnectionType } }, "ConnectionDtoWrapper": { data: { required: true, type: () => [t["../../../libs/types/src/dtos/graph/connection.dto"].ConnectionDto] } } }], [import("../../../libs/types/src/dtos/graph/graph-key-pair.dto"), { "GraphKeyPairDto": { publicKey: { required: true, type: () => String }, privateKey: { required: true, type: () => String }, keyType: { required: true, type: () => String, enum: t["../../../libs/types/src/dtos/graph/key-type.enum"].KeyType } } }]], "controllers": [[import("./controllers/health.controller"), { "HealthController": { "healthz": {}, "livez": {}, "readyz": {} } }]] } }; }; \ No newline at end of file diff --git a/apps/graph-api/src/metadata.ts b/apps/graph-api/src/metadata.ts index 5dd3e926..00ac32c7 100644 --- a/apps/graph-api/src/metadata.ts +++ b/apps/graph-api/src/metadata.ts @@ -8,8 +8,14 @@ export default async () => { ["../../../libs/types/src/dtos/graph/key-type.enum"]: await import("../../../libs/types/src/dtos/graph/key-type.enum"), ["../../../libs/types/src/dtos/graph/graph-key-pair.dto"]: await import("../../../libs/types/src/dtos/graph/graph-key-pair.dto"), ["../../../libs/types/src/dtos/graph/dsnp-graph-edge.dto"]: await import("../../../libs/types/src/dtos/graph/dsnp-graph-edge.dto"), + ["../../../libs/types/src/dtos/content-publishing/activity.dto"]: await import("../../../libs/types/src/dtos/content-publishing/activity.dto"), + ["../../../libs/types/src/dtos/content-publishing/announcement.dto"]: await import("../../../libs/types/src/dtos/content-publishing/announcement.dto"), + ["../../../libs/types/src/dtos/account/graphs.request.dto"]: await import("../../../libs/types/src/dtos/account/graphs.request.dto"), + ["../../../libs/types/src/dtos/account/wallet.login.request.dto"]: await import("../../../libs/types/src/dtos/account/wallet.login.request.dto"), + ["../../../libs/types/src/dtos/account/keys.request.dto"]: await import("../../../libs/types/src/dtos/account/keys.request.dto"), + ["../../../libs/types/src/dtos/account/accounts.response.dto"]: await import("../../../libs/types/src/dtos/account/accounts.response.dto"), ["../../../libs/types/src/dtos/graph/user-graph.dto"]: await import("../../../libs/types/src/dtos/graph/user-graph.dto"), ["../../../libs/types/src/dtos/graph/graph-change-response.dto"]: await import("../../../libs/types/src/dtos/graph/graph-change-response.dto") }; - return { "@nestjs/swagger": { "models": [[import("../../../libs/types/src/dtos/graph/connection.dto"), { "ConnectionDto": { dsnpId: { required: true, type: () => String }, privacyType: { required: true, enum: t["../../../libs/types/src/dtos/graph/privacy-type.enum"].PrivacyType }, direction: { required: true, enum: t["../../../libs/types/src/dtos/graph/direction.enum"].Direction }, connectionType: { required: true, enum: t["../../../libs/types/src/dtos/graph/connection-type.enum"].ConnectionType } }, "ConnectionDtoWrapper": { data: { required: true, type: () => [t["../../../libs/types/src/dtos/graph/connection.dto"].ConnectionDto] } } }], [import("../../../libs/types/src/dtos/graph/dsnp-graph-edge.dto"), { "DsnpGraphEdgeDto": { userId: { required: true, type: () => String }, since: { required: true, type: () => Number } } }], [import("../../../libs/types/src/dtos/graph/graph-change-response.dto"), { "GraphChangeResponseDto": { referenceId: { required: true, type: () => String, minLength: 1 } } }], [import("../../../libs/types/src/dtos/graph/graph-key-pair.dto"), { "GraphKeyPairDto": { publicKey: { required: true, type: () => String }, privateKey: { required: true, type: () => String }, keyType: { required: true, type: () => String, enum: t["../../../libs/types/src/dtos/graph/key-type.enum"].KeyType } } }], [import("../../../libs/types/src/dtos/graph/graph-query-params.dto"), { "GraphsQueryParamsDto": { dsnpIds: { required: true, type: () => [String] }, privacyType: { required: true, enum: t["../../../libs/types/src/dtos/graph/privacy-type.enum"].PrivacyType }, graphKeyPairs: { required: false, type: () => [t["../../../libs/types/src/dtos/graph/graph-key-pair.dto"].GraphKeyPairDto] } } }], [import("../../../libs/types/src/dtos/graph/provider-graph.dto"), { "ProviderGraphDto": { dsnpId: { required: true, type: () => String }, connections: { required: true, type: () => t["../../../libs/types/src/dtos/graph/connection.dto"].ConnectionDtoWrapper }, graphKeyPairs: { required: false, type: () => [t["../../../libs/types/src/dtos/graph/graph-key-pair.dto"].GraphKeyPairDto] }, webhookUrl: { required: false, type: () => String } } }], [import("../../../libs/types/src/dtos/graph/user-graph.dto"), { "UserGraphDto": { dsnpId: { required: true, type: () => String }, dsnpGraphEdges: { required: false, type: () => [t["../../../libs/types/src/dtos/graph/dsnp-graph-edge.dto"].DsnpGraphEdgeDto] } } }], [import("../../../libs/types/src/dtos/graph/watch-graphs.dto"), { "WatchGraphsDto": { dsnpIds: { required: false, type: () => [String] }, webhookEndpoint: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/common/params.dto"), { "MsaIdDto": { msaId: { required: true, type: () => String } }, "ProviderMsaIdDto": { providerId: { required: true, type: () => String } }, "UrlDto": { url: { required: true, type: () => String } }, "HandleDto": { newHandle: { required: true, type: () => String, minLength: 3 } }, "AccountIdDto": { accountId: { required: true, type: () => String } } }]], "controllers": [[import("./controllers/v1/graph-v1.controller"), { "GraphControllerV1": { "getGraphs": { type: [t["../../../libs/types/src/dtos/graph/user-graph.dto"].UserGraphDto] }, "updateGraph": { type: t["../../../libs/types/src/dtos/graph/graph-change-response.dto"].GraphChangeResponseDto } } }], [import("./controllers/health.controller"), { "HealthController": { "healthz": {}, "livez": {}, "readyz": {} } }], [import("./controllers/v1/webhooks-v1.controller"), { "WebhooksControllerV1": { "getAllWebhooks": { type: Object }, "getWebhooksForMsa": { type: [String] }, "getWebhooksForUrl": { type: [String] }, "watchGraphs": {}, "deleteAllWebhooks": {}, "deleteWebhooksForMsa": {}, "deleteAllWebhooksForUrl": {} } }]] } }; + return { "@nestjs/swagger": { "models": [[import("../../../libs/types/src/dtos/graph/connection.dto"), { "ConnectionDto": { dsnpId: { required: true, type: () => String }, privacyType: { required: true, enum: t["../../../libs/types/src/dtos/graph/privacy-type.enum"].PrivacyType }, direction: { required: true, enum: t["../../../libs/types/src/dtos/graph/direction.enum"].Direction }, connectionType: { required: true, enum: t["../../../libs/types/src/dtos/graph/connection-type.enum"].ConnectionType } }, "ConnectionDtoWrapper": { data: { required: true, type: () => [t["../../../libs/types/src/dtos/graph/connection.dto"].ConnectionDto] } } }], [import("../../../libs/types/src/dtos/graph/dsnp-graph-edge.dto"), { "DsnpGraphEdgeDto": { userId: { required: true, type: () => String }, since: { required: true, type: () => Number } } }], [import("../../../libs/types/src/dtos/graph/graph-change-response.dto"), { "GraphChangeResponseDto": { referenceId: { required: true, type: () => String, minLength: 1 } } }], [import("../../../libs/types/src/dtos/graph/graph-key-pair.dto"), { "GraphKeyPairDto": { publicKey: { required: true, type: () => String }, privateKey: { required: true, type: () => String }, keyType: { required: true, type: () => String, enum: t["../../../libs/types/src/dtos/graph/key-type.enum"].KeyType } } }], [import("../../../libs/types/src/dtos/graph/graph-query-params.dto"), { "GraphsQueryParamsDto": { dsnpIds: { required: true, type: () => [String] }, privacyType: { required: true, enum: t["../../../libs/types/src/dtos/graph/privacy-type.enum"].PrivacyType }, graphKeyPairs: { required: false, type: () => [t["../../../libs/types/src/dtos/graph/graph-key-pair.dto"].GraphKeyPairDto] } } }], [import("../../../libs/types/src/dtos/graph/provider-graph.dto"), { "ProviderGraphDto": { dsnpId: { required: true, type: () => String }, connections: { required: true, type: () => t["../../../libs/types/src/dtos/graph/connection.dto"].ConnectionDtoWrapper }, graphKeyPairs: { required: false, type: () => [t["../../../libs/types/src/dtos/graph/graph-key-pair.dto"].GraphKeyPairDto] }, webhookUrl: { required: false, type: () => String } } }], [import("../../../libs/types/src/dtos/graph/user-graph.dto"), { "UserGraphDto": { dsnpId: { required: true, type: () => String }, dsnpGraphEdges: { required: false, type: () => [t["../../../libs/types/src/dtos/graph/dsnp-graph-edge.dto"].DsnpGraphEdgeDto] } } }], [import("../../../libs/types/src/dtos/graph/watch-graphs.dto"), { "WatchGraphsDto": { dsnpIds: { required: false, type: () => [String] }, webhookEndpoint: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/content-publishing/activity.dto"), { "LocationDto": { name: { required: true, type: () => String, minLength: 1 }, accuracy: { required: false, type: () => Number, minimum: 0, maximum: 100 }, altitude: { required: false, type: () => Number }, latitude: { required: false, type: () => Number }, longitude: { required: false, type: () => Number }, radius: { required: false, type: () => Number, minimum: 0 }, units: { required: false, enum: t["../../../libs/types/src/dtos/content-publishing/activity.dto"].UnitTypeDto } }, "AssetReferenceDto": { referenceId: { required: true, type: () => String, minLength: 1 }, height: { required: false, type: () => Number }, width: { required: false, type: () => Number }, duration: { required: false, type: () => String, pattern: "DURATION_REGEX" } }, "TagDto": { type: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/activity.dto"].TagTypeDto }, name: { required: false, type: () => String, minLength: 1 }, mentionedId: { required: false, type: () => String } }, "AssetDto": { isLink: { required: false, type: () => Boolean }, references: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetReferenceDto] }, name: { required: false, type: () => String, minLength: 1 }, href: { required: false, type: () => String, minLength: 1 } }, "BaseActivityDto": { name: { required: false, type: () => String }, tag: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].TagDto] }, location: { required: false, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].LocationDto } }, "NoteActivityDto": { content: { required: true, type: () => String, minLength: 1 }, published: { required: true, type: () => String }, assets: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetDto] } }, "ProfileActivityDto": { icon: { required: false, type: () => [t["../../../libs/types/src/dtos/content-publishing/activity.dto"].AssetReferenceDto] }, summary: { required: false, type: () => String }, published: { required: false, type: () => String } } }], [import("../../../libs/types/src/dtos/content-publishing/announcement.dto"), { "BroadcastDto": { content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "ReplyDto": { inReplyTo: { required: true, type: () => String }, content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "TombstoneDto": { targetContentHash: { required: true, type: () => String }, targetAnnouncementType: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/announcement.dto"].ModifiableAnnouncementTypeDto } }, "UpdateDto": { targetContentHash: { required: true, type: () => String }, targetAnnouncementType: { required: true, enum: t["../../../libs/types/src/dtos/content-publishing/announcement.dto"].ModifiableAnnouncementTypeDto }, content: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].NoteActivityDto } }, "ReactionDto": { emoji: { required: true, type: () => String, minLength: 1, pattern: "DSNP_EMOJI_REGEX" }, apply: { required: true, type: () => Number }, inReplyTo: { required: true, type: () => String } }, "ProfileDto": { profile: { required: true, type: () => t["../../../libs/types/src/dtos/content-publishing/activity.dto"].ProfileActivityDto } } }], [import("../../../libs/types/src/dtos/content-publishing/common.dto"), { "AnnouncementResponseDto": { referenceId: { required: true, type: () => String } }, "UploadResponseDto": { assetIds: { required: true, type: () => [String] } }, "FilesUploadDto": { files: { required: true, type: () => [Object] } } }], [import("../../../libs/types/src/dtos/account/graphs.request.dto"), { "ItemActionDto": { type: { required: true, enum: t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionType }, encodedPayload: { required: false, type: () => String }, index: { required: false, type: () => Number } }, "ItemizedSignaturePayloadDto": { schemaId: { required: true, type: () => Number }, targetHash: { required: true, type: () => Number }, expiration: { required: true, type: () => Number }, actions: { required: true, type: () => [t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemActionDto] } }, "AddNewPublicKeyAgreementRequestDto": { accountId: { required: true, type: () => String }, payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, proof: { required: true, type: () => String } }, "AddNewPublicKeyAgreementPayloadRequest": { payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/graphs.request.dto"].ItemizedSignaturePayloadDto }, encodedPayload: { required: true, type: () => String } }, "PublicKeyAgreementsKeyPayload": { msaId: { required: true, type: () => String }, newKey: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/handles.request.dto"), { "HandleRequestDto": { accountId: { required: true, type: () => String }, proof: { required: true, type: () => String } }, "ChangeHandlePayloadRequest": { encodedPayload: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/wallet.login.request.dto"), { "ErrorResponseDto": { message: { required: true, type: () => String } }, "SiwsPayloadDto": { message: { required: true, type: () => String }, signature: { required: true, type: () => String } }, "SignInResponseDto": { siwsPayload: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SiwsPayloadDto }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "EncodedExtrinsicDto": { pallet: { required: true, type: () => String, minLength: 1 }, extrinsicName: { required: true, type: () => String, minLength: 1 }, encodedExtrinsic: { required: true, type: () => String } }, "SignUpResponseDto": { extrinsics: { required: false, type: () => [t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].EncodedExtrinsicDto] }, error: { required: false, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].ErrorResponseDto } }, "WalletLoginRequestDto": { signIn: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignInResponseDto }, signUp: { required: true, type: () => t["../../../libs/types/src/dtos/account/wallet.login.request.dto"].SignUpResponseDto } } }], [import("../../../libs/types/src/dtos/account/keys.request.dto"), { "KeysRequestPayloadDto": { msaId: { required: true, type: () => String }, expiration: { required: true, type: () => Number }, newPublicKey: { required: true, type: () => String } }, "KeysRequestDto": { msaOwnerAddress: { required: true, type: () => String }, msaOwnerSignature: { required: true, type: () => String }, newKeyOwnerSignature: { required: true, type: () => String }, payload: { required: true, type: () => t["../../../libs/types/src/dtos/account/keys.request.dto"].KeysRequestPayloadDto } } }], [import("../../../libs/types/src/dtos/account/accounts.response.dto"), { "HandleResponseDto": { base_handle: { required: true, type: () => String }, canonical_base: { required: true, type: () => String }, suffix: { required: true, type: () => Number } }, "AccountResponseDto": { msaId: { required: true, type: () => String }, handle: { required: false, type: () => t["../../../libs/types/src/dtos/account/accounts.response.dto"].HandleResponseDto } }, "MsaIdResponseDto": { msaId: { required: true, type: () => String } }, "RetireMsaPayloadResponseDto": { encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/accounts.request.dto"), { "RetireMsaRequestDto": { signature: { required: true, type: () => String }, accountId: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/account/revokeDelegation.request.dto"), { "RevokeDelegationPayloadResponseDto": { accountId: { required: true, type: () => String }, providerId: { required: true, type: () => String }, encodedExtrinsic: { required: true, type: () => String }, payloadToSign: { required: true, type: () => String } }, "RevokeDelegationPayloadRequestDto": { signature: { required: true, type: () => String } } }], [import("../../../libs/types/src/dtos/common/params.dto"), { "MsaIdDto": { msaId: { required: true, type: () => String } }, "ProviderMsaIdDto": { providerId: { required: true, type: () => String } }, "UrlDto": { url: { required: true, type: () => String } }, "HandleDto": { newHandle: { required: true, type: () => String, minLength: 3 } }, "AccountIdDto": { accountId: { required: true, type: () => String } } }]], "controllers": [[import("./controllers/v1/graph-v1.controller"), { "GraphControllerV1": { "getGraphs": { type: [t["../../../libs/types/src/dtos/graph/user-graph.dto"].UserGraphDto] }, "updateGraph": { type: t["../../../libs/types/src/dtos/graph/graph-change-response.dto"].GraphChangeResponseDto } } }], [import("./controllers/health.controller"), { "HealthController": { "healthz": {}, "livez": {}, "readyz": {} } }], [import("./controllers/v1/webhooks-v1.controller"), { "WebhooksControllerV1": { "getAllWebhooks": { type: Object }, "getWebhooksForMsa": { type: [String] }, "getWebhooksForUrl": { type: [String] }, "watchGraphs": {}, "deleteAllWebhooks": {}, "deleteWebhooksForMsa": {}, "deleteAllWebhooksForUrl": {} } }]] } }; }; \ No newline at end of file diff --git a/docs/account/index.html b/docs/account/index.html index 7bbe3a0f..ff92fc1a 100644 --- a/docs/account/index.html +++ b/docs/account/index.html @@ -12,340 +12,340 @@ margin: 0; } - -

Account Service (1.0)

Download OpenAPI specification:Download

Account Service API

-

v1/accounts

Get the Sign In With Frequency configuration

Responses

Response samples

Content type
application/json
{
  • "providerId": "string",
  • "siwfUrl": "string",
  • "frequencyRpcUrl": "string"
}

Request to Sign In With Frequency

Request Body schema: application/json
required
object

The wallet login request information

-
object (SignUpResponseDto)

Responses

Request samples

Content type
application/json
{
  • "signIn": {
    },
  • "signUp": {
    }
}

Response samples

Content type
application/json
{
  • "referenceId": "string",
  • "msaId": "string",
  • "publicKey": "string"
}

Fetch an account given an MSA Id

path Parameters
msaId
required
string
Example: 2

Msa Id of requested account

-

Responses

Response samples

Content type
application/json
{
  • "msaId": "string",
  • "handle": {
    }
}

Fetch an account given an Account Id

path Parameters
accountId
required
string
Example: 1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N

AccountId in hex or SS58 format

-

Responses

Response samples

Content type
application/json
{
  • "msaId": "string",
  • "handle": {
    }
}

Get a retireMsa unsigned, encoded extrinsic payload.

path Parameters
accountId
required
string
Example: 1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N

AccountId in hex or SS58 format

-

Responses

Response samples

Content type
application/json
{
  • "encodedExtrinsic": "0x1234",
  • "payloadToSign": "0x1234",
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N"
}

Request to retire an MSA ID.

Request Body schema: application/json
required
encodedExtrinsic
required
string

Hex-encoded representation of the "RetireMsa" extrinsic

-
payloadToSign
required
string

payload to be signed

-
accountId
required
string

AccountId in hex or SS58 format

-
signature
required
string

signature of the owner

-

Responses

Request samples

Content type
application/json
{
  • "encodedExtrinsic": "0x1234",
  • "payloadToSign": "0x1234",
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "signature": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

Response samples

Content type
application/json
{
  • "referenceId": "string"
}

delegations

Get all delegation information associated with an MSA Id

path Parameters
msaId
required
string
Example: 3

MSA Id of the user requesting the delegation

-

Responses

Response samples

Content type
application/json
{
  • "msaId": "string",
  • "delegations": [
    ]
}

Get an MSA's delegation information for a specific provider

path Parameters
msaId
required
string
Example: 3

MSA Id of the user requesting the delegation

-
providerId
string
Example: 1

MSA Id of the provider to whom the requesting user wishes to delegate

-

Responses

Response samples

Content type
application/json
{
  • "msaId": "string",
  • "delegations": [
    ]
}

delegation

Get the delegation information associated with an MSA Id

path Parameters
msaId
required
string
Example: 2

Msa Id of requested account

-

Responses

Response samples

Content type
application/json
{
  • "providerId": "string",
  • "schemaPermissions": { },
  • "revokedAt": { }
}

Get a properly encoded RevokeDelegationPayload that can be signed

path Parameters
accountId
required
string
Example: 1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N

AccountId in hex or SS58 format

-
providerId
required
string
Example: 1

Msa Id of provider

-

Responses

Response samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "providerId": "3",
  • "encodedExtrinsic": "0x1234",
  • "payloadToSign": "0x1234"
}

Request to revoke a delegation

Request Body schema: application/json
required
accountId
required
string

AccountId in hex or SS58 format

-
providerId
required
string

MSA Id of the provider to whom the requesting user wishes to delegate

-
encodedExtrinsic
required
string

Hex-encoded representation of the "revokeDelegation" extrinsic

-
payloadToSign
required
string

payload to be signed

-
signature
required
string

signature of the owner

-

Responses

Request samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "providerId": "3",
  • "encodedExtrinsic": "0x1234",
  • "payloadToSign": "0x1234",
  • "signature": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

Response samples

Content type
application/json
{
  • "referenceId": "string"
}

v1/handles

Request to create a new handle for an account

Request Body schema: application/json
required
accountId
required
string

AccountId in hex or SS58 format

-
required
object (HandlePayloadDto)
proof
required
string

proof is the signature for the payload

-

Responses

Request samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "payload": {
    },
  • "proof": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

Request to change a handle

Request Body schema: application/json
required
accountId
required
string

AccountId in hex or SS58 format

-
required
object (HandlePayloadDto)
proof
required
string

proof is the signature for the payload

-

Responses

Request samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "payload": {
    },
  • "proof": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

Get a properly encoded ClaimHandlePayload that can be signed.

path Parameters
newHandle
required
string >= 3 characters
Example: handle

newHandle in the request

-

Responses

Fetch a handle given an MSA Id

path Parameters
msaId
required
string
Example: 2

Msa Id of requested account

-

Responses

v1/keys

Add new control keys for an MSA Id

Request Body schema: application/json
required
msaOwnerAddress
required
string

msaOwnerAddress representing the target of this request

-
msaOwnerSignature
required
string

msaOwnerSignature is the signature by msa owner

-
newKeyOwnerSignature
required
string

newKeyOwnerSignature is the signature with new key

-
required
object (KeysRequestPayloadDto)

Responses

Request samples

Content type
application/json
{
  • "msaOwnerAddress": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "msaOwnerSignature": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85",
  • "newKeyOwnerSignature": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85",
  • "payload": {
    }
}

Fetch public keys given an MSA Id

path Parameters
msaId
required
string
Example: 2

Msa Id of requested account

-

Responses

Get a properly encoded StatefulStorageItemizedSignaturePayloadV2 that can be signed.

query Parameters
msaId
required
string
Example: msaId=3

MSA Id representing the target of this request

-
newKey
required
string
Example: newKey=0x0ed2f8c714efcac51ca2325cfe95637e5e0b898ae397aa365978b7348a717d0b

New public key to be added to the account (32-byte value in hex format)

-

Responses

Request to add a new public Key

Request Body schema: application/json
required
accountId
required
string

AccountId in hex or SS58 format

-
required
object (ItemizedSignaturePayloadDto)
proof
required
string

proof is the signature for the payload

-

Responses

Request samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "payload": {
    },
  • "proof": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

health

Check the health status of the service

Responses

Check the live status of the service

Responses

Check the ready status of the service

Responses

+ " fill="currentColor">

Account Service (1.0)

Download OpenAPI specification:Download

Account Service API

+

v1/accounts

Get the Sign In With Frequency configuration

Responses

Response samples

Content type
application/json
{
  • "providerId": "string",
  • "siwfUrl": "string",
  • "frequencyRpcUrl": "string"
}

Request to Sign In With Frequency

Request Body schema: application/json
required
object

The wallet login request information

+
object (SignUpResponseDto)

Responses

Request samples

Content type
application/json
{
  • "signIn": {
    },
  • "signUp": {
    }
}

Response samples

Content type
application/json
{
  • "referenceId": "string",
  • "msaId": "string",
  • "publicKey": "string"
}

Fetch an account given an MSA Id

path Parameters
msaId
required
string
Example: 2

Msa Id of requested account

+

Responses

Response samples

Content type
application/json
{
  • "msaId": "string",
  • "handle": {
    }
}

Fetch an account given an Account Id

path Parameters
accountId
required
string
Example: 1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N

AccountId in hex or SS58 format

+

Responses

Response samples

Content type
application/json
{
  • "msaId": "string",
  • "handle": {
    }
}

Get a retireMsa unsigned, encoded extrinsic payload.

path Parameters
accountId
required
string
Example: 1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N

AccountId in hex or SS58 format

+

Responses

Response samples

Content type
application/json
{
  • "encodedExtrinsic": "0x1234",
  • "payloadToSign": "0x1234",
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N"
}

Request to retire an MSA ID.

Request Body schema: application/json
required
encodedExtrinsic
required
string

Hex-encoded representation of the "RetireMsa" extrinsic

+
payloadToSign
required
string

payload to be signed

+
accountId
required
string

AccountId in hex or SS58 format

+
signature
required
string

signature of the owner

+

Responses

Request samples

Content type
application/json
{
  • "encodedExtrinsic": "0x1234",
  • "payloadToSign": "0x1234",
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "signature": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

Response samples

Content type
application/json
{
  • "referenceId": "string"
}

delegations

Get all delegation information associated with an MSA Id

path Parameters
msaId
required
string
Example: 3

MSA Id of the user requesting the delegation

+

Responses

Response samples

Content type
application/json
{
  • "msaId": "string",
  • "delegations": [
    ]
}

Get an MSA's delegation information for a specific provider

path Parameters
msaId
required
string
Example: 3

MSA Id of the user requesting the delegation

+
providerId
string
Example: 1

MSA Id of the provider to whom the requesting user wishes to delegate

+

Responses

Response samples

Content type
application/json
{
  • "msaId": "string",
  • "delegations": [
    ]
}

delegation

Get the delegation information associated with an MSA Id

path Parameters
msaId
required
string
Example: 2

Msa Id of requested account

+

Responses

Response samples

Content type
application/json
{
  • "providerId": "string",
  • "schemaPermissions": { },
  • "revokedAt": { }
}

Get a properly encoded RevokeDelegationPayload that can be signed

path Parameters
accountId
required
string
Example: 1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N

AccountId in hex or SS58 format

+
providerId
required
string
Example: 1

Msa Id of provider

+

Responses

Response samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "providerId": "3",
  • "encodedExtrinsic": "0x1234",
  • "payloadToSign": "0x1234"
}

Request to revoke a delegation

Request Body schema: application/json
required
accountId
required
string

AccountId in hex or SS58 format

+
providerId
required
string

MSA Id of the provider to whom the requesting user wishes to delegate

+
encodedExtrinsic
required
string

Hex-encoded representation of the "revokeDelegation" extrinsic

+
payloadToSign
required
string

payload to be signed

+
signature
required
string

signature of the owner

+

Responses

Request samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "providerId": "3",
  • "encodedExtrinsic": "0x1234",
  • "payloadToSign": "0x1234",
  • "signature": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

Response samples

Content type
application/json
{
  • "referenceId": "string"
}

v1/handles

Request to create a new handle for an account

Request Body schema: application/json
required
accountId
required
string

AccountId in hex or SS58 format

+
required
object (HandlePayloadDto)
proof
required
string

proof is the signature for the payload

+

Responses

Request samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "payload": {
    },
  • "proof": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

Request to change a handle

Request Body schema: application/json
required
accountId
required
string

AccountId in hex or SS58 format

+
required
object (HandlePayloadDto)
proof
required
string

proof is the signature for the payload

+

Responses

Request samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "payload": {
    },
  • "proof": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

Get a properly encoded ClaimHandlePayload that can be signed.

path Parameters
newHandle
required
string >= 3 characters
Example: handle

newHandle in the request

+

Responses

Fetch a handle given an MSA Id

path Parameters
msaId
required
string
Example: 2

Msa Id of requested account

+

Responses

v1/keys

Add new control keys for an MSA Id

Request Body schema: application/json
required
msaOwnerAddress
required
string

msaOwnerAddress representing the target of this request

+
msaOwnerSignature
required
string

msaOwnerSignature is the signature by msa owner

+
newKeyOwnerSignature
required
string

newKeyOwnerSignature is the signature with new key

+
required
object (KeysRequestPayloadDto)

Responses

Request samples

Content type
application/json
{
  • "msaOwnerAddress": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "msaOwnerSignature": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85",
  • "newKeyOwnerSignature": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85",
  • "payload": {
    }
}

Fetch public keys given an MSA Id

path Parameters
msaId
required
string
Example: 2

Msa Id of requested account

+

Responses

Get a properly encoded StatefulStorageItemizedSignaturePayloadV2 that can be signed.

query Parameters
msaId
required
string
Example: msaId=3

MSA Id representing the target of this request

+
newKey
required
string
Example: newKey=0x0ed2f8c714efcac51ca2325cfe95637e5e0b898ae397aa365978b7348a717d0b

New public key to be added to the account (32-byte value in hex format)

+

Responses

Request to add a new public Key

Request Body schema: application/json
required
accountId
required
string

AccountId in hex or SS58 format

+
required
object (ItemizedSignaturePayloadDto)
proof
required
string

proof is the signature for the payload

+

Responses

Request samples

Content type
application/json
{
  • "accountId": "1LSLqpLWXo7A7xuiRdu6AQPnBPNJHoQSu8DBsUYJgsNEJ4N",
  • "payload": {
    },
  • "proof": "0x065d733ca151c9e65b78f2ba77348224d31647e6913c44ad2765c6e8ba06f834dc21d8182447d01c30f84a41d90a8f2e58001d825c6f0d61b0afe89f984eec85"
}

health

Check the health status of the service

Responses

Check the live status of the service

Responses

Check the ready status of the service

Responses

-

Transaction Notification API (1.0.0)

Download OpenAPI specification:Download

Notify transaction

Request Body schema: application/json
required
One of
providerId
required
string
referenceId
required
string
msaId
required
string
"CREATE_HANDLE" (string) or "CHANGE_HANDLE" (string)
handle
required
string

Responses

Request samples

Content type
application/json
Example
{
  • "providerId": "string",
  • "referenceId": "string",
  • "msaId": "string",
  • "transactionType": "CREATE_HANDLE",
  • "handle": "string"
}
+ " fill="currentColor">

Transaction Notification API (1.0.0)

Download OpenAPI specification:Download

Notify transaction

Request Body schema: application/json
required
One of
providerId
required
string
referenceId
required
string
msaId
required
string
"CREATE_HANDLE" (string) or "CHANGE_HANDLE" (string)
handle
required
string

Responses

Request samples

Content type
application/json
Example
{
  • "providerId": "string",
  • "referenceId": "string",
  • "msaId": "string",
  • "transactionType": "CREATE_HANDLE",
  • "handle": "string"
}
-

Content Watcher Service API (1.0)

Download OpenAPI specification:Download

Content Watcher Service API

-

v1/scanner

Reset blockchain scan to a specific block number or offset from the current position

Request Body schema: application/json
required

blockNumber

-
blockNumber
number [ 0 .. 4294967296 ]

The block number to reset the scanner to

-
rewindOffset
number [ 0 .. 4294967296 ]

Number of blocks to rewind the scanner to (from blockNumber if supplied; else from latest block)

-
immediate
boolean

Whether to schedule the new scan immediately or wait for the next scheduled interval

-

Responses

Request samples

Content type
application/json
{
  • "blockNumber": 0,
  • "rewindOffset": 100,
  • "immediate": true
}

Get the current watch options for the blockchain content event scanner

Responses

Response samples

Content type
application/json
{
  • "schemaIds": [
    ],
  • "dsnpIds": [
    ]
}

Set watch options to filter the blockchain content scanner by schemas or MSA Ids

Request Body schema: application/json
required

watchOptions: Filter contents by schemaIds and/or msaIds

-
schemaIds
Array of numbers [ 0 .. 65536 ]

Specific schema ids to watch for

-
dsnpIds
Array of strings

Specific dsnpIds (msa_id) to watch for

-

Responses

Request samples

Content type
application/json
{
  • "schemaIds": [
    ],
  • "dsnpIds": [
    ]
}

Pause the blockchain scanner

Responses

Resume the blockchain content event scanner

query Parameters
immediate
boolean

Immediate: whether to resume scan immediately (true), or wait until next scheduled scan (false)

-

Responses

v1/search

v1/webhooks

Register a webhook to be called when new content is encountered on the chain

Request Body schema: application/json
required

Register a webhook to be called when a new content is encountered

-
url
required
string

Webhook URL

-
announcementTypes
required
Array of strings (AnnouncementTypeName)
Items Enum: "tombstone" "broadcast" "reply" "reaction" "profile" "update"

Responses

Request samples

Content type
application/json
{}

Clear all previously registered webhooks

Responses

Get the list of currently registered webhooks

Responses

Response samples

Content type
application/json
[]

health

Check the health status of the service

Responses

Check the live status of the service

Responses

Check the ready status of the service

Responses

+ " fill="currentColor">

Content Watcher Service API (1.0)

Download OpenAPI specification:Download

Content Watcher Service API

+

v1/scanner

Reset blockchain scan to a specific block number or offset from the current position

Request Body schema: application/json
required

blockNumber

+
blockNumber
number [ 0 .. 4294967296 ]

The block number to reset the scanner to

+
rewindOffset
number [ 0 .. 4294967296 ]

Number of blocks to rewind the scanner to (from blockNumber if supplied; else from latest block)

+
immediate
boolean

Whether to schedule the new scan immediately or wait for the next scheduled interval

+

Responses

Request samples

Content type
application/json
{
  • "blockNumber": 0,
  • "rewindOffset": 100,
  • "immediate": true
}

Get the current watch options for the blockchain content event scanner

Responses

Response samples

Content type
application/json
{
  • "schemaIds": [
    ],
  • "dsnpIds": [
    ]
}

Set watch options to filter the blockchain content scanner by schemas or MSA Ids

Request Body schema: application/json
required

watchOptions: Filter contents by schemaIds and/or msaIds

+
schemaIds
Array of numbers [ 0 .. 65536 ]

Specific schema ids to watch for

+
dsnpIds
Array of strings

Specific dsnpIds (msa_id) to watch for

+

Responses

Request samples

Content type
application/json
{
  • "schemaIds": [
    ],
  • "dsnpIds": [
    ]
}

Pause the blockchain scanner

Responses

Resume the blockchain content event scanner

query Parameters
immediate
boolean

Immediate: whether to resume scan immediately (true), or wait until next scheduled scan (false)

+

Responses

v1/search

v1/webhooks

Register a webhook to be called when new content is encountered on the chain

Request Body schema: application/json
required

Register a webhook to be called when a new content is encountered

+
url
required
string

Webhook URL

+
announcementTypes
required
Array of strings (AnnouncementTypeName)
Items Enum: "tombstone" "broadcast" "reply" "reaction" "profile" "update"

Responses

Request samples

Content type
application/json
{}

Clear all previously registered webhooks

Responses

Get the list of currently registered webhooks

Responses

Response samples

Content type
application/json
[]

health

Check the health status of the service

Responses

Check the live status of the service

Responses

Check the ready status of the service

Responses

-

Content Announcement API (1.0.0)

Download OpenAPI specification:Download

Create a new content announcement

Request Body schema: application/json
required
requestId
string or null

An optional identifier for the request, may be used for tracking or correlation

-
webhookUrl
string or null

An optional webhook URL registered as part of a specific search request

-
schemaId
required
integer

Identifier for the schema being used or referenced

-
blockNumber
required
integer

The block number on the blockchain where this announcement was recorded

-
required
TombstoneAnnouncement (object) or BroadcastAnnouncement (object) or ReplyAnnouncement (object) or ReactionAnnouncement (object) or ProfileAnnouncement (object) or UpdateAnnouncement (object)

Responses

Request samples

Content type
application/json
{
  • "requestId": "string",
  • "webhookUrl": "string",
  • "schemaId": 0,
  • "blockNumber": 0,
  • "announcement": {
    }
}
+ " fill="currentColor">

Content Announcement API (1.0.0)

Download OpenAPI specification:Download

Create a new content announcement

Request Body schema: application/json
required
requestId
string or null

An optional identifier for the request, may be used for tracking or correlation

+
webhookUrl
string or null

An optional webhook URL registered as part of a specific search request

+
schemaId
required
integer

Identifier for the schema being used or referenced

+
blockNumber
required
integer

The block number on the blockchain where this announcement was recorded

+
required
TombstoneAnnouncement (object) or BroadcastAnnouncement (object) or ReplyAnnouncement (object) or ReactionAnnouncement (object) or ProfileAnnouncement (object) or UpdateAnnouncement (object)

Responses

Request samples

Content type
application/json
{
  • "requestId": "string",
  • "webhookUrl": "string",
  • "schemaId": 0,
  • "blockNumber": 0,
  • "announcement": {
    }
}