onairos 0.1.9 → 0.1.11

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/.babelrc CHANGED
@@ -1,4 +1,8 @@
1
1
  {
2
- "presets": ["@babel/preset-env", "@babel/preset-react"]
3
- }
4
-
2
+ "presets": [
3
+ ["@babel/preset-env", {
4
+ "targets": "> 0.25%, not dead"
5
+ }],
6
+ "@babel/preset-react"
7
+ ]
8
+ }
package/dist/onairos.js CHANGED
@@ -6,14 +6,45 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _OnairosBlack = _interopRequireDefault(require("./OnairosBlack.png"));
9
+ var _kms = require("@othent/kms");
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+ // import {connect, encrypt, getActiveKey} from "@othent/kms-unbundled";
14
+ // const {connect, getActiveKey, encrypt, getActivePublicKey } = require("@othent/kms");
15
+ // const {connect, getActiveKey, encrypt, getActivePublicKey } = require("@othent/kms-unbundled");
16
+ // import * as OthentKMS from "@othent/kms";
17
+ // import connect from '@othent/kms' ;
18
+ // import getActiveKey from '@othent/kms' ;
19
+
20
+ async function initiateOthent() {
21
+ // const userDetails = await OthentKMS.connect();
22
+
23
+ // // // New Othent KMS System
24
+ const userDetails = await (0, _kms.connect)();
25
+ console.log("Othent KMS : ", userDetails);
26
+ try {
27
+ const OthentKey = await (0, _kms.getActiveKey)();
28
+ console.log("OthentKey : ", OthentKey);
29
+ } catch (e) {
30
+ console.log("Error : ", e);
31
+ }
32
+
33
+ // async function handleEncrypt(data){
34
+ // const res = await encrypt(data);
35
+ // console.log(`Encrypted USerdata: ${JSON.stringify(res)}, and length ${JSON.stringify(res).length}`)
36
+ // return res;
37
+ // };
38
+ // // const encryptedOthentKey = await encryptWithPublicKey(OnairosPublicKey, OthentKey);
39
+ // // JWK Encyrpt Othent Web2 User Details,
40
+ // const encryptedOthentKey = await handleEncrypt(JSON.stringify(userDetails));
41
+ // console.log("encryptedOthentKey : ", encryptedOthentKey)
42
+ }
12
43
  function Onairos(_ref) {
13
44
  let {
14
45
  requestData,
15
- proofMode = false,
16
- webpageName
46
+ webpageName,
47
+ proofMode = false
17
48
  } = _ref;
18
49
  // const [token,setToken] = useState('');
19
50
  const OnairosAnime = async () => {
@@ -26,48 +57,68 @@ function Onairos(_ref) {
26
57
  }
27
58
  };
28
59
  var token;
29
- async function requestToken() {
30
- const domain = window.location.href;
31
- const response = await fetch('https://api2.onairos.uk/dev/request-token', {
32
- method: 'POST',
33
- headers: {
34
- 'Content-Type': 'application/json'
35
- },
36
- body: JSON.stringify({
37
- domain
38
- })
39
- });
40
- if (!response.ok) {
41
- throw new Error('Token request failed: ' + response.statusText);
42
- }
43
- const data = await response.json();
44
- token = data.token;
45
- // this.token = data.token; // Store the token
46
- }
60
+ // connect().then(
61
+ // (response) =>{
62
+ // console.log("USer Details: ", response)
63
+ // }
64
+ // ).catch((e)=>{
65
+ // console.log("error : ", e);
66
+ // }
67
+ // );
68
+
69
+ const domain = window.location.href;
70
+
71
+ // async function requestToken(){
72
+ // const response = await fetch('https://api2.onairos.uk/dev/request-token', {
73
+ // method: 'POST',
74
+ // headers: {
75
+ // 'Content-Type': 'application/json',
76
+ // },
77
+ // body: JSON.stringify({
78
+ // domain:domain,
79
+ // userOthentKey:userOthentKey
80
+ // })
81
+ // });
82
+
83
+ // if (!response.ok) {
84
+ // throw new Error('Token request failed: ' + response.statusText);
85
+ // }
86
+
87
+ // const data = await response.json();
88
+ // token = data.token;
89
+ // // this.token = data.token; // Store the token
90
+ // }
91
+
47
92
  const ConnectOnairos = async () => {
48
93
  // Title here has to match a model in the Users : accountInfo.AccountInfo.models
49
94
  // Prepare the data to be sent
50
95
  // Send the data to the content script
51
96
 
52
- await requestToken();
97
+ // await requestToken();
98
+ // await initiateOthent();
99
+ const HashedActive = "HashedActive";
100
+ const EncryptUserDetails = "EncryptUserDetails";
53
101
  window.postMessage({
54
102
  source: 'webpage',
55
103
  type: 'GET_API_URL',
56
104
  webpageName: webpageName,
57
- access_token: token,
105
+ domain: domain,
58
106
  requestData: requestData,
59
- proofMode: proofMode
107
+ proofMode: proofMode,
108
+ HashedActive: HashedActive,
109
+ EncryptUserDetails: EncryptUserDetails
60
110
  });
61
111
  };
62
112
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("button", {
63
113
  className: "OnairosConnect w-20 h-20 flex flex-col items-center justify-center text-white font-bold py-2 px-4 rounded cursor-pointer",
64
114
  onClick: OnairosAnime
65
115
  }, /*#__PURE__*/_react.default.createElement("img", {
66
- src: _OnairosBlack.default,
116
+ src: "https://onairos.sirv.com/Images/OnairosBlack.png",
67
117
  alt: "Onairos Logo",
68
118
  className: "w-16 h-16 object-contain mb-2"
69
119
  }), " ", /*#__PURE__*/_react.default.createElement("span", {
70
120
  className: "whitespace-nowrap"
71
121
  }, "Connect to Onairos"), " "));
72
122
  }
73
- var _default = exports.default = Onairos;
123
+ var _default = exports.default = Onairos;
124
+ //# sourceMappingURL=onairos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onairos.js","names":["_react","_interopRequireWildcard","require","_OnairosBlack","_interopRequireDefault","_kms","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","initiateOthent","userDetails","connect","console","log","OthentKey","getActiveKey","Onairos","_ref","requestData","webpageName","proofMode","OnairosAnime","ConnectOnairos","error","token","domain","window","location","href","HashedActive","EncryptUserDetails","postMessage","source","type","createElement","className","onClick","src","alt","_default","exports"],"sources":["../src/onairos.jsx"],"sourcesContent":["import React, { useState } from 'react';\r\nimport onairosLogo from \"./OnairosBlack.png\";\r\nimport {connect, encrypt, getActiveKey} from \"@othent/kms\";\r\n// import {connect, encrypt, getActiveKey} from \"@othent/kms-unbundled\";\r\n// const {connect, getActiveKey, encrypt, getActivePublicKey } = require(\"@othent/kms\");\r\n// const {connect, getActiveKey, encrypt, getActivePublicKey } = require(\"@othent/kms-unbundled\");\r\n// import * as OthentKMS from \"@othent/kms\";\r\n// import connect from '@othent/kms' ;\r\n// import getActiveKey from '@othent/kms' ;\r\n\r\n\r\nasync function initiateOthent(){\r\n // const userDetails = await OthentKMS.connect();\r\n\r\n// // // New Othent KMS System\r\n const userDetails = await connect();\r\n console.log(\"Othent KMS : \", userDetails);\r\n try{\r\n const OthentKey = await getActiveKey();\r\n console.log(\"OthentKey : \", OthentKey);\r\n }catch(e){\r\n console.log(\"Error : \", e);\r\n\r\n }\r\n \r\n // async function handleEncrypt(data){\r\n // const res = await encrypt(data);\r\n // console.log(`Encrypted USerdata: ${JSON.stringify(res)}, and length ${JSON.stringify(res).length}`)\r\n // return res;\r\n // };\r\n // // const encryptedOthentKey = await encryptWithPublicKey(OnairosPublicKey, OthentKey);\r\n // // JWK Encyrpt Othent Web2 User Details, \r\n // const encryptedOthentKey = await handleEncrypt(JSON.stringify(userDetails));\r\n // console.log(\"encryptedOthentKey : \", encryptedOthentKey)\r\n}\r\n\r\nfunction Onairos( {requestData, webpageName, proofMode=false}) {\r\n // const [token,setToken] = useState('');\r\n const OnairosAnime = async () => {\r\n try {\r\n console.log(\"Clicked Onairos Connect\")\r\n await ConnectOnairos();\r\n } catch (error) {\r\n // Handle any errors here\r\n console.error(\"Error connecting to Onairos\", error);\r\n }\r\n };\r\n\r\n var token;\r\n // connect().then(\r\n // (response) =>{\r\n // console.log(\"USer Details: \", response)\r\n // }\r\n // ).catch((e)=>{\r\n // console.log(\"error : \", e);\r\n // }\r\n // );\r\n \r\n\r\n const domain = window.location.href;\r\n\r\n // async function requestToken(){\r\n // const response = await fetch('https://api2.onairos.uk/dev/request-token', {\r\n // method: 'POST',\r\n // headers: {\r\n // 'Content-Type': 'application/json',\r\n // },\r\n // body: JSON.stringify({\r\n // domain:domain,\r\n // userOthentKey:userOthentKey\r\n // })\r\n // });\r\n\r\n // if (!response.ok) {\r\n // throw new Error('Token request failed: ' + response.statusText);\r\n // }\r\n\r\n // const data = await response.json();\r\n // token = data.token;\r\n // // this.token = data.token; // Store the token\r\n // }\r\n\r\n const ConnectOnairos = async () => {\r\n // Title here has to match a model in the Users : accountInfo.AccountInfo.models\r\n // Prepare the data to be sent\r\n // Send the data to the content script\r\n \r\n // await requestToken();\r\n // await initiateOthent();\r\n const HashedActive = \"HashedActive\";\r\n const EncryptUserDetails = \"EncryptUserDetails\";\r\n window.postMessage({\r\n source: 'webpage',\r\n type: 'GET_API_URL',\r\n webpageName: webpageName,\r\n domain:domain,\r\n requestData: requestData,\r\n proofMode:proofMode,\r\n HashedActive:HashedActive,\r\n EncryptUserDetails:EncryptUserDetails\r\n });\r\n };\r\n\r\n return (\r\n <div>\r\n <button\r\n className=\"OnairosConnect w-20 h-20 flex flex-col items-center justify-center text-white font-bold py-2 px-4 rounded cursor-pointer\"\r\n onClick={OnairosAnime}\r\n >\r\n <img src={\"https://onairos.sirv.com/Images/OnairosBlack.png\"} \r\n alt=\"Onairos Logo\" className=\"w-16 h-16 object-contain mb-2\" /> {/* Adjust size as needed */}\r\n <span className=\"whitespace-nowrap\">Connect to Onairos</span> {/* Prevent text from wrapping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AEA,MAAMN,cAAc,GAAG,MAAAA,CAAA,KAAY;IACjC;IACA;IACA;;IAEA;IACA;IACA,MAAMO,YAAY,GAAG,cAAc;IACnC,MAAMC,kBAAkB,GAAG,oBAAoB;IAC/CJ,MAAM,CAACK,WAAW,CAAC;MACjBC,MAAM,EAAE,SAAS;MACjBC,IAAI,EAAE,aAAa;MACnBd,WAAW,EAAEA,WAAW;MACxBM,MAAM,EAACA,MAAM;MACbP,WAAW,EAAEA,WAAW;MACxBE,SAAS,EAACA,SAAS;MACnBS,YAAY,EAACA,YAAY;MACzBC,kBAAkB,EAACA;IACrB,CAAC,CAAC;EACJ,CAAC;EAED,oBACEjD,MAAA,CAAAQ,OAAA,CAAA6C,aAAA,2BACErD,MAAA,CAAAQ,OAAA,CAAA6C,aAAA;IACEC,SAAS,EAAC,0HAA0H;IACpIC,OAAO,EAAEf;EAAa,gBAEtBxC,MAAA,CAAAQ,OAAA,CAAA6C,aAAA;IAAKG,GAAG,EAAE,kDAAmD;IAC7DC,GAAG,EAAC,cAAc;IAACH,SAAS,EAAC;EAA+B,CAAE,CAAC,KAAC,eAChEtD,MAAA,CAAAQ,OAAA,CAAA6C,aAAA;IAAMC,SAAS,EAAC;EAAmB,GAAC,oBAAwB,CAAC,KACvD,CACL,CAAC;AAEV;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAEc2B,OAAO"}
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "onairos",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "dependencies": {
5
5
  "@testing-library/jest-dom": "^5.17.0",
6
6
  "@testing-library/react": "^13.4.0",
7
7
  "@testing-library/user-event": "^13.5.0",
8
- "react-scripts": "5.0.1",
8
+ "1.0.1": "^1.0.0",
9
+ "axios": "^1.6.2",
10
+ "react-scripts": "^5.0.1",
9
11
  "web-vitals": "^2.1.4"
10
12
  },
11
13
  "scripts": {
12
14
  "start": "react-scripts start",
13
- "build": "babel src --out-dir dist --copy-files",
15
+ "build": "babel src --out-dir dist --source-maps --copy-files",
14
16
  "test": "react-scripts test",
15
17
  "eject": "react-scripts eject"
16
18
  },
package/src/onairos.jsx CHANGED
@@ -1,7 +1,8 @@
1
1
  import React, { useState } from 'react';
2
2
  import onairosLogo from "./OnairosBlack.png";
3
3
 
4
- function Onairos( {requestData, proofMode=false,webpageName}) {
4
+
5
+ function Onairos( {requestData, webpageName, proofMode=false}) {
5
6
  // const [token,setToken] = useState('');
6
7
  const OnairosAnime = async () => {
7
8
  try {
@@ -13,40 +14,24 @@ function Onairos( {requestData, proofMode=false,webpageName}) {
13
14
  }
14
15
  };
15
16
 
16
- var token;
17
- async function requestToken(){
18
17
  const domain = window.location.href;
19
- const response = await fetch('https://api2.onairos.uk/dev/request-token', {
20
- method: 'POST',
21
- headers: {
22
- 'Content-Type': 'application/json',
23
- },
24
- body: JSON.stringify({ domain }),
25
- });
26
18
 
27
- if (!response.ok) {
28
- throw new Error('Token request failed: ' + response.statusText);
29
- }
19
+ const ConnectOnairos = async () => {
30
20
 
31
- const data = await response.json();
32
- token = data.token;
33
- // this.token = data.token; // Store the token
34
- }
21
+ // Testing User Secure Details
22
+ const HashedActive = "HashedActive";
23
+ const EncryptUserDetails = "EncryptUserDetails";
35
24
 
36
- const ConnectOnairos = async () => {
37
- // Title here has to match a model in the Users : accountInfo.AccountInfo.models
38
25
  // Prepare the data to be sent
39
- // Send the data to the content script
40
-
41
- await requestToken();
42
-
43
26
  window.postMessage({
44
27
  source: 'webpage',
45
28
  type: 'GET_API_URL',
46
29
  webpageName: webpageName,
47
- access_token:token,
30
+ domain:domain,
48
31
  requestData: requestData,
49
- proofMode:proofMode
32
+ proofMode:proofMode,
33
+ HashedActive:HashedActive,
34
+ EncryptUserDetails:EncryptUserDetails
50
35
  });
51
36
  };
52
37
 
@@ -56,7 +41,8 @@ function Onairos( {requestData, proofMode=false,webpageName}) {
56
41
  className="OnairosConnect w-20 h-20 flex flex-col items-center justify-center text-white font-bold py-2 px-4 rounded cursor-pointer"
57
42
  onClick={OnairosAnime}
58
43
  >
59
- <img src={onairosLogo} alt="Onairos Logo" className="w-16 h-16 object-contain mb-2" /> {/* Adjust size as needed */}
44
+ <img src={"https://onairos.sirv.com/Images/OnairosBlack.png"}
45
+ alt="Onairos Logo" className="w-16 h-16 object-contain mb-2" /> {/* Adjust size as needed */}
60
46
  <span className="whitespace-nowrap">Connect to Onairos</span> {/* Prevent text from wrapping */}
61
47
  </button>
62
48
  </div>