Certification

BSV certificates are cryptographic attestations that a certifier makes about a subject. Think of them as digital stamps of approval that live in the wallet.

The Certifier Class

Certifier is a standalone class that can issue certificates without needing a full wallet.

Creating a Certifier

import { Certifier } from '@bsv/simple/browser'

// Random key (ephemeral certifier)
const certifier = await Certifier.create()

// Specific key (persistent certifier)
const certifier = await Certifier.create({
  privateKey: 'a1b2c3d4...',
  certificateType: 'Y2VydGlmaWNhdGlvbg==',
  defaultFields: { role: 'member' },
  includeTimestamp: true
})

Configuration

Parameter
Type
Default
Description

privateKey

string

Random

Hex-encoded private key for the certifier

certificateType

string

base64('certification')

Certificate type identifier

defaultFields

Record<string, string>

{ certified: 'true' }

Fields included in every certificate

includeTimestamp

boolean

true

Add timestamp field automatically

Certifier Info

Issuing a Certificate

certify() does two things:

  1. Issues a MasterCertificate signed by the certifier

  2. Acquires the certificate into the subject's wallet

CertificateData

Acquiring from a Remote Server

If the certifier runs on a server, wallets can acquire certificates remotely:

Server Requirements

The server must expose two endpoints:

GET /api/info — Returns certifier metadata:

POST /api/certify — Issues a certificate:

Request body: { "identityKey": "02abc..." }

Response: CertificateData JSON

Listing Certificates

Revoking a Certificate

This removes the certificate from the wallet. For on-chain revocation of Verifiable Credentials, see the Credentials Guide.

Complete Example

Last updated