@keyringnetwork/keyring-connect-sdk 1.0.9 → 1.1.0
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/main.js +5 -16
- package/dist/types.d.ts +4 -2
- package/package.json +7 -7
package/dist/main.js
CHANGED
|
@@ -13,7 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.KeyringConnect = void 0;
|
|
16
|
-
const jwt_decode_1 = require("jwt-decode");
|
|
17
16
|
const datasources_json_1 = __importDefault(require("./constants/datasources.json"));
|
|
18
17
|
const types_1 = require("./types");
|
|
19
18
|
/**
|
|
@@ -26,7 +25,6 @@ class KeyringConnect {
|
|
|
26
25
|
*/
|
|
27
26
|
static launchExtension(data) {
|
|
28
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
var _a;
|
|
30
28
|
const keyringConnectAvailable = yield this.isKeyringConnectInstalled();
|
|
31
29
|
if (!keyringConnectAvailable) {
|
|
32
30
|
if (typeof window !== "undefined") {
|
|
@@ -40,19 +38,7 @@ class KeyringConnect {
|
|
|
40
38
|
return;
|
|
41
39
|
}
|
|
42
40
|
const validatedConfig = this.validateConfigData(data);
|
|
43
|
-
|
|
44
|
-
if ((_a = data.krn_config) === null || _a === void 0 ? void 0 : _a.auth0_id_token) {
|
|
45
|
-
try {
|
|
46
|
-
const decodedJwt = (0, jwt_decode_1.jwtDecode)(data.krn_config.auth0_id_token);
|
|
47
|
-
if (!decodedJwt) {
|
|
48
|
-
throw new Error("Failed to decode auth token");
|
|
49
|
-
}
|
|
50
|
-
launchConfig.auth_user = Object.assign(Object.assign({}, decodedJwt), { id_token: data.krn_config.auth0_id_token });
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
throw new Error("Invalid auth token provided");
|
|
54
|
-
}
|
|
55
|
-
}
|
|
41
|
+
const launchConfig = this.convertToLaunchConfig(validatedConfig);
|
|
56
42
|
console.log("launching keyring connect");
|
|
57
43
|
window.postMessage({ type: types_1.EVENT_ACTIONS.LAUNCH_KEYRING_CONNECT, data: launchConfig }, "*");
|
|
58
44
|
});
|
|
@@ -138,7 +124,7 @@ class KeyringConnect {
|
|
|
138
124
|
return validatedConfig;
|
|
139
125
|
}
|
|
140
126
|
static convertToLaunchConfig(config) {
|
|
141
|
-
var _a;
|
|
127
|
+
var _a, _b;
|
|
142
128
|
const launchConfig = {
|
|
143
129
|
client: {
|
|
144
130
|
client_name: config.name,
|
|
@@ -158,6 +144,9 @@ class KeyringConnect {
|
|
|
158
144
|
}
|
|
159
145
|
: undefined,
|
|
160
146
|
proof_config: config.proof_config,
|
|
147
|
+
session_info: {
|
|
148
|
+
access_token: (_b = config.krn_config) === null || _b === void 0 ? void 0 : _b.keyring_access_token,
|
|
149
|
+
},
|
|
161
150
|
};
|
|
162
151
|
return launchConfig;
|
|
163
152
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export type ExtensionSDKConfig = {
|
|
|
41
41
|
krn_config?: {
|
|
42
42
|
keyring_api_url?: string;
|
|
43
43
|
analytics_api_url?: string;
|
|
44
|
-
|
|
44
|
+
keyring_access_token?: string;
|
|
45
45
|
entity_id?: string;
|
|
46
46
|
isolate_proving?: boolean;
|
|
47
47
|
notaryUrl?: string;
|
|
@@ -69,7 +69,9 @@ export type ExtensionLaunchConfig = {
|
|
|
69
69
|
notaryWebsocketUrl?: string;
|
|
70
70
|
websocketProxyUrl?: string;
|
|
71
71
|
};
|
|
72
|
-
|
|
72
|
+
session_info?: {
|
|
73
|
+
access_token?: string;
|
|
74
|
+
};
|
|
73
75
|
};
|
|
74
76
|
export type ExtensionStatus = "idle" | "mounted" | "proving" | "prove_success" | "error";
|
|
75
77
|
export type AttestationStatus = "onboarding_required" | "onboarding_pending" | "attestation_ready" | "non_compliant";
|
package/package.json
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keyringnetwork/keyring-connect-sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "An SDK for interacting with Keyring Connect browser extension",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "rm -rf dist && pnpm get:datasources && tsc",
|
|
9
|
-
"dev": "pnpm get:datasources && tsc --watch",
|
|
10
|
-
"build_and_publish": "pnpm build && npm publish",
|
|
11
|
-
"get:datasources": "node ../../scripts/parseDatasource.js -o src/constants/datasources.json"
|
|
12
|
-
},
|
|
13
7
|
"files": [
|
|
14
8
|
"dist"
|
|
15
9
|
],
|
|
@@ -22,5 +16,11 @@
|
|
|
22
16
|
},
|
|
23
17
|
"dependencies": {
|
|
24
18
|
"jwt-decode": "^4.0.0"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rm -rf dist && pnpm get:datasources && tsc",
|
|
22
|
+
"dev": "pnpm get:datasources && tsc --watch",
|
|
23
|
+
"build_and_publish": "pnpm build && npm publish",
|
|
24
|
+
"get:datasources": "node ../../scripts/parseDatasource.js -o src/constants/datasources.json"
|
|
25
25
|
}
|
|
26
26
|
}
|