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
Method | Path | Description |
---|---|---|
GET | /v1/accounts/siwf | Get the Sign In With Frequency configuration |
POST | /v1/accounts/siwf | Request 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/retireMsa | Request 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/revokeDelegation | Request to revoke a delegation |
POST | /v1/handles | Request to create a new handle for an account |
POST | /v1/handles/change | Request 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/add | Add new control keys for an MSA Id |
GET | /v1/keys/{msaId} | Fetch public keys given an MSA Id |
GET | /v1/keys/publicKeyAgreements/getAddKeyPayload | Get a properly encoded StatefulStorageItemizedSignaturePayloadV2 that can be signed. |
POST | /v1/keys/publicKeyAgreements | Request to add a new public Key |
GET | /healthz | Check the health status of the service |
GET | /livez | Check the live status of the service |
GET | /readyz | Check the ready status of the service |
Reference Table
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:
Name | Description | Range/Type | Required? | Default |
---|---|---|---|---|
API_PORT | HTTP port that the application listens on | 1025 - 65535 | 3000 | |
BLOCKCHAIN_SCAN_INTERVAL_SECONDS | How many seconds to delay between successive scans of the chain for new content (after end of chain is reached) | > 0 | 12 | |
CACHE_KEY_PREFIX | Prefix to use for Redis cache keys | string | account: | |
CAPACITY_LIMIT | Maximum 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_URL | Blockchain node address resolvable from the client browser | http(s): URL | Y | |
FREQUENCY_URL | Blockchain node address | http(s): or ws(s): URL | Y | |
HEALTH_CHECK_MAX_RETRIES | Number of /health endpoint failures allowed before marking the provider webhook service down | >= 0 | 20 | |
HEALTH_CHECK_MAX_RETRY_INTERVAL_SECONDS | Number of seconds to retry provider webhook /health endpoint when failing | > 0 | 64 | |
HEALTH_CHECK_SUCCESS_THRESHOLD | Minimum number of consecutive successful calls to the provider webhook /health endpoint before it is marked up again | > 0 | 10 | |
PROVIDER_ACCESS_TOKEN | An optional bearer token authentication to the provider webhook | string | ||
PROVIDER_ACCOUNT_SEED_PHRASE | Seed phrase for provider MSA control key | string | Y | |
PROVIDER_ID | Provider MSA Id | integer | Y | |
REDIS_URL | Connection URL for Redis | URL | Y | |
TRUST_UNFINALIZED_BLOCKS | Whether to examine blocks that have not been finalized when tracking extrinsic completion | boolean | false | |
WEBHOOK_BASE_URL | Base URL for provider webhook endpoints | URL | Y | |
WEBHOOK_FAILURE_THRESHOLD | Number of failures allowed in the provider webhook before the service is marked down | > 0 | 3 | |
WEBHOOK_RETRY_INTERVAL_SECONDS | Number of seconds between provider webhook retry attempts when failing | > 0 | 10 | |
GRAPH_ENVIRONMENT_TYPE | Graph environment type. | Mainnet|TestnetPaseo | Y | |
API_TIMEOUT_MS | Api timeout limit in milliseconds | > 0 | 5000 | |
API_BODY_JSON_LIMIT | Api json body size limit in string (some examples: 100kb or 5mb or etc) | string | 1mb |
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.