@provenonce/sdk 0.10.0 → 0.11.0
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 +187 -172
- package/dist/index.d.mts +35 -23
- package/dist/index.d.ts +35 -23
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +43 -43
package/README.md
CHANGED
|
@@ -1,172 +1,187 @@
|
|
|
1
|
-
# @provenonce/sdk
|
|
2
|
-
|
|
3
|
-
Cryptographic identity and accountability SDK for AI agents. Chain-agnostic (Solana + Ethereum).
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @provenonce/sdk
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Registration
|
|
12
|
-
|
|
13
|
-
Before using the SDK, register your agent to get an API key:
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { register } from '@provenonce/sdk';
|
|
17
|
-
|
|
18
|
-
// No-wallet registration (default — identity only)
|
|
19
|
-
const creds = await register('my-agent-v1', {
|
|
20
|
-
registryUrl: 'https://provenonce.io',
|
|
21
|
-
registrationSecret: process.env.REGISTRATION_SECRET, // required in production
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
console.log(creds.hash); // unique agent identity
|
|
25
|
-
console.log(creds.api_key); // use this for BeatAgent
|
|
26
|
-
console.log(creds.secret); // save — shown only once
|
|
27
|
-
|
|
28
|
-
// Solana self-custody wallet (opt-in)
|
|
29
|
-
const withWallet = await register('my-org', {
|
|
30
|
-
registryUrl: 'https://provenonce.io',
|
|
31
|
-
walletModel: 'self-custody',
|
|
32
|
-
});
|
|
33
|
-
// withWallet.wallet.address = Solana address
|
|
34
|
-
// withWallet.wallet.secret_key = SAVE — cannot be recovered
|
|
35
|
-
|
|
36
|
-
// Child registration (requires parent credentials)
|
|
37
|
-
const child = await register('worker-1', {
|
|
38
|
-
registryUrl: 'https://provenonce.io',
|
|
39
|
-
parentHash: creds.hash,
|
|
40
|
-
parentApiKey: creds.api_key,
|
|
41
|
-
});
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Quick Start
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
import { BeatAgent } from '@provenonce/sdk';
|
|
48
|
-
|
|
49
|
-
const agent = new BeatAgent({
|
|
50
|
-
apiKey: 'pvn_...',
|
|
51
|
-
registryUrl: 'https://provenonce.io',
|
|
52
|
-
verbose: true,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
await agent.init(); // Birth in Beat time
|
|
56
|
-
|
|
57
|
-
// Purchase a SIGIL (cryptographic identity)
|
|
58
|
-
const sigil = await agent.purchaseSigil({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
|
84
|
-
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
|
101
|
-
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
|
113
|
-
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
- [
|
|
172
|
-
|
|
1
|
+
# @provenonce/sdk
|
|
2
|
+
|
|
3
|
+
Cryptographic identity and accountability SDK for AI agents. Chain-agnostic (Solana + Ethereum).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @provenonce/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Registration
|
|
12
|
+
|
|
13
|
+
Before using the SDK, register your agent to get an API key:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { register } from '@provenonce/sdk';
|
|
17
|
+
|
|
18
|
+
// No-wallet registration (default — identity only)
|
|
19
|
+
const creds = await register('my-agent-v1', {
|
|
20
|
+
registryUrl: 'https://provenonce.io',
|
|
21
|
+
registrationSecret: process.env.REGISTRATION_SECRET, // required in production
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
console.log(creds.hash); // unique agent identity
|
|
25
|
+
console.log(creds.api_key); // use this for BeatAgent
|
|
26
|
+
console.log(creds.secret); // save — shown only once
|
|
27
|
+
|
|
28
|
+
// Solana self-custody wallet (opt-in)
|
|
29
|
+
const withWallet = await register('my-org', {
|
|
30
|
+
registryUrl: 'https://provenonce.io',
|
|
31
|
+
walletModel: 'self-custody',
|
|
32
|
+
});
|
|
33
|
+
// withWallet.wallet.address = Solana address
|
|
34
|
+
// withWallet.wallet.secret_key = SAVE — cannot be recovered
|
|
35
|
+
|
|
36
|
+
// Child registration (requires parent credentials)
|
|
37
|
+
const child = await register('worker-1', {
|
|
38
|
+
registryUrl: 'https://provenonce.io',
|
|
39
|
+
parentHash: creds.hash,
|
|
40
|
+
parentApiKey: creds.api_key,
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { BeatAgent } from '@provenonce/sdk';
|
|
48
|
+
|
|
49
|
+
const agent = new BeatAgent({
|
|
50
|
+
apiKey: 'pvn_...',
|
|
51
|
+
registryUrl: 'https://provenonce.io',
|
|
52
|
+
verbose: true,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
await agent.init(); // Birth in Beat time
|
|
56
|
+
|
|
57
|
+
// Purchase a SIGIL (cryptographic identity)
|
|
58
|
+
const sigil = await agent.purchaseSigil({
|
|
59
|
+
identity_class: 'autonomous',
|
|
60
|
+
principal: 'my-agent',
|
|
61
|
+
tier: 'ind',
|
|
62
|
+
payment_tx: 'solana-tx-signature...',
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Start heartbeating (paid liveness proofs)
|
|
66
|
+
agent.startHeartbeat();
|
|
67
|
+
|
|
68
|
+
// Get your Passport (latest lineage proof)
|
|
69
|
+
const passport = await agent.getPassport();
|
|
70
|
+
console.log(passport?.identity_class); // 'autonomous'
|
|
71
|
+
console.log(passport?.provenonce_signature); // Ed25519 signed
|
|
72
|
+
|
|
73
|
+
// Verify any proof offline — no API call needed
|
|
74
|
+
const valid = BeatAgent.verifyProofLocally(passport, authorityPubKeyHex);
|
|
75
|
+
|
|
76
|
+
agent.stopHeartbeat();
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## API
|
|
80
|
+
|
|
81
|
+
### `BeatAgent`
|
|
82
|
+
|
|
83
|
+
| Method | Description |
|
|
84
|
+
|--------|-------------|
|
|
85
|
+
| `init()` | Initialize the agent's Beat chain (birth in Logical Time) |
|
|
86
|
+
| `purchaseSigil(opts)` | Purchase a SIGIL identity (required for heartbeating) |
|
|
87
|
+
| `updateMetadata(fields)` | Update mutable SIGIL metadata fields |
|
|
88
|
+
| `heartbeat(paymentTx?, globalAnchor?)` | Submit a paid heartbeat and receive a signed lineage proof |
|
|
89
|
+
| `startHeartbeat()` | Start autonomous heartbeat loop |
|
|
90
|
+
| `stopHeartbeat()` | Stop heartbeat |
|
|
91
|
+
| `getPassport()` | Get latest lineage proof (Passport) |
|
|
92
|
+
| `reissueProof(paymentTx?)` | Reissue proof without extending lineage |
|
|
93
|
+
| `requestSpawn(name?)` | Spawn a child agent (requires accumulated beats) |
|
|
94
|
+
| `getStatus()` | Get full beat status from registry |
|
|
95
|
+
| `getLocalState()` | Get local state (no network call) |
|
|
96
|
+
| `static verifyProofLocally(proof, pubKey)` | Verify a lineage proof offline |
|
|
97
|
+
|
|
98
|
+
### `BeatAgentConfig`
|
|
99
|
+
|
|
100
|
+
| Option | Default | Description |
|
|
101
|
+
|--------|---------|-------------|
|
|
102
|
+
| `apiKey` | *required* | API key from registration (`pvn_...`) |
|
|
103
|
+
| `registryUrl` | *required* | Provenonce registry URL |
|
|
104
|
+
| `heartbeatIntervalSec` | `300` | Seconds between automatic heartbeats |
|
|
105
|
+
| `onHeartbeat` | — | Callback when heartbeat completes |
|
|
106
|
+
| `onError` | — | Callback on error |
|
|
107
|
+
| `onStatusChange` | — | Callback when status changes |
|
|
108
|
+
| `verbose` | `false` | Enable console logging |
|
|
109
|
+
|
|
110
|
+
### `register(name, options)`
|
|
111
|
+
|
|
112
|
+
| Option | Description |
|
|
113
|
+
|--------|-------------|
|
|
114
|
+
| `registryUrl` | Registry URL (required) |
|
|
115
|
+
| `registrationSecret` | Registration gate (mainnet) |
|
|
116
|
+
| `walletModel` | `'self-custody'` or `'operator'` (opt-in wallet) |
|
|
117
|
+
| `walletChain` | `'solana'` or `'ethereum'` |
|
|
118
|
+
| `walletAddress` | Ethereum BYO address |
|
|
119
|
+
| `walletSignFn` | Signing function for BYO wallets |
|
|
120
|
+
| `parentHash` | Parent hash (child registration) |
|
|
121
|
+
| `parentApiKey` | Parent's API key (child registration) |
|
|
122
|
+
|
|
123
|
+
Returns `RegistrationResult` with `hash`, `api_key`, `secret`, `wallet?`.
|
|
124
|
+
|
|
125
|
+
**Note:** Agent names should only contain `[a-zA-Z0-9_\-. ]`. Other characters are stripped by the server before signature verification.
|
|
126
|
+
|
|
127
|
+
### Phase 2 Types
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import type { Passport, LineageProof, IdentityClass, SigilResult, HeartbeatResult } from '@provenonce/sdk';
|
|
131
|
+
|
|
132
|
+
// Passport = LineageProof (type alias)
|
|
133
|
+
// Contains: agent_hash, agent_public_key, identity_class, lineage_chain_hash,
|
|
134
|
+
// provenonce_signature, issued_at, valid_until, etc.
|
|
135
|
+
|
|
136
|
+
// IdentityClass = 'narrow_task' | 'autonomous' | 'orchestrator'
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### `purchaseSigil(opts)` required fields
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
await agent.purchaseSigil({
|
|
143
|
+
identity_class: 'narrow_task' | 'autonomous' | 'orchestrator',
|
|
144
|
+
principal: 'my-agent',
|
|
145
|
+
tier: 'sov' | 'org' | 'ind' | 'eph' | 'sbx',
|
|
146
|
+
payment_tx: 'solana-tx-signature...', // or 'devnet-skip' on devnet
|
|
147
|
+
name: 'optional-display-name'
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Error Handling
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
import { ProvenonceError, AuthError, RateLimitError, FrozenError, ErrorCode } from '@provenonce/sdk';
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
await agent.heartbeat();
|
|
158
|
+
} catch (err) {
|
|
159
|
+
if (err instanceof RateLimitError) {
|
|
160
|
+
console.log(`Retry after ${err.retryAfterMs}ms`);
|
|
161
|
+
} else if (err instanceof FrozenError) {
|
|
162
|
+
console.log('Agent is frozen — heartbeat refused');
|
|
163
|
+
} else if (err instanceof AuthError) {
|
|
164
|
+
console.log('Invalid API key');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Framework Integration Examples
|
|
170
|
+
|
|
171
|
+
Ready-to-run examples for popular agent frameworks are in [`examples/`](./examples/):
|
|
172
|
+
|
|
173
|
+
| Framework | File | What it shows |
|
|
174
|
+
|-----------|------|---------------|
|
|
175
|
+
| **CrewAI** | [`crewai_example.py`](./examples/crewai_example.py) | Register a research crew with parent-child lineage |
|
|
176
|
+
| **AutoGen** | [`autogen_example.py`](./examples/autogen_example.py) | Coder + reviewer agents with post-run provenance audit |
|
|
177
|
+
| **LangGraph** | [`langgraph_example.py`](./examples/langgraph_example.py) | Pipeline nodes with on-chain audit trail |
|
|
178
|
+
| **Any (Node.js)** | [`add-provenonce.ts`](./examples/add-provenonce.ts) | 20-line generic integration |
|
|
179
|
+
|
|
180
|
+
Python examples use the REST API directly — no Python SDK needed. See [`examples/README.md`](./examples/README.md) for details.
|
|
181
|
+
|
|
182
|
+
## Links
|
|
183
|
+
|
|
184
|
+
- [Live prototype](https://provenonce.io)
|
|
185
|
+
- [npm package](https://www.npmjs.com/package/@provenonce/sdk)
|
|
186
|
+
- [API docs](https://provenonce.dev)
|
|
187
|
+
- [Whitepaper](https://provenonce.dev/whitepaper)
|
package/dist/index.d.mts
CHANGED
|
@@ -242,9 +242,42 @@ interface RegistrationResult {
|
|
|
242
242
|
heartbeat?: string;
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
+
/** Options for the register() function */
|
|
246
|
+
interface RegisterOptions {
|
|
247
|
+
registryUrl?: string;
|
|
248
|
+
parentHash?: string;
|
|
249
|
+
parentApiKey?: string;
|
|
250
|
+
registrationSecret?: string;
|
|
251
|
+
/** Single-use registration token from POST /register/token or POST /register/email/verify */
|
|
252
|
+
registrationToken?: string;
|
|
253
|
+
/** Admin-minted invite token */
|
|
254
|
+
registrationInvite?: string;
|
|
255
|
+
/** Hex-encoded 32-byte Ed25519 secret seed (bring-your-own Solana key) */
|
|
256
|
+
walletSecretKey?: string;
|
|
257
|
+
/** Wallet model: 'self-custody' (Model A) or 'operator' (Model B). Must be set explicitly to opt in. */
|
|
258
|
+
walletModel?: 'self-custody' | 'operator';
|
|
259
|
+
/** Wallet chain: 'solana' (default when wallet is used) or 'ethereum' (D-63) */
|
|
260
|
+
walletChain?: 'solana' | 'ethereum';
|
|
261
|
+
/** Wallet address for Ethereum bring-your-own (0x + 40 hex chars) */
|
|
262
|
+
walletAddress?: string;
|
|
263
|
+
/** Async function to sign a message with an Ethereum wallet (EIP-191 personal_sign). Returns 0x-prefixed 65-byte hex sig. */
|
|
264
|
+
walletSignFn?: (message: string) => Promise<string>;
|
|
265
|
+
/** Operator's Solana wallet address (base58). Required when walletModel='operator'. */
|
|
266
|
+
operatorWalletAddress?: string;
|
|
267
|
+
/** Function to sign a message with the operator's Solana wallet. Required when walletModel='operator'. */
|
|
268
|
+
operatorSignFn?: (message: string) => Promise<string>;
|
|
269
|
+
/** Optional agent metadata (arbitrary JSON object, max 4KB). Returned in /verify and /status. */
|
|
270
|
+
metadata?: Record<string, unknown>;
|
|
271
|
+
}
|
|
245
272
|
/**
|
|
246
273
|
* Register a new agent on the Provenonce registry.
|
|
247
274
|
*
|
|
275
|
+
* With registration token (from /register/token or email verification):
|
|
276
|
+
* const creds = await register('my-agent', {
|
|
277
|
+
* registryUrl: '...',
|
|
278
|
+
* registrationToken: '<token-from-email-verify>',
|
|
279
|
+
* });
|
|
280
|
+
*
|
|
248
281
|
* No wallet (default, single-phase):
|
|
249
282
|
* const creds = await register('my-agent', { registryUrl: '...' });
|
|
250
283
|
*
|
|
@@ -285,28 +318,7 @@ interface RegistrationResult {
|
|
|
285
318
|
* parentApiKey: parentCreds.api_key,
|
|
286
319
|
* });
|
|
287
320
|
*/
|
|
288
|
-
declare function register(name: string, options?:
|
|
289
|
-
registryUrl?: string;
|
|
290
|
-
parentHash?: string;
|
|
291
|
-
parentApiKey?: string;
|
|
292
|
-
registrationSecret?: string;
|
|
293
|
-
/** Hex-encoded 32-byte Ed25519 secret seed (bring-your-own Solana key) */
|
|
294
|
-
walletSecretKey?: string;
|
|
295
|
-
/** Wallet model: 'self-custody' (Model A) or 'operator' (Model B). Must be set explicitly to opt in. */
|
|
296
|
-
walletModel?: 'self-custody' | 'operator';
|
|
297
|
-
/** Wallet chain: 'solana' (default when wallet is used) or 'ethereum' (D-63) */
|
|
298
|
-
walletChain?: 'solana' | 'ethereum';
|
|
299
|
-
/** Wallet address for Ethereum bring-your-own (0x + 40 hex chars) */
|
|
300
|
-
walletAddress?: string;
|
|
301
|
-
/** Async function to sign a message with an Ethereum wallet (EIP-191 personal_sign). Returns 0x-prefixed 65-byte hex sig. */
|
|
302
|
-
walletSignFn?: (message: string) => Promise<string>;
|
|
303
|
-
/** Operator's Solana wallet address (base58). Required when walletModel='operator'. */
|
|
304
|
-
operatorWalletAddress?: string;
|
|
305
|
-
/** Function to sign a message with the operator's Solana wallet. Required when walletModel='operator'. */
|
|
306
|
-
operatorSignFn?: (message: string) => Promise<string>;
|
|
307
|
-
/** Optional agent metadata (arbitrary JSON object, max 4KB). Returned in /verify and /status. */
|
|
308
|
-
metadata?: Record<string, unknown>;
|
|
309
|
-
}): Promise<RegistrationResult>;
|
|
321
|
+
declare function register(name: string, options?: RegisterOptions): Promise<RegistrationResult>;
|
|
310
322
|
interface BeatAgentConfig {
|
|
311
323
|
/** API key from registration (pvn_...) */
|
|
312
324
|
apiKey: string;
|
|
@@ -573,4 +585,4 @@ declare class ServerError extends ProvenonceError {
|
|
|
573
585
|
constructor(message: string, statusCode?: number);
|
|
574
586
|
}
|
|
575
587
|
|
|
576
|
-
export { type AgentStatus, AuthError, type Beat, BeatAgent, type BeatAgentConfig, type Capability, type CheckinResult, type ComplianceRegime, ErrorCode, FrozenError, type HeartbeatResult, type IdentityClass, type LineageProof, type MetadataUpdateResult, NetworkError, NotFoundError, type Passport, ProvenonceError, RateLimitError, type RegistrationResult, ServerError, type SigilMutableFields, type SigilProtocol, type SigilPurchaseOptions, type SigilResult, type SigilTier, type SpawnResult, StateError, type Substrate, type SubstrateProvider, ValidationError, type VerificationResult, type WalletInfo, computeBeat, computeBeatsLite, generateWalletKeypair, register };
|
|
588
|
+
export { type AgentStatus, AuthError, type Beat, BeatAgent, type BeatAgentConfig, type Capability, type CheckinResult, type ComplianceRegime, ErrorCode, FrozenError, type HeartbeatResult, type IdentityClass, type LineageProof, type MetadataUpdateResult, NetworkError, NotFoundError, type Passport, ProvenonceError, RateLimitError, type RegisterOptions, type RegistrationResult, ServerError, type SigilMutableFields, type SigilProtocol, type SigilPurchaseOptions, type SigilResult, type SigilTier, type SpawnResult, StateError, type Substrate, type SubstrateProvider, ValidationError, type VerificationResult, type WalletInfo, computeBeat, computeBeatsLite, generateWalletKeypair, register };
|
package/dist/index.d.ts
CHANGED
|
@@ -242,9 +242,42 @@ interface RegistrationResult {
|
|
|
242
242
|
heartbeat?: string;
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
+
/** Options for the register() function */
|
|
246
|
+
interface RegisterOptions {
|
|
247
|
+
registryUrl?: string;
|
|
248
|
+
parentHash?: string;
|
|
249
|
+
parentApiKey?: string;
|
|
250
|
+
registrationSecret?: string;
|
|
251
|
+
/** Single-use registration token from POST /register/token or POST /register/email/verify */
|
|
252
|
+
registrationToken?: string;
|
|
253
|
+
/** Admin-minted invite token */
|
|
254
|
+
registrationInvite?: string;
|
|
255
|
+
/** Hex-encoded 32-byte Ed25519 secret seed (bring-your-own Solana key) */
|
|
256
|
+
walletSecretKey?: string;
|
|
257
|
+
/** Wallet model: 'self-custody' (Model A) or 'operator' (Model B). Must be set explicitly to opt in. */
|
|
258
|
+
walletModel?: 'self-custody' | 'operator';
|
|
259
|
+
/** Wallet chain: 'solana' (default when wallet is used) or 'ethereum' (D-63) */
|
|
260
|
+
walletChain?: 'solana' | 'ethereum';
|
|
261
|
+
/** Wallet address for Ethereum bring-your-own (0x + 40 hex chars) */
|
|
262
|
+
walletAddress?: string;
|
|
263
|
+
/** Async function to sign a message with an Ethereum wallet (EIP-191 personal_sign). Returns 0x-prefixed 65-byte hex sig. */
|
|
264
|
+
walletSignFn?: (message: string) => Promise<string>;
|
|
265
|
+
/** Operator's Solana wallet address (base58). Required when walletModel='operator'. */
|
|
266
|
+
operatorWalletAddress?: string;
|
|
267
|
+
/** Function to sign a message with the operator's Solana wallet. Required when walletModel='operator'. */
|
|
268
|
+
operatorSignFn?: (message: string) => Promise<string>;
|
|
269
|
+
/** Optional agent metadata (arbitrary JSON object, max 4KB). Returned in /verify and /status. */
|
|
270
|
+
metadata?: Record<string, unknown>;
|
|
271
|
+
}
|
|
245
272
|
/**
|
|
246
273
|
* Register a new agent on the Provenonce registry.
|
|
247
274
|
*
|
|
275
|
+
* With registration token (from /register/token or email verification):
|
|
276
|
+
* const creds = await register('my-agent', {
|
|
277
|
+
* registryUrl: '...',
|
|
278
|
+
* registrationToken: '<token-from-email-verify>',
|
|
279
|
+
* });
|
|
280
|
+
*
|
|
248
281
|
* No wallet (default, single-phase):
|
|
249
282
|
* const creds = await register('my-agent', { registryUrl: '...' });
|
|
250
283
|
*
|
|
@@ -285,28 +318,7 @@ interface RegistrationResult {
|
|
|
285
318
|
* parentApiKey: parentCreds.api_key,
|
|
286
319
|
* });
|
|
287
320
|
*/
|
|
288
|
-
declare function register(name: string, options?:
|
|
289
|
-
registryUrl?: string;
|
|
290
|
-
parentHash?: string;
|
|
291
|
-
parentApiKey?: string;
|
|
292
|
-
registrationSecret?: string;
|
|
293
|
-
/** Hex-encoded 32-byte Ed25519 secret seed (bring-your-own Solana key) */
|
|
294
|
-
walletSecretKey?: string;
|
|
295
|
-
/** Wallet model: 'self-custody' (Model A) or 'operator' (Model B). Must be set explicitly to opt in. */
|
|
296
|
-
walletModel?: 'self-custody' | 'operator';
|
|
297
|
-
/** Wallet chain: 'solana' (default when wallet is used) or 'ethereum' (D-63) */
|
|
298
|
-
walletChain?: 'solana' | 'ethereum';
|
|
299
|
-
/** Wallet address for Ethereum bring-your-own (0x + 40 hex chars) */
|
|
300
|
-
walletAddress?: string;
|
|
301
|
-
/** Async function to sign a message with an Ethereum wallet (EIP-191 personal_sign). Returns 0x-prefixed 65-byte hex sig. */
|
|
302
|
-
walletSignFn?: (message: string) => Promise<string>;
|
|
303
|
-
/** Operator's Solana wallet address (base58). Required when walletModel='operator'. */
|
|
304
|
-
operatorWalletAddress?: string;
|
|
305
|
-
/** Function to sign a message with the operator's Solana wallet. Required when walletModel='operator'. */
|
|
306
|
-
operatorSignFn?: (message: string) => Promise<string>;
|
|
307
|
-
/** Optional agent metadata (arbitrary JSON object, max 4KB). Returned in /verify and /status. */
|
|
308
|
-
metadata?: Record<string, unknown>;
|
|
309
|
-
}): Promise<RegistrationResult>;
|
|
321
|
+
declare function register(name: string, options?: RegisterOptions): Promise<RegistrationResult>;
|
|
310
322
|
interface BeatAgentConfig {
|
|
311
323
|
/** API key from registration (pvn_...) */
|
|
312
324
|
apiKey: string;
|
|
@@ -573,4 +585,4 @@ declare class ServerError extends ProvenonceError {
|
|
|
573
585
|
constructor(message: string, statusCode?: number);
|
|
574
586
|
}
|
|
575
587
|
|
|
576
|
-
export { type AgentStatus, AuthError, type Beat, BeatAgent, type BeatAgentConfig, type Capability, type CheckinResult, type ComplianceRegime, ErrorCode, FrozenError, type HeartbeatResult, type IdentityClass, type LineageProof, type MetadataUpdateResult, NetworkError, NotFoundError, type Passport, ProvenonceError, RateLimitError, type RegistrationResult, ServerError, type SigilMutableFields, type SigilProtocol, type SigilPurchaseOptions, type SigilResult, type SigilTier, type SpawnResult, StateError, type Substrate, type SubstrateProvider, ValidationError, type VerificationResult, type WalletInfo, computeBeat, computeBeatsLite, generateWalletKeypair, register };
|
|
588
|
+
export { type AgentStatus, AuthError, type Beat, BeatAgent, type BeatAgentConfig, type Capability, type CheckinResult, type ComplianceRegime, ErrorCode, FrozenError, type HeartbeatResult, type IdentityClass, type LineageProof, type MetadataUpdateResult, NetworkError, NotFoundError, type Passport, ProvenonceError, RateLimitError, type RegisterOptions, type RegistrationResult, ServerError, type SigilMutableFields, type SigilProtocol, type SigilPurchaseOptions, type SigilResult, type SigilTier, type SpawnResult, StateError, type Substrate, type SubstrateProvider, ValidationError, type VerificationResult, type WalletInfo, computeBeat, computeBeatsLite, generateWalletKeypair, register };
|
package/dist/index.js
CHANGED
|
@@ -183,6 +183,12 @@ async function register(name, options) {
|
|
|
183
183
|
if (options?.registrationSecret) {
|
|
184
184
|
headers["x-registration-secret"] = options.registrationSecret;
|
|
185
185
|
}
|
|
186
|
+
if (options?.registrationToken) {
|
|
187
|
+
headers["x-registration-token"] = options.registrationToken;
|
|
188
|
+
}
|
|
189
|
+
if (options?.registrationInvite) {
|
|
190
|
+
headers["x-registration-invite"] = options.registrationInvite;
|
|
191
|
+
}
|
|
186
192
|
if (options?.parentHash) {
|
|
187
193
|
if (options.parentApiKey) {
|
|
188
194
|
headers["Authorization"] = `Bearer ${options.parentApiKey}`;
|