zkyc-aptos-package 1.0.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/index.cjs.js +87 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/package.json +19 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @zkyc/sdk - NPM Package Script
|
|
7
|
+
*
|
|
8
|
+
* This is the script to include in your npm package.
|
|
9
|
+
* Users will call ZKYCProcess() with their API key to generate a token
|
|
10
|
+
* and redirect to the SDK.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Generates a secure token from the API key and redirects to the SDK
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} config - Configuration object containing API key and redirect URLs
|
|
17
|
+
* @param {string} config.apiKey - Your zKYC API key (with test_ or prod_ prefix)
|
|
18
|
+
* @param {string} config.userId - EVG users userId
|
|
19
|
+
* @param {string} config.callbackUrl - URL to redirect if KYC verification fails
|
|
20
|
+
* @param {string} [config.platformApiUrl] - Optional: Your platform API URL (defaults to production)
|
|
21
|
+
* @returns {Promise<void>}
|
|
22
|
+
* @throws {Error} if API key, failurePage, or pendingPage is missing
|
|
23
|
+
* @throws {Error} if token generation fails
|
|
24
|
+
*/
|
|
25
|
+
async function ZKYCProcess(config) {
|
|
26
|
+
const { apiKey, callbackUrl, userId } = config;
|
|
27
|
+
|
|
28
|
+
// Validate required parameters
|
|
29
|
+
if (!apiKey || !callbackUrl || !userId) {
|
|
30
|
+
throw new Error("apiKey, callback, and userId are required");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Default to production platform API URL if not provided
|
|
34
|
+
// Users should set this to their platform URL (e.g., https://api.zkyc.tech)
|
|
35
|
+
const platformUrl = "https://api.zkyc.tech";
|
|
36
|
+
const tokenEndpoint = `${platformUrl}/api/kyc/generate-token`;
|
|
37
|
+
try {
|
|
38
|
+
// Generate token from API key (server-side call)
|
|
39
|
+
const response = await fetch(tokenEndpoint, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: {
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
},
|
|
44
|
+
body: JSON.stringify({ apikey: apiKey }),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
const errorData = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
49
|
+
throw new Error(`Token generation failed: ${errorData.error || response.statusText}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const result = await response.json();
|
|
53
|
+
|
|
54
|
+
if (!result.success) {
|
|
55
|
+
throw new Error("Token generation failed");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const { token, expiresIn, expiresAt } = result.data;
|
|
59
|
+
if (!token) {
|
|
60
|
+
throw new Error("Token generation failed: No token received");
|
|
61
|
+
}
|
|
62
|
+
// Build SDK URL with token
|
|
63
|
+
const sdkUrl = new URL("https://sdk.zkyc.tech/");
|
|
64
|
+
sdkUrl.searchParams.set("apiKey", token); // SDK will detect it's a token
|
|
65
|
+
sdkUrl.searchParams.set("userId", userId);
|
|
66
|
+
sdkUrl.searchParams.set("callbackUrl", callbackUrl);
|
|
67
|
+
sdkUrl.searchParams.set("platForm", "aptos");
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
// Redirect to SDK
|
|
71
|
+
if (typeof window !== "undefined") {
|
|
72
|
+
window.location.assign(sdkUrl.toString());
|
|
73
|
+
// openZKYCPopup(sdkUrl.toString())
|
|
74
|
+
} else {
|
|
75
|
+
throw new Error("ZKYCProcess can only be used in browser environment");
|
|
76
|
+
}
|
|
77
|
+
} catch (error) {
|
|
78
|
+
if (error instanceof Error) {
|
|
79
|
+
throw new Error(`ZKYC Process failed: ${error.message}`);
|
|
80
|
+
}
|
|
81
|
+
throw new Error("ZKYC Process failed: Unknown error");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
exports.ZKYCProcess = ZKYCProcess;
|
|
86
|
+
exports.default = ZKYCProcess;
|
|
87
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/index.js"],"sourcesContent":["/**\r\n * @zkyc/sdk - NPM Package Script\r\n * \r\n * This is the script to include in your npm package.\r\n * Users will call ZKYCProcess() with their API key to generate a token\r\n * and redirect to the SDK.\r\n */\r\n\r\n/**\r\n * Generates a secure token from the API key and redirects to the SDK\r\n * \r\n * @param {Object} config - Configuration object containing API key and redirect URLs\r\n * @param {string} config.apiKey - Your zKYC API key (with test_ or prod_ prefix)\r\n * @param {string} config.userId - EVG users userId\r\n * @param {string} config.callbackUrl - URL to redirect if KYC verification fails\r\n * @param {string} [config.platformApiUrl] - Optional: Your platform API URL (defaults to production)\r\n * @returns {Promise<void>}\r\n * @throws {Error} if API key, failurePage, or pendingPage is missing\r\n * @throws {Error} if token generation fails\r\n */\r\nasync function ZKYCProcess(config) {\r\n const { apiKey, callbackUrl, userId } = config;\r\n\r\n // Validate required parameters\r\n if (!apiKey || !callbackUrl || !userId) {\r\n throw new Error(\"apiKey, callback, and userId are required\");\r\n }\r\n\r\n // Default to production platform API URL if not provided\r\n // Users should set this to their platform URL (e.g., https://api.zkyc.tech)\r\n const platformUrl = \"https://api.zkyc.tech\";\r\n const tokenEndpoint = `${platformUrl}/api/kyc/generate-token`;\r\n try {\r\n // Generate token from API key (server-side call)\r\n const response = await fetch(tokenEndpoint, {\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({ apikey: apiKey }),\r\n });\r\n\r\n if (!response.ok) {\r\n const errorData = await response.json().catch(() => ({ error: \"Unknown error\" }));\r\n throw new Error(`Token generation failed: ${errorData.error || response.statusText}`);\r\n}\r\n\r\nconst result = await response.json();\r\n\r\nif (!result.success) {\r\n throw new Error(\"Token generation failed\");\r\n}\r\n\r\nconst { token, expiresIn, expiresAt } = result.data;\r\n if (!token) {\r\n throw new Error(\"Token generation failed: No token received\");\r\n }\r\n // Build SDK URL with token\r\n const sdkUrl = new URL(\"https://sdk.zkyc.tech/\");\r\n sdkUrl.searchParams.set(\"apiKey\", token); // SDK will detect it's a token\r\n sdkUrl.searchParams.set(\"userId\", userId);\r\n sdkUrl.searchParams.set(\"callbackUrl\", callbackUrl);\r\n sdkUrl.searchParams.set(\"platForm\", \"aptos\");\r\n\r\n\r\n // Redirect to SDK\r\n if (typeof window !== \"undefined\") {\r\n window.location.assign(sdkUrl.toString());\r\n // openZKYCPopup(sdkUrl.toString())\r\n } else {\r\n throw new Error(\"ZKYCProcess can only be used in browser environment\");\r\n }\r\n } catch (error) {\r\n if (error instanceof Error) {\r\n throw new Error(`ZKYC Process failed: ${error.message}`);\r\n }\r\n throw new Error(\"ZKYC Process failed: Unknown error\");\r\n }\r\n}\r\n/**\r\n * Opens centered popup like \"Continue with Google\"\r\n */\r\n// function openZKYCPopup(url) {\r\n// const width = 500;\r\n// const height = 650;\r\n\r\n// const left = window.screenX + (window.outerWidth - width) / 2;\r\n// const top = window.screenY + (window.outerHeight - height) / 2;\r\n\r\n// const popup = window.open(\r\n// url,\r\n// \"ZKYC_Popup\",\r\n// `width=${width},height=${height},left=${left},top=${top},\r\n// resizable=yes,scrollbars=yes,toolbar=no,menubar=no,status=no`,\"_self\"\r\n// );\r\n\r\n// if (!popup) {\r\n// throw new Error(\"Popup blocked. Please allow popups.\");\r\n// }\r\n\r\n// // ✅ LISTEN FOR SDK EVENTS HERE\r\n// const handleMessage = (event) => {\r\n// console.log(\"🔵 MESSAGE RECEIVED\", {\r\n// origin: event.origin,\r\n// data: event.data,\r\n// });\r\n\r\n\r\n// window.addEventListener(\"message\", handleMessage);\r\n// // 🔒 Security check — VERY IMPORTANT\r\n\r\n// if (event.origin !== \"https://evg.zkyc.tech\") return;\r\n\r\n// if (event.data?.type === \"KYC_SUBMITTED\") {\r\n// popup.close();\r\n// window.removeEventListener(\"message\", handleMessage);\r\n\r\n// // Optional: notify host app\r\n// console.log(\"KYC flow completed\");\r\n// }\r\n\r\n// if (event.data?.type === \"KYC_ERROR\") {\r\n// popup.close();\r\n// window.removeEventListener(\"message\", handleMessage);\r\n// console.error(\"KYC failed\");\r\n// }\r\n// };\r\n\r\n// window.addEventListener(\"message\", handleMessage);\r\n\r\n// popup.focus();\r\n// }\r\n\r\n\r\n// ES Module exports (for modern bundlers and browsers)\r\nexport default ZKYCProcess;\r\nexport { ZKYCProcess };\r\n\r\n"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW,CAAC,MAAM,EAAE;AACnC,IAAI,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;AACnD;AACA;AACA,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE;AAC5C,QAAQ,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;AACrE,IAAI,CAAC;AACL;AACA;AACA;AACA,IAAI,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAChD,IAAI,MAAM,aAAa,GAAG,CAAC,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAC;AAClE,IAAI,IAAI;AACR;AACA,QAAQ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,aAAa,EAAE;AACpD,YAAY,MAAM,EAAE,MAAM;AAC1B,YAAY,OAAO,EAAE;AACrB,gBAAgB,cAAc,EAAE,kBAAkB;AAClD,aAAa;AACb,YAAY,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACpD,SA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AAM,CAAC,QAAQ,EAAE,CAAC,CAAC;AACtD;AACA,QAAQ,CAAC,MAAM;AACf,YAAY,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;AACnF,QAAQ,CAAC;AACT,IAAI,CAAC,CAAC,OAAO,KAAK,EAAE;AACpB,QAAQ,IAAI,KAAK,YAAY,KAAK,EAAE;AACpC,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,qBAAqB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACrE,QAAQ,CAAC;AACT,QAAQ,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AAC9D,IAAI,CAAC;AACL;;;;;"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zkyc/sdk - NPM Package Script
|
|
3
|
+
*
|
|
4
|
+
* This is the script to include in your npm package.
|
|
5
|
+
* Users will call ZKYCProcess() with their API key to generate a token
|
|
6
|
+
* and redirect to the SDK.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Generates a secure token from the API key and redirects to the SDK
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} config - Configuration object containing API key and redirect URLs
|
|
13
|
+
* @param {string} config.apiKey - Your zKYC API key (with test_ or prod_ prefix)
|
|
14
|
+
* @param {string} config.userId - EVG users userId
|
|
15
|
+
* @param {string} config.callbackUrl - URL to redirect if KYC verification fails
|
|
16
|
+
* @param {string} [config.platformApiUrl] - Optional: Your platform API URL (defaults to production)
|
|
17
|
+
* @returns {Promise<void>}
|
|
18
|
+
* @throws {Error} if API key, failurePage, or pendingPage is missing
|
|
19
|
+
* @throws {Error} if token generation fails
|
|
20
|
+
*/
|
|
21
|
+
async function ZKYCProcess(config) {
|
|
22
|
+
const { apiKey, callbackUrl, userId } = config;
|
|
23
|
+
|
|
24
|
+
// Validate required parameters
|
|
25
|
+
if (!apiKey || !callbackUrl || !userId) {
|
|
26
|
+
throw new Error("apiKey, callback, and userId are required");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Default to production platform API URL if not provided
|
|
30
|
+
// Users should set this to their platform URL (e.g., https://api.zkyc.tech)
|
|
31
|
+
const platformUrl = "https://api.zkyc.tech";
|
|
32
|
+
const tokenEndpoint = `${platformUrl}/api/kyc/generate-token`;
|
|
33
|
+
try {
|
|
34
|
+
// Generate token from API key (server-side call)
|
|
35
|
+
const response = await fetch(tokenEndpoint, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers: {
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify({ apikey: apiKey }),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (!response.ok) {
|
|
44
|
+
const errorData = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
45
|
+
throw new Error(`Token generation failed: ${errorData.error || response.statusText}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const result = await response.json();
|
|
49
|
+
|
|
50
|
+
if (!result.success) {
|
|
51
|
+
throw new Error("Token generation failed");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { token, expiresIn, expiresAt } = result.data;
|
|
55
|
+
if (!token) {
|
|
56
|
+
throw new Error("Token generation failed: No token received");
|
|
57
|
+
}
|
|
58
|
+
// Build SDK URL with token
|
|
59
|
+
const sdkUrl = new URL("https://sdk.zkyc.tech/");
|
|
60
|
+
sdkUrl.searchParams.set("apiKey", token); // SDK will detect it's a token
|
|
61
|
+
sdkUrl.searchParams.set("userId", userId);
|
|
62
|
+
sdkUrl.searchParams.set("callbackUrl", callbackUrl);
|
|
63
|
+
sdkUrl.searchParams.set("platForm", "aptos");
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// Redirect to SDK
|
|
67
|
+
if (typeof window !== "undefined") {
|
|
68
|
+
window.location.assign(sdkUrl.toString());
|
|
69
|
+
// openZKYCPopup(sdkUrl.toString())
|
|
70
|
+
} else {
|
|
71
|
+
throw new Error("ZKYCProcess can only be used in browser environment");
|
|
72
|
+
}
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (error instanceof Error) {
|
|
75
|
+
throw new Error(`ZKYC Process failed: ${error.message}`);
|
|
76
|
+
}
|
|
77
|
+
throw new Error("ZKYC Process failed: Unknown error");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { ZKYCProcess, ZKYCProcess as default };
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.js"],"sourcesContent":["/**\r\n * @zkyc/sdk - NPM Package Script\r\n * \r\n * This is the script to include in your npm package.\r\n * Users will call ZKYCProcess() with their API key to generate a token\r\n * and redirect to the SDK.\r\n */\r\n\r\n/**\r\n * Generates a secure token from the API key and redirects to the SDK\r\n * \r\n * @param {Object} config - Configuration object containing API key and redirect URLs\r\n * @param {string} config.apiKey - Your zKYC API key (with test_ or prod_ prefix)\r\n * @param {string} config.userId - EVG users userId\r\n * @param {string} config.callbackUrl - URL to redirect if KYC verification fails\r\n * @param {string} [config.platformApiUrl] - Optional: Your platform API URL (defaults to production)\r\n * @returns {Promise<void>}\r\n * @throws {Error} if API key, failurePage, or pendingPage is missing\r\n * @throws {Error} if token generation fails\r\n */\r\nasync function ZKYCProcess(config) {\r\n const { apiKey, callbackUrl, userId } = config;\r\n\r\n // Validate required parameters\r\n if (!apiKey || !callbackUrl || !userId) {\r\n throw new Error(\"apiKey, callback, and userId are required\");\r\n }\r\n\r\n // Default to production platform API URL if not provided\r\n // Users should set this to their platform URL (e.g., https://api.zkyc.tech)\r\n const platformUrl = \"https://api.zkyc.tech\";\r\n const tokenEndpoint = `${platformUrl}/api/kyc/generate-token`;\r\n try {\r\n // Generate token from API key (server-side call)\r\n const response = await fetch(tokenEndpoint, {\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({ apikey: apiKey }),\r\n });\r\n\r\n if (!response.ok) {\r\n const errorData = await response.json().catch(() => ({ error: \"Unknown error\" }));\r\n throw new Error(`Token generation failed: ${errorData.error || response.statusText}`);\r\n}\r\n\r\nconst result = await response.json();\r\n\r\nif (!result.success) {\r\n throw new Error(\"Token generation failed\");\r\n}\r\n\r\nconst { token, expiresIn, expiresAt } = result.data;\r\n if (!token) {\r\n throw new Error(\"Token generation failed: No token received\");\r\n }\r\n // Build SDK URL with token\r\n const sdkUrl = new URL(\"https://sdk.zkyc.tech/\");\r\n sdkUrl.searchParams.set(\"apiKey\", token); // SDK will detect it's a token\r\n sdkUrl.searchParams.set(\"userId\", userId);\r\n sdkUrl.searchParams.set(\"callbackUrl\", callbackUrl);\r\n sdkUrl.searchParams.set(\"platForm\", \"aptos\");\r\n\r\n\r\n // Redirect to SDK\r\n if (typeof window !== \"undefined\") {\r\n window.location.assign(sdkUrl.toString());\r\n // openZKYCPopup(sdkUrl.toString())\r\n } else {\r\n throw new Error(\"ZKYCProcess can only be used in browser environment\");\r\n }\r\n } catch (error) {\r\n if (error instanceof Error) {\r\n throw new Error(`ZKYC Process failed: ${error.message}`);\r\n }\r\n throw new Error(\"ZKYC Process failed: Unknown error\");\r\n }\r\n}\r\n/**\r\n * Opens centered popup like \"Continue with Google\"\r\n */\r\n// function openZKYCPopup(url) {\r\n// const width = 500;\r\n// const height = 650;\r\n\r\n// const left = window.screenX + (window.outerWidth - width) / 2;\r\n// const top = window.screenY + (window.outerHeight - height) / 2;\r\n\r\n// const popup = window.open(\r\n// url,\r\n// \"ZKYC_Popup\",\r\n// `width=${width},height=${height},left=${left},top=${top},\r\n// resizable=yes,scrollbars=yes,toolbar=no,menubar=no,status=no`,\"_self\"\r\n// );\r\n\r\n// if (!popup) {\r\n// throw new Error(\"Popup blocked. Please allow popups.\");\r\n// }\r\n\r\n// // ✅ LISTEN FOR SDK EVENTS HERE\r\n// const handleMessage = (event) => {\r\n// console.log(\"🔵 MESSAGE RECEIVED\", {\r\n// origin: event.origin,\r\n// data: event.data,\r\n// });\r\n\r\n\r\n// window.addEventListener(\"message\", handleMessage);\r\n// // 🔒 Security check — VERY IMPORTANT\r\n\r\n// if (event.origin !== \"https://evg.zkyc.tech\") return;\r\n\r\n// if (event.data?.type === \"KYC_SUBMITTED\") {\r\n// popup.close();\r\n// window.removeEventListener(\"message\", handleMessage);\r\n\r\n// // Optional: notify host app\r\n// console.log(\"KYC flow completed\");\r\n// }\r\n\r\n// if (event.data?.type === \"KYC_ERROR\") {\r\n// popup.close();\r\n// window.removeEventListener(\"message\", handleMessage);\r\n// console.error(\"KYC failed\");\r\n// }\r\n// };\r\n\r\n// window.addEventListener(\"message\", handleMessage);\r\n\r\n// popup.focus();\r\n// }\r\n\r\n\r\n// ES Module exports (for modern bundlers and browsers)\r\nexport default ZKYCProcess;\r\nexport { ZKYCProcess };\r\n\r\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW,CAAC,MAAM,EAAE;AACnC,IAAI,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;AACnD;AACA;AACA,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE;AAC5C,QAAQ,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;AACrE,IAAI,CAAC;AACL;AACA;AACA;AACA,IAAI,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAChD,IAAI,MAAM,aAAa,GAAG,CAAC,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAC;AAClE,IAAI,IAAI;AACR;AACA,QAAQ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,aAAa,EAAE;AACpD,YAAY,MAAM,EAAE,MAAM;AAC1B,YAAY,OAAO,EAAE;AACrB,gBAAgB,cAA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AAC;AACrD;AACA;AACA;AACA,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAC3C,YAAY,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;AACtD;AACA,QAAQ,CAAC,MAAM;AACf,YAAY,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;AACnF,QAAQ,CAAC;AACT,IAAI,CAAC,CAAC,OAAO,KAAK,EAAE;AACpB,QAAQ,IAAI,KAAK,YAAY,KAAK,EAAE;AACpC,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,qBAAqB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACrE,QAAQ,CAAC;AACT,QAAQ,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AAC9D,IAAI,CAAC;AACL;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zkyc-aptos-package",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ZKYC SDK for Aptos",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"files": ["dist"],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "rollup -c",
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
16
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
17
|
+
"rollup": "^4.59.0"
|
|
18
|
+
}
|
|
19
|
+
}
|