@sharddog/approve
v0.1.0
Published
ShardDog Approve — on-chain human-in-the-loop approval stamps for AI-generated content
Maintainers
Readme
@sharddog/approve
On-chain human-in-the-loop approval stamps for AI-generated content. Built on ShardDog + NEAR Protocol.
Install
npm install @sharddog/approveQuick Start
import { SharddogApprove } from '@sharddog/approve'
const approve = new SharddogApprove({ apiKey: 'your_api_key' })
// Stamp approval on AI-generated content
const stamp = await approve.stamp({
content: 'The full text of your AI report...',
label: 'Q1 Financial Summary',
reviewer: 'alice.near',
metadata: {
ai_model: 'claude-opus-4',
category: 'report',
}
})
console.log(stamp.verification_url) // https://shard.dog/approve/abc123...
console.log(stamp.status) // 'minted' (on-chain) or 'stamped' (DB only)
// Verify content was approved
const result = await approve.verify('abc123...')
if (result.approved) {
console.log(`Approved by ${result.stamps[0].reviewer} at ${result.stamps[0].timestamp}`)
}
// Get reviewer's history
const history = await approve.history('alice.near')
console.log(`${history.total} approvals`)API
new SharddogApprove(config?)
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| apiKey | string | — | API key for authenticated requests |
| baseUrl | string | https://shard.dog | API base URL |
approve.stamp(options)
Create an approval stamp.
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| content | string | * | Raw content to hash and approve |
| contentHash | string | * | Pre-computed SHA-256 hex hash |
| label | string | ✅ | Human-readable description (max 256 chars) |
| reviewer | string | ✅ | NEAR wallet or email of reviewer |
| metadata | object | — | Optional: ai_model, source_system, category |
* Either content or contentHash is required.
approve.verify(hashOrContent, reviewer?)
Verify if content has been approved. Pass a SHA-256 hash or raw content string.
approve.history(reviewer, options?)
Get approval history for a reviewer.
sha256(text)
Utility to compute SHA-256 hash. Works in browser and Node.js.
Widget
Drop-in web component — no build step required:
<script src="https://shard.dog/approve-widget.js"></script>
<sharddog-approve
api-key="your_key"
content-hash="abc123..."
label="AI Report Review"
reviewer="alice.near"
ai-model="claude-opus-4"
></sharddog-approve>Or with raw content (auto-hashed):
<sharddog-approve
api-key="your_key"
content="The full AI-generated text..."
label="Blog Post Review"
reviewer="bob.near"
></sharddog-approve>Events
document.querySelector('sharddog-approve')
.addEventListener('sharddog:approved', (e) => {
console.log('Stamp created:', e.detail)
})How It Works
- AI generates content (report, code, article)
- Human reviews and clicks "Approve"
- Content is SHA-256 hashed, approval stamp stored in DB + minted on NEAR as an NFT
- Anyone can verify by checking the content hash against the on-chain record
