@zkyc/evg 1.3.0 → 1.4.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/index.js +5 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
* @param {Object} config - Configuration object containing API key and redirect URLs
|
|
13
13
|
* @param {string} config.apiKey - Your zKYC API key (with test_ or prod_ prefix)
|
|
14
14
|
* @param {string} config.userId - EVG users userId
|
|
15
|
-
* @param {string} config.
|
|
15
|
+
* @param {string} config.callbackUrl - URL to redirect if KYC verification fails
|
|
16
16
|
* @param {string} [config.platformApiUrl] - Optional: Your platform API URL (defaults to production)
|
|
17
17
|
* @returns {Promise<void>}
|
|
18
18
|
* @throws {Error} if API key, failurePage, or pendingPage is missing
|
|
19
19
|
* @throws {Error} if token generation fails
|
|
20
20
|
*/
|
|
21
21
|
async function ZKYCProcess(config) {
|
|
22
|
-
const { apiKey,
|
|
22
|
+
const { apiKey, callbackUrl, userId } = config;
|
|
23
23
|
|
|
24
24
|
// Validate required parameters
|
|
25
|
-
if (!apiKey || !
|
|
25
|
+
if (!apiKey || !callbackUrl || !userId) {
|
|
26
26
|
throw new Error("apiKey, callback, and userId are required");
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -54,9 +54,9 @@ async function ZKYCProcess(config) {
|
|
|
54
54
|
|
|
55
55
|
// Build SDK URL with token
|
|
56
56
|
const sdkUrl = new URL("https://evg.zkyc.tech/");
|
|
57
|
-
sdkUrl.searchParams.set("
|
|
58
|
-
sdkUrl.searchParams.set("callback", callback);
|
|
57
|
+
sdkUrl.searchParams.set("apiKey", token); // SDK will detect it's a token
|
|
59
58
|
sdkUrl.searchParams.set("userId", userId);
|
|
59
|
+
sdkUrl.searchParams.set("callbackUrl", callbackUrl);
|
|
60
60
|
|
|
61
61
|
// Redirect to SDK
|
|
62
62
|
if (typeof window !== "undefined") {
|