provenance-protocol 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -2
- package/package.json +2 -2
- package/src/index.d.ts +10 -0
- package/src/index.js +20 -21
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# provenance-protocol
|
|
2
2
|
|
|
3
|
-
SDK for querying the [Provenance](https://
|
|
3
|
+
SDK for querying the [Provenance](https://getprovenance.dev) agent identity index.
|
|
4
4
|
|
|
5
5
|
Drop this into any receiving system — marketplace, API, agent orchestrator —
|
|
6
6
|
to verify an AI agent's identity and trust profile before allowing it in.
|
|
@@ -127,8 +127,88 @@ if (result.fallback) {
|
|
|
127
127
|
| `incidents` | number | Number of open incidents |
|
|
128
128
|
| `status` | string | active / suspended / removed |
|
|
129
129
|
| `model` | object | `{ provider, model_id }` if declared |
|
|
130
|
+
| `public_key` | string\|null | Base64 Ed25519 public key, if registered |
|
|
131
|
+
| `identity_verified` | boolean | Cryptographic proof of key ownership confirmed |
|
|
132
|
+
| `ajp_endpoint` | string\|null | AJP job endpoint URL, if the agent accepts delegated jobs |
|
|
130
133
|
| `first_seen` | string | ISO date of first public appearance |
|
|
131
134
|
|
|
132
135
|
---
|
|
133
136
|
|
|
134
|
-
##
|
|
137
|
+
## Registering your own agent
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
import { Provenance } from 'provenance-protocol';
|
|
141
|
+
import { generateProvenanceKeyPair, signChallenge } from 'provenance-protocol/keygen';
|
|
142
|
+
|
|
143
|
+
const provenance = new Provenance();
|
|
144
|
+
|
|
145
|
+
// One-time: generate a keypair
|
|
146
|
+
const { publicKey, privateKey } = generateProvenanceKeyPair();
|
|
147
|
+
// Store privateKey as PROVENANCE_PRIVATE_KEY env var — never commit it
|
|
148
|
+
|
|
149
|
+
// Sign proof of key ownership for registration
|
|
150
|
+
const provenanceId = 'provenance:github:your-org/your-agent';
|
|
151
|
+
const signed_challenge = signChallenge(privateKey, provenanceId, 'REGISTER');
|
|
152
|
+
|
|
153
|
+
await provenance.register({
|
|
154
|
+
id: provenanceId,
|
|
155
|
+
url: 'https://github.com/your-org/your-agent',
|
|
156
|
+
name: 'Your Agent',
|
|
157
|
+
description: 'What it does',
|
|
158
|
+
capabilities: ['read:web', 'write:summaries'],
|
|
159
|
+
constraints: ['no:pii'],
|
|
160
|
+
public_key: publicKey,
|
|
161
|
+
signed_challenge, // proves you control the private key
|
|
162
|
+
});
|
|
163
|
+
// → { created: true, identity_verified: true, confidence: 1.0 }
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Revoking a compromised key
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
import { signRevocation } from 'provenance-protocol/keygen';
|
|
170
|
+
|
|
171
|
+
const signed_challenge = signRevocation(process.env.PROVENANCE_PRIVATE_KEY, provenanceId);
|
|
172
|
+
|
|
173
|
+
await fetch('https://getprovenance.dev/api/agents/revoke', {
|
|
174
|
+
method: 'POST',
|
|
175
|
+
headers: { 'Content-Type': 'application/json' },
|
|
176
|
+
body: JSON.stringify({ provenance_id: provenanceId, signed_challenge }),
|
|
177
|
+
});
|
|
178
|
+
// Then generate a new keypair and re-register
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## CLI
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npx provenance keygen
|
|
187
|
+
npx provenance register --id provenance:github:your-org/your-agent --url https://github.com/...
|
|
188
|
+
npx provenance status provenance:github:alice/my-agent
|
|
189
|
+
npx provenance validate PROVENANCE.yml
|
|
190
|
+
npx provenance revoke --id provenance:github:your-org/your-agent
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Full CLI reference: [getprovenance.dev/docs#cli](https://getprovenance.dev/docs#cli)
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Layers
|
|
198
|
+
|
|
199
|
+
`provenance-protocol` is the identity layer. Protocols that build on it:
|
|
200
|
+
|
|
201
|
+
| Package | Purpose |
|
|
202
|
+
|---|---|
|
|
203
|
+
| `provenance-protocol` | Agent identity, trust, and registration (this package) |
|
|
204
|
+
| [`ajp-protocol`](https://www.npmjs.com/package/ajp-protocol) | Agent Job Protocol — agent-to-agent job delegation |
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Full documentation
|
|
209
|
+
|
|
210
|
+
[getprovenance.dev/docs](https://getprovenance.dev/docs)
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## MIT License — getprovenance.dev
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "provenance-protocol",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "SDK for querying the Provenance agent identity index",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"type": "git",
|
|
30
30
|
"url": "https://github.com/ilucky21c/provenance-protocol"
|
|
31
31
|
},
|
|
32
|
-
"homepage": "https://
|
|
32
|
+
"homepage": "https://getprovenance.dev",
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=14.0.0"
|
|
35
35
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -164,7 +164,17 @@ export interface RegisterProfile {
|
|
|
164
164
|
model_id?: string;
|
|
165
165
|
contact_url?: string;
|
|
166
166
|
ajp_endpoint?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Base64-encoded Ed25519 SPKI DER public key.
|
|
169
|
+
* When provided, signed_challenge is also required.
|
|
170
|
+
*/
|
|
167
171
|
public_key?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Base64 Ed25519 signature of `${provenance_id}:REGISTER` using your private key.
|
|
174
|
+
* Required when public_key is provided — proves you control the key you're registering.
|
|
175
|
+
* Generate with: signChallenge(privateKey, provenanceId, 'REGISTER') from provenance-protocol/keygen
|
|
176
|
+
*/
|
|
177
|
+
signed_challenge?: string;
|
|
168
178
|
version?: string;
|
|
169
179
|
}
|
|
170
180
|
|
package/src/index.js
CHANGED
|
@@ -44,7 +44,7 @@ async function _verifyEd25519(publicKeyBase64, signatureBase64, message) {
|
|
|
44
44
|
return subtle.verify('Ed25519', cryptoKey, sigBuffer, msgBuffer);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const DEFAULT_API = 'https://
|
|
47
|
+
const DEFAULT_API = 'https://getprovenance.dev';
|
|
48
48
|
const DEFAULT_CACHE_TTL = 300; // 5 minutes
|
|
49
49
|
|
|
50
50
|
// Simple LRU cache
|
|
@@ -100,9 +100,10 @@ export class Provenance {
|
|
|
100
100
|
* const trust = await provenance.check('provenance:github:alice/research-assistant');
|
|
101
101
|
* // {
|
|
102
102
|
* // found: true,
|
|
103
|
-
* // declared: true,
|
|
104
|
-
* //
|
|
105
|
-
* //
|
|
103
|
+
* // declared: true, — has PROVENANCE.yml
|
|
104
|
+
* // identity_verified: true, — cryptographic proof of ownership
|
|
105
|
+
* // age_days: 142, — how long this agent has existed publicly
|
|
106
|
+
* // confidence: 0.9, — internal signal, use declared/identity_verified for trust decisions
|
|
106
107
|
* // capabilities: ['read:web', 'write:summaries'],
|
|
107
108
|
* // constraints: ['no:financial:transact', 'no:pii'],
|
|
108
109
|
* // incidents: 0,
|
|
@@ -132,6 +133,7 @@ export class Provenance {
|
|
|
132
133
|
platform: data.platform,
|
|
133
134
|
name: data.name,
|
|
134
135
|
declared: data.declared,
|
|
136
|
+
identity_verified: data.identity_verified || false,
|
|
135
137
|
confidence: data.confidence,
|
|
136
138
|
age_days: data.timestamps?.first_seen
|
|
137
139
|
? Math.floor((Date.now() - new Date(data.timestamps.first_seen)) / 86400000)
|
|
@@ -510,7 +512,6 @@ export class Provenance {
|
|
|
510
512
|
// → github/alice/research-assistant
|
|
511
513
|
return provenanceId.replace('provenance:', '').replace(':', '/');
|
|
512
514
|
}
|
|
513
|
-
}
|
|
514
515
|
|
|
515
516
|
// ── Self-registration ─────────────────────────────────────────────────────
|
|
516
517
|
|
|
@@ -518,30 +519,28 @@ export class Provenance {
|
|
|
518
519
|
* Register or update this agent in the Provenance index.
|
|
519
520
|
* Call once at agent startup — idempotent, safe to call on every boot.
|
|
520
521
|
*
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
* id: 'provenance:github:your-org/your-agent',
|
|
526
|
-
* url: 'https://github.com/your-org/your-agent',
|
|
527
|
-
* name: 'Your Agent',
|
|
528
|
-
* description: 'What it does',
|
|
529
|
-
* capabilities: ['read:web', 'write:summaries'],
|
|
530
|
-
* constraints: ['no:pii', 'no:financial:transact'],
|
|
531
|
-
* });
|
|
522
|
+
* To register with cryptographic proof (identity_verified: true, confidence: 1.0),
|
|
523
|
+
* provide public_key and signed_challenge:
|
|
524
|
+
* import { signChallenge } from 'provenance-protocol/keygen';
|
|
525
|
+
* const signed_challenge = signChallenge(process.env.PROVENANCE_PRIVATE_KEY, id, 'REGISTER');
|
|
532
526
|
*
|
|
533
527
|
* @param {object} profile
|
|
534
|
-
* @param {string} profile.id
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
* @param {string} [profile.
|
|
528
|
+
* @param {string} profile.id provenance:<platform>:<owner>/<name>
|
|
529
|
+
* Platforms: github, huggingface, npm, pypi, clawmarket, custom
|
|
530
|
+
* Use "custom" for private agents without a public repo.
|
|
531
|
+
* @param {string} [profile.url] Canonical URL. Optional for custom platform agents.
|
|
532
|
+
* @param {string} [profile.readme_summary] 2-3 sentence plain-English description shown on profile.
|
|
533
|
+
* For private agents without a README — write it yourself.
|
|
534
|
+
* @param {string} [profile.name] Display name
|
|
535
|
+
* @param {string} [profile.description] One-sentence description
|
|
538
536
|
* @param {string[]} [profile.capabilities]
|
|
539
537
|
* @param {string[]} [profile.constraints]
|
|
540
538
|
* @param {string} [profile.model_provider]
|
|
541
539
|
* @param {string} [profile.model_id]
|
|
542
540
|
* @param {string} [profile.contact_url]
|
|
543
541
|
* @param {string} [profile.ajp_endpoint]
|
|
544
|
-
* @param {string} [profile.public_key]
|
|
542
|
+
* @param {string} [profile.public_key] Ed25519 SPKI DER public key (base64)
|
|
543
|
+
* @param {string} [profile.signed_challenge] Signature of `${id}:REGISTER` — required with public_key
|
|
545
544
|
* @param {string} [profile.version]
|
|
546
545
|
* @returns {{ created: boolean, updated: boolean, agent: object }}
|
|
547
546
|
*/
|