onairos 0.1.135 → 0.1.136
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/RSA.js +52 -0
- package/dist/getPin.js +25 -0
- package/dist/onairos.bundle.js +1 -1
- package/dist/onairos.bundle.js.map +1 -1
- package/dist/onairos.js +155 -0
- package/dist/othent-kms.js +1 -1
- package/dist/othent-kms.js.map +1 -1
- package/package.json +2 -2
- package/src/onairos.jsx +2 -2
- package/webpack.config.js +4 -3
package/dist/RSA.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.rsaEncrypt = rsaEncrypt;
|
|
7
|
+
// Function to convert PEM encoded public key to a format usable by the Web Crypto API
|
|
8
|
+
function pemToBuffer(pem) {
|
|
9
|
+
// Remove the first and last lines (headers), and all line breaks
|
|
10
|
+
const base64String = pem.replace(/-----BEGIN PUBLIC KEY-----/, '').replace(/-----END PUBLIC KEY-----/, '').replace(/\s/g, ''); // remove all whitespace, not just line breaks
|
|
11
|
+
const binaryString = window.atob(base64String);
|
|
12
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
13
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
14
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
15
|
+
}
|
|
16
|
+
return bytes.buffer;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Function to encrypt data using RSA
|
|
20
|
+
async function rsaEncrypt(publicKeyPem, data) {
|
|
21
|
+
try {
|
|
22
|
+
const publicKeyBuffer = pemToBuffer(publicKeyPem);
|
|
23
|
+
const importedKey = await window.crypto.subtle.importKey('spki', publicKeyBuffer, {
|
|
24
|
+
name: 'RSA-OAEP',
|
|
25
|
+
hash: {
|
|
26
|
+
name: 'SHA-256'
|
|
27
|
+
}
|
|
28
|
+
}, true, ['encrypt']);
|
|
29
|
+
const encrypted = await window.crypto.subtle.encrypt({
|
|
30
|
+
name: 'RSA-OAEP'
|
|
31
|
+
}, importedKey, new TextEncoder().encode(data));
|
|
32
|
+
return bufferToBase64(encrypted);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("rsaEncrypt error:", error);
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Function to convert ArrayBuffer to Base64
|
|
40
|
+
function bufferToBase64(buffer) {
|
|
41
|
+
try {
|
|
42
|
+
let binary = '';
|
|
43
|
+
const bytes = new Uint8Array(buffer);
|
|
44
|
+
const len = bytes.byteLength;
|
|
45
|
+
for (let i = 0; i < len; i++) {
|
|
46
|
+
binary += String.fromCharCode(bytes[i]);
|
|
47
|
+
}
|
|
48
|
+
return window.btoa(binary);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
console.error("Eror in buffertoBase64 : ", e);
|
|
51
|
+
}
|
|
52
|
+
}
|
package/dist/getPin.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getPin;
|
|
7
|
+
async function getPin(hashedOthentSub) {
|
|
8
|
+
const jsonData = {
|
|
9
|
+
Info: {
|
|
10
|
+
'hashedOthentSub': hashedOthentSub
|
|
11
|
+
},
|
|
12
|
+
request: 'PIN'
|
|
13
|
+
};
|
|
14
|
+
return await fetch('https://api2.onairos.uk/getAccountInfoFromOthentSub', {
|
|
15
|
+
// return await fetch('http://localhost:8080/getAccountInfoFromOthentSub', {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
headers: {
|
|
18
|
+
'Content-Type': 'application/json'
|
|
19
|
+
},
|
|
20
|
+
body: JSON.stringify(jsonData)
|
|
21
|
+
}).then(response => response.json()).then(data => {
|
|
22
|
+
return data;
|
|
23
|
+
}).catch(error => console.error(error));
|
|
24
|
+
}
|
|
25
|
+
;
|
package/dist/onairos.bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(()=>(()=>{var e,t,r={249:function(e,t,r){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==r.g&&r.g.crypto&&(n=r.g.crypto),!n)try{n=r(480)}catch(e){}var o=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},c=a.lib={},s=c.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=c.WordArray=s.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var a=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=a<<24-(n+i)%4*8}else for(var c=0;c<o;c+=4)t[n+c>>>2]=r[c>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(o());return new u.init(t,e)}}),f=a.enc={},l=f.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},p=f.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},d=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(p.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return p.parse(unescape(encodeURIComponent(e)))}},h=c.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,o=n.words,i=n.sigBytes,a=this.blockSize,c=i/(4*a),s=(c=t?e.ceil(c):e.max((0|c)-this._minBufferSize,0))*a,f=e.min(4*s,i);if(s){for(var l=0;l<s;l+=a)this._doProcessBlock(o,l);r=o.splice(0,s),n.sigBytes-=f}return new u.init(r,f)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),y=(c.Hasher=h.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new y.HMAC.init(e,r).finalize(t)}}}),a.algo={});return a}(Math),n)},153:function(e,t,r){var n;e.exports=(n=r(249),function(e){var t=n,r=t.lib,o=r.WordArray,i=r.Hasher,a=t.algo,c=[],s=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(c[o]=r(e.pow(n,.5))),s[o]=r(e.pow(n,1/3)),o++),n++}();var u=[],f=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(c.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],c=r[4],f=r[5],l=r[6],p=r[7],d=0;d<64;d++){if(d<16)u[d]=0|e[t+d];else{var h=u[d-15],y=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,m=u[d-2],w=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[d]=y+u[d-7]+w+u[d-16]}var g=n&o^n&i^o&i,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),b=p+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&f^~c&l)+s[d]+u[d];p=l,l=f,f=c,c=a+b|0,a=i,i=o,o=n,n=b+(v+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0,r[5]=r[5]+f|0,r[6]=r[6]+l|0,r[7]=r[7]+p|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=e.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(f),t.HmacSHA256=i._createHmacHelper(f)}(Math),n.SHA256)},408:(e,t)=>{"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),s=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.iterator;var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,m={};function w(e,t,r){this.props=e,this.context=t,this.refs=m,this.updater=r||h}function g(){}function v(e,t,r){this.props=e,this.context=t,this.refs=m,this.updater=r||h}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},g.prototype=w.prototype;var b=v.prototype=new g;b.constructor=v,y(b,w.prototype),b.isPureReactComponent=!0;var _=Array.isArray,E=Object.prototype.hasOwnProperty,S={current:null},k={key:!0,ref:!0,__self:!0,__source:!0};function C(e,t,n){var o,i={},a=null,c=null;if(null!=t)for(o in void 0!==t.ref&&(c=t.ref),void 0!==t.key&&(a=""+t.key),t)E.call(t,o)&&!k.hasOwnProperty(o)&&(i[o]=t[o]);var s=arguments.length-2;if(1===s)i.children=n;else if(1<s){for(var u=Array(s),f=0;f<s;f++)u[f]=arguments[f+2];i.children=u}if(e&&e.defaultProps)for(o in s=e.defaultProps)void 0===i[o]&&(i[o]=s[o]);return{$$typeof:r,type:e,key:a,ref:c,props:i,_owner:S.current}}function A(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var B=/\/+/g;function x(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function O(e,t,o,i,a){var c=typeof e;"undefined"!==c&&"boolean"!==c||(e=null);var s=!1;if(null===e)s=!0;else switch(c){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case r:case n:s=!0}}if(s)return a=a(s=e),e=""===i?"."+x(s,0):i,_(a)?(o="",null!=e&&(o=e.replace(B,"$&/")+"/"),O(a,t,o,"",(function(e){return e}))):null!=a&&(A(a)&&(a=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(a,o+(!a.key||s&&s.key===a.key?"":(""+a.key).replace(B,"$&/")+"/")+e)),t.push(a)),1;if(s=0,i=""===i?".":i+":",_(e))for(var u=0;u<e.length;u++){var f=i+x(c=e[u],u);s+=O(c,t,o,f,a)}else if(f=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=d&&e[d]||e["@@iterator"])?e:null}(e),"function"==typeof f)for(e=f.call(e),u=0;!(c=e.next()).done;)s+=O(c=c.value,t,o,f=i+x(c,u++),a);else if("object"===c)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function j(e,t,r){if(null==e)return e;var n=[],o=0;return O(e,n,"","",(function(e){return t.call(r,e,o++)})),n}function P(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var I={current:null},R={transition:null},T={ReactCurrentDispatcher:I,ReactCurrentBatchConfig:R,ReactCurrentOwner:S};t.Children={map:j,forEach:function(e,t,r){j(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return j(e,(function(){t++})),t},toArray:function(e){return j(e,(function(e){return e}))||[]},only:function(e){if(!A(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=w,t.Fragment=o,t.Profiler=a,t.PureComponent=v,t.StrictMode=i,t.Suspense=f,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T,t.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=y({},e.props),i=e.key,a=e.ref,c=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,c=S.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(u in t)E.call(t,u)&&!k.hasOwnProperty(u)&&(o[u]=void 0===t[u]&&void 0!==s?s[u]:t[u])}var u=arguments.length-2;if(1===u)o.children=n;else if(1<u){s=Array(u);for(var f=0;f<u;f++)s[f]=arguments[f+2];o.children=s}return{$$typeof:r,type:e.type,key:i,ref:a,props:o,_owner:c}},t.createContext=function(e){return(e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:c,_context:e},e.Consumer=e},t.createElement=C,t.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.isValidElement=A,t.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:P}},t.memo=function(e,t){return{$$typeof:l,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=R.transition;R.transition={};try{e()}finally{R.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return I.current.useCallback(e,t)},t.useContext=function(e){return I.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return I.current.useDeferredValue(e)},t.useEffect=function(e,t){return I.current.useEffect(e,t)},t.useId=function(){return I.current.useId()},t.useImperativeHandle=function(e,t,r){return I.current.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return I.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return I.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return I.current.useMemo(e,t)},t.useReducer=function(e,t,r){return I.current.useReducer(e,t,r)},t.useRef=function(e){return I.current.useRef(e)},t.useState=function(e){return I.current.useState(e)},t.useSyncExternalStore=function(e,t,r){return I.current.useSyncExternalStore(e,t,r)},t.useTransition=function(){return I.current.useTransition()},t.version="18.2.0"},294:(e,t,r)=>{"use strict";e.exports=r(408)},480:()=>{}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e].call(i.exports,i,i.exports,o),i.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,r)=>(o.f[r](e,t),t)),[])),o.u=e=>"othent-kms.js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="onairos:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var c,s;if(void 0!==i)for(var u=document.getElementsByTagName("script"),f=0;f<u.length;f++){var l=u[f];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){c=l;break}}c||(s=!0,(c=document.createElement("script")).charset="utf-8",c.timeout=120,o.nc&&c.setAttribute("nonce",o.nc),c.setAttribute("data-webpack",t+i),c.src=r),e[r]=[n];var p=(t,n)=>{c.onerror=c.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach((e=>e(n))),t)return t(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=p.bind(null,c.onerror),c.onload=p.bind(null,c.onload),s&&document.head.appendChild(c)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&!e;)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={179:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=i);var a=o.p+o.u(t),c=new Error;o.l(a,(r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;c.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",c.name="ChunkLoadError",c.type=i,c.request=a,n[1](c)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,i,a=r[0],c=r[1],s=r[2],u=0;if(a.some((t=>0!==e[t]))){for(n in c)o.o(c,n)&&(o.m[n]=c[n]);if(s)s(o)}for(t&&t(r);u<a.length;u++)i=a[u],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkonairos=this.webpackChunkonairos||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};return(()=>{"use strict";o.r(i),o.d(i,{Onairos:()=>c});var e=o(294),t=o(153),r=o.n(t);async function n(e,t){try{const r=function(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),r=window.atob(t),n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return n.buffer}(e),n=await window.crypto.subtle.importKey("spki",r,{name:"RSA-OAEP",hash:{name:"SHA-256"}},!0,["encrypt"]);return function(e){try{let t="";const r=new Uint8Array(e),n=r.byteLength;for(let e=0;e<n;e++)t+=String.fromCharCode(r[e]);return window.btoa(t)}catch(e){console.error("Eror in buffertoBase64 : ",e)}}(await window.crypto.subtle.encrypt({name:"RSA-OAEP"},n,(new TextEncoder).encode(t)))}catch(e){return console.error("rsaEncrypt error:",e),null}}const a=async()=>{try{console.log("Entering Dynamic Othent Load");const e=await o.e(874).then(o.bind(o,981));return console.log("DYNAMICALLY LOADED OTHENT"),e}catch(e){console.error("Error loading Othent DYnamically : ",e)}};function c(t){let{requestData:o,webpageName:i,proofMode:c=!1}=t;const s=window.location.href,u=async()=>{try{console.log("Main initiate othent");const{connect:e}=await a();console.log("Main loaded othent");const t=await e(),u=r()(t.sub).toString(),f=await async function(e){const t={Info:{hashedOthentSub:e},request:"PIN"};return await fetch("https://api2.onairos.uk/getAccountInfoFromOthentSub",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json())).then((e=>e)).catch((e=>console.error(e)))}(u);function l(e){try{const t=window.atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r.buffer}catch(e){console.error("Error converting to Buffer :",e)}}const p=l(f.result),{decrypt:d}=await a();n("\n -----BEGIN PUBLIC KEY-----\n MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4wkWvRPaJiY8CwQ5BoJI\n amcGAYV91Bk8NrvWq4PXM+J/RJugfgTNCYKQ/c6g4xa1YES/tJEzFS7nf0Kdoqxm\n 5aav0ru5vS4fc4vCOLTI9W1T7nj02NY91rogsQm2/KMxUQ8DaLeTZKi+0Wjsa9YO\n 6XGGd1wh4azgQkj04MWW5J1EBCcBavKoY+C85oA9jkkklQ8nGWgbugmZs7eXHNQb\n qH8/ZHcB9Kx1CZ6XjQuVd6YE/A+swV+DksbkXANcYjr6SY/2TbB8GfpcOMM3bkyN\n Q8e0A51q5a8abfuAkDZXe67MwKMWu/626abwPZhJrKr5HhRZZDwPtnXlktYHhOK6\n lQIDAQAB\n -----END PUBLIC KEY-----\n ",await d(p)).then((e=>{window.postMessage({source:"webpage",type:"GET_API_URL",webpageName:i,domain:s,requestData:o,proofMode:c,HashedOthentSub:u,EncryptedUserPin:e})})).catch((e=>{console.error("Encryption failed:",e)}))}catch(h){console.error({fix:"Please ensure you have stored your model"}),console.error("Error Sending Data to Terminal: ",h)}};return e.createElement("div",null,e.createElement("button",{className:"OnairosConnect w-20 h-20 flex flex-col items-center justify-center text-white font-bold py-2 px-4 rounded cursor-pointer",onClick:async()=>{try{(()=>{const e=["Small","Medium","Large"],t=["type","descriptions","reward"];if("string"!=typeof i)throw new Error("Property webpageName must be a String");for(const r of e){if(!(r in o))throw new Error("Missing key '".concat(r,"' in requestData."));for(const e of t){if(!(e in o[r]))throw new Error("Missing property '".concat(e,"' in requestData.").concat(r,"."));if("reward"!==e&&"string"!=typeof o[r][e])throw new Error("Property '".concat(e,"' in requestData.").concat(r," must be a string."));if("reward"!==e&&""===o[r][e].trim())throw new Error("Property '".concat(e,"' in requestData.").concat(r," cannot be empty."))}}})(),await u()}catch(e){console.error("Error connecting to Onairos",e)}}},e.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",className:"w-16 h-16 object-contain mb-2"})," ",e.createElement("span",{className:"whitespace-nowrap"},"Connect to Onairos")," "))}})(),i})()));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(()=>(()=>{"use strict";var e,t,r={"./src/RSA.jsx":(e,t,r)=>{async function n(e,t){try{const r=function(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),r=window.atob(t),n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return n.buffer}(e),n=await window.crypto.subtle.importKey("spki",r,{name:"RSA-OAEP",hash:{name:"SHA-256"}},!0,["encrypt"]);return function(e){try{let t="";const r=new Uint8Array(e),n=r.byteLength;for(let e=0;e<n;e++)t+=String.fromCharCode(r[e]);return window.btoa(t)}catch(e){console.error("Eror in buffertoBase64 : ",e)}}(await window.crypto.subtle.encrypt({name:"RSA-OAEP"},n,(new TextEncoder).encode(t)))}catch(e){return console.error("rsaEncrypt error:",e),null}}r.r(t),r.d(t,{rsaEncrypt:()=>n})},"./src/getPin.js":(e,t,r)=>{async function n(e){const t={Info:{hashedOthentSub:e},request:"PIN"};return await fetch("https://api2.onairos.uk/getAccountInfoFromOthentSub",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json())).then((e=>e)).catch((e=>console.error(e)))}r.r(t),r.d(t,{default:()=>n})},"./node_modules/react/cjs/react.development.js":(e,t,r)=>{e=r.nmd(e),function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),m=Symbol.iterator,h="@@iterator";function v(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e[h];return"function"==typeof t?t:null}var g={current:null},b={transition:null},w={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},_={current:null},k={},O=null;function C(e){O=e}k.setExtraStackFrame=function(e){O=e},k.getCurrentStack=null,k.getStackAddendum=function(){var e="";O&&(e+=O);var t=k.getCurrentStack;return t&&(e+=t()||""),e};var E=!1,S=!1,j=!1,R=!1,P=!1,T={ReactCurrentDispatcher:g,ReactCurrentBatchConfig:b,ReactCurrentOwner:_};function x(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];D("warn",e,r)}function A(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];D("error",e,r)}function D(e,t,r){var n=T.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var o=r.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}T.ReactDebugCurrentFrame=k,T.ReactCurrentActQueue=w;var I={};function N(e,t){var r=e.constructor,n=r&&(r.displayName||r.name)||"ReactClass",o=n+"."+t;I[o]||(A("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",t,n),I[o]=!0)}var L={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,r){N(e,"forceUpdate")},enqueueReplaceState:function(e,t,r,n){N(e,"replaceState")},enqueueSetState:function(e,t,r,n){N(e,"setState")}},M=Object.assign,$={};function B(e,t,r){this.props=e,this.context=t,this.refs=$,this.updater=r||L}Object.freeze($),B.prototype.isReactComponent={},B.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},B.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var F={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},Y=function(e,t){Object.defineProperty(B.prototype,e,{get:function(){x("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var U in F)F.hasOwnProperty(U)&&Y(U,F[U]);function q(){}function V(e,t,r){this.props=e,this.context=t,this.refs=$,this.updater=r||L}q.prototype=B.prototype;var K=V.prototype=new q;K.constructor=V,M(K,B.prototype),K.isPureReactComponent=!0;var z=Array.isArray;function H(e){return z(e)}function W(e){return""+e}function G(e){if(function(e){try{return W(e),!1}catch(e){return!0}}(e))return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),W(e)}function Q(e){return e.displayName||"Context"}function J(e){if(null==e)return null;if("number"==typeof e.tag&&A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case s:return Q(e)+".Consumer";case u:return Q(e._context)+".Provider";case c:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case p:var t=e.displayName||null;return null!==t?t:J(e.type)||"Memo";case d:var r=e,y=r._payload,m=r._init;try{return J(m(y))}catch(e){return null}}return null}var X,Z,ee,te=Object.prototype.hasOwnProperty,re={key:!0,ref:!0,__self:!0,__source:!0};function ne(e){if(te.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}function oe(e){if(te.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}ee={};var ae=function(e,t,n,o,a,i,u){var s={$$typeof:r,type:e,key:t,ref:n,props:u,_owner:i,_store:{}};return Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function ie(e,t,r){var n,o={},a=null,i=null,u=null,s=null;if(null!=t)for(n in ne(t)&&(i=t.ref,function(e){if("string"==typeof e.ref&&_.current&&e.__self&&_.current.stateNode!==e.__self){var t=J(_.current.type);ee[t]||(A('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',t,e.ref),ee[t]=!0)}}(t)),oe(t)&&(G(t.key),a=""+t.key),u=void 0===t.__self?null:t.__self,s=void 0===t.__source?null:t.__source,t)te.call(t,n)&&!re.hasOwnProperty(n)&&(o[n]=t[n]);var c=arguments.length-2;if(1===c)o.children=r;else if(c>1){for(var l=Array(c),f=0;f<c;f++)l[f]=arguments[f+2];Object.freeze&&Object.freeze(l),o.children=l}if(e&&e.defaultProps){var p=e.defaultProps;for(n in p)void 0===o[n]&&(o[n]=p[n])}if(a||i){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;a&&function(e,t){var r=function(){X||(X=!0,A("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(o,d),i&&function(e,t){var r=function(){Z||(Z=!0,A("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(o,d)}return ae(e,a,i,u,s,_.current,o)}function ue(e,t,r){if(null==e)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n,o,a=M({},e.props),i=e.key,u=e.ref,s=e._self,c=e._source,l=e._owner;if(null!=t)for(n in ne(t)&&(u=t.ref,l=_.current),oe(t)&&(G(t.key),i=""+t.key),e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)te.call(t,n)&&!re.hasOwnProperty(n)&&(void 0===t[n]&&void 0!==o?a[n]=o[n]:a[n]=t[n]);var f=arguments.length-2;if(1===f)a.children=r;else if(f>1){for(var p=Array(f),d=0;d<f;d++)p[d]=arguments[d+2];a.children=p}return ae(e.type,i,u,s,c,l,a)}function se(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var ce=".",le=":";var fe=!1,pe=/\/+/g;function de(e){return e.replace(pe,"$&/")}function ye(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(G(e.key),r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,(function(e){return n[e]}))):t.toString(36);var r,n}function me(e,t,o,a,i){var u=typeof e;"undefined"!==u&&"boolean"!==u||(e=null);var s,c,l,f=!1;if(null===e)f=!0;else switch(u){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){case r:case n:f=!0}}if(f){var p=e,d=i(p),y=""===a?ce+ye(p,0):a;if(H(d)){var m="";null!=y&&(m=de(y)+"/"),me(d,t,m,"",(function(e){return e}))}else null!=d&&(se(d)&&(!d.key||p&&p.key===d.key||G(d.key),s=d,c=o+(!d.key||p&&p.key===d.key?"":de(""+d.key)+"/")+y,d=ae(s.type,c,s.ref,s._self,s._source,s._owner,s.props)),t.push(d));return 1}var h=0,g=""===a?ce:a+le;if(H(e))for(var b=0;b<e.length;b++)h+=me(l=e[b],t,o,g+ye(l,b),i);else{var w=v(e);if("function"==typeof w){var _=e;w===_.entries&&(fe||x("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),fe=!0);for(var k,O=w.call(_),C=0;!(k=O.next()).done;)h+=me(l=k.value,t,o,g+ye(l,C++),i)}else if("object"===u){var E=String(e);throw new Error("Objects are not valid as a React child (found: "+("[object Object]"===E?"object with keys {"+Object.keys(e).join(", ")+"}":E)+"). If you meant to render a collection of children, use an array instead.")}}return h}function he(e,t,r){if(null==e)return e;var n=[],o=0;return me(e,n,"","",(function(e){return t.call(r,e,o++)})),n}var ve,ge=-1,be=0,we=1,_e=2;function ke(e){if(e._status===ge){var t=(0,e._result)();if(t.then((function(t){if(e._status===be||e._status===ge){var r=e;r._status=we,r._result=t}}),(function(t){if(e._status===be||e._status===ge){var r=e;r._status=_e,r._result=t}})),e._status===ge){var r=e;r._status=be,r._result=t}}if(e._status===we){var n=e._result;return void 0===n&&A("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",n),"default"in n||A("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",n),n.default}throw e._result}function Oe(e){return"string"==typeof e||"function"==typeof e||(!!(e===o||e===i||P||e===a||e===l||e===f||R||e===y||E||S||j)||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===p||e.$$typeof===u||e.$$typeof===s||e.$$typeof===c||e.$$typeof===ve||void 0!==e.getModuleId))}function Ce(){var e=g.current;return null===e&&A("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."),e}ve=Symbol.for("react.module.reference");var Ee,Se,je,Re,Pe,Te,xe,Ae=0;function De(){}De.__reactDisabledLog=!0;var Ie,Ne=T.ReactCurrentDispatcher;function Le(e,t,r){if(void 0===Ie)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);Ie=n&&n[1]||""}return"\n"+Ie+e}var Me,$e=!1,Be="function"==typeof WeakMap?WeakMap:Map;function Fe(e,t){if(!e||$e)return"";var r,n=Me.get(e);if(void 0!==n)return n;$e=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=Ne.current,Ne.current=null,function(){if(0===Ae){Ee=console.log,Se=console.info,je=console.warn,Re=console.error,Pe=console.group,Te=console.groupCollapsed,xe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:De,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Ae++}();try{if(t){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(e){r=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){r=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var u=t.stack.split("\n"),s=r.stack.split("\n"),c=u.length-1,l=s.length-1;c>=1&&l>=0&&u[c]!==s[l];)l--;for(;c>=1&&l>=0;c--,l--)if(u[c]!==s[l]){if(1!==c||1!==l)do{if(c--,--l<0||u[c]!==s[l]){var f="\n"+u[c].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&Me.set(e,f),f}}while(c>=1&&l>=0);break}}}finally{$e=!1,Ne.current=o,function(){if(0==--Ae){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},e,{value:Ee}),info:M({},e,{value:Se}),warn:M({},e,{value:je}),error:M({},e,{value:Re}),group:M({},e,{value:Pe}),groupCollapsed:M({},e,{value:Te}),groupEnd:M({},e,{value:xe})})}Ae<0&&A("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var p=e?e.displayName||e.name:"",d=p?Le(p):"";return"function"==typeof e&&Me.set(e,d),d}function Ye(e,t,r){if(null==e)return"";if("function"==typeof e)return Fe(e,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(e));if("string"==typeof e)return Le(e);switch(e){case l:return Le("Suspense");case f:return Le("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return Fe(e.render,!1);case p:return Ye(e.type,t,r);case d:var n=e,o=n._payload,a=n._init;try{return Ye(a(o),t,r)}catch(e){}}return""}Me=new Be;var Ue,qe={},Ve=T.ReactDebugCurrentFrame;function Ke(e){if(e){var t=e._owner,r=Ye(e.type,e._source,t?t.type:null);Ve.setExtraStackFrame(r)}else Ve.setExtraStackFrame(null)}function ze(e){if(e){var t=e._owner;C(Ye(e.type,e._source,t?t.type:null))}else C(null)}function He(){if(_.current){var e=J(_.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Ue=!1;var We={};function Ge(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=He();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!We[r]){We[r]=!0;var n="";e&&e._owner&&e._owner!==_.current&&(n=" It was passed a child from "+J(e._owner.type)+"."),ze(e),A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),ze(null)}}}function Qe(e,t){if("object"==typeof e)if(H(e))for(var r=0;r<e.length;r++){var n=e[r];se(n)&&Ge(n,t)}else if(se(e))e._store&&(e._store.validated=!0);else if(e){var o=v(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)se(a.value)&&Ge(a.value,t)}}function Je(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==c&&r.$$typeof!==p)return;t=r.propTypes}if(t){var n=J(r);!function(e,t,r,n,o){var a=Function.call.bind(te);for(var i in e)if(a(e,i)){var u=void 0;try{if("function"!=typeof e[i]){var s=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw s.name="Invariant Violation",s}u=e[i](t,i,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){u=e}!u||u instanceof Error||(Ke(o),A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,i,typeof u),Ke(null)),u instanceof Error&&!(u.message in qe)&&(qe[u.message]=!0,Ke(o),A("Failed %s type: %s",r,u.message),Ke(null))}}(t,e.props,"prop",n,e)}else if(void 0!==r.PropTypes&&!Ue){Ue=!0,A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",J(r)||"Unknown")}"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Xe(e,t,n){var a,i,u=Oe(e);if(!u){var s="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(s+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var c,l=null!=(a=t)&&void 0!==(i=a.__source)?"\n\nCheck your code at "+i.fileName.replace(/^.*[\\\/]/,"")+":"+i.lineNumber+".":"";s+=l||He(),null===e?c="null":H(e)?c="array":void 0!==e&&e.$$typeof===r?(c="<"+(J(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):c=typeof e,A("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",c,s)}var f=ie.apply(this,arguments);if(null==f)return f;if(u)for(var p=2;p<arguments.length;p++)Qe(arguments[p],e);return e===o?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){ze(e),A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),ze(null);break}}null!==e.ref&&(ze(e),A("Invalid attribute `ref` supplied to `React.Fragment`."),ze(null))}(f):Je(f),f}var Ze=!1;var et=!1,tt=null;var rt=0,nt=!1;function ot(e){e!==rt-1&&A("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),rt=e}function at(t,r,n){var o=w.current;if(null!==o)try{ut(o),function(t){if(null===tt)try{var r=("require"+Math.random()).slice(0,7),n=e&&e[r];tt=n.call(e,"timers").setImmediate}catch(e){tt=function(e){!1===et&&(et=!0,"undefined"==typeof MessageChannel&&A("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(void 0)}}tt(t)}((function(){0===o.length?(w.current=null,r(t)):at(t,r,n)}))}catch(e){n(e)}else r(t)}var it=!1;function ut(e){if(!it){it=!0;var t=0;try{for(;t<e.length;t++){var r=e[t];do{r=r(!0)}while(null!==r)}e.length=0}catch(r){throw e=e.slice(t+1),r}finally{it=!1}}}var st=Xe,ct=function(e,t,r){for(var n=ue.apply(this,arguments),o=2;o<arguments.length;o++)Qe(arguments[o],n.type);return Je(n),n},lt=function(e){var t=Xe.bind(null,e);return t.type=e,Ze||(Ze=!0,x("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return x("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},ft={map:he,forEach:function(e,t,r){he(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return he(e,(function(){t++})),t},toArray:function(e){return he(e,(function(e){return e}))||[]},only:function(e){if(!se(e))throw new Error("React.Children.only expected to receive a single React element child.");return e}};t.Children=ft,t.Component=B,t.Fragment=o,t.Profiler=i,t.PureComponent=V,t.StrictMode=a,t.Suspense=l,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T,t.cloneElement=ct,t.createContext=function(e){var t={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};t.Provider={$$typeof:u,_context:t};var r=!1,n=!1,o=!1,a={$$typeof:s,_context:t};return Object.defineProperties(a,{Provider:{get:function(){return n||(n=!0,A("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),t.Provider},set:function(e){t.Provider=e}},_currentValue:{get:function(){return t._currentValue},set:function(e){t._currentValue=e}},_currentValue2:{get:function(){return t._currentValue2},set:function(e){t._currentValue2=e}},_threadCount:{get:function(){return t._threadCount},set:function(e){t._threadCount=e}},Consumer:{get:function(){return r||(r=!0,A("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),t.Consumer}},displayName:{get:function(){return t.displayName},set:function(e){o||(x("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",e),o=!0)}}}),t.Consumer=a,t._currentRenderer=null,t._currentRenderer2=null,t},t.createElement=st,t.createFactory=lt,t.createRef=function(){var e={current:null};return Object.seal(e),e},t.forwardRef=function(e){null!=e&&e.$$typeof===p?A("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?A("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&A("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||A("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var t,r={$$typeof:c,render:e};return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(r){t=r,e.name||e.displayName||(e.displayName=r)}}),r},t.isValidElement=se,t.lazy=function(e){var t,r,n={$$typeof:d,_payload:{_status:ge,_result:e},_init:ke};return Object.defineProperties(n,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){A("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(n,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){A("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),r=e,Object.defineProperty(n,"propTypes",{enumerable:!0})}}}),n},t.memo=function(e,t){Oe(e)||A("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e);var r,n={$$typeof:p,type:e,compare:void 0===t?null:t};return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return r},set:function(t){r=t,e.name||e.displayName||(e.displayName=t)}}),n},t.startTransition=function(e,t){var r=b.transition;b.transition={};var n=b.transition;b.transition._updatedFibers=new Set;try{e()}finally{if(b.transition=r,null===r&&n._updatedFibers)n._updatedFibers.size>10&&x("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),n._updatedFibers.clear()}},t.unstable_act=function(e){var t=rt;rt++,null===w.current&&(w.current=[]);var r,n=w.isBatchingLegacy;try{if(w.isBatchingLegacy=!0,r=e(),!n&&w.didScheduleLegacyUpdate){var o=w.current;null!==o&&(w.didScheduleLegacyUpdate=!1,ut(o))}}catch(e){throw ot(t),e}finally{w.isBatchingLegacy=n}if(null!==r&&"object"==typeof r&&"function"==typeof r.then){var a=r,i=!1,u={then:function(e,r){i=!0,a.then((function(n){ot(t),0===rt?at(n,e,r):e(n)}),(function(e){ot(t),r(e)}))}};return nt||"undefined"==typeof Promise||Promise.resolve().then((function(){})).then((function(){i||(nt=!0,A("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))})),u}var s=r;if(ot(t),0===rt){var c=w.current;return null!==c&&(ut(c),w.current=null),{then:function(e,t){null===w.current?(w.current=[],at(s,e,t)):e(s)}}}return{then:function(e,t){e(s)}}},t.useCallback=function(e,t){return Ce().useCallback(e,t)},t.useContext=function(e){var t=Ce();if(void 0!==e._context){var r=e._context;r.Consumer===e?A("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&A("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return t.useContext(e)},t.useDebugValue=function(e,t){return Ce().useDebugValue(e,t)},t.useDeferredValue=function(e){return Ce().useDeferredValue(e)},t.useEffect=function(e,t){return Ce().useEffect(e,t)},t.useId=function(){return Ce().useId()},t.useImperativeHandle=function(e,t,r){return Ce().useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return Ce().useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return Ce().useLayoutEffect(e,t)},t.useMemo=function(e,t){return Ce().useMemo(e,t)},t.useReducer=function(e,t,r){return Ce().useReducer(e,t,r)},t.useRef=function(e){return Ce().useRef(e)},t.useState=function(e){return Ce().useState(e)},t.useSyncExternalStore=function(e,t,r){return Ce().useSyncExternalStore(e,t,r)},t.useTransition=function(){return Ce().useTransition()},t.version="18.2.0","undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()},"./node_modules/react/index.js":(e,t,r)=>{e.exports=r("./node_modules/react/cjs/react.development.js")}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={id:e,loaded:!1,exports:{}};return r[e](a,a.exports,o),a.loaded=!0,a.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,r)=>(o.f[r](e,t),t)),[])),o.u=e=>e+".js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="onairos:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var u,s;if(void 0!==a)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var f=c[l];if(f.getAttribute("src")==r||f.getAttribute("data-webpack")==t+a){u=f;break}}u||(s=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+a),u.src=r),e[r]=[n];var p=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach((e=>e(n))),t)return t(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=p.bind(null,u.onerror),u.onload=p.bind(null,u.onload),s&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),o.p="/",(()=>{var e={main:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=a);var i=o.p+o.u(t),u=new Error;o.l(i,(r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",u.name="ChunkLoadError",u.type=a,u.request=i,n[1](u)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,a,i=r[0],u=r[1],s=r[2],c=0;if(i.some((t=>0!==e[t]))){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);if(s)s(o)}for(t&&t(r);c<i.length;c++)a=i[c],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=this.webpackChunkonairos=this.webpackChunkonairos||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};return(()=>{o.r(a),o.d(a,{Onairos:()=>u});var e=o("./node_modules/react/index.js"),t=o.n(e),r=o("./src/RSA.jsx"),n=o("./src/getPin.js");const i=async()=>{try{console.log("Entering Dynamic Othent Load");const e=await o.e("othent-kms").then(o.bind(o,"./node_modules/@othent/kms/dist/index.mjs"));return console.log("DYNAMICALLY LOADED OTHENT"),e}catch(e){console.error("Error loading Othent DYnamically : ",e)}};function u(e){let{requestData:o,webpageName:a,proofMode:u=!1}=e;const s=window.location.href,c=async()=>{try{console.log("Main initiate othent");const{connect:e}=await i();console.log("Main loaded othent");const t=await e(),c=sha256(t.sub).toString();function l(e){try{const t=window.atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r.buffer}catch(e){console.error("Error converting to Buffer :",e)}}const f=l((await(0,n.default)(c)).result),{decrypt:p}=await i(),d=await p(f);(0,r.rsaEncrypt)("\n -----BEGIN PUBLIC KEY-----\n MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4wkWvRPaJiY8CwQ5BoJI\n amcGAYV91Bk8NrvWq4PXM+J/RJugfgTNCYKQ/c6g4xa1YES/tJEzFS7nf0Kdoqxm\n 5aav0ru5vS4fc4vCOLTI9W1T7nj02NY91rogsQm2/KMxUQ8DaLeTZKi+0Wjsa9YO\n 6XGGd1wh4azgQkj04MWW5J1EBCcBavKoY+C85oA9jkkklQ8nGWgbugmZs7eXHNQb\n qH8/ZHcB9Kx1CZ6XjQuVd6YE/A+swV+DksbkXANcYjr6SY/2TbB8GfpcOMM3bkyN\n Q8e0A51q5a8abfuAkDZXe67MwKMWu/626abwPZhJrKr5HhRZZDwPtnXlktYHhOK6\n lQIDAQAB\n -----END PUBLIC KEY-----\n ",d).then((e=>{window.postMessage({source:"webpage",type:"GET_API_URL",webpageName:a,domain:s,requestData:o,proofMode:u,HashedOthentSub:c,EncryptedUserPin:e})})).catch((e=>{console.error("Encryption failed:",e)}))}catch(y){console.error({fix:"Please ensure you have stored your model"}),console.error("Error Sending Data to Terminal: ",y)}};return t().createElement("div",null,t().createElement("button",{className:"OnairosConnect w-20 h-20 flex flex-col items-center justify-center text-white font-bold py-2 px-4 rounded cursor-pointer",onClick:async()=>{try{(()=>{const e=["Small","Medium","Large"],t=["type","descriptions","reward"];if("string"!=typeof a)throw new Error("Property webpageName must be a String");for(const r of e){if(!(r in o))throw new Error("Missing key '".concat(r,"' in requestData."));for(const e of t){if(!(e in o[r]))throw new Error("Missing property '".concat(e,"' in requestData.").concat(r,"."));if("reward"!==e&&"string"!=typeof o[r][e])throw new Error("Property '".concat(e,"' in requestData.").concat(r," must be a string."));if("reward"!==e&&""===o[r][e].trim())throw new Error("Property '".concat(e,"' in requestData.").concat(r," cannot be empty."))}}})(),await c()}catch(e){console.error("Error connecting to Onairos",e)}}},t().createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",className:"w-16 h-16 object-contain mb-2"})," ",t().createElement("span",{className:"whitespace-nowrap"},"Connect to Onairos")," "))}})(),a})()));
|
|
2
2
|
//# sourceMappingURL=onairos.bundle.js.map
|