1. API Request

Quadrata is providing an npm package for all DApps supporting Quadrata Passport technology. The npm package is responsible for collecting user information and sending those information to the issuers directly via an API call.

The overall API payload structure will differ from issuers to issuers as the data collected varies.

It is the responsibility of a passport issuers to have an API that includes at least the following fields:

Request Payload

{
    'account': '',
    'sigAccount': '',
    'chainId': ''

    // Remaining Issuer specific Request Payload
}
FieldDescription

account

Wallet address of the user to verify

sigAccount

Ethereum ECDSA signature of a digest to prove ownership of the wallet account:

chainId

Blockchain Network Id. (ex: 1 for Ethereum Mainnet, 137 for Polygon). See list of chain ID.

sigAccount

const { Signer, Wallet } = require("ethers");


export const signAccount = async (
  signer: typeof Signer
): Promise<typeof DataHexString> => {
  const DIGEST_TO_SIGN = "Welcome to Quadrata! By signing, you agree to the Terms of Service.";
  const sig = await signer.signMessage(DIGEST_TO_SIGN);
  return sig;
};

const signer = new Wallet(ACCOUNT_PRIVATE_KEY);

const account = signer.address;
const sigAccount = await signAccount(signer)

It is the responsibility of the issuers to verify that the sigAccount matches the account.

Signature Verification

const { ethers } = require("ethers"); 

const verifyAccountSig = (account, sigAccount) => {
  const recoveredAddress = ethers.utils.recoverAddress(
    "Welcome to Quadrata! By signing, you agree to the Terms of Service.", 
    sigAccount
  );
  
  return recoveredAddress == account;
}

Last updated