@kynesyslabs/demosdk 2.8.6 → 2.8.8
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/build/tlsnotary/TLSNotaryService.d.ts +187 -0
- package/build/tlsnotary/TLSNotaryService.js +307 -0
- package/build/tlsnotary/TLSNotaryService.js.map +1 -1
- package/build/tlsnotary/auto-init.d.ts +145 -0
- package/build/tlsnotary/auto-init.js +165 -0
- package/build/tlsnotary/auto-init.js.map +1 -0
- package/build/tlsnotary/index.d.ts +2 -1
- package/build/tlsnotary/index.js +7 -1
- package/build/tlsnotary/index.js.map +1 -1
- package/build/websdk/index.d.ts +1 -0
- package/build/websdk/index.js +5 -1
- package/build/websdk/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
39
|
import type { Demos } from "../websdk/demosclass";
|
|
40
|
+
import { TLSNotary } from "./TLSNotary";
|
|
41
|
+
import type { StatusCallback } from "./types";
|
|
40
42
|
/**
|
|
41
43
|
* Response from requestAttestation
|
|
42
44
|
*/
|
|
@@ -100,6 +102,35 @@ export interface StoreProofOptions {
|
|
|
100
102
|
/** Storage location: on-chain or IPFS */
|
|
101
103
|
storage: "onchain" | "ipfs";
|
|
102
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Transaction details for user confirmation
|
|
107
|
+
*/
|
|
108
|
+
export interface TransactionDetails {
|
|
109
|
+
/** The signed transaction object */
|
|
110
|
+
transaction: any;
|
|
111
|
+
/** Transaction hash */
|
|
112
|
+
txHash: string;
|
|
113
|
+
/** Amount in DEM being burned/spent */
|
|
114
|
+
amount: number;
|
|
115
|
+
/** Description of what this transaction does */
|
|
116
|
+
description: string;
|
|
117
|
+
/** Target URL for attestation requests */
|
|
118
|
+
targetUrl?: string;
|
|
119
|
+
/** Token ID for store transactions */
|
|
120
|
+
tokenId?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Callback for user to confirm or reject a transaction
|
|
124
|
+
* Return true to proceed with broadcast, false to cancel
|
|
125
|
+
*/
|
|
126
|
+
export type TransactionConfirmCallback = (details: TransactionDetails) => Promise<boolean>;
|
|
127
|
+
/**
|
|
128
|
+
* Options for methods that require user confirmation
|
|
129
|
+
*/
|
|
130
|
+
export interface WithConfirmationOptions {
|
|
131
|
+
/** Callback for user to confirm or reject the transaction */
|
|
132
|
+
onConfirm: TransactionConfirmCallback;
|
|
133
|
+
}
|
|
103
134
|
/**
|
|
104
135
|
* TLSNotary Service for managing attestation tokens and proof storage
|
|
105
136
|
*/
|
|
@@ -128,6 +159,128 @@ export declare class TLSNotaryService {
|
|
|
128
159
|
* ```
|
|
129
160
|
*/
|
|
130
161
|
requestAttestation(options: RequestAttestationOptions): Promise<AttestationTokenResponse>;
|
|
162
|
+
/**
|
|
163
|
+
* Request an attestation token with user confirmation before broadcasting
|
|
164
|
+
*
|
|
165
|
+
* This method shows the transaction details to the user via the onConfirm callback
|
|
166
|
+
* and only broadcasts if the user confirms. This is the recommended way to request
|
|
167
|
+
* attestation tokens in user-facing applications.
|
|
168
|
+
*
|
|
169
|
+
* @param options - Request options including target URL
|
|
170
|
+
* @param confirmOptions - Options containing the confirmation callback
|
|
171
|
+
* @returns Attestation token response with proxyUrl and tokenId
|
|
172
|
+
* @throws Error if user rejects the transaction
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* const { proxyUrl, tokenId } = await service.requestAttestationWithConfirmation(
|
|
177
|
+
* { targetUrl: 'https://api.github.com/users/octocat' },
|
|
178
|
+
* {
|
|
179
|
+
* onConfirm: async (details) => {
|
|
180
|
+
* // Show confirmation dialog to user
|
|
181
|
+
* return await showConfirmDialog({
|
|
182
|
+
* title: 'Confirm Attestation Request',
|
|
183
|
+
* message: `This will burn ${details.amount} DEM to request attestation for ${details.targetUrl}`,
|
|
184
|
+
* txHash: details.txHash,
|
|
185
|
+
* });
|
|
186
|
+
* }
|
|
187
|
+
* }
|
|
188
|
+
* );
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
requestAttestationWithConfirmation(options: RequestAttestationOptions, confirmOptions: WithConfirmationOptions): Promise<AttestationTokenResponse>;
|
|
192
|
+
/**
|
|
193
|
+
* Request attestation token and create a pre-configured TLSNotary instance
|
|
194
|
+
*
|
|
195
|
+
* This is the recommended way to perform attestations. It handles:
|
|
196
|
+
* 1. Creating and broadcasting the TLSN_REQUEST transaction
|
|
197
|
+
* 2. Waiting for the token to be created
|
|
198
|
+
* 3. Getting the proxy URL
|
|
199
|
+
* 4. Creating a TLSNotary instance configured with that proxy
|
|
200
|
+
* 5. Initializing the WASM module
|
|
201
|
+
*
|
|
202
|
+
* The returned TLSNotary instance is ready to call `attest()` immediately.
|
|
203
|
+
*
|
|
204
|
+
* @param options - Request options including target URL
|
|
205
|
+
* @param onStatus - Optional status callback for progress updates
|
|
206
|
+
* @returns Object with TLSNotary instance, tokenId, and proxyUrl
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* const service = new TLSNotaryService(demos);
|
|
211
|
+
*
|
|
212
|
+
* // Get a ready-to-use TLSNotary instance
|
|
213
|
+
* const { tlsn, tokenId, proxyUrl } = await service.createTLSNotary({
|
|
214
|
+
* targetUrl: 'https://api.github.com/users/octocat'
|
|
215
|
+
* });
|
|
216
|
+
*
|
|
217
|
+
* // Perform attestation - the proxy is already configured!
|
|
218
|
+
* const result = await tlsn.attest({
|
|
219
|
+
* url: 'https://api.github.com/users/octocat',
|
|
220
|
+
* });
|
|
221
|
+
*
|
|
222
|
+
* // Store proof on-chain
|
|
223
|
+
* await service.storeProof(tokenId, JSON.stringify(result.presentation), { storage: 'onchain' });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
createTLSNotary(options: RequestAttestationOptions, onStatus?: StatusCallback): Promise<{
|
|
227
|
+
tlsn: TLSNotary;
|
|
228
|
+
tokenId: string;
|
|
229
|
+
proxyUrl: string;
|
|
230
|
+
expiresAt: number;
|
|
231
|
+
}>;
|
|
232
|
+
/**
|
|
233
|
+
* Request attestation token and create a pre-configured TLSNotary instance
|
|
234
|
+
* WITH user confirmation before broadcasting the transaction.
|
|
235
|
+
*
|
|
236
|
+
* This is the recommended way to perform attestations in user-facing applications.
|
|
237
|
+
* It handles:
|
|
238
|
+
* 1. Creating the TLSN_REQUEST transaction
|
|
239
|
+
* 2. **Asking the user to confirm via the onConfirm callback**
|
|
240
|
+
* 3. Broadcasting the transaction if confirmed
|
|
241
|
+
* 4. Waiting for the token to be created
|
|
242
|
+
* 5. Getting the proxy URL
|
|
243
|
+
* 6. Creating a TLSNotary instance configured with that proxy
|
|
244
|
+
* 7. Initializing the WASM module
|
|
245
|
+
*
|
|
246
|
+
* @param options - Request options including target URL
|
|
247
|
+
* @param confirmOptions - Options containing the confirmation callback
|
|
248
|
+
* @param onStatus - Optional status callback for progress updates
|
|
249
|
+
* @returns Object with TLSNotary instance, tokenId, and proxyUrl
|
|
250
|
+
* @throws Error if user rejects the transaction
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const service = new TLSNotaryService(demos);
|
|
255
|
+
*
|
|
256
|
+
* // Get a ready-to-use TLSNotary instance with user confirmation
|
|
257
|
+
* const { tlsn, tokenId, proxyUrl } = await service.createTLSNotaryWithConfirmation(
|
|
258
|
+
* { targetUrl: 'https://api.github.com/users/octocat' },
|
|
259
|
+
* {
|
|
260
|
+
* onConfirm: async (details) => {
|
|
261
|
+
* // Show confirmation dialog to user in your UI
|
|
262
|
+
* return await showConfirmDialog({
|
|
263
|
+
* title: 'Confirm Attestation',
|
|
264
|
+
* message: `Burn ${details.amount} DEM for attestation?`,
|
|
265
|
+
* txHash: details.txHash,
|
|
266
|
+
* });
|
|
267
|
+
* }
|
|
268
|
+
* },
|
|
269
|
+
* (status) => console.log(status)
|
|
270
|
+
* );
|
|
271
|
+
*
|
|
272
|
+
* // Perform attestation - the proxy is already configured!
|
|
273
|
+
* const result = await tlsn.attest({
|
|
274
|
+
* url: 'https://api.github.com/users/octocat',
|
|
275
|
+
* });
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
createTLSNotaryWithConfirmation(options: RequestAttestationOptions, confirmOptions: WithConfirmationOptions, onStatus?: StatusCallback): Promise<{
|
|
279
|
+
tlsn: TLSNotary;
|
|
280
|
+
tokenId: string;
|
|
281
|
+
proxyUrl: string;
|
|
282
|
+
expiresAt: number;
|
|
283
|
+
}>;
|
|
131
284
|
/**
|
|
132
285
|
* Store a TLSNotary proof on-chain or IPFS
|
|
133
286
|
*
|
|
@@ -151,6 +304,40 @@ export declare class TLSNotaryService {
|
|
|
151
304
|
* ```
|
|
152
305
|
*/
|
|
153
306
|
storeProof(tokenId: string, proof: string, options: StoreProofOptions): Promise<StoreProofResponse>;
|
|
307
|
+
/**
|
|
308
|
+
* Store a TLSNotary proof on-chain or IPFS with user confirmation
|
|
309
|
+
*
|
|
310
|
+
* This method shows the transaction details to the user via the onConfirm callback
|
|
311
|
+
* and only broadcasts if the user confirms. This is the recommended way to store
|
|
312
|
+
* proofs in user-facing applications.
|
|
313
|
+
*
|
|
314
|
+
* @param tokenId - The attestation token ID
|
|
315
|
+
* @param proof - The proof data (JSON string or serialized presentation)
|
|
316
|
+
* @param options - Storage options (on-chain or IPFS)
|
|
317
|
+
* @param confirmOptions - Options containing the confirmation callback
|
|
318
|
+
* @returns Storage response with transaction hash and fee
|
|
319
|
+
* @throws Error if user rejects the transaction
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```typescript
|
|
323
|
+
* const { txHash, storageFee } = await service.storeProofWithConfirmation(
|
|
324
|
+
* tokenId,
|
|
325
|
+
* JSON.stringify(presentation),
|
|
326
|
+
* { storage: 'onchain' },
|
|
327
|
+
* {
|
|
328
|
+
* onConfirm: async (details) => {
|
|
329
|
+
* // Show confirmation dialog to user
|
|
330
|
+
* return await showConfirmDialog({
|
|
331
|
+
* title: 'Confirm Proof Storage',
|
|
332
|
+
* message: `This will burn ${details.amount} DEM to store the proof on-chain`,
|
|
333
|
+
* txHash: details.txHash,
|
|
334
|
+
* });
|
|
335
|
+
* }
|
|
336
|
+
* }
|
|
337
|
+
* );
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
storeProofWithConfirmation(tokenId: string, proof: string, options: StoreProofOptions, confirmOptions: WithConfirmationOptions): Promise<StoreProofResponse>;
|
|
154
341
|
/**
|
|
155
342
|
* Calculate the storage fee for a proof
|
|
156
343
|
*
|
|
@@ -41,6 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
41
41
|
exports.TLSNotaryService = void 0;
|
|
42
42
|
const DemosTransactions_1 = require("../websdk/DemosTransactions");
|
|
43
43
|
const unifiedCrypto_1 = require("../encryption/unifiedCrypto");
|
|
44
|
+
const TLSNotary_1 = require("./TLSNotary");
|
|
44
45
|
/**
|
|
45
46
|
* TLSNotary Service for managing attestation tokens and proof storage
|
|
46
47
|
*/
|
|
@@ -131,6 +132,246 @@ class TLSNotaryService {
|
|
|
131
132
|
retriesLeft: proxyResponse.retriesLeft ?? 3,
|
|
132
133
|
};
|
|
133
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Request an attestation token with user confirmation before broadcasting
|
|
137
|
+
*
|
|
138
|
+
* This method shows the transaction details to the user via the onConfirm callback
|
|
139
|
+
* and only broadcasts if the user confirms. This is the recommended way to request
|
|
140
|
+
* attestation tokens in user-facing applications.
|
|
141
|
+
*
|
|
142
|
+
* @param options - Request options including target URL
|
|
143
|
+
* @param confirmOptions - Options containing the confirmation callback
|
|
144
|
+
* @returns Attestation token response with proxyUrl and tokenId
|
|
145
|
+
* @throws Error if user rejects the transaction
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const { proxyUrl, tokenId } = await service.requestAttestationWithConfirmation(
|
|
150
|
+
* { targetUrl: 'https://api.github.com/users/octocat' },
|
|
151
|
+
* {
|
|
152
|
+
* onConfirm: async (details) => {
|
|
153
|
+
* // Show confirmation dialog to user
|
|
154
|
+
* return await showConfirmDialog({
|
|
155
|
+
* title: 'Confirm Attestation Request',
|
|
156
|
+
* message: `This will burn ${details.amount} DEM to request attestation for ${details.targetUrl}`,
|
|
157
|
+
* txHash: details.txHash,
|
|
158
|
+
* });
|
|
159
|
+
* }
|
|
160
|
+
* }
|
|
161
|
+
* );
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
async requestAttestationWithConfirmation(options, confirmOptions) {
|
|
165
|
+
const { targetUrl } = options;
|
|
166
|
+
const { onConfirm } = confirmOptions;
|
|
167
|
+
// Validate URL is HTTPS
|
|
168
|
+
const url = new URL(targetUrl);
|
|
169
|
+
if (url.protocol !== "https:") {
|
|
170
|
+
throw new Error("Only HTTPS URLs are supported for TLS attestation");
|
|
171
|
+
}
|
|
172
|
+
// 1. Create the transaction (but don't broadcast yet)
|
|
173
|
+
const tx = await this.createTlsnRequestTransaction(targetUrl);
|
|
174
|
+
// 2. Get confirmation from user
|
|
175
|
+
const details = {
|
|
176
|
+
transaction: tx,
|
|
177
|
+
txHash: tx.hash,
|
|
178
|
+
amount: 1,
|
|
179
|
+
description: "TLSNotary attestation request (burns 1 DEM)",
|
|
180
|
+
targetUrl,
|
|
181
|
+
};
|
|
182
|
+
const confirmed = await onConfirm(details);
|
|
183
|
+
if (!confirmed) {
|
|
184
|
+
throw new Error("Transaction rejected by user");
|
|
185
|
+
}
|
|
186
|
+
// 3. Now confirm and broadcast the transaction
|
|
187
|
+
const confirmResult = await DemosTransactions_1.DemosTransactions.confirm(tx, this.demos);
|
|
188
|
+
const broadcastResult = await DemosTransactions_1.DemosTransactions.broadcast(confirmResult, this.demos);
|
|
189
|
+
if (broadcastResult.result !== 200) {
|
|
190
|
+
throw new Error(`Failed to submit attestation request: ${broadcastResult.response?.message || "Unknown error"}`);
|
|
191
|
+
}
|
|
192
|
+
// 4. Wait for token to be created by polling with txHash
|
|
193
|
+
const txHash = tx.hash;
|
|
194
|
+
let tokenId;
|
|
195
|
+
const maxAttempts = 30;
|
|
196
|
+
const pollInterval = 1000;
|
|
197
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
198
|
+
const tokenResponse = await this.demos.nodeCall("tlsnotary.getToken", {
|
|
199
|
+
txHash,
|
|
200
|
+
});
|
|
201
|
+
if (tokenResponse?.token?.id) {
|
|
202
|
+
tokenId = tokenResponse.token.id;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
if (attempt < maxAttempts - 1) {
|
|
206
|
+
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (!tokenId) {
|
|
210
|
+
throw new Error(`Token not created after ${maxAttempts} seconds. Transaction may still be pending in mempool. txHash: ${txHash}`);
|
|
211
|
+
}
|
|
212
|
+
// 5. Get owner address
|
|
213
|
+
const { publicKey } = await this.demos.crypto.getIdentity("ed25519");
|
|
214
|
+
const owner = (0, unifiedCrypto_1.uint8ArrayToHex)(publicKey);
|
|
215
|
+
// 6. Call nodeCall to get proxy URL using the actual tokenId
|
|
216
|
+
const proxyResponse = (await this.demos.nodeCall("requestTLSNproxy", {
|
|
217
|
+
tokenId,
|
|
218
|
+
owner,
|
|
219
|
+
targetUrl,
|
|
220
|
+
}));
|
|
221
|
+
if (!proxyResponse || !proxyResponse.websocketProxyUrl) {
|
|
222
|
+
throw new Error("Failed to get proxy URL from node");
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
proxyUrl: proxyResponse.websocketProxyUrl,
|
|
226
|
+
tokenId,
|
|
227
|
+
expiresAt: Date.now() + (proxyResponse.expiresIn || 30000),
|
|
228
|
+
retriesLeft: proxyResponse.retriesLeft ?? 3,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Request attestation token and create a pre-configured TLSNotary instance
|
|
233
|
+
*
|
|
234
|
+
* This is the recommended way to perform attestations. It handles:
|
|
235
|
+
* 1. Creating and broadcasting the TLSN_REQUEST transaction
|
|
236
|
+
* 2. Waiting for the token to be created
|
|
237
|
+
* 3. Getting the proxy URL
|
|
238
|
+
* 4. Creating a TLSNotary instance configured with that proxy
|
|
239
|
+
* 5. Initializing the WASM module
|
|
240
|
+
*
|
|
241
|
+
* The returned TLSNotary instance is ready to call `attest()` immediately.
|
|
242
|
+
*
|
|
243
|
+
* @param options - Request options including target URL
|
|
244
|
+
* @param onStatus - Optional status callback for progress updates
|
|
245
|
+
* @returns Object with TLSNotary instance, tokenId, and proxyUrl
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* const service = new TLSNotaryService(demos);
|
|
250
|
+
*
|
|
251
|
+
* // Get a ready-to-use TLSNotary instance
|
|
252
|
+
* const { tlsn, tokenId, proxyUrl } = await service.createTLSNotary({
|
|
253
|
+
* targetUrl: 'https://api.github.com/users/octocat'
|
|
254
|
+
* });
|
|
255
|
+
*
|
|
256
|
+
* // Perform attestation - the proxy is already configured!
|
|
257
|
+
* const result = await tlsn.attest({
|
|
258
|
+
* url: 'https://api.github.com/users/octocat',
|
|
259
|
+
* });
|
|
260
|
+
*
|
|
261
|
+
* // Store proof on-chain
|
|
262
|
+
* await service.storeProof(tokenId, JSON.stringify(result.presentation), { storage: 'onchain' });
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
async createTLSNotary(options, onStatus) {
|
|
266
|
+
const status = onStatus || (() => { });
|
|
267
|
+
// Step 1: Request attestation token and get proxy URL
|
|
268
|
+
status("Requesting attestation token...");
|
|
269
|
+
const tokenResponse = await this.requestAttestation(options);
|
|
270
|
+
status(`Token obtained: ${tokenResponse.tokenId}`);
|
|
271
|
+
// Step 2: Get notary info from the node
|
|
272
|
+
status("Getting notary configuration...");
|
|
273
|
+
const notaryInfo = (await this.demos.nodeCall("tlsnotary.getInfo", {}));
|
|
274
|
+
if (!notaryInfo?.notaryUrl) {
|
|
275
|
+
throw new Error("Failed to get notary info from node");
|
|
276
|
+
}
|
|
277
|
+
// Step 3: Create TLSNotary instance with the pre-obtained proxy URL
|
|
278
|
+
// IMPORTANT: We only set websocketProxyUrl (not rpcUrl) so that TLSNotary
|
|
279
|
+
// uses our pre-obtained proxy instead of trying to request its own
|
|
280
|
+
status("Creating TLSNotary instance...");
|
|
281
|
+
const tlsn = new TLSNotary_1.TLSNotary({
|
|
282
|
+
notaryUrl: notaryInfo.notaryUrl,
|
|
283
|
+
websocketProxyUrl: tokenResponse.proxyUrl, // Use the proxy we already obtained!
|
|
284
|
+
notaryPublicKey: notaryInfo.publicKey,
|
|
285
|
+
// Note: rpcUrl is intentionally NOT set - this prevents TLSNotary
|
|
286
|
+
// from trying to request its own proxy in getProxyUrl()
|
|
287
|
+
});
|
|
288
|
+
// Step 4: Initialize WASM
|
|
289
|
+
status("Initializing TLSNotary WASM...");
|
|
290
|
+
await tlsn.initialize();
|
|
291
|
+
status("TLSNotary ready for attestation!");
|
|
292
|
+
return {
|
|
293
|
+
tlsn,
|
|
294
|
+
tokenId: tokenResponse.tokenId,
|
|
295
|
+
proxyUrl: tokenResponse.proxyUrl,
|
|
296
|
+
expiresAt: tokenResponse.expiresAt,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Request attestation token and create a pre-configured TLSNotary instance
|
|
301
|
+
* WITH user confirmation before broadcasting the transaction.
|
|
302
|
+
*
|
|
303
|
+
* This is the recommended way to perform attestations in user-facing applications.
|
|
304
|
+
* It handles:
|
|
305
|
+
* 1. Creating the TLSN_REQUEST transaction
|
|
306
|
+
* 2. **Asking the user to confirm via the onConfirm callback**
|
|
307
|
+
* 3. Broadcasting the transaction if confirmed
|
|
308
|
+
* 4. Waiting for the token to be created
|
|
309
|
+
* 5. Getting the proxy URL
|
|
310
|
+
* 6. Creating a TLSNotary instance configured with that proxy
|
|
311
|
+
* 7. Initializing the WASM module
|
|
312
|
+
*
|
|
313
|
+
* @param options - Request options including target URL
|
|
314
|
+
* @param confirmOptions - Options containing the confirmation callback
|
|
315
|
+
* @param onStatus - Optional status callback for progress updates
|
|
316
|
+
* @returns Object with TLSNotary instance, tokenId, and proxyUrl
|
|
317
|
+
* @throws Error if user rejects the transaction
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* const service = new TLSNotaryService(demos);
|
|
322
|
+
*
|
|
323
|
+
* // Get a ready-to-use TLSNotary instance with user confirmation
|
|
324
|
+
* const { tlsn, tokenId, proxyUrl } = await service.createTLSNotaryWithConfirmation(
|
|
325
|
+
* { targetUrl: 'https://api.github.com/users/octocat' },
|
|
326
|
+
* {
|
|
327
|
+
* onConfirm: async (details) => {
|
|
328
|
+
* // Show confirmation dialog to user in your UI
|
|
329
|
+
* return await showConfirmDialog({
|
|
330
|
+
* title: 'Confirm Attestation',
|
|
331
|
+
* message: `Burn ${details.amount} DEM for attestation?`,
|
|
332
|
+
* txHash: details.txHash,
|
|
333
|
+
* });
|
|
334
|
+
* }
|
|
335
|
+
* },
|
|
336
|
+
* (status) => console.log(status)
|
|
337
|
+
* );
|
|
338
|
+
*
|
|
339
|
+
* // Perform attestation - the proxy is already configured!
|
|
340
|
+
* const result = await tlsn.attest({
|
|
341
|
+
* url: 'https://api.github.com/users/octocat',
|
|
342
|
+
* });
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
async createTLSNotaryWithConfirmation(options, confirmOptions, onStatus) {
|
|
346
|
+
const status = onStatus || (() => { });
|
|
347
|
+
// Step 1: Request attestation token with user confirmation
|
|
348
|
+
status("Preparing attestation request...");
|
|
349
|
+
const tokenResponse = await this.requestAttestationWithConfirmation(options, confirmOptions);
|
|
350
|
+
status(`Token obtained: ${tokenResponse.tokenId}`);
|
|
351
|
+
// Step 2: Get notary info from the node
|
|
352
|
+
status("Getting notary configuration...");
|
|
353
|
+
const notaryInfo = (await this.demos.nodeCall("tlsnotary.getInfo", {}));
|
|
354
|
+
if (!notaryInfo?.notaryUrl) {
|
|
355
|
+
throw new Error("Failed to get notary info from node");
|
|
356
|
+
}
|
|
357
|
+
// Step 3: Create TLSNotary instance with the pre-obtained proxy URL
|
|
358
|
+
status("Creating TLSNotary instance...");
|
|
359
|
+
const tlsn = new TLSNotary_1.TLSNotary({
|
|
360
|
+
notaryUrl: notaryInfo.notaryUrl,
|
|
361
|
+
websocketProxyUrl: tokenResponse.proxyUrl,
|
|
362
|
+
notaryPublicKey: notaryInfo.publicKey,
|
|
363
|
+
});
|
|
364
|
+
// Step 4: Initialize WASM
|
|
365
|
+
status("Initializing TLSNotary WASM...");
|
|
366
|
+
await tlsn.initialize();
|
|
367
|
+
status("TLSNotary ready for attestation!");
|
|
368
|
+
return {
|
|
369
|
+
tlsn,
|
|
370
|
+
tokenId: tokenResponse.tokenId,
|
|
371
|
+
proxyUrl: tokenResponse.proxyUrl,
|
|
372
|
+
expiresAt: tokenResponse.expiresAt,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
134
375
|
/**
|
|
135
376
|
* Store a TLSNotary proof on-chain or IPFS
|
|
136
377
|
*
|
|
@@ -173,6 +414,72 @@ class TLSNotaryService {
|
|
|
173
414
|
broadcastMessage: broadcastResult.response?.message || "Transaction accepted",
|
|
174
415
|
};
|
|
175
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Store a TLSNotary proof on-chain or IPFS with user confirmation
|
|
419
|
+
*
|
|
420
|
+
* This method shows the transaction details to the user via the onConfirm callback
|
|
421
|
+
* and only broadcasts if the user confirms. This is the recommended way to store
|
|
422
|
+
* proofs in user-facing applications.
|
|
423
|
+
*
|
|
424
|
+
* @param tokenId - The attestation token ID
|
|
425
|
+
* @param proof - The proof data (JSON string or serialized presentation)
|
|
426
|
+
* @param options - Storage options (on-chain or IPFS)
|
|
427
|
+
* @param confirmOptions - Options containing the confirmation callback
|
|
428
|
+
* @returns Storage response with transaction hash and fee
|
|
429
|
+
* @throws Error if user rejects the transaction
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```typescript
|
|
433
|
+
* const { txHash, storageFee } = await service.storeProofWithConfirmation(
|
|
434
|
+
* tokenId,
|
|
435
|
+
* JSON.stringify(presentation),
|
|
436
|
+
* { storage: 'onchain' },
|
|
437
|
+
* {
|
|
438
|
+
* onConfirm: async (details) => {
|
|
439
|
+
* // Show confirmation dialog to user
|
|
440
|
+
* return await showConfirmDialog({
|
|
441
|
+
* title: 'Confirm Proof Storage',
|
|
442
|
+
* message: `This will burn ${details.amount} DEM to store the proof on-chain`,
|
|
443
|
+
* txHash: details.txHash,
|
|
444
|
+
* });
|
|
445
|
+
* }
|
|
446
|
+
* }
|
|
447
|
+
* );
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
async storeProofWithConfirmation(tokenId, proof, options, confirmOptions) {
|
|
451
|
+
const { storage } = options;
|
|
452
|
+
const { onConfirm } = confirmOptions;
|
|
453
|
+
// 1. Calculate storage fee
|
|
454
|
+
const proofSizeKB = Math.ceil(proof.length / 1024);
|
|
455
|
+
const storageFee = this.calculateStorageFee(proofSizeKB);
|
|
456
|
+
// 2. Create the transaction (but don't broadcast yet)
|
|
457
|
+
const tx = await this.createTlsnStoreTransaction(tokenId, proof, storage, storageFee);
|
|
458
|
+
// 3. Get confirmation from user
|
|
459
|
+
const details = {
|
|
460
|
+
transaction: tx,
|
|
461
|
+
txHash: tx.hash,
|
|
462
|
+
amount: storageFee,
|
|
463
|
+
description: `Store TLSNotary proof ${storage === 'onchain' ? 'on-chain' : 'on IPFS'} (burns ${storageFee} DEM)`,
|
|
464
|
+
tokenId,
|
|
465
|
+
};
|
|
466
|
+
const confirmed = await onConfirm(details);
|
|
467
|
+
if (!confirmed) {
|
|
468
|
+
throw new Error("Transaction rejected by user");
|
|
469
|
+
}
|
|
470
|
+
// 4. Confirm and broadcast
|
|
471
|
+
const confirmResult = await DemosTransactions_1.DemosTransactions.confirm(tx, this.demos);
|
|
472
|
+
const broadcastResult = await DemosTransactions_1.DemosTransactions.broadcast(confirmResult, this.demos);
|
|
473
|
+
if (broadcastResult.result !== 200) {
|
|
474
|
+
throw new Error(`Failed to store proof: ${broadcastResult.response?.message || "Unknown error"}`);
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
txHash: tx.hash,
|
|
478
|
+
storageFee,
|
|
479
|
+
broadcastStatus: broadcastResult.result,
|
|
480
|
+
broadcastMessage: broadcastResult.response?.message || "Transaction accepted",
|
|
481
|
+
};
|
|
482
|
+
}
|
|
176
483
|
/**
|
|
177
484
|
* Calculate the storage fee for a proof
|
|
178
485
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TLSNotaryService.js","sourceRoot":"","sources":["../../../src/tlsnotary/TLSNotaryService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;;AAGH,kEAA8D;AAC9D,8DAA4D;AAsE5D;;GAEG;AACH,MAAa,gBAAgB;IAGzB;;;;OAIG;IACH,YAAY,KAAY;QACpB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;QACjE,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;QACvE,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,kBAAkB,CACpB,OAAkC;QAElC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;QAE7B,wBAAwB;QACxB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAA;QAC9B,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YA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AAC,MAAM,GAAG,GAAG,CAAA,CAAC,cAAc;QACtC,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAA;QAC1B,EAAE,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACjC,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG;YACd,QAAQ;YACR;gBACI,eAAe,EAAE,YAAY;gBAC7B,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC;aACtC;SACJ,CAAA;QAED,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACpC,CAAC;CACJ;AAzrBD,4CAyrBC;AAED,kBAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLSNotary Auto-Init Module
|
|
3
|
+
*
|
|
4
|
+
* Provides automatic WASM initialization with bundled files from the SDK.
|
|
5
|
+
* This module simplifies setup by handling WASM file paths automatically.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
* @module tlsnotary/auto-init
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Simple usage - WASM files must be copied to your build output
|
|
13
|
+
* import { initTlsn } from '@kynesyslabs/demosdk/tlsnotary';
|
|
14
|
+
*
|
|
15
|
+
* // Initialize with automatic WASM loading
|
|
16
|
+
* await initTlsn({ wasmBasePath: '/tlsn-wasm/' });
|
|
17
|
+
*
|
|
18
|
+
* // Now you can use TLSNotary
|
|
19
|
+
* const tlsn = new TLSNotary({ notaryUrl: '...' });
|
|
20
|
+
* await tlsn.initialize();
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example With webpack helper for automatic setup
|
|
24
|
+
* ```javascript
|
|
25
|
+
* // webpack.config.js
|
|
26
|
+
* const { mergeTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
|
|
27
|
+
*
|
|
28
|
+
* module.exports = mergeTlsnWebpackConfig({
|
|
29
|
+
* // your config
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import init, { type LoggingLevel } from "tlsn-js";
|
|
34
|
+
/**
|
|
35
|
+
* Configuration options for auto-initialization
|
|
36
|
+
*/
|
|
37
|
+
export interface AutoInitOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Base path where WASM files are served from.
|
|
40
|
+
* This should be the URL path (not filesystem path) where you've copied
|
|
41
|
+
* the WASM files from the SDK.
|
|
42
|
+
*
|
|
43
|
+
* @default '/' (root of your web app)
|
|
44
|
+
*
|
|
45
|
+
* @example '/tlsn-wasm/'
|
|
46
|
+
* @example '/assets/wasm/'
|
|
47
|
+
*/
|
|
48
|
+
wasmBasePath?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Logging level for WASM initialization
|
|
51
|
+
* @default 'Info'
|
|
52
|
+
*/
|
|
53
|
+
loggingLevel?: LoggingLevel;
|
|
54
|
+
/**
|
|
55
|
+
* Hardware concurrency for WASM threads
|
|
56
|
+
* @default navigator.hardwareConcurrency
|
|
57
|
+
*/
|
|
58
|
+
hardwareConcurrency?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* WASM file manifest - these files must be available at wasmBasePath
|
|
62
|
+
*/
|
|
63
|
+
export declare const WASM_FILES: {
|
|
64
|
+
/** Main WASM binary */
|
|
65
|
+
readonly wasm: "96d038089797746d7695.wasm";
|
|
66
|
+
/** Alternative WASM binary name (for compatibility) */
|
|
67
|
+
readonly wasmAlt: "tlsn_wasm_bg.wasm";
|
|
68
|
+
/** Main library JS */
|
|
69
|
+
readonly lib: "lib.js";
|
|
70
|
+
/** WASM loader JS */
|
|
71
|
+
readonly wasmLoader: "tlsn_wasm.js";
|
|
72
|
+
/** Spawn helper JS */
|
|
73
|
+
readonly spawn: "spawn.js";
|
|
74
|
+
/** Worker helper JS */
|
|
75
|
+
readonly worker: "a6de6b189c13ad309102.js";
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Check if WASM files are accessible at the given path
|
|
79
|
+
*
|
|
80
|
+
* @param basePath - Base URL path to check
|
|
81
|
+
* @returns Promise resolving to true if files are accessible
|
|
82
|
+
*/
|
|
83
|
+
export declare function checkWasmAvailability(basePath?: string): Promise<{
|
|
84
|
+
available: boolean;
|
|
85
|
+
missingFiles: string[];
|
|
86
|
+
error?: string;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Initialize TLSNotary WASM module
|
|
90
|
+
*
|
|
91
|
+
* This function initializes the underlying tlsn-js WASM module.
|
|
92
|
+
* The WASM files must be accessible from your web server.
|
|
93
|
+
*
|
|
94
|
+
* **Setup Options:**
|
|
95
|
+
*
|
|
96
|
+
* 1. **Using webpack helper (recommended)**:
|
|
97
|
+
* ```javascript
|
|
98
|
+
* const { mergeTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
|
|
99
|
+
* module.exports = mergeTlsnWebpackConfig({ ... });
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* 2. **Manual copy**: Copy WASM files from `node_modules/@kynesyslabs/demosdk/build/tlsnotary/wasm/`
|
|
103
|
+
* to your build output directory.
|
|
104
|
+
*
|
|
105
|
+
* @param options - Initialization options
|
|
106
|
+
* @throws Error if WASM initialization fails
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* import { initTlsn } from '@kynesyslabs/demosdk/tlsnotary';
|
|
111
|
+
*
|
|
112
|
+
* // Initialize before using TLSNotary
|
|
113
|
+
* await initTlsn({
|
|
114
|
+
* wasmBasePath: '/tlsn-wasm/', // Where you copied the WASM files
|
|
115
|
+
* loggingLevel: 'Info',
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare function initTlsn(options?: AutoInitOptions): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Get the path to WASM files bundled with the SDK.
|
|
122
|
+
*
|
|
123
|
+
* This is the filesystem path (not URL) to the WASM files in node_modules.
|
|
124
|
+
* Use this with your bundler's copy plugin.
|
|
125
|
+
*
|
|
126
|
+
* @returns Filesystem path to WASM directory
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```javascript
|
|
130
|
+
* // In webpack.config.js
|
|
131
|
+
* const { getWasmSourcePath } = require('@kynesyslabs/demosdk/tlsnotary/auto-init');
|
|
132
|
+
* const CopyPlugin = require('copy-webpack-plugin');
|
|
133
|
+
*
|
|
134
|
+
* plugins: [
|
|
135
|
+
* new CopyPlugin({
|
|
136
|
+
* patterns: [{ from: getWasmSourcePath(), to: 'tlsn-wasm' }]
|
|
137
|
+
* })
|
|
138
|
+
* ]
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare function getWasmSourcePath(): string;
|
|
142
|
+
/**
|
|
143
|
+
* Re-export the underlying init function for advanced usage
|
|
144
|
+
*/
|
|
145
|
+
export { init as rawInit };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TLSNotary Auto-Init Module
|
|
4
|
+
*
|
|
5
|
+
* Provides automatic WASM initialization with bundled files from the SDK.
|
|
6
|
+
* This module simplifies setup by handling WASM file paths automatically.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @module tlsnotary/auto-init
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Simple usage - WASM files must be copied to your build output
|
|
14
|
+
* import { initTlsn } from '@kynesyslabs/demosdk/tlsnotary';
|
|
15
|
+
*
|
|
16
|
+
* // Initialize with automatic WASM loading
|
|
17
|
+
* await initTlsn({ wasmBasePath: '/tlsn-wasm/' });
|
|
18
|
+
*
|
|
19
|
+
* // Now you can use TLSNotary
|
|
20
|
+
* const tlsn = new TLSNotary({ notaryUrl: '...' });
|
|
21
|
+
* await tlsn.initialize();
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example With webpack helper for automatic setup
|
|
25
|
+
* ```javascript
|
|
26
|
+
* // webpack.config.js
|
|
27
|
+
* const { mergeTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
|
|
28
|
+
*
|
|
29
|
+
* module.exports = mergeTlsnWebpackConfig({
|
|
30
|
+
* // your config
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.rawInit = exports.WASM_FILES = void 0;
|
|
39
|
+
exports.checkWasmAvailability = checkWasmAvailability;
|
|
40
|
+
exports.initTlsn = initTlsn;
|
|
41
|
+
exports.getWasmSourcePath = getWasmSourcePath;
|
|
42
|
+
const tlsn_js_1 = __importDefault(require("tlsn-js"));
|
|
43
|
+
exports.rawInit = tlsn_js_1.default;
|
|
44
|
+
/**
|
|
45
|
+
* WASM file manifest - these files must be available at wasmBasePath
|
|
46
|
+
*/
|
|
47
|
+
exports.WASM_FILES = {
|
|
48
|
+
/** Main WASM binary */
|
|
49
|
+
wasm: "96d038089797746d7695.wasm",
|
|
50
|
+
/** Alternative WASM binary name (for compatibility) */
|
|
51
|
+
wasmAlt: "tlsn_wasm_bg.wasm",
|
|
52
|
+
/** Main library JS */
|
|
53
|
+
lib: "lib.js",
|
|
54
|
+
/** WASM loader JS */
|
|
55
|
+
wasmLoader: "tlsn_wasm.js",
|
|
56
|
+
/** Spawn helper JS */
|
|
57
|
+
spawn: "spawn.js",
|
|
58
|
+
/** Worker helper JS */
|
|
59
|
+
worker: "a6de6b189c13ad309102.js",
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Check if WASM files are accessible at the given path
|
|
63
|
+
*
|
|
64
|
+
* @param basePath - Base URL path to check
|
|
65
|
+
* @returns Promise resolving to true if files are accessible
|
|
66
|
+
*/
|
|
67
|
+
async function checkWasmAvailability(basePath = "/") {
|
|
68
|
+
const normalizedPath = basePath.endsWith("/") ? basePath : `${basePath}/`;
|
|
69
|
+
const criticalFiles = [exports.WASM_FILES.wasm, exports.WASM_FILES.wasmLoader];
|
|
70
|
+
const missingFiles = [];
|
|
71
|
+
for (const file of criticalFiles) {
|
|
72
|
+
try {
|
|
73
|
+
const response = await fetch(`${normalizedPath}${file}`, {
|
|
74
|
+
method: "HEAD",
|
|
75
|
+
});
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
missingFiles.push(file);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
missingFiles.push(file);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
available: missingFiles.length === 0,
|
|
86
|
+
missingFiles,
|
|
87
|
+
error: missingFiles.length > 0
|
|
88
|
+
? `Missing WASM files at ${normalizedPath}: ${missingFiles.join(", ")}. ` +
|
|
89
|
+
"Use the webpack helper from '@kynesyslabs/demosdk/tlsnotary/webpack' " +
|
|
90
|
+
"to automatically copy WASM files to your build output."
|
|
91
|
+
: undefined,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Initialize TLSNotary WASM module
|
|
96
|
+
*
|
|
97
|
+
* This function initializes the underlying tlsn-js WASM module.
|
|
98
|
+
* The WASM files must be accessible from your web server.
|
|
99
|
+
*
|
|
100
|
+
* **Setup Options:**
|
|
101
|
+
*
|
|
102
|
+
* 1. **Using webpack helper (recommended)**:
|
|
103
|
+
* ```javascript
|
|
104
|
+
* const { mergeTlsnWebpackConfig } = require('@kynesyslabs/demosdk/tlsnotary/webpack');
|
|
105
|
+
* module.exports = mergeTlsnWebpackConfig({ ... });
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* 2. **Manual copy**: Copy WASM files from `node_modules/@kynesyslabs/demosdk/build/tlsnotary/wasm/`
|
|
109
|
+
* to your build output directory.
|
|
110
|
+
*
|
|
111
|
+
* @param options - Initialization options
|
|
112
|
+
* @throws Error if WASM initialization fails
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* import { initTlsn } from '@kynesyslabs/demosdk/tlsnotary';
|
|
117
|
+
*
|
|
118
|
+
* // Initialize before using TLSNotary
|
|
119
|
+
* await initTlsn({
|
|
120
|
+
* wasmBasePath: '/tlsn-wasm/', // Where you copied the WASM files
|
|
121
|
+
* loggingLevel: 'Info',
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
async function initTlsn(options = {}) {
|
|
126
|
+
const { loggingLevel = "Info", hardwareConcurrency } = options;
|
|
127
|
+
// Note: tlsn-js's init() function looks for WASM files relative to the
|
|
128
|
+
// current page's base URL. The wasmBasePath option in our config is meant
|
|
129
|
+
// to help users understand where to place files, but the actual loading
|
|
130
|
+
// is handled by tlsn-js's bundled webpack config.
|
|
131
|
+
//
|
|
132
|
+
// Users need to ensure WASM files are at the root (or configure their
|
|
133
|
+
// bundler to place them where tlsn-js expects them).
|
|
134
|
+
await (0, tlsn_js_1.default)({
|
|
135
|
+
loggingLevel,
|
|
136
|
+
hardwareConcurrency,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get the path to WASM files bundled with the SDK.
|
|
141
|
+
*
|
|
142
|
+
* This is the filesystem path (not URL) to the WASM files in node_modules.
|
|
143
|
+
* Use this with your bundler's copy plugin.
|
|
144
|
+
*
|
|
145
|
+
* @returns Filesystem path to WASM directory
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```javascript
|
|
149
|
+
* // In webpack.config.js
|
|
150
|
+
* const { getWasmSourcePath } = require('@kynesyslabs/demosdk/tlsnotary/auto-init');
|
|
151
|
+
* const CopyPlugin = require('copy-webpack-plugin');
|
|
152
|
+
*
|
|
153
|
+
* plugins: [
|
|
154
|
+
* new CopyPlugin({
|
|
155
|
+
* patterns: [{ from: getWasmSourcePath(), to: 'tlsn-wasm' }]
|
|
156
|
+
* })
|
|
157
|
+
* ]
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
function getWasmSourcePath() {
|
|
161
|
+
// This returns the path relative to where this file is in the build output
|
|
162
|
+
// In build/tlsnotary/auto-init.js, WASM files are in build/tlsnotary/wasm/
|
|
163
|
+
return require("path").resolve(__dirname, "wasm");
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=auto-init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-init.js","sourceRoot":"","sources":["../../../src/tlsnotary/auto-init.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;;;;;;AAyDH,sDAgCC;AAiCD,4BAeC;AAuBD,8CAIC;AAlKD,sDAAiD;AAuKhC,kBAvKV,iBAAI,CAuKa;AAxIxB;;GAEG;AACU,QAAA,UAAU,GAAG;IACtB,uBAAuB;IACvB,IAAI,EAAE,2BAA2B;IACjC,uDAAuD;IACvD,OAAO,EAAE,mBAAmB;IAC5B,sBAAsB;IACtB,GAAG,EAAE,QAAQ;IACb,qBAAqB;IACrB,UAAU,EAAE,cAAc;IAC1B,sBAAsB;IACtB,KAAK,EAAE,UAAU;IACjB,uBAAuB;IACvB,MAAM,EAAE,yBAAyB;CAC3B,CAAA;AAEV;;;;;GAKG;AACI,KAAK,UAAU,qBAAqB,CAAC,WAAmB,GAAG;IAK9D,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAA;IACzE,MAAM,aAAa,GAAG,CAAC,kBAAU,CAAC,IAAI,EAAE,kBAAU,CAAC,UAAU,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AM,CAAC,CAAA;AACrD,CAAC"}
|
|
@@ -54,10 +54,11 @@
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
export { TLSNotary } from "./TLSNotary";
|
|
57
|
-
export { TLSNotaryService, type AttestationTokenResponse, type StoreProofResponse, type TLSNotaryToken, type RequestAttestationOptions, type StoreProofOptions, } from "./TLSNotaryService";
|
|
57
|
+
export { TLSNotaryService, type AttestationTokenResponse, type StoreProofResponse, type TLSNotaryToken, type RequestAttestationOptions, type StoreProofOptions, type TransactionDetails, type TransactionConfirmCallback, type WithConfirmationOptions, } from "./TLSNotaryService";
|
|
58
58
|
export type { TLSNotaryConfig, TLSNotaryDiscoveryInfo, AttestRequest, AttestResult, AttestOptions, CommitRanges, Range, PresentationJSON, VerificationResult, TranscriptInfo, StatusCallback, ProxyRequestResponse, ProxyRequestError, } from "./types";
|
|
59
59
|
export { default } from "./TLSNotary";
|
|
60
60
|
export { calculateStorageFee } from "./helpers";
|
|
61
|
+
export { initTlsn, checkWasmAvailability, getWasmSourcePath, WASM_FILES, type AutoInitOptions, } from "./auto-init";
|
|
61
62
|
/**
|
|
62
63
|
* Re-export tlsn-js classes and functions for convenience.
|
|
63
64
|
*
|
package/build/tlsnotary/index.js
CHANGED
|
@@ -58,7 +58,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
58
58
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
59
59
|
};
|
|
60
60
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
-
exports.Transcript = exports.NotaryServer = exports.Presentation = exports.Prover = exports.init = exports.calculateStorageFee = exports.default = exports.TLSNotaryService = exports.TLSNotary = void 0;
|
|
61
|
+
exports.Transcript = exports.NotaryServer = exports.Presentation = exports.Prover = exports.init = exports.WASM_FILES = exports.getWasmSourcePath = exports.checkWasmAvailability = exports.initTlsn = exports.calculateStorageFee = exports.default = exports.TLSNotaryService = exports.TLSNotary = void 0;
|
|
62
62
|
// Core TLSNotary class for attestation
|
|
63
63
|
var TLSNotary_1 = require("./TLSNotary");
|
|
64
64
|
Object.defineProperty(exports, "TLSNotary", { enumerable: true, get: function () { return TLSNotary_1.TLSNotary; } });
|
|
@@ -71,6 +71,12 @@ Object.defineProperty(exports, "default", { enumerable: true, get: function () {
|
|
|
71
71
|
// Helper function exports
|
|
72
72
|
var helpers_1 = require("./helpers");
|
|
73
73
|
Object.defineProperty(exports, "calculateStorageFee", { enumerable: true, get: function () { return helpers_1.calculateStorageFee; } });
|
|
74
|
+
// Auto-init helper for simplified WASM setup
|
|
75
|
+
var auto_init_1 = require("./auto-init");
|
|
76
|
+
Object.defineProperty(exports, "initTlsn", { enumerable: true, get: function () { return auto_init_1.initTlsn; } });
|
|
77
|
+
Object.defineProperty(exports, "checkWasmAvailability", { enumerable: true, get: function () { return auto_init_1.checkWasmAvailability; } });
|
|
78
|
+
Object.defineProperty(exports, "getWasmSourcePath", { enumerable: true, get: function () { return auto_init_1.getWasmSourcePath; } });
|
|
79
|
+
Object.defineProperty(exports, "WASM_FILES", { enumerable: true, get: function () { return auto_init_1.WASM_FILES; } });
|
|
74
80
|
/**
|
|
75
81
|
* Re-export tlsn-js classes and functions for convenience.
|
|
76
82
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tlsnotary/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;;;;;;AAEH,uCAAuC;AACvC,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,2DAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tlsnotary/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;;;;;;AAEH,uCAAuC;AACvC,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,2DAA2D;AAC3D,uDAU2B;AATvB,oHAAA,gBAAgB,OAAA;AA4BpB,oBAAoB;AACpB,yCAAqC;AAA5B,qHAAA,OAAO,OAAA;AAEhB,0BAA0B;AAC1B,qCAA+C;AAAtC,8GAAA,mBAAmB,OAAA;AAE5B,6CAA6C;AAC7C,yCAMoB;AALhB,qGAAA,QAAQ,OAAA;AACR,kHAAA,qBAAqB,OAAA;AACrB,8GAAA,iBAAiB,OAAA;AACjB,uGAAA,UAAU,OAAA;AAId;;;;;;;;GAQG;AACH,mCAegB;AAdZ,sBAAsB;AACtB,gHAAA,OAAO,OAAQ;AACf,eAAe;AACf,iGAAA,MAAM,OAAA;AACN,uGAAA,YAAY,OAAA;AACZ,uGAAA,YAAY,OAAA;AACZ,qGAAA,UAAU,OAAA"}
|
package/build/websdk/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export { bufferize } from "./utils/bufferizer";
|
|
|
10
10
|
export { required, _required } from "./utils/required";
|
|
11
11
|
export { forgeToString, stringToForge } from "./utils/forge_converter";
|
|
12
12
|
export * as skeletons from "./utils/skeletons";
|
|
13
|
+
export { uint8ArrayToHex, hexToUint8Array } from "../encryption/unifiedCrypto";
|
|
13
14
|
export { RubicBridge } from "./bridge";
|
package/build/websdk/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.RubicBridge = exports.skeletons = exports.stringToForge = exports.forgeToString = exports._required = exports.required = exports.bufferize = exports.sha256 = exports.HandleNativeOperations = exports.GCRGeneration = exports.prepareXMScript = exports.prepareXMPayload = exports.XMTransactions = exports.DemosWebAuth = exports.RSA = exports.DemosTransactions = exports.Demos = exports.demos = void 0;
|
|
36
|
+
exports.RubicBridge = exports.hexToUint8Array = exports.uint8ArrayToHex = exports.skeletons = exports.stringToForge = exports.forgeToString = exports._required = exports.required = exports.bufferize = exports.sha256 = exports.HandleNativeOperations = exports.GCRGeneration = exports.prepareXMScript = exports.prepareXMPayload = exports.XMTransactions = exports.DemosWebAuth = exports.RSA = exports.DemosTransactions = exports.Demos = exports.demos = void 0;
|
|
37
37
|
// @ts-nocheck
|
|
38
38
|
var demos_1 = require("./demos");
|
|
39
39
|
Object.defineProperty(exports, "demos", { enumerable: true, get: function () { return demos_1.demos; } });
|
|
@@ -64,6 +64,10 @@ var forge_converter_1 = require("./utils/forge_converter");
|
|
|
64
64
|
Object.defineProperty(exports, "forgeToString", { enumerable: true, get: function () { return forge_converter_1.forgeToString; } });
|
|
65
65
|
Object.defineProperty(exports, "stringToForge", { enumerable: true, get: function () { return forge_converter_1.stringToForge; } });
|
|
66
66
|
exports.skeletons = __importStar(require("./utils/skeletons"));
|
|
67
|
+
// Crypto utilities (useful for developers)
|
|
68
|
+
var unifiedCrypto_1 = require("../encryption/unifiedCrypto");
|
|
69
|
+
Object.defineProperty(exports, "uint8ArrayToHex", { enumerable: true, get: function () { return unifiedCrypto_1.uint8ArrayToHex; } });
|
|
70
|
+
Object.defineProperty(exports, "hexToUint8Array", { enumerable: true, get: function () { return unifiedCrypto_1.hexToUint8Array; } });
|
|
67
71
|
// Bridge
|
|
68
72
|
var bridge_1 = require("./bridge");
|
|
69
73
|
Object.defineProperty(exports, "RubicBridge", { enumerable: true, get: function () { return bridge_1.RubicBridge; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/websdk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,2CAAoC;AAA3B,mGAAA,KAAK,OAAA;AACd,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAE1B,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,+CAA6C;AAApC,4GAAA,YAAY,OA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AAArE,gHAAA,eAAe,OAAA;AAAE,gHAAA,eAAe,OAAA;AAEzC,SAAS;AACT,mCAAsC;AAA7B,qGAAA,WAAW,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kynesyslabs/demosdk",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.8",
|
|
4
4
|
"description": "Demosdk is a JavaScript/TypeScript SDK that provides a unified interface for interacting with Demos network",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"./tlsnotary": "./build/tlsnotary/index.js",
|
|
60
60
|
"./tlsnotary/service": "./build/tlsnotary/service.js",
|
|
61
61
|
"./tlsnotary/webpack": "./build/tlsnotary/webpack.js",
|
|
62
|
+
"./tlsnotary/auto-init": "./build/tlsnotary/auto-init.js",
|
|
62
63
|
"./tlsnotary/wasm/*": "./build/tlsnotary/wasm/*"
|
|
63
64
|
},
|
|
64
65
|
"scripts": {
|