GraphQL Data Server

Githun Repository: https://github.com/litentry/litentry-juniper-api

Our GraphQL Api sever is designed as bridge between substrate blockchain and app/device. The server framework is juniper based on hyper.

Hyper is a fast, safe HTTP implementation written in and for Rust. Hyper implement all request/response via "async IO" (non-blocking sockets) via the Tokio and Futures crates. Juniper is GraphQL query implementation in Rust, provide most efficient and most flexible query service.

For the interface to substrate part, most of code from substrate code base. Functionalists include get metadata, query storage, send transaction and subscription.

VerifyToken

fn verify_token(token_hash: String, signature: String, raw_data: String)

Any user could verify the token owner by sending the token with its attached info to the data server, data server will proved that if the sender is the token owner. This function will check if the owner of the token is the same as the signer of the transaction.

  • token_hash: The ID of the token
  • signature: The signature of the token information signed by the sender
  • raw_data: The raw data of the message

The message could be generated by the following code.

const dataToBeSigned = `{ownerAccountId}:{tokenHash}:{timeStamp}`;
const signature = sign(seed, dataToBeSigned);

GetTokenInfo

fn get_token_info(token_hash: String)

token_hash: The ID of the token

Get token related information like token owner and the identity which owns the token.