onairos 0.1.9 → 0.1.10
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/onairos.js +57 -23
- package/package.json +4 -1
- package/src/onairos.jsx +54 -21
package/dist/onairos.js
CHANGED
|
@@ -6,14 +6,37 @@ 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";
|
|
14
|
+
// const {connect, getActiveKey, encrypt, getActivePublicKey } = require("@othent/kms");
|
|
15
|
+
// import * as OthentKMS from "@othent/kms";
|
|
16
|
+
|
|
17
|
+
// async function initiateOthent(){
|
|
18
|
+
// // const userDetails = await OthentKMS.connect();
|
|
19
|
+
|
|
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
|
+
// }
|
|
34
|
+
|
|
12
35
|
function Onairos(_ref) {
|
|
13
36
|
let {
|
|
14
37
|
requestData,
|
|
15
|
-
|
|
16
|
-
|
|
38
|
+
webpageName,
|
|
39
|
+
proofMode = false
|
|
17
40
|
} = _ref;
|
|
18
41
|
// const [token,setToken] = useState('');
|
|
19
42
|
const OnairosAnime = async () => {
|
|
@@ -26,35 +49,46 @@ function Onairos(_ref) {
|
|
|
26
49
|
}
|
|
27
50
|
};
|
|
28
51
|
var token;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
52
|
+
(0, _kms.connect)().then(response => {
|
|
53
|
+
console.log("USer Details: ", response);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// await initiateOthent();
|
|
57
|
+
const domain = window.location.href;
|
|
58
|
+
|
|
59
|
+
// async function requestToken(){
|
|
60
|
+
// const response = await fetch('https://api2.onairos.uk/dev/request-token', {
|
|
61
|
+
// method: 'POST',
|
|
62
|
+
// headers: {
|
|
63
|
+
// 'Content-Type': 'application/json',
|
|
64
|
+
// },
|
|
65
|
+
// body: JSON.stringify({
|
|
66
|
+
// domain:domain,
|
|
67
|
+
// userOthentKey:userOthentKey
|
|
68
|
+
// })
|
|
69
|
+
// });
|
|
70
|
+
|
|
71
|
+
// if (!response.ok) {
|
|
72
|
+
// throw new Error('Token request failed: ' + response.statusText);
|
|
73
|
+
// }
|
|
74
|
+
|
|
75
|
+
// const data = await response.json();
|
|
76
|
+
// token = data.token;
|
|
77
|
+
// // this.token = data.token; // Store the token
|
|
78
|
+
// }
|
|
79
|
+
|
|
47
80
|
const ConnectOnairos = async () => {
|
|
48
81
|
// Title here has to match a model in the Users : accountInfo.AccountInfo.models
|
|
49
82
|
// Prepare the data to be sent
|
|
50
83
|
// Send the data to the content script
|
|
51
84
|
|
|
52
|
-
await requestToken();
|
|
85
|
+
// await requestToken();
|
|
86
|
+
|
|
53
87
|
window.postMessage({
|
|
54
88
|
source: 'webpage',
|
|
55
89
|
type: 'GET_API_URL',
|
|
56
90
|
webpageName: webpageName,
|
|
57
|
-
|
|
91
|
+
domain: domain,
|
|
58
92
|
requestData: requestData,
|
|
59
93
|
proofMode: proofMode
|
|
60
94
|
});
|
|
@@ -63,7 +97,7 @@ function Onairos(_ref) {
|
|
|
63
97
|
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
98
|
onClick: OnairosAnime
|
|
65
99
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
66
|
-
src:
|
|
100
|
+
src: "https://onairos.sirv.com/Images/OnairosBlack.png",
|
|
67
101
|
alt: "Onairos Logo",
|
|
68
102
|
className: "w-16 h-16 object-contain mb-2"
|
|
69
103
|
}), " ", /*#__PURE__*/_react.default.createElement("span", {
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onairos",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"dependencies": {
|
|
5
|
+
"@othent/kms": "^1.0.2",
|
|
5
6
|
"@testing-library/jest-dom": "^5.17.0",
|
|
6
7
|
"@testing-library/react": "^13.4.0",
|
|
7
8
|
"@testing-library/user-event": "^13.5.0",
|
|
9
|
+
"1.0.1": "^1.0.0",
|
|
10
|
+
"axios": "^1.6.2",
|
|
8
11
|
"react-scripts": "5.0.1",
|
|
9
12
|
"web-vitals": "^2.1.4"
|
|
10
13
|
},
|
package/src/onairos.jsx
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
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();
|
|
3
9
|
|
|
4
|
-
|
|
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
|
+
|
|
25
|
+
function Onairos( {requestData, webpageName, proofMode=false}) {
|
|
5
26
|
// const [token,setToken] = useState('');
|
|
6
27
|
const OnairosAnime = async () => {
|
|
7
28
|
try {
|
|
@@ -14,39 +35,50 @@ function Onairos( {requestData, proofMode=false,webpageName}) {
|
|
|
14
35
|
};
|
|
15
36
|
|
|
16
37
|
var token;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
method: 'POST',
|
|
21
|
-
headers: {
|
|
22
|
-
'Content-Type': 'application/json',
|
|
23
|
-
},
|
|
24
|
-
body: JSON.stringify({ domain }),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
if (!response.ok) {
|
|
28
|
-
throw new Error('Token request failed: ' + response.statusText);
|
|
38
|
+
connect().then(
|
|
39
|
+
(response) =>{
|
|
40
|
+
console.log("USer Details: ", response)
|
|
29
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
|
+
// });
|
|
58
|
+
|
|
59
|
+
// if (!response.ok) {
|
|
60
|
+
// throw new Error('Token request failed: ' + response.statusText);
|
|
61
|
+
// }
|
|
30
62
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
63
|
+
// const data = await response.json();
|
|
64
|
+
// token = data.token;
|
|
65
|
+
// // this.token = data.token; // Store the token
|
|
66
|
+
// }
|
|
35
67
|
|
|
36
68
|
const ConnectOnairos = async () => {
|
|
37
69
|
// Title here has to match a model in the Users : accountInfo.AccountInfo.models
|
|
38
70
|
// Prepare the data to be sent
|
|
39
71
|
// Send the data to the content script
|
|
40
72
|
|
|
41
|
-
await requestToken();
|
|
73
|
+
// await requestToken();
|
|
42
74
|
|
|
43
75
|
window.postMessage({
|
|
44
76
|
source: 'webpage',
|
|
45
77
|
type: 'GET_API_URL',
|
|
46
78
|
webpageName: webpageName,
|
|
47
|
-
|
|
79
|
+
domain:domain,
|
|
48
80
|
requestData: requestData,
|
|
49
|
-
proofMode:proofMode
|
|
81
|
+
proofMode:proofMode,
|
|
50
82
|
});
|
|
51
83
|
};
|
|
52
84
|
|
|
@@ -56,7 +88,8 @@ function Onairos( {requestData, proofMode=false,webpageName}) {
|
|
|
56
88
|
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
89
|
onClick={OnairosAnime}
|
|
58
90
|
>
|
|
59
|
-
<img src={
|
|
91
|
+
<img src={"https://onairos.sirv.com/Images/OnairosBlack.png"}
|
|
92
|
+
alt="Onairos Logo" className="w-16 h-16 object-contain mb-2" /> {/* Adjust size as needed */}
|
|
60
93
|
<span className="whitespace-nowrap">Connect to Onairos</span> {/* Prevent text from wrapping */}
|
|
61
94
|
</button>
|
|
62
95
|
</div>
|