SDK Integration

Use Cases

  • Utilize addresses to gain access to rich profile information

  • Check for Civic Passes - Provides verification properties of addresses such as age check, uniqueness, ID document verification, and KYC.

Use the rich profile information to personalize your user's experience:

Loading the Profile Data

Import the SDK and load a profile as follows:

import { CivicProfile, Profile } from "@civic/profile";

...
// Query a user's profile using a wallet address, did or .sol domain
const profile: Profile = await CivicProfile.get(user);

The profile result will contain the following data:

// The resolved public key
profile.address

// The resolved did
profile.did

// A civic.me profile name, if available
profile.name?.value

// A civic.me profile image, if available
profile.image?.url

// A civic.me profile headline, if available
profile.headline?.value

Getting a list of Civic Passes for a Wallet

This returns a list of Civic passes owned by the profile's keys.

// A Solana Connection is required in order to query for passes. Public devnet used as an example here:
import { Connection, clusterApiUrl } from "@solana/web3.js";
import { CivicProfile, Profile, GatewayToken } from "@civic/profile";

const solanaConnection: Connection =  new Connection(clusterApiUrl("devnet"));
const profile: Profile = await CivicProfile.get(user, { solana: { connection }});

const passes: GatewayToken[] = await profile.getPasses();

By default, multiple pass types are queried. A blockchain RPC call is made for each combination of public key & pass type. The list of pass types to query can be overridden. A pass type is represented by its corresponding Gatekeeper Network address.

const passes: GatewayToken[] = await profile.getPasses(["ni1jXzPTq1yTqo67tUmVgnp22b1qGAAZCtPmHtskqYG"]);

Last updated