Create Credential

Creates a new credential that defines an attestation authority

Create Credential

Creates a new credential that defines an attestation authority. This instruction allows users to create credentials that specify who can issue attestations and what types of attestations they can issue.

Parameters

ParameterTypeDescription
payerSignerThe account that will pay for the transaction
credentialPublicKey | PdaThe credential account to create
authoritySignerThe authority who will control the credential
systemProgramPublicKey | PdaThe System Program account (defaults to '11111111111111111111111111111111')
namestringThe name of the credential
signersAddress[]The list of authorized signers who can create attestations

Returns

Returns a TransactionBuilder that can be used to build and send the transaction.

Example

import { getCreateCredentialInstruction } from "sas-lib";

const transaction = getCreateCredentialInstruction({
    payer: payerSigner,
    credential: credentialPublicKey,
    authority: authoritySigner,
    systemProgram: systemProgramPublicKey,
    name: "My Credential",
    signers: [signer1PublicKey, signer2PublicKey]
});

// Send the transaction
await transaction.sendAndConfirm();

Important Notes

  • The payer must be a signer of the transaction
  • The authority must be a signer of the transaction
  • The credential account must be writable
  • This operation requires the System Program for rent exemption calculations
  • The authority will have control over the credential and can:
    • Modify the list of authorized signers
    • Create schemas under this credential
    • Close the credential
  • The authorized signers can:
    • Create attestations under this credential
    • Close attestations they created
  • The name should be descriptive of the credential's purpose
  • The list of signers can be empty initially and modified later
  • The authority can be one of the authorized signers