Get Certificates

A certificate is a mechanism for one entity (the issuer) to assert specific attributes about another entity (the subject). Each certificate contains:

  • Subject's Public Key — The Keeta account identifier

  • Certified Attributes — Identity data like full name, email, or address

  • Issuer's Digital Signature — Cryptographic proof of authenticity

Keeta extends X.509 certificates to support both public and sensitive attributes. Sensitive attributes use encryption and cryptographic commitments to enable selective disclosure — subjects can prove specific values to third parties without exposing data to others

Get Certificates via the SDK

To fetch certificates tied to any Keeta account address (read-only), create a client with a null signer and pass the target account in the options:

import * as KeetaNet from '@keetanetwork/keetanet-client';

async function main() {
  // Target address
  const publicKeyString = 'keeta_aabg2lkwuy4gvzr44cniihdmwzinfuunqv4qgsuhbq7jpt4qms622tldjbdexwy';
 const account = await KeetaNet.lib.Account.fromPublicKeyString(publicKeyString);
  // Read-only client bound to target account
  const client = KeetaNet.UserClient.fromNetwork(
    'test',
    null,
    { account }
  );

  try {
    // Fetch and sort certificates by issuance date (newest first)
    const response = await client.getCertificates();
    const sorted = response.sort(
      (a, b) => b.certificate.notBefore.valueOf() - a.certificate.notBefore.valueOf()
    );

    console.log(`Found ${sorted.length} certificates for ${account}`);

    // Display basic info for each certificate
    sorted.forEach(({ certificate }) => {
      console.log('Issuer:', certificate.issuerDN);
      console.log('Subject:', certificate.subjectDN);
      console.log('Valid until:', certificate.notAfter.toISOString());
      console.log('—');
    });
  } finally {
    await client.destroy();
  }
}

main().catch(console.error);

Last updated