Account Service

The Account Service provides functionalities related to user accounts on the Frequency network. It includes endpoints for managing user authentication, account details, delegation, keys, and handles.

API Reference

Open Direct API Reference Page

Path Table

MethodPathDescription
GET/v1/accounts/siwfGet the Sign In With Frequency configuration
POST/v1/accounts/siwfRequest to Sign In With Frequency
GET/v1/accounts/{msaId}Fetch an account given an MSA Id
GET/v1/accounts/account/{accountId}Fetch an account given an Account Id
GET/v1/accounts/retireMsa/{accountId}Get a retireMsa unsigned, encoded extrinsic payload.
POST/v1/accounts/retireMsaRequest to retire an MSA ID.
GET/v2/delegations/{msaId}Get all delegation information associated with an MSA Id
GET/v2/delegations/{msaId}/{providerId}Get an MSA's delegation information for a specific provider
GET/v1/delegation/{msaId}Get the delegation information associated with an MSA Id
GET/v1/delegation/revokeDelegation/{accountId}/{providerId}Get a properly encoded RevokeDelegationPayload that can be signed
POST/v1/delegation/revokeDelegationRequest to revoke a delegation
POST/v1/handlesRequest to create a new handle for an account
POST/v1/handles/changeRequest to change a handle
GET/v1/handles/change/{newHandle}Get a properly encoded ClaimHandlePayload that can be signed.
GET/v1/handles/{msaId}Fetch a handle given an MSA Id
POST/v1/keys/addAdd new control keys for an MSA Id
GET/v1/keys/{msaId}Fetch public keys given an MSA Id
GET/v1/keys/publicKeyAgreements/getAddKeyPayloadGet a properly encoded StatefulStorageItemizedSignaturePayloadV2 that can be signed.
POST/v1/keys/publicKeyAgreementsRequest to add a new public Key
GET/healthzCheck the health status of the service
GET/livezCheck the live status of the service
GET/readyzCheck the ready status of the service

Reference Table

NamePathDescription
WalletLoginConfigResponseDto#/components/schemas/WalletLoginConfigResponseDto
HandleResponseDto#/components/schemas/HandleResponseDto
AccountResponseDto#/components/schemas/AccountResponseDto
SiwsPayloadDto#/components/schemas/SiwsPayloadDto
ErrorResponseDto#/components/schemas/ErrorResponseDto
SignInResponseDto#/components/schemas/SignInResponseDto
EncodedExtrinsicDto#/components/schemas/EncodedExtrinsicDto
SignUpResponseDto#/components/schemas/SignUpResponseDto
WalletLoginRequestDto#/components/schemas/WalletLoginRequestDto
WalletLoginResponseDto#/components/schemas/WalletLoginResponseDto
RetireMsaPayloadResponseDto#/components/schemas/RetireMsaPayloadResponseDto
RetireMsaRequestDto#/components/schemas/RetireMsaRequestDto
TransactionResponse#/components/schemas/TransactionResponse
SchemaDelegation#/components/schemas/SchemaDelegation
Delegation#/components/schemas/Delegation
DelegationResponseV2#/components/schemas/DelegationResponseV2
DelegationResponse#/components/schemas/DelegationResponse
RevokeDelegationPayloadResponseDto#/components/schemas/RevokeDelegationPayloadResponseDto
RevokeDelegationPayloadRequestDto#/components/schemas/RevokeDelegationPayloadRequestDto
HandlePayloadDto#/components/schemas/HandlePayloadDto
HandleRequestDto#/components/schemas/HandleRequestDto
KeysRequestPayloadDto#/components/schemas/KeysRequestPayloadDto
KeysRequestDto#/components/schemas/KeysRequestDto
ItemizedSignaturePayloadDto#/components/schemas/ItemizedSignaturePayloadDto
AddNewPublicKeyAgreementRequestDto#/components/schemas/AddNewPublicKeyAgreementRequestDto

Path Details


[GET]/v1/accounts/siwf

  • Summary
    Get the Sign In With Frequency configuration

Responses

  • 200 Returned SIWF Configuration data

application/json

{
  providerId: string
  siwfUrl: string
  frequencyRpcUrl: string
}

[POST]/v1/accounts/siwf

  • Summary
    Request to Sign In With Frequency

RequestBody

  • application/json
{
  // The wallet login request information
  signIn?: #/components/schemas/SignInResponseDto
  signUp: {
    extrinsics: {
      pallet: string
      extrinsicName: string
      encodedExtrinsic: string
    }[]
    error: {
      message: string
    }
  }
}

Responses

  • 201 Signed in successfully

application/json

{
  referenceId: string
  msaId?: string
  publicKey?: string
}

[GET]/v1/accounts/{msaId}

  • Summary
    Fetch an account given an MSA Id

Responses

  • 200 Found account

application/json

{
  msaId: string
  handle: {
    base_handle: string
    canonical_base: string
    suffix: number
  }
}

[GET]/v1/accounts/account/{accountId}

  • Summary
    Fetch an account given an Account Id

Responses

  • 200 Found account

application/json

{
  msaId: string
  handle: {
    base_handle: string
    canonical_base: string
    suffix: number
  }
}

[GET]/v1/accounts/retireMsa/{accountId}

  • Summary
    Get a retireMsa unsigned, encoded extrinsic payload.

Responses

  • 200 Created extrinsic

application/json

{
  encodedExtrinsic: string
  payloadToSign: string
  accountId: string
}

[POST]/v1/accounts/retireMsa

  • Summary
    Request to retire an MSA ID.

RequestBody

  • application/json
{
  encodedExtrinsic: string
  payloadToSign: string
  accountId: string
  signature: string
}

Responses

  • 201 Created and queued request to retire an MSA ID

application/json

{
  referenceId: string
}

[GET]/v2/delegations/{msaId}

  • Summary
    Get all delegation information associated with an MSA Id

Responses

  • 200 Found delegation information

application/json

{
  msaId: string
  delegations: {
    providerId: string
    schemaDelegations: {
      schemaId: number
      revokedAtBlock?: number
    }[]
    revokedAtBlock?: number
  }[]
}

[GET]/v2/delegations/{msaId}/{providerId}

  • Summary
    Get an MSA's delegation information for a specific provider

Responses

  • 200 Found delegation information

application/json

{
  msaId: string
  delegations: {
    providerId: string
    schemaDelegations: {
      schemaId: number
      revokedAtBlock?: number
    }[]
    revokedAtBlock?: number
  }[]
}

[GET]/v1/delegation/{msaId}

  • Summary
    Get the delegation information associated with an MSA Id

Responses

  • 200 Found delegation information

application/json

{
  providerId: string
  schemaPermissions: {
  }
  revokedAt: {
  }
}

[GET]/v1/delegation/revokeDelegation/{accountId}/{providerId}

  • Summary
    Get a properly encoded RevokeDelegationPayload that can be signed

Responses

  • 200 Returned an encoded RevokeDelegationPayload for signing

application/json

{
  accountId: string
  providerId: string
  encodedExtrinsic: {
  }
  payloadToSign: {
  }
}

[POST]/v1/delegation/revokeDelegation

  • Summary
    Request to revoke a delegation

RequestBody

  • application/json
{
  accountId: string
  providerId: string
  encodedExtrinsic: {
  }
  payloadToSign: {
  }
  signature: {
  }
}

Responses

  • 201 Created and queued request to revoke a delegation

application/json

{
  referenceId: string
}

[POST]/v1/handles

  • Summary
    Request to create a new handle for an account

RequestBody

  • application/json
{
  accountId: string
  payload: {
    baseHandle: string
    expiration: number
  }
  proof: string
}

Responses

  • 200 Handle creation request enqueued

[POST]/v1/handles/change

  • Summary
    Request to change a handle

RequestBody

  • application/json
{
  accountId: string
  payload: {
    baseHandle: string
    expiration: number
  }
  proof: string
}

Responses

  • 200 Handle change request enqueued

[GET]/v1/handles/change/{newHandle}

  • Summary
    Get a properly encoded ClaimHandlePayload that can be signed.

Responses

  • 200 Returned an encoded ClaimHandlePayload for signing

[GET]/v1/handles/{msaId}

  • Summary
    Fetch a handle given an MSA Id

Responses

  • 200 Found a handle

[POST]/v1/keys/add

  • Summary
    Add new control keys for an MSA Id

RequestBody

  • application/json
{
  msaOwnerAddress: string
  msaOwnerSignature: string
  newKeyOwnerSignature: string
  payload: {
    msaId: string
    expiration: number
    newPublicKey: string
  }
}

Responses

  • 200 Found public keys

[GET]/v1/keys/{msaId}

  • Summary
    Fetch public keys given an MSA Id

Responses

  • 200 Found public keys

[GET]/v1/keys/publicKeyAgreements/getAddKeyPayload

  • Summary
    Get a properly encoded StatefulStorageItemizedSignaturePayloadV2 that can be signed.

Parameters(Query)

msaId: string
newKey: string

Responses

  • 200 Returned an encoded StatefulStorageItemizedSignaturePayloadV2 for signing

[POST]/v1/keys/publicKeyAgreements

  • Summary
    Request to add a new public Key

RequestBody

  • application/json
{
  accountId: string
  payload: {
    schemaId: number
    targetHash: number
    expiration: number
    actions: {
    }[]
  }
  proof: string
}

Responses

  • 200 Add new key request enqueued

[GET]/healthz

  • Summary
    Check the health status of the service

Responses

  • 200 Service is healthy

[GET]/livez

  • Summary
    Check the live status of the service

Responses

  • 200 Service is live

[GET]/readyz

  • Summary
    Check the ready status of the service

Responses

  • 200 Service is ready

References

#/components/schemas/WalletLoginConfigResponseDto

{
  providerId: string
  siwfUrl: string
  frequencyRpcUrl: string
}

#/components/schemas/HandleResponseDto

{
  base_handle: string
  canonical_base: string
  suffix: number
}

#/components/schemas/AccountResponseDto

{
  msaId: string
  handle: {
    base_handle: string
    canonical_base: string
    suffix: number
  }
}

#/components/schemas/SiwsPayloadDto

{
  message: string
  signature: string
}

#/components/schemas/ErrorResponseDto

{
  message: string
}

#/components/schemas/SignInResponseDto

{
  siwsPayload: {
    message: string
    signature: string
  }
  error: {
    message: string
  }
}

#/components/schemas/EncodedExtrinsicDto

{
  pallet: string
  extrinsicName: string
  encodedExtrinsic: string
}

#/components/schemas/SignUpResponseDto

{
  extrinsics: {
    pallet: string
    extrinsicName: string
    encodedExtrinsic: string
  }[]
  error: {
    message: string
  }
}

#/components/schemas/WalletLoginRequestDto

{
  // The wallet login request information
  signIn?: #/components/schemas/SignInResponseDto
  signUp: {
    extrinsics: {
      pallet: string
      extrinsicName: string
      encodedExtrinsic: string
    }[]
    error: {
      message: string
    }
  }
}

#/components/schemas/WalletLoginResponseDto

{
  referenceId: string
  msaId?: string
  publicKey?: string
}

#/components/schemas/RetireMsaPayloadResponseDto

{
  encodedExtrinsic: string
  payloadToSign: string
  accountId: string
}

#/components/schemas/RetireMsaRequestDto

{
  encodedExtrinsic: string
  payloadToSign: string
  accountId: string
  signature: string
}

#/components/schemas/TransactionResponse

{
  referenceId: string
}

#/components/schemas/SchemaDelegation

{
  schemaId: number
  revokedAtBlock?: number
}

#/components/schemas/Delegation

{
  providerId: string
  schemaDelegations: {
    schemaId: number
    revokedAtBlock?: number
  }[]
  revokedAtBlock?: number
}

#/components/schemas/DelegationResponseV2

{
  msaId: string
  delegations: {
    providerId: string
    schemaDelegations: {
      schemaId: number
      revokedAtBlock?: number
    }[]
    revokedAtBlock?: number
  }[]
}

#/components/schemas/DelegationResponse

{
  providerId: string
  schemaPermissions: {
  }
  revokedAt: {
  }
}

#/components/schemas/RevokeDelegationPayloadResponseDto

{
  accountId: string
  providerId: string
  encodedExtrinsic: {
  }
  payloadToSign: {
  }
}

#/components/schemas/RevokeDelegationPayloadRequestDto

{
  accountId: string
  providerId: string
  encodedExtrinsic: {
  }
  payloadToSign: {
  }
  signature: {
  }
}

#/components/schemas/HandlePayloadDto

{
  baseHandle: string
  expiration: number
}

#/components/schemas/HandleRequestDto

{
  accountId: string
  payload: {
    baseHandle: string
    expiration: number
  }
  proof: string
}

#/components/schemas/KeysRequestPayloadDto

{
  msaId: string
  expiration: number
  newPublicKey: string
}

#/components/schemas/KeysRequestDto

{
  msaOwnerAddress: string
  msaOwnerSignature: string
  newKeyOwnerSignature: string
  payload: {
    msaId: string
    expiration: number
    newPublicKey: string
  }
}

#/components/schemas/ItemizedSignaturePayloadDto

{
  schemaId: number
  targetHash: number
  expiration: number
  actions: {
  }[]
}

#/components/schemas/AddNewPublicKeyAgreementRequestDto

{
  accountId: string
  payload: {
    schemaId: number
    targetHash: number
    expiration: number
    actions: {
    }[]
  }
  proof: string
}

Configuration

ℹ️ Feel free to adjust your environment variables to taste. This application recognizes the following environment variables:

NameDescriptionRange/TypeRequired?Default
API_PORTHTTP port that the application listens on1025 - 655353000
BLOCKCHAIN_SCAN_INTERVAL_SECONDSHow many seconds to delay between successive scans of the chain for new content (after end of chain is reached)> 012
CACHE_KEY_PREFIXPrefix to use for Redis cache keysstringaccount:
CAPACITY_LIMITMaximum amount of provider capacity this app is allowed to use (per epoch) type: 'percentage' 'amount' value: number (may be percentage, ie '80', or absolute amount of capacity)JSON (example)Y
FREQUENCY_HTTP_URLBlockchain node address resolvable from the client browserhttp(s): URLY
FREQUENCY_URLBlockchain node addresshttp(s): or ws(s): URLY
HEALTH_CHECK_MAX_RETRIESNumber of /health endpoint failures allowed before marking the provider webhook service down>= 020
HEALTH_CHECK_MAX_RETRY_INTERVAL_SECONDSNumber of seconds to retry provider webhook /health endpoint when failing> 064
HEALTH_CHECK_SUCCESS_THRESHOLDMinimum number of consecutive successful calls to the provider webhook /health endpoint before it is marked up again> 010
PROVIDER_ACCESS_TOKENAn optional bearer token authentication to the provider webhookstring
PROVIDER_ACCOUNT_SEED_PHRASESeed phrase for provider MSA control keystringY
PROVIDER_IDProvider MSA IdintegerY
REDIS_URLConnection URL for RedisURLY
TRUST_UNFINALIZED_BLOCKSWhether to examine blocks that have not been finalized when tracking extrinsic completionbooleanfalse
WEBHOOK_BASE_URLBase URL for provider webhook endpointsURLY
WEBHOOK_FAILURE_THRESHOLDNumber of failures allowed in the provider webhook before the service is marked down> 03
WEBHOOK_RETRY_INTERVAL_SECONDSNumber of seconds between provider webhook retry attempts when failing> 010
GRAPH_ENVIRONMENT_TYPEGraph environment type.Mainnet|TestnetPaseoY
API_TIMEOUT_MSApi timeout limit in milliseconds> 05000
API_BODY_JSON_LIMITApi json body size limit in string (some examples: 100kb or 5mb or etc)string1mb

Best Practices

  • Secure Authentication: Always use secure methods (e.g., JWT tokens) for authentication to protect user data.
  • Validate Inputs: Ensure all input data is validated to prevent injection attacks and other vulnerabilities.
  • Rate Limiting: Implement rate limiting to protect the service from abuse and ensure fair usage.