Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nexeraid/kyc-sdk

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nexeraid/kyc-sdk - npm Package Compare versions

Comparing version 0.1.10 to 0.2.0

83

client/dist/nexeraid-kyc-sdk-client.cjs.dev.js

@@ -399,5 +399,5 @@ 'use strict';

var KYCDataResponses = ["onInitKyc", "signature", "zkProofVerified"];
var KYCDataResponses = ["onInitKyc", "signature"];
var KYCDataResponseSchema = zod.z["enum"](KYCDataResponses);
var KYCDataMessages = ["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "zkVerifySignature", "closeScreen"];
var KYCDataMessages = ["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "closeScreen"];
var KYCDataMessageSchema = zod.z["enum"](KYCDataMessages);

@@ -409,24 +409,17 @@

_defineProperty(this, "onInitKycData", function (onInitKyc) {
var _this$callbacks;
((_this$callbacks = _this.callbacks) !== null && _this$callbacks !== void 0 ? _this$callbacks : _this.callbacks = {}).onInitKycCallback = onInitKyc;
console.log("onInitKycData");
_this.callbacks.onInitKycCallback = onInitKyc;
});
_defineProperty(this, "onSignPersonalData", function (signPersonalDataCallback) {
var _this$callbacks2;
((_this$callbacks2 = _this.callbacks) !== null && _this$callbacks2 !== void 0 ? _this$callbacks2 : _this.callbacks = {}).signPersonalDataCallback = signPersonalDataCallback;
console.log("onSignPersonalData");
_this.callbacks.signPersonalDataCallback = signPersonalDataCallback;
});
_defineProperty(this, "onZkCallback", function (zkCallBack) {
var _this$callbacks3;
((_this$callbacks3 = _this.callbacks) !== null && _this$callbacks3 !== void 0 ? _this$callbacks3 : _this.callbacks = {}).zkCallback = zkCallBack;
});
_defineProperty(this, "onOffChainShareCompletition", function (offChainShareCompletionCallback) {
var _this$callbacks4;
((_this$callbacks4 = _this.callbacks) !== null && _this$callbacks4 !== void 0 ? _this$callbacks4 : _this.callbacks = {}).offChainShareCompletionCallback = offChainShareCompletionCallback;
_this.callbacks.offChainShareCompletionCallback = offChainShareCompletionCallback;
});
_defineProperty(this, "onKycCompletion", function (kycCompletionCallback) {
var _this$callbacks5;
((_this$callbacks5 = _this.callbacks) !== null && _this$callbacks5 !== void 0 ? _this$callbacks5 : _this.callbacks = {}).kycCompletionCallback = kycCompletionCallback;
_this.callbacks.kycCompletionCallback = kycCompletionCallback;
});
_defineProperty(this, "onCloseScreen", function (onCloseScreenCallback) {
var _this$callbacks6;
((_this$callbacks6 = _this.callbacks) !== null && _this$callbacks6 !== void 0 ? _this$callbacks6 : _this.callbacks = {}).onCloseScreenCallback = onCloseScreenCallback;
_this.callbacks.onCloseScreenCallback = onCloseScreenCallback;
});

@@ -438,7 +431,4 @@ _defineProperty(this, "init", function (options) {

}
if (options.identityProviders) {
_this.identityProviders = options.identityProviders;
}
if (options.initOnFlow) {
_this.initOnFlow = options.initOnFlow;
_this.selectedFlow = options.initOnFlow;
}

@@ -479,4 +469,4 @@ if (!_this.alreadyInit) {

var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
var _this$callbacks7, _this$callbacks8, _this$callbacks10;
var kycData, dataOnInit, signedMessage, _frames, _this$callbacks9, txHash, _frames2;
var _this$callbacks, _this$callbacks2;
var kycData, _this$auth, _this$auth2, _this$auth3, dataOnInit, signedMessage, _frames, _this$callbacks3;
return _regeneratorRuntime().wrap(function _callee$(_context) {

@@ -499,4 +489,7 @@ while (1) switch (_context.prev = _context.next) {

dataOnInit = {
initOnFlow: _this.initOnFlow,
identityProviders: _this.identityProviders
selectedFlow: _this.selectedFlow,
accessToken: ((_this$auth = _this.auth) === null || _this$auth === void 0 ? void 0 : _this$auth.accessToken) || "",
identifier: _this.identifier || "",
signature: ((_this$auth2 = _this.auth) === null || _this$auth2 === void 0 ? void 0 : _this$auth2.signature) || "",
signingMessage: ((_this$auth3 = _this.auth) === null || _this$auth3 === void 0 ? void 0 : _this$auth3.signingMessage) || ""
}; // eslint-disable-next-line @typescript-eslint/ban-ts-comment

@@ -515,3 +508,3 @@ // @ts-ignore

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks7 = _this.callbacks) !== null && _this$callbacks7 !== void 0 && _this$callbacks7.signPersonalDataCallback)) {
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks = _this.callbacks) !== null && _this$callbacks !== void 0 && _this$callbacks.signPersonalDataCallback)) {
_context.next = 9;

@@ -537,3 +530,3 @@ break;

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks8 = _this.callbacks) !== null && _this$callbacks8 !== void 0 && _this$callbacks8.kycCompletionCallback) {
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks2 = _this.callbacks) !== null && _this$callbacks2 !== void 0 && _this$callbacks2.kycCompletionCallback) {
_this.callbacks.kycCompletionCallback(

@@ -551,3 +544,3 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access

!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier))) {
if ((_this$callbacks9 = _this.callbacks) !== null && _this$callbacks9 !== void 0 && _this$callbacks9.offChainShareCompletionCallback) {
if ((_this$callbacks3 = _this.callbacks) !== null && _this$callbacks3 !== void 0 && _this$callbacks3.offChainShareCompletionCallback) {
_this.callbacks.offChainShareCompletionCallback();

@@ -557,23 +550,2 @@ }

}
//send tx to verify the ZKProof
if (!(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
kycData.type === KYCDataMessageSchema["enum"].zkVerifySignature && (
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks10 = _this.callbacks) !== null && _this$callbacks10 !== void 0 && _this$callbacks10.zkCallback)) {
_context.next = 17;
break;
}
_context.next = 14;
return _this.callbacks.zkCallback(kycData.data.message);
case 14:
txHash = _context.sent;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
_frames2 = window.frames; // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
_frames2[_this.iframeName].postMessage({
type: KYCDataResponseSchema["enum"].zkProofVerified,
data: txHash
}, _this.baseURL);
case 17:
if (

@@ -586,3 +558,3 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access

}
case 18:
case 12:
case "end":

@@ -615,4 +587,4 @@ return _context.stop();

_defineProperty(this, "_setIframeAttributes", function (iframe) {
var _this$auth, _this$auth2, _this$auth3;
iframe.setAttribute("src", "".concat(_this.baseURL, "?accessToken=").concat((_this$auth = _this.auth) === null || _this$auth === void 0 ? void 0 : _this$auth.accessToken, "&signingMessage=").concat((_this$auth2 = _this.auth) === null || _this$auth2 === void 0 ? void 0 : _this$auth2.signingMessage, "&signature=").concat((_this$auth3 = _this.auth) === null || _this$auth3 === void 0 ? void 0 : _this$auth3.signature, "&identifier=").concat(_this.identifier));
var _this$auth4, _this$auth5, _this$auth6;
iframe.setAttribute("src", "".concat(_this.baseURL, "?accessToken=").concat((_this$auth4 = _this.auth) === null || _this$auth4 === void 0 ? void 0 : _this$auth4.accessToken, "&signingMessage=").concat((_this$auth5 = _this.auth) === null || _this$auth5 === void 0 ? void 0 : _this$auth5.signingMessage, "&signature=").concat((_this$auth6 = _this.auth) === null || _this$auth6 === void 0 ? void 0 : _this$auth6.signature, "&identifier=").concat(_this.identifier));
iframe.setAttribute("name", _this.iframeName);

@@ -628,2 +600,3 @@ iframe.setAttribute("allow", "microphone; camera; midi; encrypted-media; usb; ethereum");

_defineProperty(this, "_closeFlow", function () {
var _this$iframe, _this$iframe$parentNo, _this$overlaySpinner, _this$overlaySpinner$;
var html = document.getElementsByTagName("html")[0];

@@ -645,4 +618,4 @@ var body = document.getElementsByTagName("body")[0];

_this.initDataSent = false;
_this.iframe && document.body.removeChild(_this.iframe);
_this.overlaySpinner && document.body.removeChild(_this.overlaySpinner);
(_this$iframe = _this.iframe) === null || _this$iframe === void 0 ? void 0 : (_this$iframe$parentNo = _this$iframe.parentNode) === null || _this$iframe$parentNo === void 0 ? void 0 : _this$iframe$parentNo.removeChild(_this.iframe);
(_this$overlaySpinner = _this.overlaySpinner) === null || _this$overlaySpinner === void 0 ? void 0 : (_this$overlaySpinner$ = _this$overlaySpinner.parentNode) === null || _this$overlaySpinner$ === void 0 ? void 0 : _this$overlaySpinner$.removeChild(_this.overlaySpinner);
});

@@ -661,5 +634,5 @@ this.baseURL = (config === null || config === void 0 ? void 0 : config.baseUrl) || BASE_URL;

this.isOpen = false;
this.initOnFlow = "KYC";
this.identityProviders = ["GBG"];
this.selectedFlow = "REQUEST";
this.overlaySpinner = undefined;
this.callbacks = {};
this.styles = ".kyc-sdk-loader-modal{position:fixed;left:0;top:0;display:flex; justify-content:center;align-items:center;width:100%;height:100%;z-index:9999;background-color:rgb(1,1,1,0.65);}.kyc-sdk-loader-embed{position:relative;left:0;top:0;width:100%;height:100%;z-index:9999};";

@@ -666,0 +639,0 @@ });

@@ -399,5 +399,5 @@ 'use strict';

var KYCDataResponses = ["onInitKyc", "signature", "zkProofVerified"];
var KYCDataResponses = ["onInitKyc", "signature"];
var KYCDataResponseSchema = zod.z["enum"](KYCDataResponses);
var KYCDataMessages = ["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "zkVerifySignature", "closeScreen"];
var KYCDataMessages = ["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "closeScreen"];
var KYCDataMessageSchema = zod.z["enum"](KYCDataMessages);

@@ -409,24 +409,17 @@

_defineProperty(this, "onInitKycData", function (onInitKyc) {
var _this$callbacks;
((_this$callbacks = _this.callbacks) !== null && _this$callbacks !== void 0 ? _this$callbacks : _this.callbacks = {}).onInitKycCallback = onInitKyc;
console.log("onInitKycData");
_this.callbacks.onInitKycCallback = onInitKyc;
});
_defineProperty(this, "onSignPersonalData", function (signPersonalDataCallback) {
var _this$callbacks2;
((_this$callbacks2 = _this.callbacks) !== null && _this$callbacks2 !== void 0 ? _this$callbacks2 : _this.callbacks = {}).signPersonalDataCallback = signPersonalDataCallback;
console.log("onSignPersonalData");
_this.callbacks.signPersonalDataCallback = signPersonalDataCallback;
});
_defineProperty(this, "onZkCallback", function (zkCallBack) {
var _this$callbacks3;
((_this$callbacks3 = _this.callbacks) !== null && _this$callbacks3 !== void 0 ? _this$callbacks3 : _this.callbacks = {}).zkCallback = zkCallBack;
});
_defineProperty(this, "onOffChainShareCompletition", function (offChainShareCompletionCallback) {
var _this$callbacks4;
((_this$callbacks4 = _this.callbacks) !== null && _this$callbacks4 !== void 0 ? _this$callbacks4 : _this.callbacks = {}).offChainShareCompletionCallback = offChainShareCompletionCallback;
_this.callbacks.offChainShareCompletionCallback = offChainShareCompletionCallback;
});
_defineProperty(this, "onKycCompletion", function (kycCompletionCallback) {
var _this$callbacks5;
((_this$callbacks5 = _this.callbacks) !== null && _this$callbacks5 !== void 0 ? _this$callbacks5 : _this.callbacks = {}).kycCompletionCallback = kycCompletionCallback;
_this.callbacks.kycCompletionCallback = kycCompletionCallback;
});
_defineProperty(this, "onCloseScreen", function (onCloseScreenCallback) {
var _this$callbacks6;
((_this$callbacks6 = _this.callbacks) !== null && _this$callbacks6 !== void 0 ? _this$callbacks6 : _this.callbacks = {}).onCloseScreenCallback = onCloseScreenCallback;
_this.callbacks.onCloseScreenCallback = onCloseScreenCallback;
});

@@ -438,7 +431,4 @@ _defineProperty(this, "init", function (options) {

}
if (options.identityProviders) {
_this.identityProviders = options.identityProviders;
}
if (options.initOnFlow) {
_this.initOnFlow = options.initOnFlow;
_this.selectedFlow = options.initOnFlow;
}

@@ -479,4 +469,4 @@ if (!_this.alreadyInit) {

var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
var _this$callbacks7, _this$callbacks8, _this$callbacks10;
var kycData, dataOnInit, signedMessage, _frames, _this$callbacks9, txHash, _frames2;
var _this$callbacks, _this$callbacks2;
var kycData, _this$auth, _this$auth2, _this$auth3, dataOnInit, signedMessage, _frames, _this$callbacks3;
return _regeneratorRuntime().wrap(function _callee$(_context) {

@@ -499,4 +489,7 @@ while (1) switch (_context.prev = _context.next) {

dataOnInit = {
initOnFlow: _this.initOnFlow,
identityProviders: _this.identityProviders
selectedFlow: _this.selectedFlow,
accessToken: ((_this$auth = _this.auth) === null || _this$auth === void 0 ? void 0 : _this$auth.accessToken) || "",
identifier: _this.identifier || "",
signature: ((_this$auth2 = _this.auth) === null || _this$auth2 === void 0 ? void 0 : _this$auth2.signature) || "",
signingMessage: ((_this$auth3 = _this.auth) === null || _this$auth3 === void 0 ? void 0 : _this$auth3.signingMessage) || ""
}; // eslint-disable-next-line @typescript-eslint/ban-ts-comment

@@ -515,3 +508,3 @@ // @ts-ignore

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks7 = _this.callbacks) !== null && _this$callbacks7 !== void 0 && _this$callbacks7.signPersonalDataCallback)) {
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks = _this.callbacks) !== null && _this$callbacks !== void 0 && _this$callbacks.signPersonalDataCallback)) {
_context.next = 9;

@@ -537,3 +530,3 @@ break;

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks8 = _this.callbacks) !== null && _this$callbacks8 !== void 0 && _this$callbacks8.kycCompletionCallback) {
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks2 = _this.callbacks) !== null && _this$callbacks2 !== void 0 && _this$callbacks2.kycCompletionCallback) {
_this.callbacks.kycCompletionCallback(

@@ -551,3 +544,3 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access

!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier))) {
if ((_this$callbacks9 = _this.callbacks) !== null && _this$callbacks9 !== void 0 && _this$callbacks9.offChainShareCompletionCallback) {
if ((_this$callbacks3 = _this.callbacks) !== null && _this$callbacks3 !== void 0 && _this$callbacks3.offChainShareCompletionCallback) {
_this.callbacks.offChainShareCompletionCallback();

@@ -557,23 +550,2 @@ }

}
//send tx to verify the ZKProof
if (!(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
kycData.type === KYCDataMessageSchema["enum"].zkVerifySignature && (
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks10 = _this.callbacks) !== null && _this$callbacks10 !== void 0 && _this$callbacks10.zkCallback)) {
_context.next = 17;
break;
}
_context.next = 14;
return _this.callbacks.zkCallback(kycData.data.message);
case 14:
txHash = _context.sent;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
_frames2 = window.frames; // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
_frames2[_this.iframeName].postMessage({
type: KYCDataResponseSchema["enum"].zkProofVerified,
data: txHash
}, _this.baseURL);
case 17:
if (

@@ -586,3 +558,3 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access

}
case 18:
case 12:
case "end":

@@ -615,4 +587,4 @@ return _context.stop();

_defineProperty(this, "_setIframeAttributes", function (iframe) {
var _this$auth, _this$auth2, _this$auth3;
iframe.setAttribute("src", "".concat(_this.baseURL, "?accessToken=").concat((_this$auth = _this.auth) === null || _this$auth === void 0 ? void 0 : _this$auth.accessToken, "&signingMessage=").concat((_this$auth2 = _this.auth) === null || _this$auth2 === void 0 ? void 0 : _this$auth2.signingMessage, "&signature=").concat((_this$auth3 = _this.auth) === null || _this$auth3 === void 0 ? void 0 : _this$auth3.signature, "&identifier=").concat(_this.identifier));
var _this$auth4, _this$auth5, _this$auth6;
iframe.setAttribute("src", "".concat(_this.baseURL, "?accessToken=").concat((_this$auth4 = _this.auth) === null || _this$auth4 === void 0 ? void 0 : _this$auth4.accessToken, "&signingMessage=").concat((_this$auth5 = _this.auth) === null || _this$auth5 === void 0 ? void 0 : _this$auth5.signingMessage, "&signature=").concat((_this$auth6 = _this.auth) === null || _this$auth6 === void 0 ? void 0 : _this$auth6.signature, "&identifier=").concat(_this.identifier));
iframe.setAttribute("name", _this.iframeName);

@@ -628,2 +600,3 @@ iframe.setAttribute("allow", "microphone; camera; midi; encrypted-media; usb; ethereum");

_defineProperty(this, "_closeFlow", function () {
var _this$iframe, _this$iframe$parentNo, _this$overlaySpinner, _this$overlaySpinner$;
var html = document.getElementsByTagName("html")[0];

@@ -645,4 +618,4 @@ var body = document.getElementsByTagName("body")[0];

_this.initDataSent = false;
_this.iframe && document.body.removeChild(_this.iframe);
_this.overlaySpinner && document.body.removeChild(_this.overlaySpinner);
(_this$iframe = _this.iframe) === null || _this$iframe === void 0 ? void 0 : (_this$iframe$parentNo = _this$iframe.parentNode) === null || _this$iframe$parentNo === void 0 ? void 0 : _this$iframe$parentNo.removeChild(_this.iframe);
(_this$overlaySpinner = _this.overlaySpinner) === null || _this$overlaySpinner === void 0 ? void 0 : (_this$overlaySpinner$ = _this$overlaySpinner.parentNode) === null || _this$overlaySpinner$ === void 0 ? void 0 : _this$overlaySpinner$.removeChild(_this.overlaySpinner);
});

@@ -661,5 +634,5 @@ this.baseURL = (config === null || config === void 0 ? void 0 : config.baseUrl) || BASE_URL;

this.isOpen = false;
this.initOnFlow = "KYC";
this.identityProviders = ["GBG"];
this.selectedFlow = "REQUEST";
this.overlaySpinner = undefined;
this.callbacks = {};
this.styles = ".kyc-sdk-loader-modal{position:fixed;left:0;top:0;display:flex; justify-content:center;align-items:center;width:100%;height:100%;z-index:9999;background-color:rgb(1,1,1,0.65);}.kyc-sdk-loader-embed{position:relative;left:0;top:0;width:100%;height:100%;z-index:9999};";

@@ -666,0 +639,0 @@ });

@@ -395,5 +395,5 @@ import { z } from 'zod';

var KYCDataResponses = ["onInitKyc", "signature", "zkProofVerified"];
var KYCDataResponses = ["onInitKyc", "signature"];
var KYCDataResponseSchema = z["enum"](KYCDataResponses);
var KYCDataMessages = ["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "zkVerifySignature", "closeScreen"];
var KYCDataMessages = ["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "closeScreen"];
var KYCDataMessageSchema = z["enum"](KYCDataMessages);

@@ -405,24 +405,17 @@

_defineProperty(this, "onInitKycData", function (onInitKyc) {
var _this$callbacks;
((_this$callbacks = _this.callbacks) !== null && _this$callbacks !== void 0 ? _this$callbacks : _this.callbacks = {}).onInitKycCallback = onInitKyc;
console.log("onInitKycData");
_this.callbacks.onInitKycCallback = onInitKyc;
});
_defineProperty(this, "onSignPersonalData", function (signPersonalDataCallback) {
var _this$callbacks2;
((_this$callbacks2 = _this.callbacks) !== null && _this$callbacks2 !== void 0 ? _this$callbacks2 : _this.callbacks = {}).signPersonalDataCallback = signPersonalDataCallback;
console.log("onSignPersonalData");
_this.callbacks.signPersonalDataCallback = signPersonalDataCallback;
});
_defineProperty(this, "onZkCallback", function (zkCallBack) {
var _this$callbacks3;
((_this$callbacks3 = _this.callbacks) !== null && _this$callbacks3 !== void 0 ? _this$callbacks3 : _this.callbacks = {}).zkCallback = zkCallBack;
});
_defineProperty(this, "onOffChainShareCompletition", function (offChainShareCompletionCallback) {
var _this$callbacks4;
((_this$callbacks4 = _this.callbacks) !== null && _this$callbacks4 !== void 0 ? _this$callbacks4 : _this.callbacks = {}).offChainShareCompletionCallback = offChainShareCompletionCallback;
_this.callbacks.offChainShareCompletionCallback = offChainShareCompletionCallback;
});
_defineProperty(this, "onKycCompletion", function (kycCompletionCallback) {
var _this$callbacks5;
((_this$callbacks5 = _this.callbacks) !== null && _this$callbacks5 !== void 0 ? _this$callbacks5 : _this.callbacks = {}).kycCompletionCallback = kycCompletionCallback;
_this.callbacks.kycCompletionCallback = kycCompletionCallback;
});
_defineProperty(this, "onCloseScreen", function (onCloseScreenCallback) {
var _this$callbacks6;
((_this$callbacks6 = _this.callbacks) !== null && _this$callbacks6 !== void 0 ? _this$callbacks6 : _this.callbacks = {}).onCloseScreenCallback = onCloseScreenCallback;
_this.callbacks.onCloseScreenCallback = onCloseScreenCallback;
});

@@ -434,7 +427,4 @@ _defineProperty(this, "init", function (options) {

}
if (options.identityProviders) {
_this.identityProviders = options.identityProviders;
}
if (options.initOnFlow) {
_this.initOnFlow = options.initOnFlow;
_this.selectedFlow = options.initOnFlow;
}

@@ -475,4 +465,4 @@ if (!_this.alreadyInit) {

var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
var _this$callbacks7, _this$callbacks8, _this$callbacks10;
var kycData, dataOnInit, signedMessage, _frames, _this$callbacks9, txHash, _frames2;
var _this$callbacks, _this$callbacks2;
var kycData, _this$auth, _this$auth2, _this$auth3, dataOnInit, signedMessage, _frames, _this$callbacks3;
return _regeneratorRuntime().wrap(function _callee$(_context) {

@@ -495,4 +485,7 @@ while (1) switch (_context.prev = _context.next) {

dataOnInit = {
initOnFlow: _this.initOnFlow,
identityProviders: _this.identityProviders
selectedFlow: _this.selectedFlow,
accessToken: ((_this$auth = _this.auth) === null || _this$auth === void 0 ? void 0 : _this$auth.accessToken) || "",
identifier: _this.identifier || "",
signature: ((_this$auth2 = _this.auth) === null || _this$auth2 === void 0 ? void 0 : _this$auth2.signature) || "",
signingMessage: ((_this$auth3 = _this.auth) === null || _this$auth3 === void 0 ? void 0 : _this$auth3.signingMessage) || ""
}; // eslint-disable-next-line @typescript-eslint/ban-ts-comment

@@ -511,3 +504,3 @@ // @ts-ignore

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks7 = _this.callbacks) !== null && _this$callbacks7 !== void 0 && _this$callbacks7.signPersonalDataCallback)) {
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks = _this.callbacks) !== null && _this$callbacks !== void 0 && _this$callbacks.signPersonalDataCallback)) {
_context.next = 9;

@@ -533,3 +526,3 @@ break;

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks8 = _this.callbacks) !== null && _this$callbacks8 !== void 0 && _this$callbacks8.kycCompletionCallback) {
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks2 = _this.callbacks) !== null && _this$callbacks2 !== void 0 && _this$callbacks2.kycCompletionCallback) {
_this.callbacks.kycCompletionCallback(

@@ -547,3 +540,3 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access

!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier))) {
if ((_this$callbacks9 = _this.callbacks) !== null && _this$callbacks9 !== void 0 && _this$callbacks9.offChainShareCompletionCallback) {
if ((_this$callbacks3 = _this.callbacks) !== null && _this$callbacks3 !== void 0 && _this$callbacks3.offChainShareCompletionCallback) {
_this.callbacks.offChainShareCompletionCallback();

@@ -553,23 +546,2 @@ }

}
//send tx to verify the ZKProof
if (!(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
kycData.type === KYCDataMessageSchema["enum"].zkVerifySignature && (
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
!_this.identifier || _this.identifier === (kycData === null || kycData === void 0 ? void 0 : kycData.identifier)) && (_this$callbacks10 = _this.callbacks) !== null && _this$callbacks10 !== void 0 && _this$callbacks10.zkCallback)) {
_context.next = 17;
break;
}
_context.next = 14;
return _this.callbacks.zkCallback(kycData.data.message);
case 14:
txHash = _context.sent;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
_frames2 = window.frames; // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
_frames2[_this.iframeName].postMessage({
type: KYCDataResponseSchema["enum"].zkProofVerified,
data: txHash
}, _this.baseURL);
case 17:
if (

@@ -582,3 +554,3 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access

}
case 18:
case 12:
case "end":

@@ -611,4 +583,4 @@ return _context.stop();

_defineProperty(this, "_setIframeAttributes", function (iframe) {
var _this$auth, _this$auth2, _this$auth3;
iframe.setAttribute("src", "".concat(_this.baseURL, "?accessToken=").concat((_this$auth = _this.auth) === null || _this$auth === void 0 ? void 0 : _this$auth.accessToken, "&signingMessage=").concat((_this$auth2 = _this.auth) === null || _this$auth2 === void 0 ? void 0 : _this$auth2.signingMessage, "&signature=").concat((_this$auth3 = _this.auth) === null || _this$auth3 === void 0 ? void 0 : _this$auth3.signature, "&identifier=").concat(_this.identifier));
var _this$auth4, _this$auth5, _this$auth6;
iframe.setAttribute("src", "".concat(_this.baseURL, "?accessToken=").concat((_this$auth4 = _this.auth) === null || _this$auth4 === void 0 ? void 0 : _this$auth4.accessToken, "&signingMessage=").concat((_this$auth5 = _this.auth) === null || _this$auth5 === void 0 ? void 0 : _this$auth5.signingMessage, "&signature=").concat((_this$auth6 = _this.auth) === null || _this$auth6 === void 0 ? void 0 : _this$auth6.signature, "&identifier=").concat(_this.identifier));
iframe.setAttribute("name", _this.iframeName);

@@ -624,2 +596,3 @@ iframe.setAttribute("allow", "microphone; camera; midi; encrypted-media; usb; ethereum");

_defineProperty(this, "_closeFlow", function () {
var _this$iframe, _this$iframe$parentNo, _this$overlaySpinner, _this$overlaySpinner$;
var html = document.getElementsByTagName("html")[0];

@@ -641,4 +614,4 @@ var body = document.getElementsByTagName("body")[0];

_this.initDataSent = false;
_this.iframe && document.body.removeChild(_this.iframe);
_this.overlaySpinner && document.body.removeChild(_this.overlaySpinner);
(_this$iframe = _this.iframe) === null || _this$iframe === void 0 ? void 0 : (_this$iframe$parentNo = _this$iframe.parentNode) === null || _this$iframe$parentNo === void 0 ? void 0 : _this$iframe$parentNo.removeChild(_this.iframe);
(_this$overlaySpinner = _this.overlaySpinner) === null || _this$overlaySpinner === void 0 ? void 0 : (_this$overlaySpinner$ = _this$overlaySpinner.parentNode) === null || _this$overlaySpinner$ === void 0 ? void 0 : _this$overlaySpinner$.removeChild(_this.overlaySpinner);
});

@@ -657,5 +630,5 @@ this.baseURL = (config === null || config === void 0 ? void 0 : config.baseUrl) || BASE_URL;

this.isOpen = false;
this.initOnFlow = "KYC";
this.identityProviders = ["GBG"];
this.selectedFlow = "REQUEST";
this.overlaySpinner = undefined;
this.callbacks = {};
this.styles = ".kyc-sdk-loader-modal{position:fixed;left:0;top:0;display:flex; justify-content:center;align-items:center;width:100%;height:100%;z-index:9999;background-color:rgb(1,1,1,0.65);}.kyc-sdk-loader-embed{position:relative;left:0;top:0;width:100%;height:100%;z-index:9999};";

@@ -662,0 +635,0 @@ });

@@ -1,10 +0,11 @@

import { type ethers } from "ethers";
import { type DataAvailableOnInit, type IKycClient, type KYCSDKInitOptions } from "./types/client";
import { type DataAvailableOnInit } from "@nexeraprotocol/nexera-id-schemas/compliance/kyc";
import { type IKycClient, type KYCSDKInitOptions } from "./types/client";
export * from "./types/client";
export * from "./types/actions";
export type { AvailableFlow } from "@nexeraprotocol/nexera-id-schemas/compliance/kyc";
export default class KycClient implements IKycClient {
private baseURL;
private initOnFlow?;
private selectedFlow?;
private auth?;
private callbacks?;
private callbacks;
private iframe?;

@@ -14,3 +15,2 @@ private alreadyInit;

private isOpen;
private identityProviders;
private styles;

@@ -28,3 +28,2 @@ private domElementId;

onSignPersonalData: (signPersonalDataCallback: (data: string) => Promise<string>) => void;
onZkCallback: (zkCallBack: (data: ethers.PopulatedTransaction) => Promise<string>) => void;
onOffChainShareCompletition: (offChainShareCompletionCallback: () => void) => void;

@@ -31,0 +30,0 @@ onKycCompletion: (kycCompletionCallback: (idScanVerifiableCredential: any, id3VerifiableCredential: any) => void) => void;

export declare const BASE_URL = "https://nexera-id-kyc-app-monorepo.vercel.app";
export declare const IFRAME_NAME = "kyc";
export declare const KYC_TYPE = "modal";
export declare const KYC_ELEMENT_ID = "kyc-btn";

@@ -1,8 +0,6 @@

import { type ethers } from "ethers";
import { z } from "zod";
import { type DataAvailableOnInit } from "./client";
import { type DataAvailableOnInit } from "@nexeraprotocol/nexera-id-schemas/compliance/kyc";
export type Callbacks = {
onInitKycCallback?: (data: DataAvailableOnInit) => DataAvailableOnInit;
signPersonalDataCallback?: (data: string) => Promise<string>;
zkCallback?: (data: ethers.PopulatedTransaction) => Promise<string>;
onCloseScreenCallback?: () => Promise<string>;

@@ -12,7 +10,7 @@ offChainShareCompletionCallback?: () => void;

};
export declare const KYCDataResponses: readonly ["onInitKyc", "signature", "zkProofVerified"];
export declare const KYCDataResponseSchema: z.ZodEnum<["onInitKyc", "signature", "zkProofVerified"]>;
export declare const KYCDataResponses: readonly ["onInitKyc", "signature"];
export declare const KYCDataResponseSchema: z.ZodEnum<["onInitKyc", "signature"]>;
export type KYCDataResponse = z.infer<typeof KYCDataResponseSchema>;
export declare const KYCDataMessages: readonly ["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "zkVerifySignature", "closeScreen"];
export declare const KYCDataMessageSchema: z.ZodEnum<["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "zkVerifySignature", "closeScreen"]>;
export declare const KYCDataMessages: readonly ["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "closeScreen"];
export declare const KYCDataMessageSchema: z.ZodEnum<["requestInitialData", "signatureRequest", "kycCompletition", "offChainShareCompletition", "closeScreen"]>;
export type KYCDataMessage = z.infer<typeof KYCDataMessageSchema>;

@@ -1,4 +0,2 @@

import { type ethers } from "ethers";
export type AvailableFlows = "KYC" | "ZKProofs" | "REQUEST" | "MANAGEMENT";
export type AvailableIdentityProviders = "GBG";
import { type AvailableFlow, type DataAvailableOnInit } from "@nexeraprotocol/nexera-id-schemas/compliance/kyc";
export type Auth = {

@@ -12,10 +10,4 @@ accessToken: string;

askForProofOfResidence?: boolean;
initOnFlow?: AvailableFlows;
identityProviders?: AvailableIdentityProviders[];
initOnFlow?: AvailableFlow;
};
export type DataAvailableOnInit = {
askForProofOfResidence?: boolean;
initOnFlow?: AvailableFlows;
identityProviders?: AvailableIdentityProviders[];
};
export interface IKycClient {

@@ -25,3 +17,2 @@ init: (options: KYCSDKInitOptions) => void;

onSignPersonalData: (signPersonalDataCallback: (data: string) => Promise<string>) => void;
onZkCallback: (zkCallBack: (data: ethers.PopulatedTransaction) => Promise<string>) => void;
onKycCompletion: (kycCompletionCallback: (idScanVerifiableCredential: any, id3VerifiableCredential: any) => void) => void;

@@ -28,0 +19,0 @@ onOffChainShareCompletition: (offChainShareCompletionCallback: () => void) => void;

{
"name": "@nexeraid/kyc-sdk",
"version": "0.1.10",
"version": "0.2.0",
"description": "Nexera ID KYC Verification SDK",

@@ -34,2 +34,3 @@ "main": "dist/nexeraprotocol-kyc-sdk.cjs.js",

"dependencies": {
"@nexeraprotocol/nexera-id-schemas": "workspace:*",
"ethers": "5.7.2",

@@ -36,0 +37,0 @@ "zod": "^3.21.4"

{
"name": "@nexeraid/kyc-sdk",
"version": "0.1.10",
"version": "0.2.0",
"description": "Nexera ID KYC Verification SDK",

@@ -22,3 +22,4 @@ "main": "dist/nexeraprotocol-kyc-sdk.cjs.js",

"ethers": "5.7.2",
"zod": "^3.21.4"
"zod": "^3.21.4",
"@nexeraprotocol/nexera-id-schemas": "1.0.7"
},

@@ -25,0 +26,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc