@zkproofport-app/sdk 0.1.2-beta.1
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/LICENSE +21 -0
- package/README.md +469 -0
- package/dist/ProofportSDK.d.ts +1011 -0
- package/dist/constants.d.ts +223 -0
- package/dist/deeplink.d.ts +192 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.esm.js +5225 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2364 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5225 -0
- package/dist/index.mjs.map +1 -0
- package/dist/qrcode.d.ts +120 -0
- package/dist/types.d.ts +434 -0
- package/dist/verifier.d.ts +224 -0
- package/package.json +75 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZKProofport SDK Constants
|
|
3
|
+
*/
|
|
4
|
+
import type { CircuitType, SDKEnvironment } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Pre-configured relay server URLs for each environment.
|
|
7
|
+
* Used by `ProofportSDK.create('production')` for zero-config initialization.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const sdk = ProofportSDK.create('production');
|
|
12
|
+
* // Uses RELAY_URLS.production = 'https://relay.zkproofport.app'
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const RELAY_URLS: Record<SDKEnvironment, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Default deep link URL scheme for ZKProofport mobile app.
|
|
18
|
+
* Used to construct deep link URLs that open the mobile app.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const deepLink = `${DEFAULT_SCHEME}://proof-request?...`;
|
|
23
|
+
* // Results in: zkproofport://proof-request?...
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_SCHEME = "zkproofport";
|
|
27
|
+
/**
|
|
28
|
+
* Deep link URL hosts for different proof request flows.
|
|
29
|
+
* Used as the host component in deep link URLs.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const requestUrl = `zkproofport://${DEEP_LINK_HOSTS.PROOF_REQUEST}`;
|
|
34
|
+
* const responseUrl = `zkproofport://${DEEP_LINK_HOSTS.PROOF_RESPONSE}`;
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEEP_LINK_HOSTS: {
|
|
38
|
+
/** Host for proof requests sent to mobile app */
|
|
39
|
+
readonly PROOF_REQUEST: "proof-request";
|
|
40
|
+
/** Host for proof responses returned from mobile app */
|
|
41
|
+
readonly PROOF_RESPONSE: "proof-response";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Circuit metadata containing display names, descriptions, and public input specifications.
|
|
45
|
+
* Each circuit has a defined number and layout of public inputs that must match
|
|
46
|
+
* the Noir circuit definition.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const metadata = CIRCUIT_METADATA['coinbase_attestation'];
|
|
51
|
+
* console.log(metadata.name); // "Coinbase KYC"
|
|
52
|
+
* console.log(metadata.publicInputsCount); // 2
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare const CIRCUIT_METADATA: Record<CircuitType, {
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
publicInputsCount: number;
|
|
59
|
+
publicInputNames: string[];
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Standard verifier contract ABI shared across all Barretenberg-generated verifiers.
|
|
63
|
+
* This ABI defines the interface for calling the verify function on deployed verifier contracts.
|
|
64
|
+
*
|
|
65
|
+
* Uses ethers v6 human-readable ABI format.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* import { Contract } from 'ethers';
|
|
70
|
+
*
|
|
71
|
+
* const verifier = new Contract(verifierAddress, VERIFIER_ABI, provider);
|
|
72
|
+
* const isValid = await verifier.verify(proofBytes, publicInputs);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare const VERIFIER_ABI: string[];
|
|
76
|
+
/**
|
|
77
|
+
* Public RPC endpoint URLs for supported blockchain networks.
|
|
78
|
+
* Used as fallback when no custom provider is supplied.
|
|
79
|
+
*
|
|
80
|
+
* Supported networks:
|
|
81
|
+
* - 84532: Base Sepolia (testnet)
|
|
82
|
+
* - 8453: Base Mainnet (production)
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import { JsonRpcProvider } from 'ethers';
|
|
87
|
+
*
|
|
88
|
+
* const provider = new JsonRpcProvider(RPC_ENDPOINTS[84532]);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare const RPC_ENDPOINTS: Record<number, string>;
|
|
92
|
+
/**
|
|
93
|
+
* Default proof request expiration time in milliseconds.
|
|
94
|
+
* Requests older than this are considered expired and should not be processed.
|
|
95
|
+
*
|
|
96
|
+
* Default: 10 minutes (600,000 ms)
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const request: ProofRequest = {
|
|
101
|
+
* // ...
|
|
102
|
+
* createdAt: Date.now(),
|
|
103
|
+
* expiresAt: Date.now() + DEFAULT_REQUEST_EXPIRY_MS
|
|
104
|
+
* };
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare const DEFAULT_REQUEST_EXPIRY_MS: number;
|
|
108
|
+
/**
|
|
109
|
+
* Maximum data size (in bytes) that can be encoded in a QR code.
|
|
110
|
+
* Based on QR Code Version 40 with L (Low) error correction level.
|
|
111
|
+
*
|
|
112
|
+
* Requests exceeding this size should use alternative methods (HTTP, WebSocket).
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const deepLinkUrl = generateDeepLink(request);
|
|
117
|
+
* if (deepLinkUrl.length > MAX_QR_DATA_SIZE) {
|
|
118
|
+
* console.warn('Request too large for QR code');
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare const MAX_QR_DATA_SIZE = 2953;
|
|
123
|
+
/**
|
|
124
|
+
* Coinbase Attestation circuit public input layout (byte offsets).
|
|
125
|
+
* Defines the byte positions of each field in the flattened public inputs array.
|
|
126
|
+
*
|
|
127
|
+
* Public inputs are packed as bytes32 values:
|
|
128
|
+
* - signal_hash: bytes 0-31
|
|
129
|
+
* - merkle_root: bytes 32-63
|
|
130
|
+
* - scope: bytes 64-95
|
|
131
|
+
* - nullifier: bytes 96-127
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const publicInputs = response.publicInputs;
|
|
136
|
+
* const signalHash = publicInputs.slice(
|
|
137
|
+
* COINBASE_ATTESTATION_PUBLIC_INPUT_LAYOUT.SIGNAL_HASH_START,
|
|
138
|
+
* COINBASE_ATTESTATION_PUBLIC_INPUT_LAYOUT.SIGNAL_HASH_END + 1
|
|
139
|
+
* );
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export declare const COINBASE_ATTESTATION_PUBLIC_INPUT_LAYOUT: {
|
|
143
|
+
readonly SIGNAL_HASH_START: 0;
|
|
144
|
+
readonly SIGNAL_HASH_END: 31;
|
|
145
|
+
readonly MERKLE_ROOT_START: 32;
|
|
146
|
+
readonly MERKLE_ROOT_END: 63;
|
|
147
|
+
readonly SCOPE_START: 64;
|
|
148
|
+
readonly SCOPE_END: 95;
|
|
149
|
+
readonly NULLIFIER_START: 96;
|
|
150
|
+
readonly NULLIFIER_END: 127;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Coinbase Country Attestation circuit public input layout (byte offsets).
|
|
154
|
+
* Defines the byte positions of each field in the flattened public inputs array.
|
|
155
|
+
*
|
|
156
|
+
* Public inputs are packed as bytes32 values:
|
|
157
|
+
* - signal_hash: bytes 0-31
|
|
158
|
+
* - merkle_root: bytes 32-63
|
|
159
|
+
* - country_list: bytes 64-83 (20 bytes for 10 countries)
|
|
160
|
+
* - country_list_length: byte 84
|
|
161
|
+
* - is_included: byte 85
|
|
162
|
+
* - scope: bytes 86-117
|
|
163
|
+
* - nullifier: bytes 118-149
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const publicInputs = response.publicInputs;
|
|
168
|
+
* const countryList = publicInputs.slice(
|
|
169
|
+
* COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT.COUNTRY_LIST_START,
|
|
170
|
+
* COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT.COUNTRY_LIST_END + 1
|
|
171
|
+
* );
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
export declare const COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT: {
|
|
175
|
+
readonly SIGNAL_HASH_START: 0;
|
|
176
|
+
readonly SIGNAL_HASH_END: 31;
|
|
177
|
+
readonly MERKLE_ROOT_START: 32;
|
|
178
|
+
readonly MERKLE_ROOT_END: 63;
|
|
179
|
+
readonly COUNTRY_LIST_START: 64;
|
|
180
|
+
readonly COUNTRY_LIST_END: 83;
|
|
181
|
+
readonly COUNTRY_LIST_LENGTH: 84;
|
|
182
|
+
readonly IS_INCLUDED: 85;
|
|
183
|
+
readonly SCOPE_START: 86;
|
|
184
|
+
readonly SCOPE_END: 117;
|
|
185
|
+
readonly NULLIFIER_START: 118;
|
|
186
|
+
readonly NULLIFIER_END: 149;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* V1 NullifierRegistry contract ABI (DEPRECATED).
|
|
190
|
+
*
|
|
191
|
+
* This is the legacy nullifier registry interface.
|
|
192
|
+
* Use ZKPROOFPORT_NULLIFIER_REGISTRY_ABI for new integrations.
|
|
193
|
+
*
|
|
194
|
+
* @deprecated Use ZKPROOFPORT_NULLIFIER_REGISTRY_ABI instead. This is the V1 NullifierRegistry ABI.
|
|
195
|
+
*/
|
|
196
|
+
export declare const NULLIFIER_REGISTRY_ABI: string[];
|
|
197
|
+
/**
|
|
198
|
+
* ZKProofportNullifierRegistry contract ABI (V2).
|
|
199
|
+
*
|
|
200
|
+
* This is the current nullifier registry interface with relayer-only registration.
|
|
201
|
+
* Public view functions allow checking nullifier status and verifying proofs without registration.
|
|
202
|
+
*
|
|
203
|
+
* Key functions:
|
|
204
|
+
* - `isNullifierRegistered`: Check if a nullifier has been used
|
|
205
|
+
* - `getNullifierInfo`: Get registration details for a nullifier
|
|
206
|
+
* - `verifyOnly`: Verify a proof without registering the nullifier
|
|
207
|
+
*
|
|
208
|
+
* Note: Registration functions (verifyAndRegister) are relayer-only and not exposed in this ABI.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* import { Contract } from 'ethers';
|
|
213
|
+
*
|
|
214
|
+
* const registry = new Contract(
|
|
215
|
+
* registryAddress,
|
|
216
|
+
* ZKPROOFPORT_NULLIFIER_REGISTRY_ABI,
|
|
217
|
+
* provider
|
|
218
|
+
* );
|
|
219
|
+
*
|
|
220
|
+
* const isUsed = await registry.isNullifierRegistered(nullifier);
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export declare const ZKPROOFPORT_NULLIFIER_REGISTRY_ABI: string[];
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep Link utilities for ZKProofport SDK
|
|
3
|
+
*/
|
|
4
|
+
import type { ProofRequest, ProofResponse, DeepLinkComponents } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Generates a unique request ID for proof requests.
|
|
7
|
+
*
|
|
8
|
+
* Creates an ID by combining a base36-encoded timestamp with a random string,
|
|
9
|
+
* prefixed with "req-". This ensures uniqueness across concurrent requests.
|
|
10
|
+
*
|
|
11
|
+
* @returns A unique string identifier in the format "req-{timestamp}-{random}"
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const id = generateRequestId();
|
|
16
|
+
* // "req-lh8k3f2g-a9b7c4d2"
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function generateRequestId(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Encodes an object into a URL-safe base64url string with UTF-8 support.
|
|
22
|
+
*
|
|
23
|
+
* Converts the input object to JSON, then encodes it using base64url format
|
|
24
|
+
* (RFC 4648 §5) which replaces '+' with '-', '/' with '_', and removes padding.
|
|
25
|
+
* Works in both browser and Node.js environments.
|
|
26
|
+
*
|
|
27
|
+
* @param data - The object to encode (will be JSON stringified)
|
|
28
|
+
* @returns Base64url-encoded string safe for URL parameters
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const encoded = encodeData({ circuit: 'coinbase_attestation', requestId: 'req-123' });
|
|
33
|
+
* // "eyJjaXJjdWl0IjoiY29pbmJhc2VfYXR0ZXN0YXRpb24iLCJyZXF1ZXN0SWQiOiJyZXEtMTIzIn0"
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function encodeData(data: object): string;
|
|
37
|
+
/**
|
|
38
|
+
* Decodes a base64url-encoded string back into a typed object.
|
|
39
|
+
*
|
|
40
|
+
* Reverses the encoding process by converting base64url to standard base64,
|
|
41
|
+
* decoding it, and parsing the resulting JSON. Handles UTF-8 correctly in
|
|
42
|
+
* both browser and Node.js environments.
|
|
43
|
+
*
|
|
44
|
+
* @typeParam T - The expected type of the decoded object
|
|
45
|
+
* @param encoded - Base64url-encoded string (from encodeData)
|
|
46
|
+
* @returns Decoded and parsed object of type T
|
|
47
|
+
*
|
|
48
|
+
* @throws {SyntaxError} If the decoded string is not valid JSON
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const request = decodeData<ProofRequest>(encodedString);
|
|
53
|
+
* console.log(request.circuit); // "coinbase_attestation"
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function decodeData<T>(encoded: string): T;
|
|
57
|
+
/**
|
|
58
|
+
* Builds a deep link URL for a proof request.
|
|
59
|
+
*
|
|
60
|
+
* Encodes the proof request and constructs a deep link URL that can be opened
|
|
61
|
+
* by the ZKProofport mobile app. The URL format is:
|
|
62
|
+
* `{scheme}://proof-request?data={encodedRequest}`
|
|
63
|
+
*
|
|
64
|
+
* @param request - The proof request to encode in the deep link
|
|
65
|
+
* @param scheme - Custom URL scheme (defaults to "zkproofport")
|
|
66
|
+
* @returns Complete deep link URL ready to be opened or embedded in a QR code
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const request: ProofRequest = {
|
|
71
|
+
* requestId: generateRequestId(),
|
|
72
|
+
* circuit: 'coinbase_attestation',
|
|
73
|
+
* inputs: { scope: 'myapp.com' },
|
|
74
|
+
* createdAt: Date.now()
|
|
75
|
+
* };
|
|
76
|
+
* const url = buildProofRequestUrl(request);
|
|
77
|
+
* // "zkproofport://proof-request?data=eyJyZXF1ZXN0SWQi..."
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function buildProofRequestUrl(request: ProofRequest, scheme?: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Builds a callback URL with proof response data as query parameters.
|
|
83
|
+
*
|
|
84
|
+
* Appends proof response fields to the provided callback URL. For completed proofs,
|
|
85
|
+
* includes proof data, public inputs, and nullifier. For errors, includes error message.
|
|
86
|
+
*
|
|
87
|
+
* @internal Used by the mobile app to construct callback URLs — not intended for SDK consumers.
|
|
88
|
+
*
|
|
89
|
+
* @param callbackUrl - Base callback URL (from the original proof request)
|
|
90
|
+
* @param response - Proof response containing status and optional proof data
|
|
91
|
+
* @returns Complete callback URL with proof response as query parameters
|
|
92
|
+
*/
|
|
93
|
+
export declare function buildCallbackUrl(callbackUrl: string, response: ProofResponse): string;
|
|
94
|
+
/**
|
|
95
|
+
* Parses a proof request from a deep link URL.
|
|
96
|
+
*
|
|
97
|
+
* Extracts and decodes the proof request data from a ZKProofport deep link URL.
|
|
98
|
+
* Returns null if the URL is invalid or missing required parameters.
|
|
99
|
+
*
|
|
100
|
+
* @param url - Deep link URL (e.g., "zkproofport://proof-request?data=...")
|
|
101
|
+
* @returns Decoded ProofRequest object, or null if parsing fails
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const url = "zkproofport://proof-request?data=eyJyZXF1ZXN0SWQi...";
|
|
106
|
+
* const request = parseProofRequestUrl(url);
|
|
107
|
+
* if (request) {
|
|
108
|
+
* console.log(request.circuit); // "coinbase_attestation"
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare function parseProofRequestUrl(url: string): ProofRequest | null;
|
|
113
|
+
/**
|
|
114
|
+
* Parses a proof response from a callback URL.
|
|
115
|
+
*
|
|
116
|
+
* Extracts proof response data from query parameters in a callback URL.
|
|
117
|
+
* Handles both successful proof completions and error responses.
|
|
118
|
+
* Returns null if required parameters (requestId, status) are missing.
|
|
119
|
+
*
|
|
120
|
+
* @param url - Callback URL with proof response query parameters
|
|
121
|
+
* @returns Decoded ProofResponse object, or null if parsing fails
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* const callbackUrl = "https://example.com/callback?requestId=req-123&status=completed&proof=0x...";
|
|
126
|
+
* const response = parseProofResponseUrl(callbackUrl);
|
|
127
|
+
* if (response && response.status === 'completed') {
|
|
128
|
+
* console.log(response.proof); // "0x..."
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare function parseProofResponseUrl(url: string): ProofResponse | null;
|
|
133
|
+
/**
|
|
134
|
+
* Parses a deep link URL into its component parts.
|
|
135
|
+
*
|
|
136
|
+
* Breaks down a custom scheme URL into scheme, host, path, and query parameters.
|
|
137
|
+
* Useful for routing and handling different types of deep links.
|
|
138
|
+
*
|
|
139
|
+
* @param url - Custom scheme URL to parse (e.g., "zkproofport://proof-request?data=...")
|
|
140
|
+
* @returns Object containing scheme, host, path, and params, or null if invalid
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const url = "zkproofport://proof-request/verify?data=abc123";
|
|
145
|
+
* const components = parseDeepLink(url);
|
|
146
|
+
* // {
|
|
147
|
+
* // scheme: "zkproofport",
|
|
148
|
+
* // host: "proof-request",
|
|
149
|
+
* // path: "/verify",
|
|
150
|
+
* // params: { data: "abc123" }
|
|
151
|
+
* // }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export declare function parseDeepLink(url: string): DeepLinkComponents | null;
|
|
155
|
+
/**
|
|
156
|
+
* Checks if a URL is a valid ZKProofport deep link.
|
|
157
|
+
*
|
|
158
|
+
* Performs a case-insensitive check to see if the URL starts with the
|
|
159
|
+
* ZKProofport scheme. Does not validate the URL structure beyond the scheme.
|
|
160
|
+
*
|
|
161
|
+
* @param url - URL to check
|
|
162
|
+
* @param scheme - Expected URL scheme (defaults to "zkproofport")
|
|
163
|
+
* @returns True if the URL starts with the specified scheme
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* isProofportDeepLink("zkproofport://proof-request?data=..."); // true
|
|
168
|
+
* isProofportDeepLink("https://example.com"); // false
|
|
169
|
+
* isProofportDeepLink("ZKPROOFPORT://proof-request"); // true (case-insensitive)
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
export declare function isProofportDeepLink(url: string, scheme?: string): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* @internal
|
|
175
|
+
* Validates a proof request for completeness and correctness.
|
|
176
|
+
*
|
|
177
|
+
* Performs comprehensive validation including:
|
|
178
|
+
* - Required fields (requestId, circuit, callbackUrl)
|
|
179
|
+
* - Circuit type validity (must be a supported circuit)
|
|
180
|
+
* - Circuit-specific input validation (e.g., userAddress format, countryList structure)
|
|
181
|
+
* - Expiration check (if expiresAt is provided)
|
|
182
|
+
*
|
|
183
|
+
* Note: userAddress is optional for both circuits - the mobile app will prompt
|
|
184
|
+
* for wallet connection if not provided.
|
|
185
|
+
*
|
|
186
|
+
* @param request - Proof request to validate
|
|
187
|
+
* @returns Validation result with `valid` flag and optional `error` message
|
|
188
|
+
*/
|
|
189
|
+
export declare function validateProofRequest(request: ProofRequest): {
|
|
190
|
+
valid: boolean;
|
|
191
|
+
error?: string;
|
|
192
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZKProofport SDK
|
|
3
|
+
*
|
|
4
|
+
* SDK for requesting ZK proofs from the ZKProofport mobile app
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { ProofportSDK } from '@zkproofport-app/sdk';
|
|
9
|
+
*
|
|
10
|
+
* // Initialize with environment preset
|
|
11
|
+
* const sdk = ProofportSDK.create('production');
|
|
12
|
+
*
|
|
13
|
+
* // Authenticate
|
|
14
|
+
* await sdk.login({ clientId: 'your-id', apiKey: 'your-key' });
|
|
15
|
+
*
|
|
16
|
+
* // Create proof request via relay
|
|
17
|
+
* const relay = await sdk.createRelayRequest('coinbase_attestation', {
|
|
18
|
+
* scope: 'myapp.com'
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Generate QR code
|
|
22
|
+
* const qr = await sdk.generateQRCode(relay.deepLink);
|
|
23
|
+
*
|
|
24
|
+
* // Wait for proof
|
|
25
|
+
* const result = await sdk.waitForProof(relay.requestId);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export { ProofportSDK, default } from './ProofportSDK';
|
|
29
|
+
export type { CircuitType, ProofRequestStatus, CoinbaseKycInputs, CoinbaseCountryInputs, CircuitInputs, ProofRequest, ProofResponse, QRCodeOptions, VerifierContract, ProofportConfig, AuthCredentials, AuthToken, RelayProofRequest, RelayProofResult, SDKEnvironment, } from './types';
|