noah-clarity 0.1.0 → 0.2.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/dist/proof.d.ts +16 -7
- package/dist/proof.js +25 -12
- package/dist/types.d.ts +9 -0
- package/package.json +1 -1
package/dist/proof.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Proof generation and verification utilities
|
|
3
3
|
*/
|
|
4
|
-
import { ProofRequest, ProofResponse, AttestationRequest, AttestationResponse, SDKConfig } from './types';
|
|
4
|
+
import { ProofRequest, ProofResponse, AttestationRequest, AttestationResponse, SDKConfig, ProtocolRequirements } from './types';
|
|
5
5
|
export declare class ProofService {
|
|
6
6
|
private proverServiceUrl;
|
|
7
7
|
private attesterServiceUrl;
|
|
@@ -19,11 +19,20 @@ export declare class ProofService {
|
|
|
19
19
|
*/
|
|
20
20
|
requestAttestation(request: AttestationRequest): Promise<AttestationResponse>;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* Generate a proof matching protocol-specific requirements
|
|
23
|
+
*
|
|
24
|
+
* Takes user credential data and protocol requirements, then constructs
|
|
25
|
+
* a ProofRequest with protocol requirements as public inputs.
|
|
26
|
+
*
|
|
27
|
+
* @param userCredential User's credential data (private inputs)
|
|
28
|
+
* @param protocolRequirements Protocol's KYC requirements (public inputs)
|
|
29
|
+
* @returns Proof response with proof and public inputs
|
|
27
30
|
*/
|
|
28
|
-
|
|
31
|
+
generateProofForProtocol(userCredential: {
|
|
32
|
+
age: string;
|
|
33
|
+
jurisdiction: string;
|
|
34
|
+
is_accredited: string;
|
|
35
|
+
identity_data: string;
|
|
36
|
+
nonce: string;
|
|
37
|
+
}, protocolRequirements: ProtocolRequirements): Promise<ProofResponse>;
|
|
29
38
|
}
|
package/dist/proof.js
CHANGED
|
@@ -64,19 +64,32 @@ class ProofService {
|
|
|
64
64
|
return data;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
67
|
+
* Generate a proof matching protocol-specific requirements
|
|
68
|
+
*
|
|
69
|
+
* Takes user credential data and protocol requirements, then constructs
|
|
70
|
+
* a ProofRequest with protocol requirements as public inputs.
|
|
71
|
+
*
|
|
72
|
+
* @param userCredential User's credential data (private inputs)
|
|
73
|
+
* @param protocolRequirements Protocol's KYC requirements (public inputs)
|
|
74
|
+
* @returns Proof response with proof and public inputs
|
|
72
75
|
*/
|
|
73
|
-
async
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
async generateProofForProtocol(userCredential, protocolRequirements) {
|
|
77
|
+
// Construct ProofRequest with protocol requirements as public inputs
|
|
78
|
+
const proofRequest = {
|
|
79
|
+
// Private inputs (user's actual credential data)
|
|
80
|
+
age: userCredential.age,
|
|
81
|
+
jurisdiction: userCredential.jurisdiction,
|
|
82
|
+
is_accredited: userCredential.is_accredited,
|
|
83
|
+
identity_data: userCredential.identity_data,
|
|
84
|
+
nonce: userCredential.nonce,
|
|
85
|
+
// Public inputs (protocol requirements)
|
|
86
|
+
min_age: protocolRequirements.min_age.toString(),
|
|
87
|
+
allowed_jurisdictions: protocolRequirements.allowed_jurisdictions.map(j => j.toString()),
|
|
88
|
+
require_accreditation: protocolRequirements.require_accreditation ? '1' : '0',
|
|
89
|
+
commitment: '', // Will be computed by prover service
|
|
90
|
+
};
|
|
91
|
+
// Generate proof using existing method
|
|
92
|
+
return await this.generateProof(proofRequest);
|
|
80
93
|
}
|
|
81
94
|
}
|
|
82
95
|
exports.ProofService = ProofService;
|
package/dist/types.d.ts
CHANGED
|
@@ -55,3 +55,12 @@ export interface WalletConfig {
|
|
|
55
55
|
appIcon?: string;
|
|
56
56
|
redirectPath?: string;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Protocol-specific KYC requirements
|
|
60
|
+
* Protocols define these requirements off-chain (e.g., in JSON/metadata)
|
|
61
|
+
*/
|
|
62
|
+
export interface ProtocolRequirements {
|
|
63
|
+
min_age: number;
|
|
64
|
+
allowed_jurisdictions: number[];
|
|
65
|
+
require_accreditation: boolean;
|
|
66
|
+
}
|