
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
@hashproof/sdk
Advanced tools
Official JavaScript/TypeScript SDK for the Hashproof Content Provenance API
Published as
@hashproof/sdkon npm. The source directory ispackages/sdk-js(legacy name).
Official JavaScript/TypeScript SDK for the Hashproof Content Provenance API.
Hashproof provides content provenance infrastructure built on the C2PA standard. This SDK wraps the REST API with a type-safe client for storing, resolving, verifying, and signing digital assets.
npm install @hashproof/sdk
# or
pnpm add @hashproof/sdk
# or
yarn add @hashproof/sdk
import { HashproofClient } from '@hashproof/sdk';
import { readFileSync } from 'node:fs';
const client = new HashproofClient({ apiKey: 'hpsk_...' });
// Verify a file's provenance
const file = readFileSync('photo.jpg');
const result = await client.verify(file);
if (result.hasProvenance) {
console.log(`Provenance found via: ${result.source}`);
console.log(`Trust status: ${result.trustStatus}`);
console.log(`Signer: ${result.manifest?.signatureInfo.subject}`);
} else {
console.log('No provenance found for this file.');
}
const client = new HashproofClient({
apiKey: 'hpsk_...', // Required. Your Hashproof API key.
baseUrl: 'https://api.hashproof.ai', // Optional. Defaults to production.
timeout: 30000, // Optional. Request timeout in ms.
});
store(file, options?)Upload a digital asset and extract/store its C2PA manifest. Perceptual fingerprints are computed automatically.
const result = await client.store(fileBuffer, { title: 'Press Photo' });
console.log(result.manifestId);
console.log(result.softBindings); // computed perceptual hashes
Parameters:
| Name | Type | Description |
|---|---|---|
file | Buffer | Blob | The digital asset to store |
options.title | string | Optional human-readable title |
Returns: Promise<StoreResult>
resolve(file) / resolve(fingerprint, algorithm?)Resolve provenance for a file or pre-computed fingerprint. Finds matching manifests via perceptual hashing (soft binding).
// By file upload
const result = await client.resolve(imageBuffer);
// By pre-computed fingerprint (no upload needed)
const result = await client.resolve('a1b2c3d4...', 'phash-dct-64');
for (const match of result.matches) {
console.log(`${match.similarity * 100}% similar — ${match.manifest.title}`);
}
Parameters (file overload):
| Name | Type | Description |
|---|---|---|
file | Buffer | Blob | The file to resolve |
Parameters (fingerprint overload):
| Name | Type | Description |
|---|---|---|
fingerprint | string | Hex-encoded perceptual hash |
algorithm | string | Algorithm name (default: phash-dct-64) |
Returns: Promise<ResolveResult>
verify(file)One-call provenance verification. Checks embedded C2PA manifests, hard binding (hash match), and soft binding (perceptual hash resolution).
const result = await client.verify(imageBuffer);
console.log(result.hasProvenance); // boolean
console.log(result.source); // 'embedded' | 'resolved' | 'none'
console.log(result.trustStatus); // 'trusted' | 'untrusted' | 'unknown'
Parameters:
| Name | Type | Description |
|---|---|---|
file | Buffer | Blob | The file to verify |
Returns: Promise<VerifyResult>
getManifest(id)Retrieve a manifest by its UUID.
const manifest = await client.getManifest('550e8400-...');
Returns: Promise<ManifestData>
getManifestByHash(hash)Retrieve a manifest by its hard binding hash (SHA-256 of the original asset).
const manifest = await client.getManifestByHash('e3b0c44298fc...');
Returns: Promise<ManifestData>
listManifests(options?)List manifests with pagination and search.
const page = await client.listManifests({ page: 1, perPage: 50, search: 'photo' });
console.log(`${page.total} total manifests`);
Parameters:
| Name | Type | Description |
|---|---|---|
options.page | number | Page number (default: 1) |
options.perPage | number | Results per page (default: 20) |
options.search | string | Filter by title |
Returns: Promise<PaginatedResponse<ManifestData>>
sign(file, options?)Sign a digital asset with a C2PA manifest using Hashproof managed signing. Requires the sign scope on your API key.
const result = await client.sign(imageBuffer, { title: 'Press Photo' });
console.log(result.manifestId);
Parameters:
| Name | Type | Description |
|---|---|---|
file | Buffer | Blob | The file to sign |
options.title | string | Optional title |
Returns: Promise<SignResult>
computeFingerprint(file, algorithm?)Compute a perceptual fingerprint without resolving. Useful for offline computation followed by later resolution.
const fp = await client.computeFingerprint(imageBuffer);
console.log(fp.fingerprint); // hex string
console.log(fp.algorithm); // 'phash-dct-64'
// Later, resolve without re-uploading:
const matches = await client.resolve(fp.fingerprint, fp.algorithm);
Parameters:
| Name | Type | Description |
|---|---|---|
file | Buffer | Blob | The file to fingerprint |
algorithm | string | Algorithm (default: phash-dct-64) |
Returns: Promise<FingerprintResult>
All API errors are thrown as HashproofApiError instances:
import { HashproofClient, HashproofApiError } from '@hashproof/sdk';
try {
await client.getManifest('nonexistent');
} catch (err) {
if (err instanceof HashproofApiError) {
console.error(err.message); // "Manifest not found"
console.error(err.statusCode); // 404
console.error(err.code); // "NOT_FOUND"
}
}
All types are exported from the package for full type safety:
import type {
ManifestData,
VerifyResult,
ResolveResult,
ValidationStatus,
PaginatedResponse,
} from '@hashproof/sdk';
fetch)MIT
FAQs
Official JavaScript/TypeScript SDK for the Hashproof Content Provenance API
The npm package @hashproof/sdk receives a total of 3 weekly downloads. As such, @hashproof/sdk popularity was classified as not popular.
We found that @hashproof/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.