Querying Attestations

So now, how can you verify if Alice attested to Bob's signature? We will be using Sign Protocol's Indexing Service to do exactly that!

Querying for an Attestation

You can query for an attestation using our NPM SDK or by making requests to our REST API.

NPM SDK

Our NPM SDK includes an IndexService that you can use to query schemas and attestations.

import { IndexService } from "@ethsign/sp-sdk";

async function queryAttestations() {
  const indexService = new IndexService("testnet");
    
  const attId = `onchain_evm_${chainId}_${attestationId}`;
  const res = await indexService.queryAttestationList({
    schemaId: "onchain_evm_84532_0x34", // Your full schema's ID
    attester: "0x...", // Alice's address
    page: 1,
    mode: "onchain", // Data storage location
    indexingValue: "0x...".toLowerCase(), // Bob's address
  });
  
  return {
    success: true,
    attestations: response.rows,
  };
}

REST API

Alternatively, we will create a helper function that we can reuse to make requests to the Sign Protocol Indexing Service.

Next, we will use this function to query for Alice's attestation of Bob's signature.

Great! So now, we have a list of available attestations that Alice has made, of Bob's signature. If we only need to check for the existence of at least one attestation that matches our criteria, we could stop here. But what if we wanted to validate the message that Alice was attesting? Perhaps there are several different contracts that Alice has notarized for Bob and we are looking for a specific one. When you are ready, move on to the next page where we will parse the attestation data.

Last updated

Was this helpful?