@truthlocks/sdk
v2.0.1
Published
Official Truthlock JavaScript/TypeScript SDK
Maintainers
Readme
@truthlocks/sdk
Official JavaScript/TypeScript SDK for Truthlocks — cryptographic trust infrastructure for content protection, AI agent identity, and compliance.
Install
npm install @truthlocks/sdkGet Started (Free — 10 Seconds, No Website Needed)
import { TruthlockClient } from '@truthlocks/sdk';
// Register instantly — get an API key without visiting any website
const { apiKey, tenantId } = await TruthlockClient.register({
email: '[email protected]',
source: 'npm',
});
// → apiKey: "tl_test_..." (free tier: 100 attestations/month)
// Start protecting content immediately
const client = new TruthlockClient({ apiKey });
const attestation = await client.attestations.mint({
content_hash: 'sha256:a1b2c3...',
title: 'My Protected Work',
algorithm: 'Ed25519',
});
console.log(`Protected! Verify at: ${attestation.verify_url}`);All Ways to Register (No Website Needed)
# Via this SDK
const result = await TruthlockClient.register({ email: '[email protected]' });
# Via CLI
npx @truthlocks/protect register --email [email protected]
# Via VS Code
# Command Palette → "MAIP: Register Developer"
# Via MCP (Claude/ChatGPT)
# Call tool: truthlocks_register { email: "[email protected]" }
# Via Python
# await TruthlockClient.register("[email protected]")
# Via Go
# truthlocks.Register(ctx, "[email protected]")
# Via cURL
curl -X POST https://sandbox-api.truthlocks.com/v1/developers/register \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","source":"curl"}'Features
- Content Protection — SHA-256 fingerprinting + signed attestations
- Verification — Cryptographic proof validation
- Machine Identity (MAIP) — AI agent registration, trust scores, kill switches
- Action Receipts — Tamper-proof operation logs
- Anti-Fraud — Risk evaluation and decision engine
- 10 Signing Algorithms — Ed25519, ES256, ES384, ES512, RS256, RS384, RS512, PS256, PS384, PS512
Free Tier (No Credit Card)
| Resource | Limit | |----------|-------| | Attestations | 100/month | | Verifications | 1,000/month | | API Keys | 3 | | Algorithms | All 10 |
When you hit limits: TruthlocksUpgradeRequired error with upgradeUrl.
Upgrade at console.truthlocks.com/upgrade
10 Supported Algorithms
| Algorithm | Constant | Use Case |
|-----------|----------|----------|
| Ed25519 | Algorithm.Ed25519 | Default, fastest |
| ES256 | Algorithm.ES256 | Web standard |
| ES384 | Algorithm.ES384 | Government/CNSA |
| ES512 | Algorithm.ES512 | Max ECDSA |
| RS256 | Algorithm.RS256 | Legacy PKI |
| RS384 | Algorithm.RS384 | Higher RSA |
| RS512 | Algorithm.RS512 | Max RSA |
| PS256 | Algorithm.PS256 | Modern RSA (NIST) |
| PS384 | Algorithm.PS384 | Higher PSS |
| PS512 | Algorithm.PS512 | Max PSS |
Links
License
MIT
