@kynesyslabs/demosdk 2.7.4 → 2.7.6
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 +204 -0
- package/build/tlsnotary/TLSNotaryService.js +266 -0
- package/build/tlsnotary/TLSNotaryService.js.map +1 -0
- package/build/tlsnotary/helpers.d.ts +24 -0
- package/build/tlsnotary/helpers.js +30 -0
- package/build/tlsnotary/helpers.js.map +1 -0
- package/build/tlsnotary/index.d.ts +21 -11
- package/build/tlsnotary/index.js +27 -12
- package/build/tlsnotary/index.js.map +1 -1
- package/build/types/blockchain/GCREdit.d.ts +18 -1
- package/build/types/blockchain/blocks.d.ts +1 -0
- package/build/types/native/INativePayload.d.ts +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLSNotary Service - Token-based Attestation Management
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions for managing TLSNotary attestation tokens
|
|
5
|
+
* and storing proofs on the Demos Network blockchain.
|
|
6
|
+
*
|
|
7
|
+
* The attestation flow:
|
|
8
|
+
* 1. Request attestation token (burns 1 DEM) → get tokenId + proxyUrl
|
|
9
|
+
* 2. Perform attestation using the proxy
|
|
10
|
+
* 3. Store proof on-chain or IPFS (burns 1 + ceil(size/1024) DEM)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { TLSNotaryService } from '@kynesyslabs/demosdk/tlsnotary';
|
|
15
|
+
*
|
|
16
|
+
* const demos = new Demos();
|
|
17
|
+
* await demos.connect('https://node.demos.sh');
|
|
18
|
+
* await demos.connectWallet(mnemonic);
|
|
19
|
+
*
|
|
20
|
+
* const service = new TLSNotaryService(demos);
|
|
21
|
+
*
|
|
22
|
+
* // Request attestation token
|
|
23
|
+
* const { proxyUrl, tokenId } = await service.requestAttestation({
|
|
24
|
+
* targetUrl: 'https://api.github.com/users/octocat'
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Perform attestation (using TLSNotary class)
|
|
28
|
+
* const tlsn = await demos.tlsnotary();
|
|
29
|
+
* const result = await tlsn.attest({ url: targetUrl });
|
|
30
|
+
*
|
|
31
|
+
* // Store proof on-chain
|
|
32
|
+
* const { txHash } = await service.storeProof(
|
|
33
|
+
* tokenId,
|
|
34
|
+
* JSON.stringify(result.presentation),
|
|
35
|
+
* { storage: 'onchain' }
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
import type { Demos } from "../websdk/demosclass";
|
|
40
|
+
/**
|
|
41
|
+
* Response from requestAttestation
|
|
42
|
+
*/
|
|
43
|
+
export interface AttestationTokenResponse {
|
|
44
|
+
/** WebSocket proxy URL for this attestation */
|
|
45
|
+
proxyUrl: string;
|
|
46
|
+
/** Unique token ID for this attestation */
|
|
47
|
+
tokenId: string;
|
|
48
|
+
/** Unix timestamp when token expires */
|
|
49
|
+
expiresAt: number;
|
|
50
|
+
/** Number of retry attempts remaining */
|
|
51
|
+
retriesLeft: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Response from storeProof
|
|
55
|
+
*/
|
|
56
|
+
export interface StoreProofResponse {
|
|
57
|
+
/** Transaction hash of the storage transaction */
|
|
58
|
+
txHash: string;
|
|
59
|
+
/** Total fee burned for storage (in DEM) */
|
|
60
|
+
storageFee: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* TLSNotary token information
|
|
64
|
+
*/
|
|
65
|
+
export interface TLSNotaryToken {
|
|
66
|
+
/** Unique token ID */
|
|
67
|
+
tokenId: string;
|
|
68
|
+
/** Owner's address */
|
|
69
|
+
owner: string;
|
|
70
|
+
/** Target domain for attestation */
|
|
71
|
+
domain: string;
|
|
72
|
+
/** Current token status */
|
|
73
|
+
status: "pending" | "used" | "expired" | "stored";
|
|
74
|
+
/** Creation timestamp */
|
|
75
|
+
createdAt: number;
|
|
76
|
+
/** Expiration timestamp */
|
|
77
|
+
expiresAt: number;
|
|
78
|
+
/** Number of retry attempts remaining */
|
|
79
|
+
retriesLeft: number;
|
|
80
|
+
/** Associated proof hash (if stored) */
|
|
81
|
+
proofHash?: string;
|
|
82
|
+
/** Storage type (if stored) */
|
|
83
|
+
storageType?: "onchain" | "ipfs";
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Options for requesting an attestation
|
|
87
|
+
*/
|
|
88
|
+
export interface RequestAttestationOptions {
|
|
89
|
+
/** Target HTTPS URL to attest */
|
|
90
|
+
targetUrl: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Options for storing a proof
|
|
94
|
+
*/
|
|
95
|
+
export interface StoreProofOptions {
|
|
96
|
+
/** Storage location: on-chain or IPFS */
|
|
97
|
+
storage: "onchain" | "ipfs";
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* TLSNotary Service for managing attestation tokens and proof storage
|
|
101
|
+
*/
|
|
102
|
+
export declare class TLSNotaryService {
|
|
103
|
+
private demos;
|
|
104
|
+
/**
|
|
105
|
+
* Create a new TLSNotaryService instance
|
|
106
|
+
*
|
|
107
|
+
* @param demos - Connected Demos instance with wallet
|
|
108
|
+
*/
|
|
109
|
+
constructor(demos: Demos);
|
|
110
|
+
/**
|
|
111
|
+
* Request an attestation token for a target URL
|
|
112
|
+
*
|
|
113
|
+
* This submits a TLSN_REQUEST native transaction that burns 1 DEM
|
|
114
|
+
* and returns a token ID with a proxy URL for performing the attestation.
|
|
115
|
+
*
|
|
116
|
+
* @param options - Request options including target URL
|
|
117
|
+
* @returns Attestation token response with proxyUrl and tokenId
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const { proxyUrl, tokenId } = await service.requestAttestation({
|
|
122
|
+
* targetUrl: 'https://api.coingecko.com/api/v3/simple/price'
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
requestAttestation(options: RequestAttestationOptions): Promise<AttestationTokenResponse>;
|
|
127
|
+
/**
|
|
128
|
+
* Store a TLSNotary proof on-chain or IPFS
|
|
129
|
+
*
|
|
130
|
+
* This submits a TLSN_STORE native transaction that burns:
|
|
131
|
+
* - 1 DEM base fee
|
|
132
|
+
* - 1 DEM per KB of proof data
|
|
133
|
+
*
|
|
134
|
+
* @param tokenId - The attestation token ID
|
|
135
|
+
* @param proof - The proof data (JSON string or serialized presentation)
|
|
136
|
+
* @param options - Storage options (on-chain or IPFS)
|
|
137
|
+
* @returns Storage response with transaction hash and fee
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* const { txHash, storageFee } = await service.storeProof(
|
|
142
|
+
* tokenId,
|
|
143
|
+
* JSON.stringify(presentation),
|
|
144
|
+
* { storage: 'onchain' }
|
|
145
|
+
* );
|
|
146
|
+
* console.log(`Proof stored! Fee: ${storageFee} DEM`);
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
storeProof(tokenId: string, proof: string, options: StoreProofOptions): Promise<StoreProofResponse>;
|
|
150
|
+
/**
|
|
151
|
+
* Calculate the storage fee for a proof
|
|
152
|
+
*
|
|
153
|
+
* Fee structure:
|
|
154
|
+
* - 1 DEM base fee
|
|
155
|
+
* - 1 DEM per KB of proof data
|
|
156
|
+
*
|
|
157
|
+
* @param proofSizeKB - Size of proof in kilobytes
|
|
158
|
+
* @returns Total fee in DEM
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const fee = service.calculateStorageFee(5); // 6 DEM for 5KB proof
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
calculateStorageFee(proofSizeKB: number): number;
|
|
166
|
+
/**
|
|
167
|
+
* Get attestation token information by token ID
|
|
168
|
+
*
|
|
169
|
+
* @param tokenId - The attestation token ID
|
|
170
|
+
* @returns Token information or null if not found
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const token = await service.getToken(tokenId);
|
|
175
|
+
* if (token?.status === 'stored') {
|
|
176
|
+
* console.log('Proof already stored:', token.proofHash);
|
|
177
|
+
* }
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
getToken(tokenId: string): Promise<TLSNotaryToken | null>;
|
|
181
|
+
/**
|
|
182
|
+
* Get attestation token information by transaction hash
|
|
183
|
+
*
|
|
184
|
+
* @param txHash - The transaction hash of the TLSN_REQUEST transaction
|
|
185
|
+
* @returns Token information or null if not found
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* const token = await service.getTokenByTxHash(txHash);
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
getTokenByTxHash(txHash: string): Promise<TLSNotaryToken | null>;
|
|
193
|
+
/**
|
|
194
|
+
* Create a TLSN_REQUEST native transaction
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
|
+
private createTlsnRequestTransaction;
|
|
198
|
+
/**
|
|
199
|
+
* Create a TLSN_STORE native transaction
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
private createTlsnStoreTransaction;
|
|
203
|
+
}
|
|
204
|
+
export default TLSNotaryService;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TLSNotary Service - Token-based Attestation Management
|
|
4
|
+
*
|
|
5
|
+
* This module provides functions for managing TLSNotary attestation tokens
|
|
6
|
+
* and storing proofs on the Demos Network blockchain.
|
|
7
|
+
*
|
|
8
|
+
* The attestation flow:
|
|
9
|
+
* 1. Request attestation token (burns 1 DEM) → get tokenId + proxyUrl
|
|
10
|
+
* 2. Perform attestation using the proxy
|
|
11
|
+
* 3. Store proof on-chain or IPFS (burns 1 + ceil(size/1024) DEM)
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { TLSNotaryService } from '@kynesyslabs/demosdk/tlsnotary';
|
|
16
|
+
*
|
|
17
|
+
* const demos = new Demos();
|
|
18
|
+
* await demos.connect('https://node.demos.sh');
|
|
19
|
+
* await demos.connectWallet(mnemonic);
|
|
20
|
+
*
|
|
21
|
+
* const service = new TLSNotaryService(demos);
|
|
22
|
+
*
|
|
23
|
+
* // Request attestation token
|
|
24
|
+
* const { proxyUrl, tokenId } = await service.requestAttestation({
|
|
25
|
+
* targetUrl: 'https://api.github.com/users/octocat'
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Perform attestation (using TLSNotary class)
|
|
29
|
+
* const tlsn = await demos.tlsnotary();
|
|
30
|
+
* const result = await tlsn.attest({ url: targetUrl });
|
|
31
|
+
*
|
|
32
|
+
* // Store proof on-chain
|
|
33
|
+
* const { txHash } = await service.storeProof(
|
|
34
|
+
* tokenId,
|
|
35
|
+
* JSON.stringify(result.presentation),
|
|
36
|
+
* { storage: 'onchain' }
|
|
37
|
+
* );
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.TLSNotaryService = void 0;
|
|
42
|
+
const DemosTransactions_1 = require("../websdk/DemosTransactions");
|
|
43
|
+
const unifiedCrypto_1 = require("../encryption/unifiedCrypto");
|
|
44
|
+
/**
|
|
45
|
+
* TLSNotary Service for managing attestation tokens and proof storage
|
|
46
|
+
*/
|
|
47
|
+
class TLSNotaryService {
|
|
48
|
+
/**
|
|
49
|
+
* Create a new TLSNotaryService instance
|
|
50
|
+
*
|
|
51
|
+
* @param demos - Connected Demos instance with wallet
|
|
52
|
+
*/
|
|
53
|
+
constructor(demos) {
|
|
54
|
+
if (!demos.connected) {
|
|
55
|
+
throw new Error("Demos instance must be connected to a node");
|
|
56
|
+
}
|
|
57
|
+
if (!demos.walletConnected) {
|
|
58
|
+
throw new Error("Wallet must be connected to use TLSNotaryService");
|
|
59
|
+
}
|
|
60
|
+
this.demos = demos;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Request an attestation token for a target URL
|
|
64
|
+
*
|
|
65
|
+
* This submits a TLSN_REQUEST native transaction that burns 1 DEM
|
|
66
|
+
* and returns a token ID with a proxy URL for performing the attestation.
|
|
67
|
+
*
|
|
68
|
+
* @param options - Request options including target URL
|
|
69
|
+
* @returns Attestation token response with proxyUrl and tokenId
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const { proxyUrl, tokenId } = await service.requestAttestation({
|
|
74
|
+
* targetUrl: 'https://api.coingecko.com/api/v3/simple/price'
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
async requestAttestation(options) {
|
|
79
|
+
const { targetUrl } = options;
|
|
80
|
+
// Validate URL is HTTPS
|
|
81
|
+
const url = new URL(targetUrl);
|
|
82
|
+
if (url.protocol !== "https:") {
|
|
83
|
+
throw new Error("Only HTTPS URLs are supported for TLS attestation");
|
|
84
|
+
}
|
|
85
|
+
// 1. Create and submit TLSN_REQUEST native transaction (burns 1 DEM)
|
|
86
|
+
const tx = await this.createTlsnRequestTransaction(targetUrl);
|
|
87
|
+
// 2. Confirm and broadcast the transaction
|
|
88
|
+
const confirmResult = await DemosTransactions_1.DemosTransactions.confirm(tx, this.demos);
|
|
89
|
+
const broadcastResult = await DemosTransactions_1.DemosTransactions.broadcast(confirmResult, this.demos);
|
|
90
|
+
if (broadcastResult.result !== 200) {
|
|
91
|
+
throw new Error(`Failed to submit attestation request: ${broadcastResult.response?.message || "Unknown error"}`);
|
|
92
|
+
}
|
|
93
|
+
// 3. Extract tokenId from transaction result
|
|
94
|
+
const tokenId = broadcastResult.response?.tokenId || tx.hash;
|
|
95
|
+
// 4. Get owner address
|
|
96
|
+
const { publicKey } = await this.demos.crypto.getIdentity("ed25519");
|
|
97
|
+
const owner = (0, unifiedCrypto_1.uint8ArrayToHex)(publicKey);
|
|
98
|
+
// 5. Call nodeCall to get proxy URL
|
|
99
|
+
const proxyResponse = (await this.demos.nodeCall("requestTLSNproxy", {
|
|
100
|
+
tokenId,
|
|
101
|
+
owner,
|
|
102
|
+
targetUrl,
|
|
103
|
+
}));
|
|
104
|
+
if (!proxyResponse || !proxyResponse.websocketProxyUrl) {
|
|
105
|
+
throw new Error("Failed to get proxy URL from node");
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
proxyUrl: proxyResponse.websocketProxyUrl,
|
|
109
|
+
tokenId,
|
|
110
|
+
expiresAt: Date.now() + (proxyResponse.expiresIn || 30000),
|
|
111
|
+
retriesLeft: proxyResponse.retriesLeft ?? 3,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Store a TLSNotary proof on-chain or IPFS
|
|
116
|
+
*
|
|
117
|
+
* This submits a TLSN_STORE native transaction that burns:
|
|
118
|
+
* - 1 DEM base fee
|
|
119
|
+
* - 1 DEM per KB of proof data
|
|
120
|
+
*
|
|
121
|
+
* @param tokenId - The attestation token ID
|
|
122
|
+
* @param proof - The proof data (JSON string or serialized presentation)
|
|
123
|
+
* @param options - Storage options (on-chain or IPFS)
|
|
124
|
+
* @returns Storage response with transaction hash and fee
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const { txHash, storageFee } = await service.storeProof(
|
|
129
|
+
* tokenId,
|
|
130
|
+
* JSON.stringify(presentation),
|
|
131
|
+
* { storage: 'onchain' }
|
|
132
|
+
* );
|
|
133
|
+
* console.log(`Proof stored! Fee: ${storageFee} DEM`);
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
async storeProof(tokenId, proof, options) {
|
|
137
|
+
const { storage } = options;
|
|
138
|
+
// 1. Calculate storage fee
|
|
139
|
+
const proofSizeKB = Math.ceil(proof.length / 1024);
|
|
140
|
+
const storageFee = this.calculateStorageFee(proofSizeKB);
|
|
141
|
+
// 2. Create and submit TLSN_STORE native transaction
|
|
142
|
+
const tx = await this.createTlsnStoreTransaction(tokenId, proof, storage, storageFee);
|
|
143
|
+
// 3. Confirm and broadcast
|
|
144
|
+
const confirmResult = await DemosTransactions_1.DemosTransactions.confirm(tx, this.demos);
|
|
145
|
+
const broadcastResult = await DemosTransactions_1.DemosTransactions.broadcast(confirmResult, this.demos);
|
|
146
|
+
if (broadcastResult.result !== 200) {
|
|
147
|
+
throw new Error(`Failed to store proof: ${broadcastResult.response?.message || "Unknown error"}`);
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
txHash: tx.hash,
|
|
151
|
+
storageFee,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Calculate the storage fee for a proof
|
|
156
|
+
*
|
|
157
|
+
* Fee structure:
|
|
158
|
+
* - 1 DEM base fee
|
|
159
|
+
* - 1 DEM per KB of proof data
|
|
160
|
+
*
|
|
161
|
+
* @param proofSizeKB - Size of proof in kilobytes
|
|
162
|
+
* @returns Total fee in DEM
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const fee = service.calculateStorageFee(5); // 6 DEM for 5KB proof
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
calculateStorageFee(proofSizeKB) {
|
|
170
|
+
return 1 + proofSizeKB; // 1 DEM base + 1 DEM per KB
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get attestation token information by token ID
|
|
174
|
+
*
|
|
175
|
+
* @param tokenId - The attestation token ID
|
|
176
|
+
* @returns Token information or null if not found
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const token = await service.getToken(tokenId);
|
|
181
|
+
* if (token?.status === 'stored') {
|
|
182
|
+
* console.log('Proof already stored:', token.proofHash);
|
|
183
|
+
* }
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
async getToken(tokenId) {
|
|
187
|
+
const response = await this.demos.nodeCall("tlsnotary.getToken", {
|
|
188
|
+
tokenId,
|
|
189
|
+
});
|
|
190
|
+
if (!response || response.error) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
return response;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Get attestation token information by transaction hash
|
|
197
|
+
*
|
|
198
|
+
* @param txHash - The transaction hash of the TLSN_REQUEST transaction
|
|
199
|
+
* @returns Token information or null if not found
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const token = await service.getTokenByTxHash(txHash);
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
async getTokenByTxHash(txHash) {
|
|
207
|
+
const response = await this.demos.nodeCall("tlsnotary.getToken", {
|
|
208
|
+
txHash,
|
|
209
|
+
});
|
|
210
|
+
if (!response || response.error) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
return response;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Create a TLSN_REQUEST native transaction
|
|
217
|
+
* @internal
|
|
218
|
+
*/
|
|
219
|
+
async createTlsnRequestTransaction(targetUrl) {
|
|
220
|
+
const tx = DemosTransactions_1.DemosTransactions.empty();
|
|
221
|
+
const { publicKey } = await this.demos.crypto.getIdentity("ed25519");
|
|
222
|
+
const publicKeyHex = (0, unifiedCrypto_1.uint8ArrayToHex)(publicKey);
|
|
223
|
+
const nonce = await this.demos.getAddressNonce(publicKeyHex);
|
|
224
|
+
// Self-directed transaction (burns tokens)
|
|
225
|
+
tx.content.to = publicKeyHex;
|
|
226
|
+
tx.content.nonce = nonce + 1;
|
|
227
|
+
tx.content.amount = 1; // 1 DEM fee for attestation request
|
|
228
|
+
tx.content.type = "native";
|
|
229
|
+
tx.content.timestamp = Date.now();
|
|
230
|
+
tx.content.data = [
|
|
231
|
+
"native",
|
|
232
|
+
{
|
|
233
|
+
nativeOperation: "tlsn_request",
|
|
234
|
+
args: [targetUrl],
|
|
235
|
+
},
|
|
236
|
+
];
|
|
237
|
+
return await this.demos.sign(tx);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Create a TLSN_STORE native transaction
|
|
241
|
+
* @internal
|
|
242
|
+
*/
|
|
243
|
+
async createTlsnStoreTransaction(tokenId, proof, storageType, fee) {
|
|
244
|
+
const tx = DemosTransactions_1.DemosTransactions.empty();
|
|
245
|
+
const { publicKey } = await this.demos.crypto.getIdentity("ed25519");
|
|
246
|
+
const publicKeyHex = (0, unifiedCrypto_1.uint8ArrayToHex)(publicKey);
|
|
247
|
+
const nonce = await this.demos.getAddressNonce(publicKeyHex);
|
|
248
|
+
// Self-directed transaction (burns tokens)
|
|
249
|
+
tx.content.to = publicKeyHex;
|
|
250
|
+
tx.content.nonce = nonce + 1;
|
|
251
|
+
tx.content.amount = fee; // Storage fee
|
|
252
|
+
tx.content.type = "native";
|
|
253
|
+
tx.content.timestamp = Date.now();
|
|
254
|
+
tx.content.data = [
|
|
255
|
+
"native",
|
|
256
|
+
{
|
|
257
|
+
nativeOperation: "tlsn_store",
|
|
258
|
+
args: [tokenId, proof, storageType],
|
|
259
|
+
},
|
|
260
|
+
];
|
|
261
|
+
return await this.demos.sign(tx);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
exports.TLSNotaryService = TLSNotaryService;
|
|
265
|
+
exports.default = TLSNotaryService;
|
|
266
|
+
//# sourceMappingURL=TLSNotaryService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TLSNotaryService.js","sourceRoot":"","sources":["../../../src/tlsnotary/TLSNotaryService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;;AAGH,kEAA8D;AAC9D,8DAA4D;AAkE5D;;GAEG;AACH,MAAa,gBAAgB;IAGzB;;;;OAIG;IACH,YAAY,KAAY;QACpB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAA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AAG,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;AAvRD,4CAuRC;AAED,kBAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLSNotary Helper Functions
|
|
3
|
+
*
|
|
4
|
+
* Standalone utility functions for TLSNotary operations.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Calculate the storage fee for a TLSNotary proof
|
|
8
|
+
*
|
|
9
|
+
* Fee structure:
|
|
10
|
+
* - 1 DEM base fee
|
|
11
|
+
* - 1 DEM per KB of proof data
|
|
12
|
+
*
|
|
13
|
+
* @param proofSizeKB - Size of proof in kilobytes
|
|
14
|
+
* @returns Total fee in DEM
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { calculateStorageFee } from '@kynesyslabs/demosdk/tlsnotary';
|
|
19
|
+
*
|
|
20
|
+
* const proofSize = Math.ceil(proof.length / 1024);
|
|
21
|
+
* const fee = calculateStorageFee(proofSize); // e.g., 6 DEM for 5KB
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function calculateStorageFee(proofSizeKB: number): number;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TLSNotary Helper Functions
|
|
4
|
+
*
|
|
5
|
+
* Standalone utility functions for TLSNotary operations.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.calculateStorageFee = calculateStorageFee;
|
|
9
|
+
/**
|
|
10
|
+
* Calculate the storage fee for a TLSNotary proof
|
|
11
|
+
*
|
|
12
|
+
* Fee structure:
|
|
13
|
+
* - 1 DEM base fee
|
|
14
|
+
* - 1 DEM per KB of proof data
|
|
15
|
+
*
|
|
16
|
+
* @param proofSizeKB - Size of proof in kilobytes
|
|
17
|
+
* @returns Total fee in DEM
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { calculateStorageFee } from '@kynesyslabs/demosdk/tlsnotary';
|
|
22
|
+
*
|
|
23
|
+
* const proofSize = Math.ceil(proof.length / 1024);
|
|
24
|
+
* const fee = calculateStorageFee(proofSize); // e.g., 6 DEM for 5KB
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
function calculateStorageFee(proofSizeKB) {
|
|
28
|
+
return 1 + proofSizeKB; // 1 DEM base + 1 DEM per KB
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/tlsnotary/helpers.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAoBH,kDAEC;AApBD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,mBAAmB,CAAC,WAAmB;IACnD,OAAO,CAAC,GAAG,WAAW,CAAA,CAAC,4BAA4B;AACvD,CAAC"}
|
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TLSNotary SDK Module
|
|
3
3
|
*
|
|
4
|
-
* Browser-based HTTPS attestation using MPC-TLS.
|
|
4
|
+
* Browser-based HTTPS attestation using MPC-TLS with token-based management.
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
* @module tlsnotary
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```typescript
|
|
11
|
-
* import { TLSNotary } from '@kynesyslabs/demosdk/tlsnotary';
|
|
11
|
+
* import { TLSNotary, TLSNotaryService } from '@kynesyslabs/demosdk/tlsnotary';
|
|
12
12
|
*
|
|
13
|
-
* // Option 1: Via Demos instance (recommended - auto-configures dynamic proxies)
|
|
14
13
|
* const demos = new Demos();
|
|
15
14
|
* await demos.connect('https://node.demos.sh');
|
|
16
|
-
*
|
|
15
|
+
* await demos.connectWallet(mnemonic);
|
|
17
16
|
*
|
|
18
|
-
* //
|
|
19
|
-
* const
|
|
20
|
-
* notaryUrl: 'wss://node.demos.sh:7047',
|
|
21
|
-
* rpcUrl: 'https://node.demos.sh', // For dynamic proxy allocation
|
|
22
|
-
* });
|
|
17
|
+
* // Token-based flow (recommended for production)
|
|
18
|
+
* const service = new TLSNotaryService(demos);
|
|
23
19
|
*
|
|
24
|
-
*
|
|
20
|
+
* // 1. Request attestation token (burns 1 DEM)
|
|
21
|
+
* const { proxyUrl, tokenId } = await service.requestAttestation({
|
|
22
|
+
* targetUrl: 'https://api.github.com/users/octocat'
|
|
23
|
+
* });
|
|
25
24
|
*
|
|
25
|
+
* // 2. Perform attestation
|
|
26
|
+
* const tlsn = await demos.tlsnotary();
|
|
26
27
|
* const result = await tlsn.attest({
|
|
27
28
|
* url: 'https://api.github.com/users/octocat',
|
|
28
29
|
* });
|
|
29
30
|
*
|
|
30
|
-
*
|
|
31
|
+
* // 3. Store proof on-chain (burns 1 + proof_size_kb DEM)
|
|
32
|
+
* const { txHash } = await service.storeProof(
|
|
33
|
+
* tokenId,
|
|
34
|
+
* JSON.stringify(result.presentation),
|
|
35
|
+
* { storage: 'onchain' }
|
|
36
|
+
* );
|
|
37
|
+
*
|
|
38
|
+
* console.log('Proof stored:', txHash);
|
|
31
39
|
* ```
|
|
32
40
|
*/
|
|
33
41
|
export { TLSNotary } from "./TLSNotary";
|
|
42
|
+
export { TLSNotaryService, type AttestationTokenResponse, type StoreProofResponse, type TLSNotaryToken, type RequestAttestationOptions, type StoreProofOptions, } from "./TLSNotaryService";
|
|
34
43
|
export type { TLSNotaryConfig, TLSNotaryDiscoveryInfo, AttestRequest, AttestResult, AttestOptions, CommitRanges, Range, PresentationJSON, VerificationResult, TranscriptInfo, StatusCallback, ProxyRequestResponse, ProxyRequestError, } from "./types";
|
|
35
44
|
export { default } from "./TLSNotary";
|
|
45
|
+
export { calculateStorageFee } from "./helpers";
|
package/build/tlsnotary/index.js
CHANGED
|
@@ -2,43 +2,58 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* TLSNotary SDK Module
|
|
4
4
|
*
|
|
5
|
-
* Browser-based HTTPS attestation using MPC-TLS.
|
|
5
|
+
* Browser-based HTTPS attestation using MPC-TLS with token-based management.
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
* @module tlsnotary
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
|
-
* import { TLSNotary } from '@kynesyslabs/demosdk/tlsnotary';
|
|
12
|
+
* import { TLSNotary, TLSNotaryService } from '@kynesyslabs/demosdk/tlsnotary';
|
|
13
13
|
*
|
|
14
|
-
* // Option 1: Via Demos instance (recommended - auto-configures dynamic proxies)
|
|
15
14
|
* const demos = new Demos();
|
|
16
15
|
* await demos.connect('https://node.demos.sh');
|
|
17
|
-
*
|
|
16
|
+
* await demos.connectWallet(mnemonic);
|
|
18
17
|
*
|
|
19
|
-
* //
|
|
20
|
-
* const
|
|
21
|
-
* notaryUrl: 'wss://node.demos.sh:7047',
|
|
22
|
-
* rpcUrl: 'https://node.demos.sh', // For dynamic proxy allocation
|
|
23
|
-
* });
|
|
18
|
+
* // Token-based flow (recommended for production)
|
|
19
|
+
* const service = new TLSNotaryService(demos);
|
|
24
20
|
*
|
|
25
|
-
*
|
|
21
|
+
* // 1. Request attestation token (burns 1 DEM)
|
|
22
|
+
* const { proxyUrl, tokenId } = await service.requestAttestation({
|
|
23
|
+
* targetUrl: 'https://api.github.com/users/octocat'
|
|
24
|
+
* });
|
|
26
25
|
*
|
|
26
|
+
* // 2. Perform attestation
|
|
27
|
+
* const tlsn = await demos.tlsnotary();
|
|
27
28
|
* const result = await tlsn.attest({
|
|
28
29
|
* url: 'https://api.github.com/users/octocat',
|
|
29
30
|
* });
|
|
30
31
|
*
|
|
31
|
-
*
|
|
32
|
+
* // 3. Store proof on-chain (burns 1 + proof_size_kb DEM)
|
|
33
|
+
* const { txHash } = await service.storeProof(
|
|
34
|
+
* tokenId,
|
|
35
|
+
* JSON.stringify(result.presentation),
|
|
36
|
+
* { storage: 'onchain' }
|
|
37
|
+
* );
|
|
38
|
+
*
|
|
39
|
+
* console.log('Proof stored:', txHash);
|
|
32
40
|
* ```
|
|
33
41
|
*/
|
|
34
42
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
43
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
44
|
};
|
|
37
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.default = exports.TLSNotary = void 0;
|
|
46
|
+
exports.calculateStorageFee = exports.default = exports.TLSNotaryService = exports.TLSNotary = void 0;
|
|
47
|
+
// Core TLSNotary class for attestation
|
|
39
48
|
var TLSNotary_1 = require("./TLSNotary");
|
|
40
49
|
Object.defineProperty(exports, "TLSNotary", { enumerable: true, get: function () { return TLSNotary_1.TLSNotary; } });
|
|
50
|
+
// TLSNotary Service for token management and proof storage
|
|
51
|
+
var TLSNotaryService_1 = require("./TLSNotaryService");
|
|
52
|
+
Object.defineProperty(exports, "TLSNotaryService", { enumerable: true, get: function () { return TLSNotaryService_1.TLSNotaryService; } });
|
|
41
53
|
// Re-export default
|
|
42
54
|
var TLSNotary_2 = require("./TLSNotary");
|
|
43
55
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(TLSNotary_2).default; } });
|
|
56
|
+
// Helper function exports
|
|
57
|
+
var helpers_1 = require("./helpers");
|
|
58
|
+
Object.defineProperty(exports, "calculateStorageFee", { enumerable: true, get: function () { return helpers_1.calculateStorageFee; } });
|
|
44
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tlsnotary/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tlsnotary/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;;;;;;AAEH,uCAAuC;AACvC,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,2DAA2D;AAC3D,uDAO2B;AANvB,oHAAA,gBAAgB,OAAA;AAyBpB,oBAAoB;AACpB,yCAAqC;AAA5B,qHAAA,OAAO,OAAA;AAEhB,0BAA0B;AAC1B,qCAA+C;AAAtC,8GAAA,mBAAmB,OAAA"}
|
|
@@ -132,4 +132,21 @@ export interface GCREditEscrow {
|
|
|
132
132
|
txhash: string;
|
|
133
133
|
isRollback: boolean;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
/**
|
|
136
|
+
* TLSNotary attestation storage GCR edit
|
|
137
|
+
*/
|
|
138
|
+
export interface GCREditTLSNotary {
|
|
139
|
+
type: "tlsnotary";
|
|
140
|
+
operation: "store";
|
|
141
|
+
account: string;
|
|
142
|
+
data: {
|
|
143
|
+
tokenId: string;
|
|
144
|
+
domain: string;
|
|
145
|
+
proof: string;
|
|
146
|
+
storageType: "onchain" | "ipfs";
|
|
147
|
+
timestamp: number;
|
|
148
|
+
};
|
|
149
|
+
txhash: string;
|
|
150
|
+
isRollback: boolean;
|
|
151
|
+
}
|
|
152
|
+
export type GCREdit = GCREditBalance | GCREditNonce | GCREditAssign | GCREditAssignIdentity | GCREditSubnetsTx | GCREditIdentity | GCREditSmartContract | GCREditStorageProgram | GCREditEscrow | GCREditTLSNotary;
|
|
@@ -6,5 +6,9 @@ interface INativeTlsnRequest {
|
|
|
6
6
|
nativeOperation: "tlsn_request";
|
|
7
7
|
args: [string];
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface INativeTlsnStore {
|
|
10
|
+
nativeOperation: "tlsn_store";
|
|
11
|
+
args: [string, string, "onchain" | "ipfs"];
|
|
12
|
+
}
|
|
13
|
+
export type INativePayload = INativeSend | INativeTlsnRequest | INativeTlsnStore;
|
|
10
14
|
export {};
|
package/package.json
CHANGED