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

// The resolved did

// A profile name, if available

// A profile image, if available

// A profile headline, if available

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