onairos 0.1.10 → 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
@@ -10,28 +10,36 @@ var _kms = require("@othent/kms");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
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); }
12
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";
13
+ // import {connect, encrypt, getActiveKey} from "@othent/kms-unbundled";
14
14
  // const {connect, getActiveKey, encrypt, getActivePublicKey } = require("@othent/kms");
15
+ // const {connect, getActiveKey, encrypt, getActivePublicKey } = require("@othent/kms-unbundled");
15
16
  // import * as OthentKMS from "@othent/kms";
17
+ // import connect from '@othent/kms' ;
18
+ // import getActiveKey from '@othent/kms' ;
16
19
 
17
- // async function initiateOthent(){
18
- // // const userDetails = await OthentKMS.connect();
20
+ async function initiateOthent() {
21
+ // const userDetails = await OthentKMS.connect();
19
22
 
20
- // // // New Othent KMS System
21
- // const userDetails = await connect();
22
- // // console.log("Othent KMS : ", userDetails);
23
- // // const OthentKey = await getActiveKey();
24
- // // async function handleEncrypt(data){
25
- // // const res = await encrypt(data);
26
- // // console.log(`Encrypted USerdata: ${JSON.stringify(res)}, and length ${JSON.stringify(res).length}`)
27
- // // return res;
28
- // // };
29
- // // // const encryptedOthentKey = await encryptWithPublicKey(OnairosPublicKey, OthentKey);
30
- // // // JWK Encyrpt Othent Web2 User Details,
31
- // // const encryptedOthentKey = await handleEncrypt(JSON.stringify(userDetails));
32
- // // console.log("encryptedOthentKey : ", encryptedOthentKey)
33
- // }
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
+ }
34
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
+ }
35
43
  function Onairos(_ref) {
36
44
  let {
37
45
  requestData,
@@ -49,11 +57,15 @@ function Onairos(_ref) {
49
57
  }
50
58
  };
51
59
  var token;
52
- (0, _kms.connect)().then(response => {
53
- console.log("USer Details: ", response);
54
- });
60
+ // connect().then(
61
+ // (response) =>{
62
+ // console.log("USer Details: ", response)
63
+ // }
64
+ // ).catch((e)=>{
65
+ // console.log("error : ", e);
66
+ // }
67
+ // );
55
68
 
56
- // await initiateOthent();
57
69
  const domain = window.location.href;
58
70
 
59
71
  // async function requestToken(){
@@ -83,14 +95,18 @@ function Onairos(_ref) {
83
95
  // Send the data to the content script
84
96
 
85
97
  // await requestToken();
86
-
98
+ // await initiateOthent();
99
+ const HashedActive = "HashedActive";
100
+ const EncryptUserDetails = "EncryptUserDetails";
87
101
  window.postMessage({
88
102
  source: 'webpage',
89
103
  type: 'GET_API_URL',
90
104
  webpageName: webpageName,
91
105
  domain: domain,
92
106
  requestData: requestData,
93
- proofMode: proofMode
107
+ proofMode: proofMode,
108
+ HashedActive: HashedActive,
109
+ EncryptUserDetails: EncryptUserDetails
94
110
  });
95
111
  };
96
112
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("button", {
@@ -104,4 +120,5 @@ function Onairos(_ref) {
104
120
  className: "whitespace-nowrap"
105
121
  }, "Connect to Onairos"), " "));
106
122
  }
107
- 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 */}\r\n </button>\r\n </div>\r\n );\r\n}\r\n\r\nexport default Onairos;\r\n\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAA2D,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,C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,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,19 +1,18 @@
1
1
  {
2
2
  "name": "onairos",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "dependencies": {
5
- "@othent/kms": "^1.0.2",
6
5
  "@testing-library/jest-dom": "^5.17.0",
7
6
  "@testing-library/react": "^13.4.0",
8
7
  "@testing-library/user-event": "^13.5.0",
9
8
  "1.0.1": "^1.0.0",
10
9
  "axios": "^1.6.2",
11
- "react-scripts": "5.0.1",
10
+ "react-scripts": "^5.0.1",
12
11
  "web-vitals": "^2.1.4"
13
12
  },
14
13
  "scripts": {
15
14
  "start": "react-scripts start",
16
- "build": "babel src --out-dir dist --copy-files",
15
+ "build": "babel src --out-dir dist --source-maps --copy-files",
17
16
  "test": "react-scripts test",
18
17
  "eject": "react-scripts eject"
19
18
  },
package/src/onairos.jsx CHANGED
@@ -1,26 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import onairosLogo from "./OnairosBlack.png";
3
- // import {connect, encrypt, getActiveKey} from "@othent/kms";
4
- // const {connect, getActiveKey, encrypt, getActivePublicKey } = require("@othent/kms");
5
- // import * as OthentKMS from "@othent/kms";
6
- import { connect, getActiveKey } from '@othent/kms';
7
- // async function initiateOthent(){
8
- // // const userDetails = await OthentKMS.connect();
9
3
 
10
- // // // New Othent KMS System
11
- // const userDetails = await connect();
12
- // // console.log("Othent KMS : ", userDetails);
13
- // // const OthentKey `= await getActiveKey();
14
- // // async function handleEncrypt(data){
15
- // // const res = await encrypt(data);
16
- // // console.log(`Encrypted USerdata: ${JSON.stringify(res)}, and length ${JSON.stringify(res).length}`)
17
- // // return res;
18
- // // };
19
- // // // const encryptedOthentKey = await encryptWithPublicKey(OnairosPublicKey, OthentKey);
20
- // // // JWK Encyrpt Othent Web2 User Details,
21
- // // const encryptedOthentKey = await handleEncrypt(JSON.stringify(userDetails));
22
- // // console.log("encryptedOthentKey : ", encryptedOthentKey)
23
- // }
24
4
 
25
5
  function Onairos( {requestData, webpageName, proofMode=false}) {
26
6
  // const [token,setToken] = useState('');
@@ -34,44 +14,15 @@ function Onairos( {requestData, webpageName, proofMode=false}) {
34
14
  }
35
15
  };
36
16
 
37
- var token;
38
- connect().then(
39
- (response) =>{
40
- console.log("USer Details: ", response)
41
- }
42
- );
43
-
44
- // await initiateOthent();
45
- const domain = window.location.href;
46
-
47
- // async function requestToken(){
48
- // const response = await fetch('https://api2.onairos.uk/dev/request-token', {
49
- // method: 'POST',
50
- // headers: {
51
- // 'Content-Type': 'application/json',
52
- // },
53
- // body: JSON.stringify({
54
- // domain:domain,
55
- // userOthentKey:userOthentKey
56
- // })
57
- // });
17
+ const domain = window.location.href;
58
18
 
59
- // if (!response.ok) {
60
- // throw new Error('Token request failed: ' + response.statusText);
61
- // }
19
+ const ConnectOnairos = async () => {
62
20
 
63
- // const data = await response.json();
64
- // token = data.token;
65
- // // this.token = data.token; // Store the token
66
- // }
21
+ // Testing User Secure Details
22
+ const HashedActive = "HashedActive";
23
+ const EncryptUserDetails = "EncryptUserDetails";
67
24
 
68
- const ConnectOnairos = async () => {
69
- // Title here has to match a model in the Users : accountInfo.AccountInfo.models
70
25
  // Prepare the data to be sent
71
- // Send the data to the content script
72
-
73
- // await requestToken();
74
-
75
26
  window.postMessage({
76
27
  source: 'webpage',
77
28
  type: 'GET_API_URL',
@@ -79,6 +30,8 @@ function Onairos( {requestData, webpageName, proofMode=false}) {
79
30
  domain:domain,
80
31
  requestData: requestData,
81
32
  proofMode:proofMode,
33
+ HashedActive:HashedActive,
34
+ EncryptUserDetails:EncryptUserDetails
82
35
  });
83
36
  };
84
37