Endpoints
List of DeSo Identity iframe API endpoints
Last updated
List of DeSo Identity iframe API endpoints
Last updated
The iframe API supports functionality for both public keys and derived keys. You can determine key type from the login response by checking for derivedPublicKeyBase58Check
.
AccessLevel: 3, 4 (depends on transaction)
The sign message is responsible for signing transaction hexes. If approval is required an application must call the endpoint in the Window API to sign the transaction.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
You will get this response if the transaction was successful signed.
You will get this response if the accessLevel
your user has authorized doesn't match the access level required to sign a transaction.
AccessLevel: 2
Only required if logged in user is using a derived key to sign on behalf of an owner public key.
You will get this response if the request includes a derivedPublicKeyBase58Check
and does not include both ownerPublicKeyBase58Check
and encryptedMessagingKeyRandomness
.
You can request Encrypted MessagingKeyRandomness by calling the messaging-group in the Window API.
You will get this response if the accessLevel
your user has authorized doesn't match the access level required to sign a transaction.
To fix, the user needs to allow at least access level 2.
AccessLevel: 2
The decrypt API is responsible for decrypting messages.
The decrypt API allows you to decrypt multiple messages at once by passing an array of encryptedMessage
objects.
The decrypt
API is intended to be constructed right after calling the /api/v0/get-messages-stateless
backend API endpoint, and so the structure of encryptedMessage
matches the structure of the response from backend.
We recommend tracing through GetMessages()
function in the DeSo Protocol frontend's src/app/backend-api.service.ts
.
Assuming message
is a taken from OrderedContactsWithMessages.Messages
from the backend API response, encryptedMessage
can be constructed as follows:
Another use-case for the decrypt
API is decrypting unlock-able text in NFTs.
To see how this can be done, we recommend tracing through the DecryptUnlockableTexts()
in the DeSo Protocol repository.
You will get this response if the request includes a derivedPublicKeyBase58Check
and does not include both ownerPublicKeyBase58Check
and encryptedMessagingKeyRandomness
.
You will get this response if the accessLevel
your user has authorized doesn't match the access level required to sign a transaction.
To fix, the user needs to allow at least access level 2.
Response contains a decryptedHexes
field which is a map of decrypted messages, indexed by EncryptedHex
from the request.
AccessLevel: 2
The jwt
message creates signed JWT tokens that can be used to verify a user's ownership of a specific public key.
The JWT is only valid for 10 minutes.
JWTs are used in some Backend API endpoints such as /api/v0/upload-image.
The best practice is to request the JWT right before calling these endpoints.
In case you want to validate the JWT token in Go, you could use the code below:
The encrypt API is responsible for encrypting messages. For more details check out
Name | Type | Description |
---|---|---|
As we mentioned in the section, the current messaging protocol is V2
; however, it is still possible to decrypt messages from the V1
scheme.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
recipientPublicKey
string
Public key of the recipient in base58check format.
message
string
Message text that you want to encrypt.
recipientPublicKey
string
Public key of the recipient in base58check format.
message
string
Message text that you want to encrypt.
encryptedMessagingKeyRandomness
string
This value is used in place of the encryptedSeedHex
when encrypting the message.
derivedPublicKeyBase58Check
string
Public key requesting encryption in base58check format.
ownerPublicKeyBase58Check
string
Public key used only for validation.
encryptedMessages
[]encryptedMessage
List of encrypted messages objects.
derivedPublicKeyBase58Check
string
Public key requesting decryption in base58check format.
ownerPublicKeyBase58Check
string
Used to identify which messaging group member entry is used to decrypt group messages.
encryptedMessagingKeyRandomness
string
Required to decrypt the request.
encryptedMessages
[]encryptedMessage
List of encrypted messages objects.
N/A
N/A
No payload.
derivedPublicKeyBase58Check
string
Informs Identity on how to sign the transaction.
transactionHex
string
Hex of the transaction you want to sign.
transactionHex
string
Hex of the transaction you want to sign.
derivedPublicKeyBase58Check
string
Only required if logged in user is using a derived key to sign on behalf of an owner public key.