@bytexbyte/ike-app-api 1.0.30 → 1.0.32
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/lib/Rsa/index.d.ts +33 -0
- package/lib/Rsa/index.js +129 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BxBApi from '@bytexbyte/bxb-api';
|
|
2
|
+
declare class IKEAppRsaApi extends BxBApi {
|
|
3
|
+
constructor({ host, onSuccess, onError }: {
|
|
4
|
+
host: string;
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
onError?: (error: any) => void;
|
|
7
|
+
});
|
|
8
|
+
signatureUUID(form: {
|
|
9
|
+
uuid: number[];
|
|
10
|
+
tokenId: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
signedUuid: number[];
|
|
13
|
+
} | {
|
|
14
|
+
error: 'tokenId is required' | 'Invalid token';
|
|
15
|
+
}>;
|
|
16
|
+
verifySignedToken(form: {
|
|
17
|
+
signedToken: number[];
|
|
18
|
+
tokenId: string;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
verified: boolean;
|
|
21
|
+
} | {
|
|
22
|
+
error: 'tokenId is required' | 'Invalid token';
|
|
23
|
+
}>;
|
|
24
|
+
verifyEncryptedToken(form: {
|
|
25
|
+
encryptedToken: number[];
|
|
26
|
+
tokenId: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
verified: boolean;
|
|
29
|
+
} | {
|
|
30
|
+
error: 'tokenId is required' | 'Invalid token' | 'Decryption failed';
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export default IKEAppRsaApi;
|
package/lib/Rsa/index.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
/* eslint-disable no-undef */
|
|
55
|
+
var bxb_api_1 = require("@bytexbyte/bxb-api");
|
|
56
|
+
var config_1 = require("../config");
|
|
57
|
+
var IKEAppRsaApi = /** @class */ (function (_super) {
|
|
58
|
+
__extends(IKEAppRsaApi, _super);
|
|
59
|
+
function IKEAppRsaApi(_a) {
|
|
60
|
+
var host = _a.host, onSuccess = _a.onSuccess, onError = _a.onError;
|
|
61
|
+
return _super.call(this, {
|
|
62
|
+
host: host,
|
|
63
|
+
secretKey: config_1.localSecretKey,
|
|
64
|
+
secret: '',
|
|
65
|
+
moduleName: 'rsa',
|
|
66
|
+
onSuccess: onSuccess,
|
|
67
|
+
onError: onError,
|
|
68
|
+
}) || this;
|
|
69
|
+
}
|
|
70
|
+
IKEAppRsaApi.prototype.signatureUUID = function (form) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var response;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: {
|
|
78
|
+
'Content-Type': 'application/json',
|
|
79
|
+
},
|
|
80
|
+
body: JSON.stringify(form)
|
|
81
|
+
}, "uuid")];
|
|
82
|
+
case 1:
|
|
83
|
+
response = _a.sent();
|
|
84
|
+
return [2 /*return*/, response.json()];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
IKEAppRsaApi.prototype.verifySignedToken = function (form) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
+
var response;
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
95
|
+
method: 'POST',
|
|
96
|
+
headers: {
|
|
97
|
+
'Content-Type': 'application/json',
|
|
98
|
+
},
|
|
99
|
+
body: JSON.stringify(form)
|
|
100
|
+
}, "verifySignedToken")];
|
|
101
|
+
case 1:
|
|
102
|
+
response = _a.sent();
|
|
103
|
+
return [2 /*return*/, response.json()];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
IKEAppRsaApi.prototype.verifyEncryptedToken = function (form) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
var response;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
114
|
+
method: 'POST',
|
|
115
|
+
headers: {
|
|
116
|
+
'Content-Type': 'application/json',
|
|
117
|
+
},
|
|
118
|
+
body: JSON.stringify(form)
|
|
119
|
+
}, "verifyEncryptedToken")];
|
|
120
|
+
case 1:
|
|
121
|
+
response = _a.sent();
|
|
122
|
+
return [2 /*return*/, response.json()];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
return IKEAppRsaApi;
|
|
128
|
+
}(bxb_api_1.default));
|
|
129
|
+
exports.default = IKEAppRsaApi;
|
package/lib/index.d.ts
CHANGED
|
@@ -5,13 +5,14 @@ import IKEAppContractApi from './Contract';
|
|
|
5
5
|
import IKEAppDigitalCustomizationApi from './DigitalCustomization';
|
|
6
6
|
import IKEAppFileApi from './File';
|
|
7
7
|
import IKEApInAppNotificationApi from './InAppNotification';
|
|
8
|
+
import IKEAppIncodeApi from './Incode';
|
|
8
9
|
import IKEAppMfaApi from './Mfa';
|
|
9
10
|
import IKEAppRedeemApi from './Redeem';
|
|
10
11
|
import IKEAppRegisterDeviceCodeApi from './RegisterDeviceCode';
|
|
12
|
+
import IKEAppRsaApi from './Rsa';
|
|
11
13
|
import IKEAppScanApi from './Scan';
|
|
12
14
|
import IKEAppTagsApi from './Tags';
|
|
13
15
|
import IKEAppUserApi from './User';
|
|
14
|
-
import IKEAppIncodeApi from './Incode';
|
|
15
16
|
declare class IKEAppApi {
|
|
16
17
|
host: string;
|
|
17
18
|
env: string;
|
|
@@ -29,6 +30,7 @@ declare class IKEAppApi {
|
|
|
29
30
|
contract: IKEAppContractApi;
|
|
30
31
|
inAppNotification: IKEApInAppNotificationApi;
|
|
31
32
|
incode: IKEAppIncodeApi;
|
|
33
|
+
rsa: IKEAppRsaApi;
|
|
32
34
|
constructor({ host, env, secretKey, secret, onSuccess, onError, }: {
|
|
33
35
|
host: string;
|
|
34
36
|
env: string;
|
package/lib/index.js
CHANGED
|
@@ -54,13 +54,14 @@ var Contract_1 = require("./Contract");
|
|
|
54
54
|
var DigitalCustomization_1 = require("./DigitalCustomization");
|
|
55
55
|
var File_1 = require("./File");
|
|
56
56
|
var InAppNotification_1 = require("./InAppNotification");
|
|
57
|
+
var Incode_1 = require("./Incode");
|
|
57
58
|
var Mfa_1 = require("./Mfa");
|
|
58
59
|
var Redeem_1 = require("./Redeem");
|
|
59
60
|
var RegisterDeviceCode_1 = require("./RegisterDeviceCode");
|
|
61
|
+
var Rsa_1 = require("./Rsa");
|
|
60
62
|
var Scan_1 = require("./Scan");
|
|
61
63
|
var Tags_1 = require("./Tags");
|
|
62
64
|
var User_1 = require("./User");
|
|
63
|
-
var Incode_1 = require("./Incode");
|
|
64
65
|
var IKEAppApi = /** @class */ (function () {
|
|
65
66
|
function IKEAppApi(_a) {
|
|
66
67
|
var host = _a.host, env = _a.env, secretKey = _a.secretKey, secret = _a.secret, onSuccess = _a.onSuccess, onError = _a.onError;
|
|
@@ -91,6 +92,7 @@ var IKEAppApi = /** @class */ (function () {
|
|
|
91
92
|
this.tags = new Tags_1.default({ host: host, onSuccess: onSuccess, onError: onError });
|
|
92
93
|
this.digitalCustomization = new DigitalCustomization_1.default({ host: host, onSuccess: onSuccess, onError: onError });
|
|
93
94
|
this.contract = new Contract_1.default({ host: host, onSuccess: onSuccess, onError: onError });
|
|
95
|
+
this.rsa = new Rsa_1.default({ host: host, onSuccess: onSuccess, onError: onError });
|
|
94
96
|
this.inAppNotification = new InAppNotification_1.default({ host: host, secretKey: secretKey, secret: secret, onSuccess: onSuccess, onError: onError });
|
|
95
97
|
this.incode = new Incode_1.default({ host: host, secretKey: secretKey, secret: secret, onSuccess: onSuccess, onError: onError });
|
|
96
98
|
}
|