0.0.9 • Published 12 months ago

@holonym-foundation/human-id-sdk v0.0.9

Weekly downloads
-
License
-
Repository
-
Last release
12 months ago

@holonym-foundation/human-id-sdk

A TypeScript SDK for integrating Human ID private verification flows with SBTs into your app.

Installation

npm install @holonym-foundation/human-id-sdk

Quick Start

import { initHumanID } from '@holonym-foundation/human-id-sdk'

// Initialize the SDK. This should be done client-side (e.g., in a useEffect) because it relies on the window object
const humanID = initHumanID()

// Request a KYC SBT
const result = await humanID.requestSBT('kyc')
console.log('SBT recipient:', result?.recipient)

Query SBTs

First, to make SBT queries, you must provide an RPC URL for Optimism.

import { setOptimismRpcUrl } from '@holonym-foundation/human-id-sdk'

setOptimismRpcUrl('YOUR_OPTIMISM_RPC_URL')

Query functions:

import {
  getPhoneSBTByAddress,
  getKycSBTByAddress,
  uncheckedGetMinimalPhoneSBTByAddress,
  uncheckedGetMinimalKycSBTByAddress
} from '@holonym-foundation/human-id-sdk'

const phoneSbt = await getPhoneSBTByAddress(address)
const kycSbt = await getKycSBTByAddress(address)

const minimalPhoneSbt = await uncheckedGetMinimalPhoneSBTByAddress(address)
const minimalKycSbt = await uncheckedGetMinimalKycSBTByAddress(address)