attest Docs

SDK

Installation

Install @attestinfra/sdk 0.2.0 and create a client.

Install #

@attestinfra/sdk version 0.2.0 is a server-side JavaScript client for Node.js 18 or later. It has no runtime dependencies and uses the built-in fetch. It works with both import and require and ships TypeScript definitions.

Install · Shell
npm install @attestinfra/sdk@0.2.0

Create a client #

OptionTypeRequiredDescription
apiKeystringRequiredAn environment API key. The key decides Sandbox or Production.
baseUrlstringOptionalDefaults to https://attestinfra.com.
timeoutnumberOptionalPer-request timeout in milliseconds. Defaults to 10000.

The constructor throws AttestValidationError if apiKey is empty, baseUrl is not a URL, or timeout is not a positive number. It makes no network call.

Example · JavaScript (ES module)
import { Attest } from "@attestinfra/sdk";

const attest = new Attest({ apiKey: process.env.ATTEST_API_KEY });
console.log(attest.baseUrl, attest.timeout);
Example · JavaScript (CommonJS)
const { Attest } = require("@attestinfra/sdk");

const attest = new Attest({ apiKey: process.env.ATTEST_API_KEY });
console.log(attest.baseUrl, attest.timeout);
Output · Console
https://attestinfra.com 10000

Methods #

MethodCallsPage
verify(event)POST /v1/eventsverify()
prepareWitness(event)None until executeprepareWitness()
finalizeWitness(pairId)POST /v1/witness/{pairId}/finalizefinalizeWitness()
resumeWitness(pairId, options)GET, then optionally POST and finalizeRecovery and helpers
getWitness(pairId)GET /v1/witness/{pairId}Recovery and helpers
witnessAssembly(event, options), witnessDelivery(event, options)POST /v1/witnessRecovery and helpers
witness(event, operation)Same as prepareWitness(event).execute(operation)Recovery and helpers