iobroker.parcel 0.2.7 → 0.2.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/LICENSE +1 -1
- package/README.md +11 -2
- package/admin/copyurl.png +0 -0
- package/admin/index_m.html +27 -0
- package/admin/words.js +1 -0
- package/io-package.json +57 -68
- package/lib/dhldecrypt.js +0 -1
- package/lib/rsaKey.js +54 -53
- package/main.js +450 -282
- package/package.json +72 -64
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022 TA2k <tombox2020@gmail.com>
|
|
3
|
+
Copyright (c) 2022-2030 TA2k <tombox2020@gmail.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -62,14 +62,23 @@ Den Datenpunkt parcel.0.dhl.briefe....image ein "String img src" element als Obj
|
|
|
62
62
|
<https://forum.iobroker.net/topic/51795/test-adapter-parcel-paketverfolgung-dhl-v0-0-1>
|
|
63
63
|
|
|
64
64
|
## Changelog
|
|
65
|
+
### 0.2.10 (2025-01-15)
|
|
66
|
+
|
|
67
|
+
- add alternative way for dhl login
|
|
68
|
+
- move dhl connections error to info level
|
|
69
|
+
|
|
70
|
+
### 0.2.8 (2024-10-18)
|
|
71
|
+
|
|
72
|
+
- fix amazon login
|
|
65
73
|
|
|
66
74
|
### 0.0.30
|
|
67
75
|
|
|
68
76
|
- Fix hermes login
|
|
69
|
-
|
|
77
|
+
|
|
70
78
|
### 0.0.25
|
|
71
79
|
|
|
72
80
|
- Fix amazon UI parsing
|
|
81
|
+
|
|
73
82
|
### 0.0.19
|
|
74
83
|
|
|
75
84
|
- Fix GLS Parcel
|
|
@@ -86,7 +95,7 @@ Den Datenpunkt parcel.0.dhl.briefe....image ein "String img src" element als Obj
|
|
|
86
95
|
|
|
87
96
|
MIT License
|
|
88
97
|
|
|
89
|
-
Copyright (c) 2022 TA2k <tombox2020@gmail.com>
|
|
98
|
+
Copyright (c) 2022-2030 TA2k <tombox2020@gmail.com>
|
|
90
99
|
|
|
91
100
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
92
101
|
of this software and associated documentation files (the "Software"), to deal
|
|
Binary file
|
package/admin/index_m.html
CHANGED
|
@@ -118,6 +118,33 @@
|
|
|
118
118
|
<label for="dhlMfa" class="translate">SMS/Mail Pin nach erstem Start</label>
|
|
119
119
|
</div>
|
|
120
120
|
</div>
|
|
121
|
+
<div class="row">
|
|
122
|
+
<div class="col s6 input-field" id="captchaResponse">
|
|
123
|
+
If normal login is not working alternate DHL login method is available
|
|
124
|
+
<p></p>
|
|
125
|
+
1. Open the Url below in Chrome and login with your account
|
|
126
|
+
<p></p>
|
|
127
|
+
2. Open Developer Console F12 or Option + Command + I
|
|
128
|
+
<p></p>
|
|
129
|
+
3. You see a failed redirect in the Console copy the dhllogin:// url
|
|
130
|
+
<p></p>
|
|
131
|
+
<img src="copyurl.png" style="width: 30rem" />
|
|
132
|
+
<p></p>
|
|
133
|
+
4. Paste the url in the input field below
|
|
134
|
+
|
|
135
|
+
<p></p>
|
|
136
|
+
<p></p>
|
|
137
|
+
<a
|
|
138
|
+
href="https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/login/authorize?redirect_uri=dhllogin://de.deutschepost.dhl/login&state=eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9&client_id=83471082-5c13-4fce-8dcb-19d2a3fca413&response_type=code&scope=openid%20offline_access&claims=%7B%22id_token%22:%7B%22email%22:null,%22post_number%22:null,%22twofa%22:null,%22service_mask%22:null,%22deactivate_account%22:null,%22last_login%22:null,%22customer_type%22:null,%22display_name%22:null,%22data_confirmation_required%22:null%7D%7D&nonce=&login_hint=&prompt=login&ui_locales=de-DE&code_challenge=MAhrhXXZP-Owy-R7ruyB7Fn-Z8ODW6qxCoHg4uXELCw&code_challenge_method=S256"
|
|
139
|
+
target="_blank"
|
|
140
|
+
style="color: red !important"
|
|
141
|
+
>DHL Login Url CLICK HERE</a
|
|
142
|
+
>
|
|
143
|
+
<p></p>
|
|
144
|
+
<input type="text" class="value" id="dhlCode" placeholder="dhllogin://de.deutschepost.dhl/login?code=Jqbzy3wbJ..." />
|
|
145
|
+
<label for="dhlCode" class="translate">dhllogin Url</label>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
121
148
|
<div class="row">
|
|
122
149
|
<div class="col"><h5>Amazon</h5></div>
|
|
123
150
|
</div>
|
package/admin/words.js
CHANGED
package/io-package.json
CHANGED
|
@@ -1,8 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "parcel",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.10",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.2.10": {
|
|
7
|
+
"en": "add alternative way for dhl login\nmove dhl connections error to info level",
|
|
8
|
+
"de": "alternative möglichkeit für dhl anmelden\ndhl-verbindungen fehler auf info-ebene verschieben",
|
|
9
|
+
"ru": "добавить альтернативный способ dhl login\nперенести ошибку подключений dhl на уровень информации",
|
|
10
|
+
"pt": "adicionar maneira alternativa para dhl login\nmover erro de conexões dhl para nível de informação",
|
|
11
|
+
"nl": "alternatieve manier toevoegen voor dhl login\ndhl-verbindingsfout naar infoniveau verplaatsen",
|
|
12
|
+
"fr": "ajouter une autre façon pour la connexion dhl\ndéplacer l'erreur de connexions dhl au niveau info",
|
|
13
|
+
"it": "aggiungere modo alternativo per il login dhl\nspostare l'errore di connessioni dhl a livello info",
|
|
14
|
+
"es": "añadir la forma alternativa para dhl login\nmovimiento dhl conexiones error a nivel de información",
|
|
15
|
+
"pl": "dodaj alternatywny sposób logowania dhl\nprzenieść błąd połączeń dhl do poziomu informacji",
|
|
16
|
+
"uk": "додати альтернативний спосіб для входу в систему\nперемістити помилки з'єднанням dhl на інформаційний рівень",
|
|
17
|
+
"zh-cn": "添加 dhl 登录的替代方式\n将 dhl 连接错误移动到信息级别"
|
|
18
|
+
},
|
|
19
|
+
"0.2.9": {
|
|
20
|
+
"en": "add alternative way for dhl login\nmove dhl connections error to info level",
|
|
21
|
+
"de": "alternative möglichkeit für dhl login\ndhl verbindungsfehler auf info level verschoben",
|
|
22
|
+
"ru": "добавить альтернативный способ dhl login\nперенести ошибку подключений dhl на уровень информации",
|
|
23
|
+
"pt": "adicionar maneira alternativa para dhl login\nmover erro de conexões dhl para nível de informação",
|
|
24
|
+
"nl": "alternatieve manier toevoegen voor dhl login\ndhl-verbindingsfout naar infoniveau verplaatsen",
|
|
25
|
+
"fr": "ajouter une autre façon pour la connexion dhl\ndéplacer l'erreur de connexions dhl au niveau info",
|
|
26
|
+
"it": "aggiungere modo alternativo per il login dhl\nspostare l'errore di connessioni dhl a livello info",
|
|
27
|
+
"es": "añadir la forma alternativa para dhl login\nmovimiento dhl conexiones error a nivel de información",
|
|
28
|
+
"pl": "dodaj alternatywny sposób logowania dhl\nprzenieść błąd połączeń dhl do poziomu informacji",
|
|
29
|
+
"uk": "додати альтернативний спосіб для входу в систему\nперемістити помилки з'єднанням dhl на інформаційний рівень",
|
|
30
|
+
"zh-cn": "添加 dhl 登录的替代方式\n将 dhl 连接错误移动到信息级别"
|
|
31
|
+
},
|
|
32
|
+
"0.2.8": {
|
|
33
|
+
"en": "fix amazon login",
|
|
34
|
+
"de": "fix amazon login",
|
|
35
|
+
"ru": "исправить логин амазон",
|
|
36
|
+
"pt": "corrigir amazon login",
|
|
37
|
+
"nl": "fix amazon login",
|
|
38
|
+
"fr": "correction de la connexion amazon",
|
|
39
|
+
"it": "fix amazon login",
|
|
40
|
+
"es": "fijar amazon login",
|
|
41
|
+
"pl": "naprawić logowanie amazon",
|
|
42
|
+
"uk": "виправити amazon увійти",
|
|
43
|
+
"zh-cn": "修补amazon 登录"
|
|
44
|
+
},
|
|
45
|
+
"0.2.8-beta.0": {
|
|
46
|
+
"en": "improve amazon login",
|
|
47
|
+
"de": "amazon login verbessern",
|
|
48
|
+
"ru": "улучшить логин amazon",
|
|
49
|
+
"pt": "melhorar o login amazon",
|
|
50
|
+
"nl": "amazon login verbeteren",
|
|
51
|
+
"fr": "améliorer la connexion amazon",
|
|
52
|
+
"it": "migliorare amazon login",
|
|
53
|
+
"es": "mejorar amazon login",
|
|
54
|
+
"pl": "poprawić logowanie amazon",
|
|
55
|
+
"uk": "поліпшити логін amazon",
|
|
56
|
+
"zh-cn": "改进amazon 登录"
|
|
57
|
+
},
|
|
6
58
|
"0.2.7": {
|
|
7
59
|
"en": "Fix for UPS Login",
|
|
8
60
|
"de": "Fix für UPS Login"
|
|
@@ -14,72 +66,6 @@
|
|
|
14
66
|
"0.2.2": {
|
|
15
67
|
"en": "Improvment for Amazon Login and fix for Briefaanündigung Image",
|
|
16
68
|
"de": "Verbesserung für Amazon Login und Fix für Briefankündigung Image State"
|
|
17
|
-
},
|
|
18
|
-
"0.2.1": {
|
|
19
|
-
"en": "Fix for Briefankündigung",
|
|
20
|
-
"de": "Briefankündigung wieder aktiviert"
|
|
21
|
-
},
|
|
22
|
-
"0.1.6": {
|
|
23
|
-
"en": "Fix DHL and UPS",
|
|
24
|
-
"de": "DHL und UPS gefixt"
|
|
25
|
-
},
|
|
26
|
-
"0.1.5": {
|
|
27
|
-
"en": "Improve failed Amazon Login",
|
|
28
|
-
"de": "Verbesserter Amazon Login im Fehlerfall"
|
|
29
|
-
},
|
|
30
|
-
"0.1.2": {
|
|
31
|
-
"en": "Fix Amazon Status",
|
|
32
|
-
"de": "Amazon Status gefixt"
|
|
33
|
-
},
|
|
34
|
-
"0.1.1": {
|
|
35
|
-
"en": "Fix State creating warnings",
|
|
36
|
-
"de": "Warnung beim erstellen von Objekten behoben"
|
|
37
|
-
},
|
|
38
|
-
"0.1.0": {
|
|
39
|
-
"en": "Fix Hermes login"
|
|
40
|
-
},
|
|
41
|
-
"0.0.32": {
|
|
42
|
-
"en": "Fix Amazon relogin"
|
|
43
|
-
},
|
|
44
|
-
"0.0.30": {
|
|
45
|
-
"en": "Fix Hermes Login"
|
|
46
|
-
},
|
|
47
|
-
"0.0.28": {
|
|
48
|
-
"en": "Fix Amazon Login"
|
|
49
|
-
},
|
|
50
|
-
"0.0.27": {
|
|
51
|
-
"en": "Fix DHL Refresh token",
|
|
52
|
-
"de": "DHL Refresh token gefixt"
|
|
53
|
-
},
|
|
54
|
-
"0.0.26": {
|
|
55
|
-
"en": "Fix DHL Login",
|
|
56
|
-
"de": "DHL Login gefixt"
|
|
57
|
-
},
|
|
58
|
-
"0.0.25": {
|
|
59
|
-
"en": "Fix new Amazon UI parsing",
|
|
60
|
-
"de": "Neues Amazon UI parsing gefixt"
|
|
61
|
-
},
|
|
62
|
-
"0.0.23": {
|
|
63
|
-
"en": "Disable Pictures of Briefankündigung",
|
|
64
|
-
"de": "Bilder der Briefankündigung deaktiviert"
|
|
65
|
-
},
|
|
66
|
-
"0.0.22": {
|
|
67
|
-
"en": "Fix Amazon Login"
|
|
68
|
-
},
|
|
69
|
-
"0.0.21": {
|
|
70
|
-
"en": "Fix Brief images and pushover user"
|
|
71
|
-
},
|
|
72
|
-
"0.0.20": {
|
|
73
|
-
"en": "Fix GLS Parcel"
|
|
74
|
-
},
|
|
75
|
-
"0.0.18": {
|
|
76
|
-
"en": "Fix UPS/GLS login"
|
|
77
|
-
},
|
|
78
|
-
"0.0.15": {
|
|
79
|
-
"en": "Fix DPD states and remove canvas dependency"
|
|
80
|
-
},
|
|
81
|
-
"0.0.13": {
|
|
82
|
-
"en": "Fix Amazon delivery state, add telegram user"
|
|
83
69
|
}
|
|
84
70
|
},
|
|
85
71
|
"title": "Parcel tracking",
|
|
@@ -107,7 +93,9 @@
|
|
|
107
93
|
"pl": "Śledzenie przesyłek",
|
|
108
94
|
"zh-cn": "包裹追踪"
|
|
109
95
|
},
|
|
110
|
-
"authors": [
|
|
96
|
+
"authors": [
|
|
97
|
+
"TA2k <tombox2020@gmail.com>"
|
|
98
|
+
],
|
|
111
99
|
"keywords": [
|
|
112
100
|
"parcel",
|
|
113
101
|
"tracking",
|
|
@@ -198,6 +186,7 @@
|
|
|
198
186
|
"dpdpassword": "",
|
|
199
187
|
"dhlusername": "",
|
|
200
188
|
"dhlpassword": "",
|
|
189
|
+
"dhlCode": "",
|
|
201
190
|
"dhlMfa": "",
|
|
202
191
|
"17trackKey": "",
|
|
203
192
|
"sendToActive": false,
|
package/lib/dhldecrypt.js
CHANGED
package/lib/rsaKey.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
1
2
|
const crypto = require('crypto');
|
|
2
3
|
const RSAKey = (function () {
|
|
3
4
|
function a(a, b, c) {
|
|
@@ -13,14 +14,14 @@ const RSAKey = (function () {
|
|
|
13
14
|
}
|
|
14
15
|
function c(a, b, c, d, e, f) {
|
|
15
16
|
for (; --f >= 0; ) {
|
|
16
|
-
|
|
17
|
+
const g = b * this[a++] + c[d] + e;
|
|
17
18
|
(e = Math.floor(g / 67108864)), (c[d++] = 67108863 & g);
|
|
18
19
|
}
|
|
19
20
|
return e;
|
|
20
21
|
}
|
|
21
22
|
function d(a, b, c, d, e, f) {
|
|
22
|
-
for (
|
|
23
|
-
|
|
23
|
+
for (let g = 32767 & b, h = b >> 15; --f >= 0; ) {
|
|
24
|
+
let i = 32767 & this[a],
|
|
24
25
|
j = this[a++] >> 15,
|
|
25
26
|
k = h * i + j * g;
|
|
26
27
|
(i = g * i + ((32767 & k) << 15) + c[d] + (1073741823 & e)),
|
|
@@ -30,8 +31,8 @@ const RSAKey = (function () {
|
|
|
30
31
|
return e;
|
|
31
32
|
}
|
|
32
33
|
function e(a, b, c, d, e, f) {
|
|
33
|
-
for (
|
|
34
|
-
|
|
34
|
+
for (let g = 16383 & b, h = b >> 14; --f >= 0; ) {
|
|
35
|
+
let i = 16383 & this[a],
|
|
35
36
|
j = this[a++] >> 14,
|
|
36
37
|
k = h * i + j * g;
|
|
37
38
|
(i = g * i + ((16383 & k) << 14) + c[d] + e), (e = (i >> 28) + (k >> 14) + h * j), (c[d++] = 268435455 & i);
|
|
@@ -42,22 +43,22 @@ const RSAKey = (function () {
|
|
|
42
43
|
return ka.charAt(a);
|
|
43
44
|
}
|
|
44
45
|
function g(a, b) {
|
|
45
|
-
|
|
46
|
+
const c = la[a.charCodeAt(b)];
|
|
46
47
|
return null == c ? -1 : c;
|
|
47
48
|
}
|
|
48
49
|
function h(a) {
|
|
49
|
-
for (
|
|
50
|
+
for (let b = this.t - 1; b >= 0; --b) a[b] = this[b];
|
|
50
51
|
(a.t = this.t), (a.s = this.s);
|
|
51
52
|
}
|
|
52
53
|
function i(a) {
|
|
53
54
|
(this.t = 1), (this.s = 0 > a ? -1 : 0), a > 0 ? (this[0] = a) : -1 > a ? (this[0] = a + this.DV) : (this.t = 0);
|
|
54
55
|
}
|
|
55
56
|
function j(a) {
|
|
56
|
-
|
|
57
|
+
const c = b();
|
|
57
58
|
return c.fromInt(a), c;
|
|
58
59
|
}
|
|
59
60
|
function k(b, c) {
|
|
60
|
-
|
|
61
|
+
let d;
|
|
61
62
|
if (16 == c) d = 4;
|
|
62
63
|
else if (8 == c) d = 3;
|
|
63
64
|
else if (256 == c) d = 8;
|
|
@@ -69,7 +70,7 @@ const RSAKey = (function () {
|
|
|
69
70
|
}
|
|
70
71
|
(this.t = 0), (this.s = 0);
|
|
71
72
|
for (var e = b.length, f = !1, h = 0; --e >= 0; ) {
|
|
72
|
-
|
|
73
|
+
const i = 8 == d ? 255 & b[e] : g(b, e);
|
|
73
74
|
0 > i
|
|
74
75
|
? '-' == b.charAt(e) && (f = !0)
|
|
75
76
|
: ((f = !1),
|
|
@@ -86,11 +87,11 @@ const RSAKey = (function () {
|
|
|
86
87
|
f && a.ZERO.subTo(this, this);
|
|
87
88
|
}
|
|
88
89
|
function l() {
|
|
89
|
-
for (
|
|
90
|
+
for (let a = this.s & this.DM; this.t > 0 && this[this.t - 1] == a; ) --this.t;
|
|
90
91
|
}
|
|
91
92
|
function m(a) {
|
|
92
93
|
if (this.s < 0) return '-' + this.negate().toString(a);
|
|
93
|
-
|
|
94
|
+
let b;
|
|
94
95
|
if (16 == a) b = 4;
|
|
95
96
|
else if (8 == a) b = 3;
|
|
96
97
|
else if (2 == a) b = 1;
|
|
@@ -99,7 +100,7 @@ const RSAKey = (function () {
|
|
|
99
100
|
if (4 != a) return this.toRadix(a);
|
|
100
101
|
b = 2;
|
|
101
102
|
}
|
|
102
|
-
|
|
103
|
+
let c,
|
|
103
104
|
d = (1 << b) - 1,
|
|
104
105
|
e = !1,
|
|
105
106
|
g = '',
|
|
@@ -115,22 +116,22 @@ const RSAKey = (function () {
|
|
|
115
116
|
return e ? g : '0';
|
|
116
117
|
}
|
|
117
118
|
function n() {
|
|
118
|
-
|
|
119
|
+
const c = b();
|
|
119
120
|
return a.ZERO.subTo(this, c), c;
|
|
120
121
|
}
|
|
121
122
|
function o() {
|
|
122
123
|
return this.s < 0 ? this.negate() : this;
|
|
123
124
|
}
|
|
124
125
|
function p(a) {
|
|
125
|
-
|
|
126
|
+
let b = this.s - a.s;
|
|
126
127
|
if (0 != b) return b;
|
|
127
|
-
|
|
128
|
+
let c = this.t;
|
|
128
129
|
if (((b = c - a.t), 0 != b)) return this.s < 0 ? -b : b;
|
|
129
130
|
for (; --c >= 0; ) if (0 != (b = this[c] - a[c])) return b;
|
|
130
131
|
return 0;
|
|
131
132
|
}
|
|
132
133
|
function q(a) {
|
|
133
|
-
|
|
134
|
+
let b,
|
|
134
135
|
c = 1;
|
|
135
136
|
return (
|
|
136
137
|
0 != (b = a >>> 16) && ((a = b), (c += 16)),
|
|
@@ -145,17 +146,17 @@ const RSAKey = (function () {
|
|
|
145
146
|
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + q(this[this.t - 1] ^ (this.s & this.DM));
|
|
146
147
|
}
|
|
147
148
|
function s(a, b) {
|
|
148
|
-
|
|
149
|
+
let c;
|
|
149
150
|
for (c = this.t - 1; c >= 0; --c) b[c + a] = this[c];
|
|
150
151
|
for (c = a - 1; c >= 0; --c) b[c] = 0;
|
|
151
152
|
(b.t = this.t + a), (b.s = this.s);
|
|
152
153
|
}
|
|
153
154
|
function t(a, b) {
|
|
154
|
-
for (
|
|
155
|
+
for (let c = a; c < this.t; ++c) b[c - a] = this[c];
|
|
155
156
|
(b.t = Math.max(this.t - a, 0)), (b.s = this.s);
|
|
156
157
|
}
|
|
157
158
|
function u(a, b) {
|
|
158
|
-
|
|
159
|
+
let c,
|
|
159
160
|
d = a % this.DB,
|
|
160
161
|
e = this.DB - d,
|
|
161
162
|
f = (1 << e) - 1,
|
|
@@ -167,13 +168,13 @@ const RSAKey = (function () {
|
|
|
167
168
|
}
|
|
168
169
|
function v(a, b) {
|
|
169
170
|
b.s = this.s;
|
|
170
|
-
|
|
171
|
+
const c = Math.floor(a / this.DB);
|
|
171
172
|
if (c >= this.t) return void (b.t = 0);
|
|
172
|
-
|
|
173
|
+
const d = a % this.DB,
|
|
173
174
|
e = this.DB - d,
|
|
174
175
|
f = (1 << d) - 1;
|
|
175
176
|
b[0] = this[c] >> d;
|
|
176
|
-
for (
|
|
177
|
+
for (let g = c + 1; g < this.t; ++g) (b[g - c - 1] |= (this[g] & f) << e), (b[g - c] = this[g] >> d);
|
|
177
178
|
d > 0 && (b[this.t - c - 1] |= (this.s & f) << e), (b.t = this.t - c), b.clamp();
|
|
178
179
|
}
|
|
179
180
|
function w(a, b) {
|
|
@@ -188,7 +189,7 @@ const RSAKey = (function () {
|
|
|
188
189
|
(b.s = 0 > d ? -1 : 0), -1 > d ? (b[c++] = this.DV + d) : d > 0 && (b[c++] = d), (b.t = c), b.clamp();
|
|
189
190
|
}
|
|
190
191
|
function x(b, c) {
|
|
191
|
-
|
|
192
|
+
let d = this.abs(),
|
|
192
193
|
e = b.abs(),
|
|
193
194
|
f = d.t;
|
|
194
195
|
for (c.t = f + e.t; --f >= 0; ) c[f] = 0;
|
|
@@ -198,26 +199,26 @@ const RSAKey = (function () {
|
|
|
198
199
|
function y(a) {
|
|
199
200
|
for (var b = this.abs(), c = (a.t = 2 * b.t); --c >= 0; ) a[c] = 0;
|
|
200
201
|
for (c = 0; c < b.t - 1; ++c) {
|
|
201
|
-
|
|
202
|
+
const d = b.am(c, b[c], a, 2 * c, 0, 1);
|
|
202
203
|
(a[c + b.t] += b.am(c + 1, 2 * b[c], a, 2 * c + 1, d, b.t - c - 1)) >= b.DV && ((a[c + b.t] -= b.DV), (a[c + b.t + 1] = 1));
|
|
203
204
|
}
|
|
204
205
|
a.t > 0 && (a[a.t - 1] += b.am(c, b[c], a, 2 * c, 0, 1)), (a.s = 0), a.clamp();
|
|
205
206
|
}
|
|
206
207
|
function z(c, d, e) {
|
|
207
|
-
|
|
208
|
+
const f = c.abs();
|
|
208
209
|
if (!(f.t <= 0)) {
|
|
209
|
-
|
|
210
|
+
const g = this.abs();
|
|
210
211
|
if (g.t < f.t) return null != d && d.fromInt(0), void (null != e && this.copyTo(e));
|
|
211
212
|
null == e && (e = b());
|
|
212
|
-
|
|
213
|
+
const h = b(),
|
|
213
214
|
i = this.s,
|
|
214
215
|
j = c.s,
|
|
215
216
|
k = this.DB - q(f[f.t - 1]);
|
|
216
217
|
k > 0 ? (f.lShiftTo(k, h), g.lShiftTo(k, e)) : (f.copyTo(h), g.copyTo(e));
|
|
217
|
-
|
|
218
|
+
const l = h.t,
|
|
218
219
|
m = h[l - 1];
|
|
219
220
|
if (0 != m) {
|
|
220
|
-
|
|
221
|
+
let n = m * (1 << this.F1) + (l > 1 ? h[l - 2] >> this.F2 : 0),
|
|
221
222
|
o = this.FV / n,
|
|
222
223
|
p = (1 << this.F1) / n,
|
|
223
224
|
r = 1 << this.F2,
|
|
@@ -227,7 +228,7 @@ const RSAKey = (function () {
|
|
|
227
228
|
for (h.dlShiftTo(t, u), e.compareTo(u) >= 0 && ((e[e.t++] = 1), e.subTo(u, e)), a.ONE.dlShiftTo(l, u), u.subTo(h, h); h.t < l; )
|
|
228
229
|
h[h.t++] = 0;
|
|
229
230
|
for (; --t >= 0; ) {
|
|
230
|
-
|
|
231
|
+
let v = e[--s] == m ? this.DM : Math.floor(e[s] * o + (e[s - 1] + r) * p);
|
|
231
232
|
if ((e[s] += h.am(0, v, e, t, 0, l)) < v) for (h.dlShiftTo(t, u), e.subTo(u, e); e[s] < --v; ) e.subTo(u, e);
|
|
232
233
|
}
|
|
233
234
|
null != d && (e.drShiftTo(l, d), i != j && a.ZERO.subTo(d, d)),
|
|
@@ -239,7 +240,7 @@ const RSAKey = (function () {
|
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
function A(c) {
|
|
242
|
-
|
|
243
|
+
const d = b();
|
|
243
244
|
return this.abs().divRemTo(c, null, d), this.s < 0 && d.compareTo(a.ZERO) > 0 && c.subTo(d, d), d;
|
|
244
245
|
}
|
|
245
246
|
function B(a) {
|
|
@@ -262,9 +263,9 @@ const RSAKey = (function () {
|
|
|
262
263
|
}
|
|
263
264
|
function H() {
|
|
264
265
|
if (this.t < 1) return 0;
|
|
265
|
-
|
|
266
|
+
const a = this[0];
|
|
266
267
|
if (0 == (1 & a)) return 0;
|
|
267
|
-
|
|
268
|
+
let b = 3 & a;
|
|
268
269
|
return (
|
|
269
270
|
(b = (b * (2 - (15 & a) * b)) & 15),
|
|
270
271
|
(b = (b * (2 - (255 & a) * b)) & 255),
|
|
@@ -282,17 +283,17 @@ const RSAKey = (function () {
|
|
|
282
283
|
(this.mt2 = 2 * a.t);
|
|
283
284
|
}
|
|
284
285
|
function J(c) {
|
|
285
|
-
|
|
286
|
+
const d = b();
|
|
286
287
|
return c.abs().dlShiftTo(this.m.t, d), d.divRemTo(this.m, null, d), c.s < 0 && d.compareTo(a.ZERO) > 0 && this.m.subTo(d, d), d;
|
|
287
288
|
}
|
|
288
289
|
function K(a) {
|
|
289
|
-
|
|
290
|
+
const c = b();
|
|
290
291
|
return a.copyTo(c), this.reduce(c), c;
|
|
291
292
|
}
|
|
292
293
|
function L(a) {
|
|
293
294
|
for (; a.t <= this.mt2; ) a[a.t++] = 0;
|
|
294
|
-
for (
|
|
295
|
-
|
|
295
|
+
for (let b = 0; b < this.m.t; ++b) {
|
|
296
|
+
let c = 32767 & a[b],
|
|
296
297
|
d = (c * this.mpl + (((c * this.mph + (a[b] >> 15) * this.mpl) & this.um) << 15)) & a.DM;
|
|
297
298
|
for (c = b + this.m.t, a[c] += this.m.am(0, d, a, b, 0, this.m.t); a[c] >= a.DV; ) (a[c] -= a.DV), a[++c]++;
|
|
298
299
|
}
|
|
@@ -309,34 +310,34 @@ const RSAKey = (function () {
|
|
|
309
310
|
}
|
|
310
311
|
function P(c, d) {
|
|
311
312
|
if (c > 4294967295 || 1 > c) return a.ONE;
|
|
312
|
-
|
|
313
|
+
let e = b(),
|
|
313
314
|
f = b(),
|
|
314
315
|
g = d.convert(this),
|
|
315
316
|
h = q(c) - 1;
|
|
316
317
|
for (g.copyTo(e); --h >= 0; )
|
|
317
318
|
if ((d.sqrTo(e, f), (c & (1 << h)) > 0)) d.mulTo(f, g, e);
|
|
318
319
|
else {
|
|
319
|
-
|
|
320
|
+
const i = e;
|
|
320
321
|
(e = f), (f = i);
|
|
321
322
|
}
|
|
322
323
|
return d.revert(e);
|
|
323
324
|
}
|
|
324
325
|
function Q(a, b) {
|
|
325
|
-
|
|
326
|
+
let c;
|
|
326
327
|
return (c = 256 > a || b.isEven() ? new B(b) : new I(b)), this.exp(a, c);
|
|
327
328
|
}
|
|
328
329
|
function R() {
|
|
329
330
|
(this.i = 0), (this.j = 0), (this.S = new Array());
|
|
330
331
|
}
|
|
331
332
|
function S(a) {
|
|
332
|
-
|
|
333
|
+
let b, c, d;
|
|
333
334
|
for (b = 0; 256 > b; ++b) this.S[b] = b;
|
|
334
335
|
for (c = 0, b = 0; 256 > b; ++b)
|
|
335
336
|
(c = (c + this.S[b] + a[b % a.length]) & 255), (d = this.S[b]), (this.S[b] = this.S[c]), (this.S[c] = d);
|
|
336
337
|
(this.i = 0), (this.j = 0);
|
|
337
338
|
}
|
|
338
339
|
function T() {
|
|
339
|
-
|
|
340
|
+
let a;
|
|
340
341
|
return (
|
|
341
342
|
(this.i = (this.i + 1) & 255),
|
|
342
343
|
(this.j = (this.j + this.S[this.i]) & 255),
|
|
@@ -367,7 +368,7 @@ const RSAKey = (function () {
|
|
|
367
368
|
return ma.next();
|
|
368
369
|
}
|
|
369
370
|
function Y(a) {
|
|
370
|
-
|
|
371
|
+
let b;
|
|
371
372
|
for (b = 0; b < a.length; ++b) a[b] = X();
|
|
372
373
|
}
|
|
373
374
|
function Z() {}
|
|
@@ -377,7 +378,7 @@ const RSAKey = (function () {
|
|
|
377
378
|
function _(b, c) {
|
|
378
379
|
if (c < b.length + 11) return alert('Message too long for RSA'), null;
|
|
379
380
|
for (var d = new Array(), e = b.length - 1; e >= 0 && c > 0; ) {
|
|
380
|
-
|
|
381
|
+
const f = b.charCodeAt(e--);
|
|
381
382
|
128 > f
|
|
382
383
|
? (d[--c] = f)
|
|
383
384
|
: f > 127 && 2048 > f
|
|
@@ -385,7 +386,7 @@ const RSAKey = (function () {
|
|
|
385
386
|
: ((d[--c] = (63 & f) | 128), (d[--c] = ((f >> 6) & 63) | 128), (d[--c] = (f >> 12) | 224));
|
|
386
387
|
}
|
|
387
388
|
d[--c] = 0;
|
|
388
|
-
for (
|
|
389
|
+
for (let g = new Z(), h = new Array(); c > 2; ) {
|
|
389
390
|
for (h[0] = 0; 0 == h[0]; ) g.nextBytes(h);
|
|
390
391
|
d[--c] = h[0];
|
|
391
392
|
}
|
|
@@ -410,18 +411,18 @@ const RSAKey = (function () {
|
|
|
410
411
|
return a.modPowInt(this.e, this.n);
|
|
411
412
|
}
|
|
412
413
|
function da(a) {
|
|
413
|
-
|
|
414
|
+
const b = _(a, (this.n.bitLength() + 7) >> 3);
|
|
414
415
|
if (null == b) return null;
|
|
415
|
-
|
|
416
|
+
const c = this.doPublic(b);
|
|
416
417
|
if (null == c) return null;
|
|
417
|
-
|
|
418
|
+
const d = c.toString(16);
|
|
418
419
|
return 0 == (1 & d.length) ? d : '0' + d;
|
|
419
420
|
}
|
|
420
|
-
|
|
421
|
+
let ea,
|
|
421
422
|
fa = 0xdeadbeefcafe,
|
|
422
423
|
ga = 15715070 == (16777215 & fa);
|
|
423
424
|
(a.prototype.am = e), (ea = 28), (a.prototype.DB = ea), (a.prototype.DM = (1 << ea) - 1), (a.prototype.DV = 1 << ea);
|
|
424
|
-
|
|
425
|
+
const ha = 52;
|
|
425
426
|
(a.prototype.FV = Math.pow(2, ha)), (a.prototype.F1 = ha - ea), (a.prototype.F2 = 2 * ea - ha);
|
|
426
427
|
var ia,
|
|
427
428
|
ja,
|
|
@@ -472,9 +473,9 @@ const RSAKey = (function () {
|
|
|
472
473
|
pa = 256;
|
|
473
474
|
if (null == na) {
|
|
474
475
|
(na = new Array()), (oa = 0);
|
|
475
|
-
|
|
476
|
+
let qa;
|
|
476
477
|
if (crypto && crypto.getRandomValues) {
|
|
477
|
-
|
|
478
|
+
const ra = new Uint8Array(32);
|
|
478
479
|
for (crypto.getRandomValues(ra), qa = 0; 32 > qa; ++qa) na[oa++] = ra[qa];
|
|
479
480
|
}
|
|
480
481
|
|