@kynesyslabs/demosdk 2.4.25 → 2.5.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/build/abstraction/index.d.ts +2 -2
- package/build/abstraction/index.js.map +1 -1
- package/build/d402/client/D402Client.d.ts +47 -0
- package/build/d402/client/D402Client.js +159 -0
- package/build/d402/client/D402Client.js.map +1 -0
- package/build/d402/client/index.d.ts +6 -0
- package/build/d402/client/index.js +10 -0
- package/build/d402/client/index.js.map +1 -0
- package/build/d402/client/types.d.ts +30 -0
- package/build/d402/client/types.js +7 -0
- package/build/d402/client/types.js.map +1 -0
- package/build/d402/index.d.ts +7 -0
- package/build/d402/index.js +27 -0
- package/build/d402/index.js.map +1 -0
- package/build/d402/server/D402Server.d.ts +42 -0
- package/build/d402/server/D402Server.js +156 -0
- package/build/d402/server/D402Server.js.map +1 -0
- package/build/d402/server/index.d.ts +8 -0
- package/build/d402/server/index.js +12 -0
- package/build/d402/server/index.js.map +1 -0
- package/build/d402/server/middleware.d.ts +54 -0
- package/build/d402/server/middleware.js +97 -0
- package/build/d402/server/middleware.js.map +1 -0
- package/build/d402/server/types.d.ts +49 -0
- package/build/d402/server/types.js +7 -0
- package/build/d402/server/types.js.map +1 -0
- package/build/encryption/zK/identity/CommitmentService.d.ts +48 -0
- package/build/encryption/zK/identity/CommitmentService.js +120 -0
- package/build/encryption/zK/identity/CommitmentService.js.map +1 -0
- package/build/encryption/zK/identity/ProofGenerator.d.ts +57 -0
- package/build/encryption/zK/identity/ProofGenerator.js +151 -0
- package/build/encryption/zK/identity/ProofGenerator.js.map +1 -0
- package/build/encryption/zK/identity/ZKIdentity.d.ts +141 -0
- package/build/encryption/zK/identity/ZKIdentity.js +231 -0
- package/build/encryption/zK/identity/ZKIdentity.js.map +1 -0
- package/build/encryption/zK/identity/index.d.ts +12 -0
- package/build/encryption/zK/identity/index.js +48 -0
- package/build/encryption/zK/identity/index.js.map +1 -0
- package/build/encryption/zK/index.d.ts +1 -0
- package/build/encryption/zK/index.js +3 -1
- package/build/encryption/zK/index.js.map +1 -1
- package/package.json +5 -2
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZKIdentity - User-facing API for ZK identity system
|
|
3
|
+
*
|
|
4
|
+
* REVIEW: Phase 9 - SDK Integration
|
|
5
|
+
*
|
|
6
|
+
* Provides a simple interface for users to:
|
|
7
|
+
* 1. Create identity commitments
|
|
8
|
+
* 2. Generate ZK attestation proofs
|
|
9
|
+
* 3. Interact with node RPC endpoints
|
|
10
|
+
*/
|
|
11
|
+
import * as ProofGenerator from './ProofGenerator';
|
|
12
|
+
export interface IdentityCommitmentPayload {
|
|
13
|
+
commitment_hash: string;
|
|
14
|
+
provider: string;
|
|
15
|
+
timestamp: number;
|
|
16
|
+
}
|
|
17
|
+
export interface IdentityAttestationPayload {
|
|
18
|
+
nullifier_hash: string;
|
|
19
|
+
merkle_root: string;
|
|
20
|
+
proof: ProofGenerator.ZKProof;
|
|
21
|
+
public_signals: string[];
|
|
22
|
+
provider: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* ZKIdentity class for privacy-preserving identity attestations
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Create identity
|
|
30
|
+
* const identity = new ZKIdentity('github:12345')
|
|
31
|
+
*
|
|
32
|
+
* // Get commitment (safe to share publicly)
|
|
33
|
+
* const commitment = identity.getCommitment()
|
|
34
|
+
*
|
|
35
|
+
* // Create commitment transaction
|
|
36
|
+
* const commitmentTx = await identity.createCommitmentTransaction('http://localhost:3000')
|
|
37
|
+
*
|
|
38
|
+
* // Later: Create anonymous attestation
|
|
39
|
+
* const attestationTx = await identity.createAttestationTransaction(
|
|
40
|
+
* 'http://localhost:3000',
|
|
41
|
+
* 'dao_vote_123'
|
|
42
|
+
* )
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare class ZKIdentity {
|
|
46
|
+
private providerId;
|
|
47
|
+
private secret;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new ZK identity
|
|
50
|
+
*
|
|
51
|
+
* @param providerId - Provider identifier (e.g., "github:12345", "discord:67890")
|
|
52
|
+
* @param secret - Optional secret (will be generated if not provided)
|
|
53
|
+
*
|
|
54
|
+
* WARNING: Keep the secret secure! Store it encrypted in local storage.
|
|
55
|
+
* If lost, you cannot create attestations for this commitment.
|
|
56
|
+
*/
|
|
57
|
+
constructor(providerId: string, secret?: string);
|
|
58
|
+
/**
|
|
59
|
+
* Get the identity commitment hash
|
|
60
|
+
*
|
|
61
|
+
* This is safe to share publicly and will be stored in the Merkle tree.
|
|
62
|
+
*
|
|
63
|
+
* @returns Commitment hash as string
|
|
64
|
+
*/
|
|
65
|
+
getCommitment(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Get the provider name from provider ID
|
|
68
|
+
*
|
|
69
|
+
* @returns Provider name (e.g., "github", "discord")
|
|
70
|
+
*/
|
|
71
|
+
getProvider(): string;
|
|
72
|
+
/**
|
|
73
|
+
* Get the secret (use with caution!)
|
|
74
|
+
*
|
|
75
|
+
* @returns The secret value
|
|
76
|
+
*
|
|
77
|
+
* WARNING: Never transmit this over the network!
|
|
78
|
+
*/
|
|
79
|
+
getSecret(): string;
|
|
80
|
+
/**
|
|
81
|
+
* Create a commitment transaction to submit to the node
|
|
82
|
+
*
|
|
83
|
+
* This adds your commitment to the global Merkle tree.
|
|
84
|
+
* You must submit this transaction before you can create attestations.
|
|
85
|
+
*
|
|
86
|
+
* @param rpcUrl - Node RPC URL
|
|
87
|
+
* @returns Commitment transaction payload
|
|
88
|
+
*/
|
|
89
|
+
createCommitmentTransaction(rpcUrl: string): Promise<IdentityCommitmentPayload>;
|
|
90
|
+
/**
|
|
91
|
+
* Create an anonymous attestation transaction
|
|
92
|
+
*
|
|
93
|
+
* This proves you have a valid identity commitment in the Merkle tree
|
|
94
|
+
* without revealing which one. Uses ZK-SNARKs for privacy.
|
|
95
|
+
*
|
|
96
|
+
* @param rpcUrl - Node RPC URL
|
|
97
|
+
* @param context - Context string for this attestation (e.g., "dao_vote_123")
|
|
98
|
+
* @returns Attestation transaction payload
|
|
99
|
+
*
|
|
100
|
+
* NOTE: Each context can only be used once per identity (nullifier prevents reuse)
|
|
101
|
+
*/
|
|
102
|
+
createAttestationTransaction(rpcUrl: string, context: string): Promise<IdentityAttestationPayload>;
|
|
103
|
+
/**
|
|
104
|
+
* Verify an attestation locally (optional - for testing)
|
|
105
|
+
*
|
|
106
|
+
* @param attestation - Attestation payload to verify
|
|
107
|
+
* @returns True if valid
|
|
108
|
+
*
|
|
109
|
+
* NOTE: Node will verify proofs server-side, this is mainly for debugging
|
|
110
|
+
*/
|
|
111
|
+
static verifyAttestation(attestation: IdentityAttestationPayload): Promise<boolean>;
|
|
112
|
+
/**
|
|
113
|
+
* Export identity for backup
|
|
114
|
+
*
|
|
115
|
+
* @returns Object containing provider ID and secret
|
|
116
|
+
*
|
|
117
|
+
* WARNING: Store this securely! Anyone with this data can create
|
|
118
|
+
* attestations as you.
|
|
119
|
+
*/
|
|
120
|
+
export(): {
|
|
121
|
+
providerId: string;
|
|
122
|
+
secret: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Import identity from backup
|
|
126
|
+
*
|
|
127
|
+
* @param data - Exported identity data
|
|
128
|
+
* @returns New ZKIdentity instance
|
|
129
|
+
*/
|
|
130
|
+
static import(data: {
|
|
131
|
+
providerId: string;
|
|
132
|
+
secret: string;
|
|
133
|
+
}): ZKIdentity;
|
|
134
|
+
/**
|
|
135
|
+
* Generate a fresh identity with random secret
|
|
136
|
+
*
|
|
137
|
+
* @param providerId - Provider identifier
|
|
138
|
+
* @returns New ZKIdentity instance
|
|
139
|
+
*/
|
|
140
|
+
static generate(providerId: string): ZKIdentity;
|
|
141
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ZKIdentity - User-facing API for ZK identity system
|
|
4
|
+
*
|
|
5
|
+
* REVIEW: Phase 9 - SDK Integration
|
|
6
|
+
*
|
|
7
|
+
* Provides a simple interface for users to:
|
|
8
|
+
* 1. Create identity commitments
|
|
9
|
+
* 2. Generate ZK attestation proofs
|
|
10
|
+
* 3. Interact with node RPC endpoints
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.ZKIdentity = void 0;
|
|
47
|
+
const CommitmentService = __importStar(require("./CommitmentService"));
|
|
48
|
+
const ProofGenerator = __importStar(require("./ProofGenerator"));
|
|
49
|
+
/**
|
|
50
|
+
* ZKIdentity class for privacy-preserving identity attestations
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* // Create identity
|
|
55
|
+
* const identity = new ZKIdentity('github:12345')
|
|
56
|
+
*
|
|
57
|
+
* // Get commitment (safe to share publicly)
|
|
58
|
+
* const commitment = identity.getCommitment()
|
|
59
|
+
*
|
|
60
|
+
* // Create commitment transaction
|
|
61
|
+
* const commitmentTx = await identity.createCommitmentTransaction('http://localhost:3000')
|
|
62
|
+
*
|
|
63
|
+
* // Later: Create anonymous attestation
|
|
64
|
+
* const attestationTx = await identity.createAttestationTransaction(
|
|
65
|
+
* 'http://localhost:3000',
|
|
66
|
+
* 'dao_vote_123'
|
|
67
|
+
* )
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
class ZKIdentity {
|
|
71
|
+
/**
|
|
72
|
+
* Create a new ZK identity
|
|
73
|
+
*
|
|
74
|
+
* @param providerId - Provider identifier (e.g., "github:12345", "discord:67890")
|
|
75
|
+
* @param secret - Optional secret (will be generated if not provided)
|
|
76
|
+
*
|
|
77
|
+
* WARNING: Keep the secret secure! Store it encrypted in local storage.
|
|
78
|
+
* If lost, you cannot create attestations for this commitment.
|
|
79
|
+
*/
|
|
80
|
+
constructor(providerId, secret) {
|
|
81
|
+
this.providerId = providerId;
|
|
82
|
+
this.secret = secret || CommitmentService.generateSecret();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get the identity commitment hash
|
|
86
|
+
*
|
|
87
|
+
* This is safe to share publicly and will be stored in the Merkle tree.
|
|
88
|
+
*
|
|
89
|
+
* @returns Commitment hash as string
|
|
90
|
+
*/
|
|
91
|
+
getCommitment() {
|
|
92
|
+
return CommitmentService.generateCommitment(this.providerId, this.secret);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get the provider name from provider ID
|
|
96
|
+
*
|
|
97
|
+
* @returns Provider name (e.g., "github", "discord")
|
|
98
|
+
*/
|
|
99
|
+
getProvider() {
|
|
100
|
+
return this.providerId.split(':')[0];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get the secret (use with caution!)
|
|
104
|
+
*
|
|
105
|
+
* @returns The secret value
|
|
106
|
+
*
|
|
107
|
+
* WARNING: Never transmit this over the network!
|
|
108
|
+
*/
|
|
109
|
+
getSecret() {
|
|
110
|
+
return this.secret;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Create a commitment transaction to submit to the node
|
|
114
|
+
*
|
|
115
|
+
* This adds your commitment to the global Merkle tree.
|
|
116
|
+
* You must submit this transaction before you can create attestations.
|
|
117
|
+
*
|
|
118
|
+
* @param rpcUrl - Node RPC URL
|
|
119
|
+
* @returns Commitment transaction payload
|
|
120
|
+
*/
|
|
121
|
+
async createCommitmentTransaction(rpcUrl) {
|
|
122
|
+
const commitment = this.getCommitment();
|
|
123
|
+
const payload = {
|
|
124
|
+
commitment_hash: commitment,
|
|
125
|
+
provider: this.getProvider(),
|
|
126
|
+
timestamp: Date.now(),
|
|
127
|
+
};
|
|
128
|
+
return payload;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Create an anonymous attestation transaction
|
|
132
|
+
*
|
|
133
|
+
* This proves you have a valid identity commitment in the Merkle tree
|
|
134
|
+
* without revealing which one. Uses ZK-SNARKs for privacy.
|
|
135
|
+
*
|
|
136
|
+
* @param rpcUrl - Node RPC URL
|
|
137
|
+
* @param context - Context string for this attestation (e.g., "dao_vote_123")
|
|
138
|
+
* @returns Attestation transaction payload
|
|
139
|
+
*
|
|
140
|
+
* NOTE: Each context can only be used once per identity (nullifier prevents reuse)
|
|
141
|
+
*/
|
|
142
|
+
async createAttestationTransaction(rpcUrl, context) {
|
|
143
|
+
// 1. Check if commitment exists in Merkle tree
|
|
144
|
+
const commitment = this.getCommitment();
|
|
145
|
+
// 2. Fetch Merkle proof for our commitment
|
|
146
|
+
const proofResponse = await fetch(`${rpcUrl}/zk/merkle/proof/${commitment}`);
|
|
147
|
+
if (!proofResponse.ok) {
|
|
148
|
+
const error = await proofResponse.json();
|
|
149
|
+
throw new Error(`Failed to get Merkle proof: ${error.error || 'Unknown error'}`);
|
|
150
|
+
}
|
|
151
|
+
const proofData = await proofResponse.json();
|
|
152
|
+
const merkleProof = {
|
|
153
|
+
siblings: proofData.proof.siblings,
|
|
154
|
+
pathIndices: proofData.proof.pathIndices,
|
|
155
|
+
root: proofData.proof.root,
|
|
156
|
+
leaf: proofData.proof.leaf || commitment,
|
|
157
|
+
};
|
|
158
|
+
// 3. Fetch current Merkle root
|
|
159
|
+
const rootResponse = await fetch(`${rpcUrl}/zk/merkle-root`);
|
|
160
|
+
if (!rootResponse.ok) {
|
|
161
|
+
throw new Error('Failed to get Merkle root');
|
|
162
|
+
}
|
|
163
|
+
const rootData = await rootResponse.json();
|
|
164
|
+
const merkleRoot = rootData.rootHash;
|
|
165
|
+
// 4. Check if nullifier has been used for this context
|
|
166
|
+
const nullifier = CommitmentService.generateNullifier(this.providerId, context);
|
|
167
|
+
const nullifierResponse = await fetch(`${rpcUrl}/zk/nullifier/${nullifier}`);
|
|
168
|
+
if (nullifierResponse.ok) {
|
|
169
|
+
const nullifierData = await nullifierResponse.json();
|
|
170
|
+
if (nullifierData.used) {
|
|
171
|
+
throw new Error(`Nullifier already used for context "${context}". Each identity can only attest once per context.`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// 5. Generate ZK proof
|
|
175
|
+
const { proof, publicSignals } = await ProofGenerator.generateIdentityProof(this.providerId, this.secret, context, merkleProof, merkleRoot);
|
|
176
|
+
// 6. Create attestation payload
|
|
177
|
+
const payload = {
|
|
178
|
+
nullifier_hash: publicSignals[0],
|
|
179
|
+
merkle_root: publicSignals[1],
|
|
180
|
+
proof,
|
|
181
|
+
public_signals: publicSignals,
|
|
182
|
+
provider: this.getProvider(),
|
|
183
|
+
};
|
|
184
|
+
return payload;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Verify an attestation locally (optional - for testing)
|
|
188
|
+
*
|
|
189
|
+
* @param attestation - Attestation payload to verify
|
|
190
|
+
* @returns True if valid
|
|
191
|
+
*
|
|
192
|
+
* NOTE: Node will verify proofs server-side, this is mainly for debugging
|
|
193
|
+
*/
|
|
194
|
+
static async verifyAttestation(attestation) {
|
|
195
|
+
return await ProofGenerator.verifyProof(attestation.proof, attestation.public_signals);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Export identity for backup
|
|
199
|
+
*
|
|
200
|
+
* @returns Object containing provider ID and secret
|
|
201
|
+
*
|
|
202
|
+
* WARNING: Store this securely! Anyone with this data can create
|
|
203
|
+
* attestations as you.
|
|
204
|
+
*/
|
|
205
|
+
export() {
|
|
206
|
+
return {
|
|
207
|
+
providerId: this.providerId,
|
|
208
|
+
secret: this.secret,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Import identity from backup
|
|
213
|
+
*
|
|
214
|
+
* @param data - Exported identity data
|
|
215
|
+
* @returns New ZKIdentity instance
|
|
216
|
+
*/
|
|
217
|
+
static import(data) {
|
|
218
|
+
return new ZKIdentity(data.providerId, data.secret);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Generate a fresh identity with random secret
|
|
222
|
+
*
|
|
223
|
+
* @param providerId - Provider identifier
|
|
224
|
+
* @returns New ZKIdentity instance
|
|
225
|
+
*/
|
|
226
|
+
static generate(providerId) {
|
|
227
|
+
return new ZKIdentity(providerId);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
exports.ZKIdentity = ZKIdentity;
|
|
231
|
+
//# sourceMappingURL=ZKIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZKIdentity.js","sourceRoot":"","sources":["../../../../../src/encryption/zK/identity/ZKIdentity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uEAAwD;AACxD,iEAAkD;AAgBlD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,UAAU;IAInB;;;;;;;;OAQG;IACH,YAAY,UAAkB,EAAE,MAAe;QAC3C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,iBAAiB,CAAC,cAAc,EAAE,CAAA;IAC9D,CAAC;IAED;;;;;;OAMG;IACH,aAAa;QACT,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAC7E,CAAC;IAED;;;;OAIG;IACH,WAAW;QACP,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACxC,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACL,OAAO,IAAI,CAAC,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,2BAA2B,CAC7B,MAAc;QAEd,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QAEvC,MAAM,OAAO,GAA8B;YACvC,eAAe,EAAE,UAAU;YAC3B,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;YAC5B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACxB,CAAA;QAED,OAAO,OAAO,CAAA;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,4BAA4B,CAC9B,MAAc,EACd,OAAe;QAEf,+CAA+C;QAC/C,MAA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
|
|
1
|
+
/**
|
|
2
|
+
* ZK Identity Module
|
|
3
|
+
*
|
|
4
|
+
* REVIEW: Phase 9 - SDK Integration
|
|
5
|
+
*
|
|
6
|
+
* Provides privacy-preserving identity attestations using ZK-SNARKs.
|
|
7
|
+
*/
|
|
8
|
+
export * as CommitmentService from './CommitmentService';
|
|
9
|
+
export * as ProofGenerator from './ProofGenerator';
|
|
10
|
+
export { ZKIdentity } from './ZKIdentity';
|
|
11
|
+
export type { ZKProof, ProofGenerationResult, MerkleProof, } from './ProofGenerator';
|
|
12
|
+
export type { IdentityCommitmentPayload, IdentityAttestationPayload, } from './ZKIdentity';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ZK Identity Module
|
|
4
|
+
*
|
|
5
|
+
* REVIEW: Phase 9 - SDK Integration
|
|
6
|
+
*
|
|
7
|
+
* Provides privacy-preserving identity attestations using ZK-SNARKs.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.ZKIdentity = exports.ProofGenerator = exports.CommitmentService = void 0;
|
|
44
|
+
exports.CommitmentService = __importStar(require("./CommitmentService"));
|
|
45
|
+
exports.ProofGenerator = __importStar(require("./ProofGenerator"));
|
|
46
|
+
var ZKIdentity_1 = require("./ZKIdentity");
|
|
47
|
+
Object.defineProperty(exports, "ZKIdentity", { enumerable: true, get: function () { return ZKIdentity_1.ZKIdentity; } });
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/encryption/zK/identity/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yEAAwD;AACxD,mEAAkD;AAClD,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
|
|
@@ -33,6 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.interactive = void 0;
|
|
36
|
+
exports.identity = exports.interactive = void 0;
|
|
37
37
|
exports.interactive = __importStar(require("./interactive")); // interactive.Prover and interactive.Verifier
|
|
38
|
+
// REVIEW: Phase 9 - SDK Integration - ZK Identity attestations
|
|
39
|
+
exports.identity = __importStar(require("./identity"));
|
|
38
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/encryption/zK/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA4C,CAAC,8CAA8C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/encryption/zK/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA4C,CAAC,8CAA8C;AAC3F,+DAA+D;AAC/D,uDAAsC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kynesyslabs/demosdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
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",
|
|
@@ -33,7 +33,10 @@
|
|
|
33
33
|
"./utils": "./build/utils/index.js",
|
|
34
34
|
"./encryption": "./build/encryption/index.js",
|
|
35
35
|
"./bridge": "./build/bridge/index.js",
|
|
36
|
-
"./storage": "./build/storage/index.js"
|
|
36
|
+
"./storage": "./build/storage/index.js",
|
|
37
|
+
"./d402": "./build/d402/index.js",
|
|
38
|
+
"./d402/server": "./build/d402/server/index.js",
|
|
39
|
+
"./d402/client": "./build/d402/client/index.js"
|
|
37
40
|
},
|
|
38
41
|
"scripts": {
|
|
39
42
|
"postinstall": "cp .github/hooks/pre-commit .git/hooks/pre-commit 2>/dev/null && chmod +x .git/hooks/pre-commit 2>/dev/null || true",
|