notaryos 1.0.0 → 2.0.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 +97 -52
- package/dist/index.d.mts +136 -59
- package/dist/index.d.ts +136 -59
- package/dist/index.js +272 -60
- package/dist/index.mjs +270 -60
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -31,65 +31,111 @@ const isValid = await verifyReceipt(receiptJson);
|
|
|
31
31
|
// true
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
## API Reference
|
|
35
|
+
|
|
36
|
+
### `NotaryClient`
|
|
37
|
+
|
|
38
|
+
| Method | Auth | Description |
|
|
39
|
+
|--------|------|-------------|
|
|
40
|
+
| `issue(actionType, payload, options?)` | API Key | Issue a signed receipt |
|
|
41
|
+
| `verify(receipt)` | Public | Verify a receipt |
|
|
42
|
+
| `verifyById(receiptId)` | API Key | Verify by receipt ID |
|
|
43
|
+
| `status()` | Public | Service health check |
|
|
44
|
+
| `publicKey()` | Public | Get Ed25519 public key |
|
|
45
|
+
| `me()` | API Key | Authenticated agent info |
|
|
46
|
+
| `lookup(receiptHash)` | Public | Look up receipt by hash |
|
|
47
|
+
| `history(options?)` | Clerk JWT | Paginated receipt history |
|
|
48
|
+
| `provenance(receiptHash)` | Public | Provenance DAG report |
|
|
49
|
+
| `wrap(obj, config?)` | API Key | Auto-receipt wrapping |
|
|
50
|
+
|
|
51
|
+
### `notary.counterfactual.*`
|
|
52
|
+
|
|
53
|
+
| Method | Auth | Description |
|
|
54
|
+
|--------|------|-------------|
|
|
55
|
+
| `issue(options)` | API Key | Issue v1 counterfactual |
|
|
56
|
+
| `get(receiptHash)` | Public | Verify counterfactual |
|
|
57
|
+
| `listByAgent(agentId)` | Public | List agent's counterfactuals |
|
|
58
|
+
| `commit(options)` | API Key | v2 commit phase |
|
|
59
|
+
| `reveal(hash, plaintext)` | API Key | v2 reveal phase |
|
|
60
|
+
| `commitStatus(hash)` | Public | Check commit-reveal status |
|
|
61
|
+
| `corroborate(hash, signals)` | API Key | Counter-sign |
|
|
62
|
+
| `certificate(hash, format?)` | Public | Compliance certificate |
|
|
63
|
+
| `verifyChain(agentId)` | Public | Chain continuity |
|
|
64
|
+
|
|
65
|
+
### Standalone Functions
|
|
66
|
+
|
|
67
|
+
| Function | Description |
|
|
68
|
+
|----------|-------------|
|
|
69
|
+
| `verifyReceipt(receipt, baseUrl?)` | Public verification (returns boolean) |
|
|
70
|
+
| `computeHash(payload)` | SHA-256 matching server-side hashing |
|
|
71
|
+
|
|
72
|
+
### Error Codes
|
|
35
73
|
|
|
36
74
|
```typescript
|
|
37
|
-
import {
|
|
75
|
+
import { NotaryErrorCode } from 'notaryos';
|
|
38
76
|
|
|
39
|
-
|
|
77
|
+
NotaryErrorCode.ERR_RECEIPT_NOT_FOUND // 404
|
|
78
|
+
NotaryErrorCode.ERR_INVALID_API_KEY // 401
|
|
79
|
+
NotaryErrorCode.ERR_RATE_LIMIT_EXCEEDED // 429
|
|
80
|
+
NotaryErrorCode.ERR_CHAIN_BROKEN // 400
|
|
81
|
+
// ... 16 total error codes
|
|
82
|
+
```
|
|
40
83
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
84
|
+
## Auto-Receipting
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
const agent = notary.wrap(myAgent, { mode: 'all', fireAndForget: true });
|
|
88
|
+
await agent.processData(input); // auto-receipted!
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Options: `mode` (`'all'` | `'errors_only'` | `'sample'`), `sampleRate`, `fireAndForget`, `dryRun`.
|
|
48
92
|
|
|
49
|
-
|
|
50
|
-
const result = await notary.verify(receipt);
|
|
51
|
-
console.log(result.valid); // true
|
|
52
|
-
console.log(result.signature_ok); // true
|
|
93
|
+
## Counterfactual Receipts
|
|
53
94
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
95
|
+
```typescript
|
|
96
|
+
// v1: Direct issuance
|
|
97
|
+
const stamp = await notary.counterfactual.issue({
|
|
98
|
+
actionNotTaken: 'delete_user_data',
|
|
99
|
+
capabilityProof: { scope: 'data:delete', granted: true },
|
|
100
|
+
opportunityContext: { user_id: 'u_123' },
|
|
101
|
+
decisionReason: 'GDPR retention period not yet expired',
|
|
102
|
+
});
|
|
57
103
|
|
|
58
|
-
//
|
|
59
|
-
const
|
|
60
|
-
|
|
104
|
+
// v2: Commit-reveal
|
|
105
|
+
const commit = await notary.counterfactual.commit({ ...options });
|
|
106
|
+
const reveal = await notary.counterfactual.reveal(hash, plaintext);
|
|
61
107
|
```
|
|
62
108
|
|
|
63
|
-
##
|
|
109
|
+
## Offline Verification
|
|
64
110
|
|
|
65
|
-
|
|
111
|
+
```typescript
|
|
112
|
+
import { OfflineVerifier } from 'notaryos/offline';
|
|
66
113
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
| `verifyById(receiptId)` | API Key | Verify by receipt ID |
|
|
72
|
-
| `status()` | API Key | Service health check |
|
|
73
|
-
| `publicKey()` | API Key | Get Ed25519 public key |
|
|
74
|
-
| `me()` | API Key | Authenticated agent info |
|
|
114
|
+
const verifier = await OfflineVerifier.fromJWKS();
|
|
115
|
+
const result = await verifier.verify(receipt);
|
|
116
|
+
console.log(result.valid); // true — no API call needed
|
|
117
|
+
```
|
|
75
118
|
|
|
76
|
-
|
|
119
|
+
## Framework Integrations
|
|
77
120
|
|
|
78
|
-
|
|
121
|
+
### Vercel AI SDK
|
|
79
122
|
|
|
80
|
-
|
|
123
|
+
```typescript
|
|
124
|
+
import { notaryMiddleware } from 'notaryos/integrations/vercel-ai';
|
|
125
|
+
```
|
|
81
126
|
|
|
82
|
-
|
|
127
|
+
### LangChain.js
|
|
83
128
|
|
|
84
|
-
|
|
129
|
+
```typescript
|
|
130
|
+
import { NotaryCallbackHandler } from 'notaryos/integrations/langchain';
|
|
131
|
+
const handler = new NotaryCallbackHandler(notary);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### OpenAI Agents
|
|
85
135
|
|
|
86
136
|
```typescript
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
baseUrl: 'https://...', // Default: https://api.agenttownsquare.com
|
|
90
|
-
timeout: 30_000, // Default: 30s
|
|
91
|
-
maxRetries: 2, // Default: 2
|
|
92
|
-
});
|
|
137
|
+
import { notaryToolWrapper } from 'notaryos/integrations/openai-agents';
|
|
138
|
+
const wrappedTool = notaryToolWrapper(notary, myToolFn, 'my_tool');
|
|
93
139
|
```
|
|
94
140
|
|
|
95
141
|
## Error Handling
|
|
@@ -110,18 +156,17 @@ try {
|
|
|
110
156
|
}
|
|
111
157
|
```
|
|
112
158
|
|
|
113
|
-
##
|
|
114
|
-
|
|
115
|
-
1. Sign up at [notaryos.org](https://notaryos.org)
|
|
116
|
-
2. Generate an API key from the dashboard
|
|
117
|
-
3. Keys start with `notary_live_` (production) or `notary_test_` (sandbox)
|
|
118
|
-
|
|
119
|
-
## Links
|
|
159
|
+
## Configuration
|
|
120
160
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
161
|
+
```typescript
|
|
162
|
+
const notary = new NotaryClient({
|
|
163
|
+
apiKey: 'notary_live_xxx', // Required
|
|
164
|
+
baseUrl: 'https://...', // Default: https://api.agenttownsquare.com
|
|
165
|
+
timeout: 30_000, // Default: 30s
|
|
166
|
+
maxRetries: 2, // Default: 2
|
|
167
|
+
});
|
|
168
|
+
```
|
|
124
169
|
|
|
125
170
|
## License
|
|
126
171
|
|
|
127
|
-
|
|
172
|
+
BUSL-1.1
|
package/dist/index.d.mts
CHANGED
|
@@ -17,7 +17,27 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
|
-
declare const SDK_VERSION = "
|
|
20
|
+
declare const SDK_VERSION = "2.0.0";
|
|
21
|
+
/** Standardized error codes mirroring the backend API. */
|
|
22
|
+
declare const NotaryErrorCode: {
|
|
23
|
+
readonly ERR_RECEIPT_NOT_FOUND: "ERR_RECEIPT_NOT_FOUND";
|
|
24
|
+
readonly ERR_INVALID_SIGNATURE: "ERR_INVALID_SIGNATURE";
|
|
25
|
+
readonly ERR_INVALID_STRUCTURE: "ERR_INVALID_STRUCTURE";
|
|
26
|
+
readonly ERR_INVALID_TIMESTAMP: "ERR_INVALID_TIMESTAMP";
|
|
27
|
+
readonly ERR_UNKNOWN_SIGNER: "ERR_UNKNOWN_SIGNER";
|
|
28
|
+
readonly ERR_UNSUPPORTED_ALGORITHM: "ERR_UNSUPPORTED_ALGORITHM";
|
|
29
|
+
readonly ERR_CHAIN_BROKEN: "ERR_CHAIN_BROKEN";
|
|
30
|
+
readonly ERR_CHAIN_MISSING: "ERR_CHAIN_MISSING";
|
|
31
|
+
readonly ERR_PAYLOAD_TOO_LARGE: "ERR_PAYLOAD_TOO_LARGE";
|
|
32
|
+
readonly ERR_RATE_LIMIT_EXCEEDED: "ERR_RATE_LIMIT_EXCEEDED";
|
|
33
|
+
readonly ERR_INVALID_API_KEY: "ERR_INVALID_API_KEY";
|
|
34
|
+
readonly ERR_INSUFFICIENT_SCOPE: "ERR_INSUFFICIENT_SCOPE";
|
|
35
|
+
readonly ERR_VALIDATION_FAILED: "ERR_VALIDATION_FAILED";
|
|
36
|
+
readonly ERR_INTERNAL_ERROR: "ERR_INTERNAL_ERROR";
|
|
37
|
+
readonly ERR_DATABASE_ERROR: "ERR_DATABASE_ERROR";
|
|
38
|
+
readonly ERR_SIGNING_ERROR: "ERR_SIGNING_ERROR";
|
|
39
|
+
};
|
|
40
|
+
type NotaryErrorCodeType = (typeof NotaryErrorCode)[keyof typeof NotaryErrorCode];
|
|
21
41
|
/** Client configuration options. */
|
|
22
42
|
interface NotaryConfig {
|
|
23
43
|
/** Your Notary API key (notary_live_xxx or notary_test_xxx). */
|
|
@@ -95,6 +115,47 @@ interface IssueOptions {
|
|
|
95
115
|
/** Additional metadata. */
|
|
96
116
|
metadata?: Record<string, unknown>;
|
|
97
117
|
}
|
|
118
|
+
/** Paginated history result. */
|
|
119
|
+
interface HistoryResult {
|
|
120
|
+
items: Record<string, unknown>[];
|
|
121
|
+
total: number;
|
|
122
|
+
totalPages: number;
|
|
123
|
+
page: number;
|
|
124
|
+
pageSize: number;
|
|
125
|
+
}
|
|
126
|
+
/** Options for history queries. */
|
|
127
|
+
interface HistoryOptions {
|
|
128
|
+
page?: number;
|
|
129
|
+
pageSize?: number;
|
|
130
|
+
status?: string;
|
|
131
|
+
search?: string;
|
|
132
|
+
startDate?: string;
|
|
133
|
+
endDate?: string;
|
|
134
|
+
clerkToken?: string;
|
|
135
|
+
}
|
|
136
|
+
/** Counterfactual issue options. */
|
|
137
|
+
interface CounterfactualIssueOptions {
|
|
138
|
+
actionNotTaken: string;
|
|
139
|
+
capabilityProof: Record<string, unknown>;
|
|
140
|
+
opportunityContext: Record<string, unknown>;
|
|
141
|
+
decisionReason: string;
|
|
142
|
+
declinationReason?: string;
|
|
143
|
+
provenanceRefs?: string[];
|
|
144
|
+
validityWindowMinutes?: number;
|
|
145
|
+
}
|
|
146
|
+
/** Counterfactual commit options (v2 commit-reveal). */
|
|
147
|
+
interface CounterfactualCommitOptions extends CounterfactualIssueOptions {
|
|
148
|
+
minRevealDelaySeconds?: number;
|
|
149
|
+
maxRevealWindowSeconds?: number;
|
|
150
|
+
}
|
|
151
|
+
/** Auto-receipt configuration. */
|
|
152
|
+
interface AutoReceiptConfig {
|
|
153
|
+
mode?: 'all' | 'errors_only' | 'sample';
|
|
154
|
+
sampleRate?: number;
|
|
155
|
+
fireAndForget?: boolean;
|
|
156
|
+
maxPayloadBytes?: number;
|
|
157
|
+
dryRun?: boolean;
|
|
158
|
+
}
|
|
98
159
|
/** Base error for all NotaryOS SDK errors. */
|
|
99
160
|
declare class NotaryError extends Error {
|
|
100
161
|
code: string;
|
|
@@ -115,6 +176,41 @@ declare class RateLimitError extends NotaryError {
|
|
|
115
176
|
declare class ValidationError extends NotaryError {
|
|
116
177
|
constructor(message: string, details?: Record<string, unknown>);
|
|
117
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Sub-client for counterfactual receipt operations (proof of non-action).
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const stamp = await notary.counterfactual.issue({
|
|
185
|
+
* actionNotTaken: 'delete_user_data',
|
|
186
|
+
* capabilityProof: { scope: 'data:delete', granted: true },
|
|
187
|
+
* opportunityContext: { user_id: 'u_123' },
|
|
188
|
+
* decisionReason: 'GDPR retention period not yet expired',
|
|
189
|
+
* });
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
declare class CounterfactualClient {
|
|
193
|
+
private client;
|
|
194
|
+
constructor(client: NotaryClient);
|
|
195
|
+
/** Issue a v1 counterfactual receipt (proof of non-action). */
|
|
196
|
+
issue(options: CounterfactualIssueOptions): Promise<Record<string, unknown>>;
|
|
197
|
+
/** Retrieve/verify a counterfactual receipt by hash (public). */
|
|
198
|
+
get(receiptHash: string): Promise<Record<string, unknown>>;
|
|
199
|
+
/** List counterfactual receipts for a specific agent (public). */
|
|
200
|
+
listByAgent(agentId: string, limit?: number, offset?: number): Promise<Record<string, unknown>>;
|
|
201
|
+
/** Commit a v2 counterfactual receipt (Phase 1 of commit-reveal). */
|
|
202
|
+
commit(options: CounterfactualCommitOptions): Promise<Record<string, unknown>>;
|
|
203
|
+
/** Reveal a committed counterfactual receipt (Phase 2). */
|
|
204
|
+
reveal(receiptHash: string, decisionReasonPlaintext: string): Promise<Record<string, unknown>>;
|
|
205
|
+
/** Check commit-reveal lifecycle status (public). */
|
|
206
|
+
commitStatus(receiptHash: string): Promise<Record<string, unknown>>;
|
|
207
|
+
/** Counter-sign a counterfactual receipt (corroboration). */
|
|
208
|
+
corroborate(receiptHash: string, signals: string[]): Promise<Record<string, unknown>>;
|
|
209
|
+
/** Generate a compliance certificate for a counterfactual receipt (public). */
|
|
210
|
+
certificate(receiptHash: string, format?: string): Promise<Record<string, unknown>>;
|
|
211
|
+
/** Verify counterfactual chain continuity for an agent (public). */
|
|
212
|
+
verifyChain(agentId: string): Promise<Record<string, unknown>>;
|
|
213
|
+
}
|
|
118
214
|
/**
|
|
119
215
|
* NotaryOS API client.
|
|
120
216
|
*
|
|
@@ -129,8 +225,11 @@ declare class ValidationError extends NotaryError {
|
|
|
129
225
|
* const result = await notary.verify(receipt);
|
|
130
226
|
* console.log(result.valid); // true
|
|
131
227
|
*
|
|
132
|
-
* //
|
|
133
|
-
* const
|
|
228
|
+
* // Counterfactual receipts
|
|
229
|
+
* const stamp = await notary.counterfactual.issue({ ... });
|
|
230
|
+
*
|
|
231
|
+
* // Auto-receipt wrapping
|
|
232
|
+
* const agent = notary.wrap(myAgent, { mode: 'all' });
|
|
134
233
|
* ```
|
|
135
234
|
*/
|
|
136
235
|
declare class NotaryClient {
|
|
@@ -138,10 +237,15 @@ declare class NotaryClient {
|
|
|
138
237
|
private baseUrl;
|
|
139
238
|
private timeout;
|
|
140
239
|
private maxRetries;
|
|
240
|
+
private _counterfactual?;
|
|
141
241
|
static readonly DEFAULT_BASE_URL = "https://api.agenttownsquare.com";
|
|
142
242
|
static readonly DEFAULT_TIMEOUT = 30000;
|
|
143
243
|
constructor(config: NotaryConfig);
|
|
244
|
+
/** Access counterfactual receipt operations (enterprise premium). */
|
|
245
|
+
get counterfactual(): CounterfactualClient;
|
|
144
246
|
private request;
|
|
247
|
+
/** Public GET helper (no API key in headers). */
|
|
248
|
+
private publicGet;
|
|
145
249
|
private sleep;
|
|
146
250
|
/**
|
|
147
251
|
* Issue a signed receipt for an action.
|
|
@@ -150,88 +254,61 @@ declare class NotaryClient {
|
|
|
150
254
|
* @param payload - Action payload to be receipted
|
|
151
255
|
* @param options - Optional chaining and metadata
|
|
152
256
|
* @returns A signed Receipt
|
|
153
|
-
*
|
|
154
|
-
* @example
|
|
155
|
-
* ```typescript
|
|
156
|
-
* const receipt = await notary.issue('transfer', { amount: 100, to: 'agent-b' });
|
|
157
|
-
* console.log(receipt.receipt_id);
|
|
158
|
-
* console.log(receipt.verify_url); // https://...notary/r/abc123
|
|
159
|
-
* ```
|
|
160
257
|
*/
|
|
161
258
|
issue(actionType: string, payload: Record<string, unknown>, options?: IssueOptions): Promise<Receipt>;
|
|
162
|
-
/**
|
|
163
|
-
* Verify a receipt's signature and integrity.
|
|
164
|
-
*
|
|
165
|
-
* @param receipt - Receipt object or raw receipt dict
|
|
166
|
-
* @returns VerificationResult with validity details
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```typescript
|
|
170
|
-
* const result = await notary.verify(receipt);
|
|
171
|
-
* if (result.valid) {
|
|
172
|
-
* console.log('Receipt is authentic');
|
|
173
|
-
* }
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
259
|
+
/** Verify a receipt's signature and integrity. */
|
|
176
260
|
verify(receipt: Receipt | Record<string, unknown>): Promise<VerificationResult>;
|
|
177
261
|
/** Verify a receipt by its ID (server-side lookup). */
|
|
178
262
|
verifyById(receiptId: string): Promise<VerificationResult>;
|
|
179
|
-
/**
|
|
180
|
-
* Get Notary service status.
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```typescript
|
|
184
|
-
* const status = await notary.status();
|
|
185
|
-
* console.log(status.status); // "active"
|
|
186
|
-
* ```
|
|
187
|
-
*/
|
|
263
|
+
/** Get Notary service status. */
|
|
188
264
|
status(): Promise<ServiceStatus>;
|
|
189
265
|
/** Get the public key for offline verification. */
|
|
190
266
|
publicKey(): Promise<PublicKeyInfo>;
|
|
191
267
|
/** Get authenticated agent info. */
|
|
192
268
|
me(): Promise<AgentInfo>;
|
|
269
|
+
/** Look up a receipt by hash (public endpoint). */
|
|
270
|
+
lookup(receiptHash: string): Promise<LookupResult>;
|
|
271
|
+
/**
|
|
272
|
+
* Get paginated receipt history (requires Clerk JWT).
|
|
273
|
+
*
|
|
274
|
+
* @param options - Pagination, filters, and Clerk token
|
|
275
|
+
* @returns Paginated history with items, total, totalPages
|
|
276
|
+
*/
|
|
277
|
+
history(options?: HistoryOptions): Promise<HistoryResult>;
|
|
278
|
+
/**
|
|
279
|
+
* Get the provenance DAG report for a receipt (public).
|
|
280
|
+
*
|
|
281
|
+
* @param receiptHash - The receipt hash to check
|
|
282
|
+
* @returns Provenance report with grounding status, ancestors, paths
|
|
283
|
+
*/
|
|
284
|
+
provenance(receiptHash: string): Promise<Record<string, unknown>>;
|
|
193
285
|
/**
|
|
194
|
-
*
|
|
286
|
+
* Wrap an object so method calls are automatically receipted.
|
|
287
|
+
*
|
|
288
|
+
* Uses ES6 Proxy to intercept method calls. Receipts are issued
|
|
289
|
+
* in the background via fire-and-forget (won't slow down your agent).
|
|
195
290
|
*
|
|
196
|
-
* @param
|
|
197
|
-
* @
|
|
291
|
+
* @param obj - The agent or object to wrap
|
|
292
|
+
* @param config - Optional auto-receipt configuration
|
|
293
|
+
* @returns A proxied version of the object
|
|
198
294
|
*
|
|
199
295
|
* @example
|
|
200
296
|
* ```typescript
|
|
201
|
-
* const
|
|
202
|
-
*
|
|
203
|
-
* console.log('Receipt is valid!');
|
|
204
|
-
* }
|
|
297
|
+
* const agent = notary.wrap(myAgent, { mode: 'all', fireAndForget: true });
|
|
298
|
+
* await agent.processData(input); // auto-receipted!
|
|
205
299
|
* ```
|
|
206
300
|
*/
|
|
207
|
-
|
|
301
|
+
wrap<T extends object>(obj: T, config?: AutoReceiptConfig): T;
|
|
208
302
|
}
|
|
209
303
|
/**
|
|
210
304
|
* Quick receipt verification without API key.
|
|
211
|
-
*
|
|
212
305
|
* Uses the public /verify endpoint — no authentication needed.
|
|
213
|
-
*
|
|
214
|
-
* @param receipt - Receipt JSON object
|
|
215
|
-
* @param baseUrl - API base URL (default: production)
|
|
216
|
-
* @returns true if the receipt is valid
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
* ```typescript
|
|
220
|
-
* import { verifyReceipt } from 'notaryos';
|
|
221
|
-
*
|
|
222
|
-
* const isValid = await verifyReceipt(receiptJson);
|
|
223
|
-
* console.log(isValid); // true
|
|
224
|
-
* ```
|
|
225
306
|
*/
|
|
226
307
|
declare function verifyReceipt(receipt: Record<string, unknown>, baseUrl?: string): Promise<boolean>;
|
|
227
308
|
/**
|
|
228
309
|
* Compute SHA-256 hash of a payload using Web Crypto API.
|
|
229
|
-
*
|
|
230
310
|
* Matches the server-side hashing for independent verification.
|
|
231
|
-
*
|
|
232
|
-
* @param payload - String or JSON-serializable object
|
|
233
|
-
* @returns Hex-encoded SHA-256 digest
|
|
234
311
|
*/
|
|
235
312
|
declare function computeHash(payload: Record<string, unknown> | string): Promise<string>;
|
|
236
313
|
|
|
237
|
-
export { type AgentInfo, AuthenticationError, type IssueOptions, type LookupResult, NotaryClient, type NotaryConfig, NotaryError, type PublicKeyInfo, RateLimitError, type Receipt, SDK_VERSION, type ServiceStatus, ValidationError, type VerificationResult, computeHash, verifyReceipt };
|
|
314
|
+
export { type AgentInfo, AuthenticationError, type AutoReceiptConfig, CounterfactualClient, type CounterfactualCommitOptions, type CounterfactualIssueOptions, type HistoryOptions, type HistoryResult, type IssueOptions, type LookupResult, NotaryClient, type NotaryConfig, NotaryError, NotaryErrorCode, type NotaryErrorCodeType, type PublicKeyInfo, RateLimitError, type Receipt, SDK_VERSION, type ServiceStatus, ValidationError, type VerificationResult, computeHash, verifyReceipt };
|