npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@totemsdk/proof-integritas

v0.1.1

Published

Integritas v2 proof provider adapter for @totemsdk/proof — hash stamping, checking, and on-chain verification on Minima

Readme

@totemsdk/proof-integritas

Integritas v2 proof provider adapter for @totemsdk/proof — hash stamping, checking, and on-chain verification on Minima.

Installation

npm install @totemsdk/proof-integritas

Overview

Integritas is a hosted hash-anchoring service that writes SHA3-256 commitment hashes to the Minima blockchain. @totemsdk/proof-integritas wraps the Integritas v2 REST API as a ProofProvider so any @totemsdk/proof consumer can anchor, check, and verify proofs on-chain with a single method call.

What this package does:

  • Stamp, check, and verify arbitrary hex hashes via Integritas
  • Anchor SignedProof objects — computes the canonical createAnchorCommitment hash and stamps it
  • Verify proofs locally (WOTS signature) first, then confirm on-chain via Integritas
  • Map all API responses to structured ProofOperationResult / ProofVerifyResult — never throws on network errors

What this package does not do:

Capabilities

hash:stamp  hash:check  hash:verify
proof:anchor  proof:check  proof:verify
report:pdf  nft:trace  minima:onchain

Quick start

import { createIntegritasProofProvider } from '@totemsdk/proof-integritas';
import { createProof, signProof } from '@totemsdk/proof';

const provider = createIntegritasProofProvider({
  apiKey: process.env.INTEGRITAS_API_KEY,
  baseUrl: 'https://integritas.minima.global/core/v2', // default
});

// Stamp a raw hash
const stamp = await provider.stampHash({ hash: 'deadbeef...' });
console.log(stamp.ok, stamp.data);   // { ok: true, data: { hash, txId, timestamp } }

// Anchor a signed proof (computes createAnchorCommitment internally)
const signed = signProof(createProof({ kind: 'attestation', subject: { id: '...', kind: 'device' }, issuer: 'Mx...' }), seed, 0);
const anchored = await provider.anchorProof(signed);
console.log(anchored.data.anchorRef);  // { provider: 'integritas', hash, txId }

// Verify on-chain (local WOTS check first, then Integritas)
const verified = await provider.verifyProof(signed);
console.log(verified.valid, verified.signerAddress);

All exports

Factory

| Export | Description | |--------|-------------| | createIntegritasProofProvider(config) | Returns an object implementing ProofProvider |

Normalization helpers

| Export | Description | |--------|-------------| | normalizeIntegritasStampResponse(raw) | Map raw stamp API response → ProofOperationResult | | normalizeIntegritasCheckResponse(raw) | Map raw check API response → ProofOperationResult | | normalizeIntegritasVerifyResponse(raw) | Map raw verify API response → ProofVerifyResult |

Hash utilities

| Export | Description | |--------|-------------| | integritasHashFromProof(signed) | Compute the canonical hash to submit to Integritas (createAnchorCommitment) | | integritasAnchorRefFromResponse(response) | Map a successful stamp response to an AnchorRef |

Type reference

IntegritasConfig

interface IntegritasConfig {
  baseUrl?: string;                    // default: 'https://integritas.minima.global/core/v2'
  apiKey?: string;                     // Sent as x-api-key header
  requestIdFactory?: () => string;     // default: crypto.randomUUID
  fetch?: typeof globalThis.fetch;     // Injected fetch — useful for testing
}

Raw API response types

interface IntegritasStampResponse {
  status: string;       // 'ok' | 'error' | …
  hash?: string;
  txId?: string;
  timestamp?: number;   // Unix ms of on-chain confirmation
  message?: string;     // Error description
}

interface IntegritasCheckResponse { /* same shape */ }

interface IntegritasVerifyResponse {
  status: string;       // 'verified' | 'unverified' | 'error' | …
  hash?: string;
  txId?: string;
  timestamp?: number;
  message?: string;
  report?: string;      // PDF report URL (when x-report-required: true)
}

IntegritasCapability

type IntegritasCapability =
  | 'hash:stamp' | 'hash:check' | 'hash:verify'
  | 'proof:anchor' | 'proof:check' | 'proof:verify'
  | 'report:pdf' | 'nft:trace' | 'minima:onchain';

Provider method reference

stampHash({ hash })

POST /timestamp/post — stamps a hex hash. Sets headers x-api-key, x-request-id, Content-Type: application/json.

checkHash({ hash })

POST /file/check — checks whether a hash has already been stamped.

verifyHash({ hash, reportRequired? })

POST /verify/file — verifies on-chain. If reportRequired: true, sets x-report-required: 'true' header and the response will include a PDF report URL.

anchorProof(signed)

Computes createAnchorCommitment(signed), calls stampHash, and if successful attaches an AnchorRef to result.data.anchorRef.

checkProof(signed)

Computes the commitment hash and calls checkHash.

verifyProof(signed, options?)

  1. Runs local WOTS verification via @totemsdk/proof.
  2. If local fails → returns { valid: false } without calling Integritas.
  3. If local passes (or options.skipLocalVerification === true) → calls verifyHash.
  4. Merges results — both must pass for valid: true.

Error handling

All methods catch network errors and return a structured failure instead of throwing:

// Network error
const result = await provider.stampHash({ hash: 'abc' });
// { ok: false, error: 'Network unreachable', providerRef: 'integritas' }

Testing with a mock fetch

Inject config.fetch to avoid real HTTP calls in tests:

const mockFetch = jest.fn().mockResolvedValue({
  json: () => Promise.resolve({ status: 'ok', hash: 'abc', txId: 'tx-1' }),
});

const provider = createIntegritasProofProvider({
  fetch: mockFetch,
  apiKey: 'test-key',
  requestIdFactory: () => 'fixed-request-id',
});

Related packages

License

MIT