@nexeraid/identity-sdk
Advanced tools
Comparing version 1.1.69 to 1.1.70
@@ -117,2 +117,8 @@ import type { z } from "zod"; | ||
/** | ||
* Public method to get the whitelisted status of an address | ||
* @param address | ||
* @param provider | ||
*/ | ||
isWhitelisted: (address: string) => Promise<boolean>; | ||
/** | ||
* Private method to initialize the iframe (hidden) with kyc-app and start event listening. | ||
@@ -119,0 +125,0 @@ * That way, third party apps can communicate with kyc-app. |
'use strict'; | ||
var zodValidationError = require('zod-validation-error'); | ||
var viem = require('viem'); | ||
var chains = require('viem/chains'); | ||
var nexeraIdSchemas = require('@nexeraprotocol/nexera-id-schemas'); | ||
@@ -501,2 +503,52 @@ | ||
var ABI = [ | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address[]", | ||
name: "toAddAddresses", | ||
type: "address[]" | ||
} | ||
], | ||
name: "addToWhitelist", | ||
outputs: [ | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address[]", | ||
name: "toRemoveAddresses", | ||
type: "address[]" | ||
} | ||
], | ||
name: "removeFromWhitelist", | ||
outputs: [ | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "", | ||
type: "address" | ||
} | ||
], | ||
name: "whitelist", | ||
outputs: [ | ||
{ | ||
internalType: "bool", | ||
name: "", | ||
type: "bool" | ||
} | ||
], | ||
stateMutability: "view", | ||
type: "function" | ||
} | ||
]; | ||
/** | ||
@@ -515,2 +567,3 @@ * Represents the initial css configuration for the IdentityClient. | ||
}; | ||
var SIMPLE_WHITELIST_CONTRACT = '0x4BAcFD67F584b497823Da979ecCa4750f5fDC743'; | ||
@@ -646,2 +699,37 @@ /** | ||
/** | ||
* Public method to get the whitelisted status of an address | ||
* @param address | ||
* @param provider | ||
*/ | ||
_defineProperty(this, "isWhitelisted", /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(address) { | ||
var client, res; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
client = viem.createPublicClient({ | ||
chain: chains.polygonMumbai, | ||
transport: viem.http() | ||
}); | ||
_context.next = 3; | ||
return client.readContract({ | ||
address: SIMPLE_WHITELIST_CONTRACT, | ||
abi: ABI, | ||
functionName: 'whitelist', | ||
args: [address] | ||
}); | ||
case 3: | ||
res = _context.sent; | ||
return _context.abrupt("return", res); | ||
case 5: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee); | ||
})); | ||
return function (_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}()); | ||
/** | ||
* Private method to initialize the iframe (hidden) with kyc-app and start event listening. | ||
@@ -688,7 +776,7 @@ * That way, third party apps can communicate with kyc-app. | ||
var msgEventHandler = /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { | ||
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { | ||
var _this$callbacks, _this$callbacks2; | ||
var identityMessage, identityMessageData, onInitDataMessage, signedMessage, _this$callbacks3, _this$callbacks$sdkIn, _this$callbacks4, _this$callbacks$resol, _this$callbacks5; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
@@ -701,3 +789,3 @@ // if (event.origin !== this.baseURL) return; TODO let's think about security later | ||
if (identityMessage.success) { | ||
_context.next = 5; | ||
_context2.next = 5; | ||
break; | ||
@@ -709,3 +797,3 @@ } | ||
}); | ||
return _context.abrupt("return"); | ||
return _context2.abrupt("return"); | ||
case 5: | ||
@@ -720,9 +808,9 @@ identityMessageData = identityMessage.data; // Send initial data to the App | ||
if (!(identityMessageData.type === "signatureRequest" && identifier === (identityMessageData === null || identityMessageData === void 0 ? void 0 : identityMessageData.identifier) && (_this$callbacks = _this.callbacks) !== null && _this$callbacks !== void 0 && _this$callbacks.onSignMessageCallback)) { | ||
_context.next = 12; | ||
_context2.next = 12; | ||
break; | ||
} | ||
_context.next = 10; | ||
_context2.next = 10; | ||
return _this.callbacks.onSignMessageCallback(identityMessageData.data); | ||
case 10: | ||
signedMessage = _context.sent; | ||
signedMessage = _context2.sent; | ||
_this._sendMessageToIdentityApp(HostMessageFactory.createSignatureResponse(signedMessage)); | ||
@@ -737,10 +825,10 @@ case 12: | ||
if (!(identityMessageData.type === "closeScreen" && identifier === (identityMessageData === null || identityMessageData === void 0 ? void 0 : identityMessageData.identifier))) { | ||
_context.next = 18; | ||
_context2.next = 18; | ||
break; | ||
} | ||
if (!((_this$callbacks3 = _this.callbacks) !== null && _this$callbacks3 !== void 0 && _this$callbacks3.closeScreenCallback)) { | ||
_context.next = 17; | ||
_context2.next = 17; | ||
break; | ||
} | ||
_context.next = 17; | ||
_context2.next = 17; | ||
return _this.callbacks.closeScreenCallback(); | ||
@@ -764,8 +852,8 @@ case 17: | ||
case "end": | ||
return _context.stop(); | ||
return _context2.stop(); | ||
} | ||
}, _callee); | ||
}, _callee2); | ||
})); | ||
return function msgEventHandler() { | ||
return _ref.apply(this, arguments); | ||
return _ref2.apply(this, arguments); | ||
}; | ||
@@ -772,0 +860,0 @@ }(); |
'use strict'; | ||
var zodValidationError = require('zod-validation-error'); | ||
var viem = require('viem'); | ||
var chains = require('viem/chains'); | ||
var nexeraIdSchemas = require('@nexeraprotocol/nexera-id-schemas'); | ||
@@ -501,2 +503,52 @@ | ||
var ABI = [ | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address[]", | ||
name: "toAddAddresses", | ||
type: "address[]" | ||
} | ||
], | ||
name: "addToWhitelist", | ||
outputs: [ | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address[]", | ||
name: "toRemoveAddresses", | ||
type: "address[]" | ||
} | ||
], | ||
name: "removeFromWhitelist", | ||
outputs: [ | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "", | ||
type: "address" | ||
} | ||
], | ||
name: "whitelist", | ||
outputs: [ | ||
{ | ||
internalType: "bool", | ||
name: "", | ||
type: "bool" | ||
} | ||
], | ||
stateMutability: "view", | ||
type: "function" | ||
} | ||
]; | ||
/** | ||
@@ -515,2 +567,3 @@ * Represents the initial css configuration for the IdentityClient. | ||
}; | ||
var SIMPLE_WHITELIST_CONTRACT = '0x4BAcFD67F584b497823Da979ecCa4750f5fDC743'; | ||
@@ -646,2 +699,37 @@ /** | ||
/** | ||
* Public method to get the whitelisted status of an address | ||
* @param address | ||
* @param provider | ||
*/ | ||
_defineProperty(this, "isWhitelisted", /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(address) { | ||
var client, res; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
client = viem.createPublicClient({ | ||
chain: chains.polygonMumbai, | ||
transport: viem.http() | ||
}); | ||
_context.next = 3; | ||
return client.readContract({ | ||
address: SIMPLE_WHITELIST_CONTRACT, | ||
abi: ABI, | ||
functionName: 'whitelist', | ||
args: [address] | ||
}); | ||
case 3: | ||
res = _context.sent; | ||
return _context.abrupt("return", res); | ||
case 5: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee); | ||
})); | ||
return function (_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}()); | ||
/** | ||
* Private method to initialize the iframe (hidden) with kyc-app and start event listening. | ||
@@ -688,7 +776,7 @@ * That way, third party apps can communicate with kyc-app. | ||
var msgEventHandler = /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { | ||
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { | ||
var _this$callbacks, _this$callbacks2; | ||
var identityMessage, identityMessageData, onInitDataMessage, signedMessage, _this$callbacks3, _this$callbacks$sdkIn, _this$callbacks4, _this$callbacks$resol, _this$callbacks5; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
@@ -701,3 +789,3 @@ // if (event.origin !== this.baseURL) return; TODO let's think about security later | ||
if (identityMessage.success) { | ||
_context.next = 5; | ||
_context2.next = 5; | ||
break; | ||
@@ -709,3 +797,3 @@ } | ||
}); | ||
return _context.abrupt("return"); | ||
return _context2.abrupt("return"); | ||
case 5: | ||
@@ -720,9 +808,9 @@ identityMessageData = identityMessage.data; // Send initial data to the App | ||
if (!(identityMessageData.type === "signatureRequest" && identifier === (identityMessageData === null || identityMessageData === void 0 ? void 0 : identityMessageData.identifier) && (_this$callbacks = _this.callbacks) !== null && _this$callbacks !== void 0 && _this$callbacks.onSignMessageCallback)) { | ||
_context.next = 12; | ||
_context2.next = 12; | ||
break; | ||
} | ||
_context.next = 10; | ||
_context2.next = 10; | ||
return _this.callbacks.onSignMessageCallback(identityMessageData.data); | ||
case 10: | ||
signedMessage = _context.sent; | ||
signedMessage = _context2.sent; | ||
_this._sendMessageToIdentityApp(HostMessageFactory.createSignatureResponse(signedMessage)); | ||
@@ -737,10 +825,10 @@ case 12: | ||
if (!(identityMessageData.type === "closeScreen" && identifier === (identityMessageData === null || identityMessageData === void 0 ? void 0 : identityMessageData.identifier))) { | ||
_context.next = 18; | ||
_context2.next = 18; | ||
break; | ||
} | ||
if (!((_this$callbacks3 = _this.callbacks) !== null && _this$callbacks3 !== void 0 && _this$callbacks3.closeScreenCallback)) { | ||
_context.next = 17; | ||
_context2.next = 17; | ||
break; | ||
} | ||
_context.next = 17; | ||
_context2.next = 17; | ||
return _this.callbacks.closeScreenCallback(); | ||
@@ -764,8 +852,8 @@ case 17: | ||
case "end": | ||
return _context.stop(); | ||
return _context2.stop(); | ||
} | ||
}, _callee); | ||
}, _callee2); | ||
})); | ||
return function msgEventHandler() { | ||
return _ref.apply(this, arguments); | ||
return _ref2.apply(this, arguments); | ||
}; | ||
@@ -772,0 +860,0 @@ }(); |
import { fromZodError } from 'zod-validation-error'; | ||
import { createPublicClient, http } from 'viem'; | ||
import { polygonMumbai } from 'viem/chains'; | ||
import { IdentityMessage, KycCompletionData } from '@nexeraprotocol/nexera-id-schemas'; | ||
@@ -499,2 +501,52 @@ | ||
var ABI = [ | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address[]", | ||
name: "toAddAddresses", | ||
type: "address[]" | ||
} | ||
], | ||
name: "addToWhitelist", | ||
outputs: [ | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address[]", | ||
name: "toRemoveAddresses", | ||
type: "address[]" | ||
} | ||
], | ||
name: "removeFromWhitelist", | ||
outputs: [ | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "", | ||
type: "address" | ||
} | ||
], | ||
name: "whitelist", | ||
outputs: [ | ||
{ | ||
internalType: "bool", | ||
name: "", | ||
type: "bool" | ||
} | ||
], | ||
stateMutability: "view", | ||
type: "function" | ||
} | ||
]; | ||
/** | ||
@@ -513,2 +565,3 @@ * Represents the initial css configuration for the IdentityClient. | ||
}; | ||
var SIMPLE_WHITELIST_CONTRACT = '0x4BAcFD67F584b497823Da979ecCa4750f5fDC743'; | ||
@@ -644,2 +697,37 @@ /** | ||
/** | ||
* Public method to get the whitelisted status of an address | ||
* @param address | ||
* @param provider | ||
*/ | ||
_defineProperty(this, "isWhitelisted", /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(address) { | ||
var client, res; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
client = createPublicClient({ | ||
chain: polygonMumbai, | ||
transport: http() | ||
}); | ||
_context.next = 3; | ||
return client.readContract({ | ||
address: SIMPLE_WHITELIST_CONTRACT, | ||
abi: ABI, | ||
functionName: 'whitelist', | ||
args: [address] | ||
}); | ||
case 3: | ||
res = _context.sent; | ||
return _context.abrupt("return", res); | ||
case 5: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee); | ||
})); | ||
return function (_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}()); | ||
/** | ||
* Private method to initialize the iframe (hidden) with kyc-app and start event listening. | ||
@@ -686,7 +774,7 @@ * That way, third party apps can communicate with kyc-app. | ||
var msgEventHandler = /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { | ||
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { | ||
var _this$callbacks, _this$callbacks2; | ||
var identityMessage, identityMessageData, onInitDataMessage, signedMessage, _this$callbacks3, _this$callbacks$sdkIn, _this$callbacks4, _this$callbacks$resol, _this$callbacks5; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
@@ -699,3 +787,3 @@ // if (event.origin !== this.baseURL) return; TODO let's think about security later | ||
if (identityMessage.success) { | ||
_context.next = 5; | ||
_context2.next = 5; | ||
break; | ||
@@ -707,3 +795,3 @@ } | ||
}); | ||
return _context.abrupt("return"); | ||
return _context2.abrupt("return"); | ||
case 5: | ||
@@ -718,9 +806,9 @@ identityMessageData = identityMessage.data; // Send initial data to the App | ||
if (!(identityMessageData.type === "signatureRequest" && identifier === (identityMessageData === null || identityMessageData === void 0 ? void 0 : identityMessageData.identifier) && (_this$callbacks = _this.callbacks) !== null && _this$callbacks !== void 0 && _this$callbacks.onSignMessageCallback)) { | ||
_context.next = 12; | ||
_context2.next = 12; | ||
break; | ||
} | ||
_context.next = 10; | ||
_context2.next = 10; | ||
return _this.callbacks.onSignMessageCallback(identityMessageData.data); | ||
case 10: | ||
signedMessage = _context.sent; | ||
signedMessage = _context2.sent; | ||
_this._sendMessageToIdentityApp(HostMessageFactory.createSignatureResponse(signedMessage)); | ||
@@ -735,10 +823,10 @@ case 12: | ||
if (!(identityMessageData.type === "closeScreen" && identifier === (identityMessageData === null || identityMessageData === void 0 ? void 0 : identityMessageData.identifier))) { | ||
_context.next = 18; | ||
_context2.next = 18; | ||
break; | ||
} | ||
if (!((_this$callbacks3 = _this.callbacks) !== null && _this$callbacks3 !== void 0 && _this$callbacks3.closeScreenCallback)) { | ||
_context.next = 17; | ||
_context2.next = 17; | ||
break; | ||
} | ||
_context.next = 17; | ||
_context2.next = 17; | ||
return _this.callbacks.closeScreenCallback(); | ||
@@ -762,8 +850,8 @@ case 17: | ||
case "end": | ||
return _context.stop(); | ||
return _context2.stop(); | ||
} | ||
}, _callee); | ||
}, _callee2); | ||
})); | ||
return function msgEventHandler() { | ||
return _ref.apply(this, arguments); | ||
return _ref2.apply(this, arguments); | ||
}; | ||
@@ -770,0 +858,0 @@ }(); |
{ | ||
"name": "@nexeraid/identity-sdk", | ||
"version": "1.1.69", | ||
"version": "1.1.70", | ||
"description": "Nexera ID Identity Verification SDK", | ||
@@ -34,2 +34,3 @@ "main": "dist/nexeraid-identity-sdk.cjs.js", | ||
"@nexeraprotocol/nexera-id-schemas": "workspace:*", | ||
"viem": "^1.11.0", | ||
"zod": "^3.22.2", | ||
@@ -36,0 +37,0 @@ "zod-validation-error": "^1.5.0" |
{ | ||
"name": "@nexeraid/identity-sdk", | ||
"version": "1.1.69", | ||
"version": "1.1.70", | ||
"description": "Nexera ID Identity Verification SDK", | ||
@@ -19,2 +19,3 @@ "main": "dist/nexeraid-identity-sdk.cjs.js", | ||
"dependencies": { | ||
"viem": "^1.11.0", | ||
"zod": "^3.22.2", | ||
@@ -21,0 +22,0 @@ "zod-validation-error": "^1.5.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120517
2807
4
+ Addedviem@^1.11.0
+ Added@adraffy/ens-normalize@1.10.0(transitive)
+ Added@noble/hashes@1.3.3(transitive)
+ Added@scure/base@1.1.9(transitive)
+ Added@scure/bip32@1.3.2(transitive)
+ Added@scure/bip39@1.2.1(transitive)
+ Addedabitype@0.9.8(transitive)
+ Addedisows@1.0.3(transitive)
+ Addedviem@1.21.4(transitive)
+ Addedws@8.13.0(transitive)