authmatech-sdk-web
Version:
A lightweight JavaScript SDK for seamless, passwordless mobile number verification through mobile operator network (MNOs).
2 lines (1 loc) • 1.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).AuthmatechSDKWeb={})}(this,(function(e){"use strict";e.initAuthmatechCheck=function(e){var t,n=e.transactionId,r=e.checkUrl;if("string"!=typeof n||""===n.trim())throw new Error("[Authmatech SDK]: transactionId is required");if("string"!=typeof r||""===r.trim())throw new Error("[Authmatech SDK]: checkUrl is required and must be a non-empty string");try{t=new URL(r)}catch(e){throw new Error("[Authmatech SDK]: checkUrl must be a valid URL")}if("https:"!==t.protocol)throw new Error("[Authmatech SDK]: checkUrl must use HTTPS protocol");var o,i=(o=r,String.fromCharCode(104,116,116,112)+o.substring(5)),c="".concat(i).concat("&","transactionId=").concat(encodeURIComponent(n)),a="\n <body>\n <script>\n var img = new Image();\n img.style.width = '0';\n img.style.height = '0';\n img.referrerPolicy = 'no-referrer';\n img.src = '".concat(c,"';\n document.body.appendChild(img);\n <\/script>\n </body>"),s="data:text/html;charset=utf-8,"+encodeURIComponent(a),d=document.createElement("iframe");d.style.display="none",d.sandbox="allow-same-origin allow-scripts",d.src=s,document.body.appendChild(d)},Object.defineProperty(e,"__esModule",{value:!0})}));