@breakside/jskit 2023.20.0 → 2023.22.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/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSImage.js +9 -7
- package/Frameworks/Foundation.jsframework/JS/JSURLResponse.js +1 -1
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/JS/SECCipher+HTML.js +31 -44
- package/Frameworks/SecurityKit.jsframework/JS/SECCipher+Node.js +16 -38
- package/Frameworks/SecurityKit.jsframework/JS/SECCipher.js +33 -3
- package/Frameworks/SecurityKit.jsframework/JS/SECHMAC.js +17 -0
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/HTMLBuilder.js +76 -20
- package/Node/Resources.js +21 -120
- package/Node/io.breakside.jskit-bundle.js +2 -2
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSImage.js +9 -7
- package/Root/Frameworks/Foundation/JSURLResponse.js +1 -1
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +2 -1
- package/Root/Frameworks/NotificationKit/NKHTMLUserNotificationCenter.js +59 -18
- package/Root/Frameworks/NotificationKit/NKUserNotification.js +12 -1
- package/Root/Frameworks/NotificationKit/NKUserNotificationCenter.js +5 -0
- package/Root/Frameworks/NotificationKit/NKWebPushService.js +145 -38
- package/Root/Frameworks/NotificationKit/NotificationKit+Node.js +19 -0
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/SECCipher+HTML.js +31 -44
- package/Root/Frameworks/SecurityKit/SECCipher+Node.js +16 -38
- package/Root/Frameworks/SecurityKit/SECCipher.js +33 -3
- package/Root/Frameworks/SecurityKit/SECHMAC.js +17 -0
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/UIHTMLApplication.js +2 -0
- package/Root/Frameworks/UIKit/UIHTMLContentEditableTextInputManager.js +1 -1
- package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +8 -1
- package/Root/Frameworks/UIKit/UIListView.js +4 -2
- package/Root/Frameworks/UIKit/UIWindowServer.js +7 -13
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/Root/Templates/html/${PROJECT_NAME}/www/${PROJECT_NAME}.webmanifest +9 -0
- package/Root/Templates/html/${PROJECT_NAME}/www/HTMLAppBootstrapper.js +7 -1
- package/Root/Templates/html/${PROJECT_NAME}/www/index.html +1 -0
- package/Root/Templates/html/${PROJECT_NAME}/www/service-worker.js +25 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.22.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "DOM+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "c5e74a677a557876be14d6e2bf15b95202dcea6e"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
6
|
-
"JSBundleVersion": "2023.
|
|
6
|
+
"JSBundleVersion": "2023.22.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
11
11
|
"node": "DOM+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "c5e74a677a557876be14d6e2bf15b95202dcea6e"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.22.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
8
8
|
"html": "FontKit+HTML.js"
|
|
9
9
|
},
|
|
10
10
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "c5e74a677a557876be14d6e2bf15b95202dcea6e"
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.JSKit.FontKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
6
|
-
"JSBundleVersion": "2023.
|
|
6
|
+
"JSBundleVersion": "2023.22.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
10
10
|
"html": "FontKit+HTML.js"
|
|
11
11
|
},
|
|
12
12
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "c5e74a677a557876be14d6e2bf15b95202dcea6e"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [],
|
|
16
16
|
"ResourceLookup": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.22.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "Foundation+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "c5e74a677a557876be14d6e2bf15b95202dcea6e"
|
|
13
13
|
}
|
|
@@ -417,16 +417,18 @@ _JSDataImage.sizeFromSVGData = function(data){
|
|
|
417
417
|
return multiple[unit] * n;
|
|
418
418
|
};
|
|
419
419
|
if (namespace == 'http://www.w3.org/2000/svg' && name.toLowerCase() == 'svg'){
|
|
420
|
-
var width = attributes.get("width");
|
|
421
|
-
var height = attributes.get("height");
|
|
420
|
+
var width = px(attributes.get("width"));
|
|
421
|
+
var height = px(attributes.get("height"));
|
|
422
422
|
var viewBox = attributes.get("viewBox");
|
|
423
|
-
if (width && height){
|
|
424
|
-
size.width =
|
|
425
|
-
size.height =
|
|
423
|
+
if (width !== undefined && height !== undefined){
|
|
424
|
+
size.width = width;
|
|
425
|
+
size.height = height;
|
|
426
426
|
}else if (viewBox){
|
|
427
427
|
var box = viewBox.split(/\s+/).map(function(n){ return parseInt(n); });
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
if (!isNaN(box[2]) && !isNaN(box[3])){
|
|
429
|
+
size.width = box[2];
|
|
430
|
+
size.height = box[3];
|
|
431
|
+
}
|
|
430
432
|
}
|
|
431
433
|
}
|
|
432
434
|
parser.stop();
|
|
@@ -175,7 +175,7 @@ JSURLResponse.error = function(statusCode, object){
|
|
|
175
175
|
|
|
176
176
|
JSGlobalObject.JSURLResponseError = function(response){
|
|
177
177
|
if (this === undefined){
|
|
178
|
-
return new JSURLResponseError();
|
|
178
|
+
return new JSURLResponseError(response);
|
|
179
179
|
}
|
|
180
180
|
this.name = "JSURLResponseError";
|
|
181
181
|
if (response instanceof JSURLResponseError){
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
6
|
-
"JSBundleVersion": "2023.
|
|
6
|
+
"JSBundleVersion": "2023.22.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
11
11
|
"node": "Foundation+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "c5e74a677a557876be14d6e2bf15b95202dcea6e"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [
|
|
17
17
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.22.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "SecurityKit+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "c5e74a677a557876be14d6e2bf15b95202dcea6e"
|
|
13
13
|
}
|
|
@@ -195,14 +195,6 @@ SECCipherAESCounter.definePropertiesFromExtensions({
|
|
|
195
195
|
counter: JSData.initWithLength(16),
|
|
196
196
|
length: 64
|
|
197
197
|
};
|
|
198
|
-
this.decryptedMessageId =
|
|
199
|
-
(nonce[6] << 48)
|
|
200
|
-
| (nonce[5] << 40)
|
|
201
|
-
| (nonce[4] << 32)
|
|
202
|
-
| (nonce[3] << 24)
|
|
203
|
-
| (nonce[2] << 16)
|
|
204
|
-
| (nonce[1] << 8)
|
|
205
|
-
| (nonce[0]);
|
|
206
198
|
nonce.copyTo(algorithm.counter, 0);
|
|
207
199
|
return algorithm;
|
|
208
200
|
},
|
|
@@ -282,55 +274,41 @@ SECCipherAESGaloisCounterMode.definePropertiesFromExtensions({
|
|
|
282
274
|
|
|
283
275
|
htmlAlgorithmName: HTMLCryptoAlgorithmNames.aesGCM,
|
|
284
276
|
|
|
285
|
-
_getHTMLEncryptAlgorithm: function(){
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
((this.encryptedMessageId / 0x100000000) >> 8) & 0xFF,
|
|
290
|
-
(this.encryptedMessageId / 0x100000000) & 0xFF,
|
|
291
|
-
(this.encryptedMessageId >> 24) & 0xFF,
|
|
292
|
-
(this.encryptedMessageId >> 16) & 0xFF,
|
|
293
|
-
(this.encryptedMessageId >> 8) & 0xFF,
|
|
294
|
-
this.encryptedMessageId & 0xF
|
|
295
|
-
]);
|
|
277
|
+
_getHTMLEncryptAlgorithm: function(nonce, _ivLength){
|
|
278
|
+
if (_ivLength === undefined){
|
|
279
|
+
_ivLength = nonce.length;
|
|
280
|
+
}
|
|
296
281
|
var algorithm = {
|
|
297
282
|
name: HTMLCryptoAlgorithmNames.aesGCM,
|
|
298
|
-
iv: JSData.initWithLength(
|
|
283
|
+
iv: JSData.initWithLength(_ivLength),
|
|
299
284
|
tagLength: 128
|
|
300
285
|
};
|
|
301
286
|
nonce.copyTo(algorithm.iv, 0);
|
|
302
287
|
return algorithm;
|
|
303
288
|
},
|
|
304
289
|
|
|
305
|
-
_getHTMLDecryptAlgorithm: function(prefixedData){
|
|
306
|
-
|
|
290
|
+
_getHTMLDecryptAlgorithm: function(prefixedData, nonceLength, _ivLength){
|
|
291
|
+
if (nonceLength === undefined){
|
|
292
|
+
nonceLength = 8;
|
|
293
|
+
}
|
|
294
|
+
if (_ivLength === undefined){
|
|
295
|
+
_ivLength = nonceLength;
|
|
296
|
+
}
|
|
297
|
+
var nonce = prefixedData.subdataInRange(JSRange(0, nonceLength));
|
|
307
298
|
var algorithm = {
|
|
308
299
|
name: HTMLCryptoAlgorithmNames.aesGCM,
|
|
309
|
-
iv: JSData.initWithLength(
|
|
300
|
+
iv: JSData.initWithLength(_ivLength),
|
|
310
301
|
tagLength: 128
|
|
311
302
|
};
|
|
312
|
-
this.decryptedMessageId =
|
|
313
|
-
(nonce[6] << 48)
|
|
314
|
-
| (nonce[5] << 40)
|
|
315
|
-
| (nonce[4] << 32)
|
|
316
|
-
| (nonce[3] << 24)
|
|
317
|
-
| (nonce[2] << 16)
|
|
318
|
-
| (nonce[1] << 8)
|
|
319
|
-
| (nonce[0]);
|
|
320
303
|
nonce.copyTo(algorithm.iv, 0);
|
|
321
304
|
return algorithm;
|
|
322
305
|
},
|
|
323
306
|
|
|
324
|
-
|
|
307
|
+
encryptWithNonce: function(nonce, data, key, completion, target, _ivLength){
|
|
325
308
|
if (!completion){
|
|
326
309
|
completion = Promise.completion(Promise.resolveNonNull);
|
|
327
310
|
}
|
|
328
|
-
|
|
329
|
-
JSRunLoop.main.schedule(completion, target, null);
|
|
330
|
-
return completion.promise;
|
|
331
|
-
}
|
|
332
|
-
var algorithm = this._getHTMLEncryptAlgorithm();
|
|
333
|
-
var nonce = algorithm.iv.truncatedToLength(8);
|
|
311
|
+
var algorithm = this._getHTMLEncryptAlgorithm(nonce, _ivLength);
|
|
334
312
|
crypto.subtle.encrypt(algorithm, key.htmlKey, data).then(function(encrypted){
|
|
335
313
|
var noncePrefixed = JSData.initWithChunks([nonce, JSData.initWithBuffer(encrypted)]);
|
|
336
314
|
completion.call(target, noncePrefixed);
|
|
@@ -340,12 +318,12 @@ SECCipherAESGaloisCounterMode.definePropertiesFromExtensions({
|
|
|
340
318
|
return completion.promise;
|
|
341
319
|
},
|
|
342
320
|
|
|
343
|
-
|
|
321
|
+
decryptWithNonceLength: function(nonceLength, data, key, completion, target, _ivLength){
|
|
344
322
|
if (!completion){
|
|
345
323
|
completion = Promise.completion(Promise.resolveNonNull);
|
|
346
324
|
}
|
|
347
|
-
var algorithm = this._getHTMLDecryptAlgorithm(data);
|
|
348
|
-
var encrypted = data.subdataInRange(JSRange(
|
|
325
|
+
var algorithm = this._getHTMLDecryptAlgorithm(data, nonceLength, _ivLength);
|
|
326
|
+
var encrypted = data.subdataInRange(JSRange(nonceLength, data.length - nonceLength));
|
|
349
327
|
crypto.subtle.decrypt(algorithm, key.htmlKey, encrypted).then(function(decrypted){
|
|
350
328
|
var decryptedData = JSData.initWithBuffer(decrypted);
|
|
351
329
|
completion.call(target, decryptedData);
|
|
@@ -363,8 +341,17 @@ SECCipherAESGaloisCounterMode.definePropertiesFromExtensions({
|
|
|
363
341
|
JSRunLoop.main.schedule(completion, target, null);
|
|
364
342
|
return completion.promise;
|
|
365
343
|
}
|
|
366
|
-
var
|
|
367
|
-
|
|
344
|
+
var nonce = JSData.initWithArray([
|
|
345
|
+
1,
|
|
346
|
+
((this.encryptedMessageId / 0x100000000) >> 16) & 0xFF,
|
|
347
|
+
((this.encryptedMessageId / 0x100000000) >> 8) & 0xFF,
|
|
348
|
+
(this.encryptedMessageId / 0x100000000) & 0xFF,
|
|
349
|
+
(this.encryptedMessageId >> 24) & 0xFF,
|
|
350
|
+
(this.encryptedMessageId >> 16) & 0xFF,
|
|
351
|
+
(this.encryptedMessageId >> 8) & 0xFF,
|
|
352
|
+
this.encryptedMessageId & 0xF
|
|
353
|
+
]);
|
|
354
|
+
var algorithm = this._getHTMLEncryptAlgorithm(nonce, 16);
|
|
368
355
|
crypto.subtle.wrapKey("raw", key.htmlKey, wrappingKey.htmlKey, algorithm).then(function(bytes){
|
|
369
356
|
var noncePrefixed = JSData.initWithChunks([nonce, JSData.initWithBuffer(bytes)]);
|
|
370
357
|
completion.call(target, noncePrefixed);
|
|
@@ -378,7 +365,7 @@ SECCipherAESGaloisCounterMode.definePropertiesFromExtensions({
|
|
|
378
365
|
if (!completion){
|
|
379
366
|
completion = Promise.completion(Promise.resolveNonNull);
|
|
380
367
|
}
|
|
381
|
-
var algorithm = this._getHTMLDecryptAlgorithm(wrappedKeyData);
|
|
368
|
+
var algorithm = this._getHTMLDecryptAlgorithm(wrappedKeyData, 8, 16);
|
|
382
369
|
var unwrappedKeyHTMLAlgorithm = HTMLCryptoAlgorithmNames.fromAlgorithm(unwrappedKeyAlgorithm);
|
|
383
370
|
wrappedKeyData = wrappedKeyData.subdataInRange(JSRange(8, wrappedKeyData.length - 8));
|
|
384
371
|
crypto.subtle.unwrapKey("raw", wrappedKeyData, wrappingKey.htmlKey, algorithm, unwrappedKeyHTMLAlgorithm, true, ["encrypt", "decrypt"]).then(function(key){
|
|
@@ -182,14 +182,6 @@ SECCipherAESCounter.definePropertiesFromExtensions({
|
|
|
182
182
|
return completion.promise;
|
|
183
183
|
}
|
|
184
184
|
var nonce = data.subdataInRange(JSRange(0, 8));
|
|
185
|
-
this.decryptedMessageId =
|
|
186
|
-
(nonce[6] << 48)
|
|
187
|
-
| (nonce[5] << 40)
|
|
188
|
-
| (nonce[4] << 32)
|
|
189
|
-
| (nonce[3] << 24)
|
|
190
|
-
| (nonce[2] << 16)
|
|
191
|
-
| (nonce[1] << 8)
|
|
192
|
-
| (nonce[0]);
|
|
193
185
|
var iv = JSData.initWithLength(16);
|
|
194
186
|
nonce.copyTo(iv, 0);
|
|
195
187
|
var cipher = crypto.createDecipheriv(name, key.keyData, iv);
|
|
@@ -217,41 +209,31 @@ SECCipherAESGaloisCounterMode.definePropertiesFromExtensions({
|
|
|
217
209
|
return null;
|
|
218
210
|
},
|
|
219
211
|
|
|
220
|
-
|
|
212
|
+
encryptWithNonce: function(nonce, data, key, completion, target, _ivLength){
|
|
221
213
|
if (!completion){
|
|
222
214
|
completion = Promise.completion(Promise.resolveNonNull);
|
|
223
215
|
}
|
|
224
|
-
if (!this.ensureUniqueMessageID()){
|
|
225
|
-
JSRunLoop.main.schedule(completion, target, null);
|
|
226
|
-
return completion.promise;
|
|
227
|
-
}
|
|
228
216
|
var name = this._cipherNameForKey(key);
|
|
229
217
|
if (name === null){
|
|
230
218
|
JSRunLoop.main.schedule(completion, target, null);
|
|
231
219
|
return completion.promise;
|
|
232
220
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
(this.encryptedMessageId / 0x100000000) & 0xFF,
|
|
238
|
-
(this.encryptedMessageId >> 24) & 0xFF,
|
|
239
|
-
(this.encryptedMessageId >> 16) & 0xFF,
|
|
240
|
-
(this.encryptedMessageId >> 8) & 0xFF,
|
|
241
|
-
this.encryptedMessageId & 0xF
|
|
242
|
-
]);
|
|
243
|
-
var iv = JSData.initWithLength(16);
|
|
221
|
+
if (_ivLength === undefined){
|
|
222
|
+
_ivLength = nonce.length;
|
|
223
|
+
}
|
|
224
|
+
var iv = JSData.initWithLength(_ivLength);
|
|
244
225
|
nonce.copyTo(iv, 0);
|
|
245
226
|
var cipher = crypto.createCipheriv(name, key.keyData, iv);
|
|
246
227
|
var chunks = [nonce, cipher.update(data), cipher.final()];
|
|
247
|
-
var
|
|
228
|
+
var tagLength = 16;
|
|
229
|
+
var tag = JSData.initWithLength(tagLength);
|
|
248
230
|
cipher.getAuthTag().copyTo(tag, 0);
|
|
249
231
|
chunks.push(tag);
|
|
250
232
|
JSRunLoop.main.schedule(completion, target, JSData.initWithChunks(chunks));
|
|
251
233
|
return completion.promise;
|
|
252
234
|
},
|
|
253
235
|
|
|
254
|
-
|
|
236
|
+
decryptWithNonceLength: function(nonceLength, data, key, completion, target, _ivLength){
|
|
255
237
|
if (!completion){
|
|
256
238
|
completion = Promise.completion(Promise.resolveNonNull);
|
|
257
239
|
}
|
|
@@ -261,21 +243,17 @@ SECCipherAESGaloisCounterMode.definePropertiesFromExtensions({
|
|
|
261
243
|
JSRunLoop.main.schedule(completion, target, null);
|
|
262
244
|
return completion.promise;
|
|
263
245
|
}
|
|
264
|
-
var nonce = data.subdataInRange(JSRange(0,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
| (nonce[3] << 24)
|
|
270
|
-
| (nonce[2] << 16)
|
|
271
|
-
| (nonce[1] << 8)
|
|
272
|
-
| (nonce[0]);
|
|
273
|
-
var iv = JSData.initWithLength(16);
|
|
246
|
+
var nonce = data.subdataInRange(JSRange(0, nonceLength));
|
|
247
|
+
if (_ivLength === undefined){
|
|
248
|
+
_ivLength = nonceLength;
|
|
249
|
+
}
|
|
250
|
+
var iv = JSData.initWithLength(_ivLength);
|
|
274
251
|
nonce.copyTo(iv, 0);
|
|
275
252
|
var cipher = crypto.createDecipheriv(name, key.keyData, iv);
|
|
276
|
-
var
|
|
253
|
+
var tagLength = 16;
|
|
254
|
+
var tag = data.subdataInRange(JSRange(data.length - tagLength, tagLength));
|
|
277
255
|
cipher.setAuthTag(tag);
|
|
278
|
-
var chunks = [cipher.update(data.subdataInRange(JSRange(
|
|
256
|
+
var chunks = [cipher.update(data.subdataInRange(JSRange(nonceLength, data.length - nonceLength - tagLength))), cipher.final()];
|
|
279
257
|
JSRunLoop.main.schedule(completion, target, JSData.initWithChunks(chunks));
|
|
280
258
|
}catch(e){
|
|
281
259
|
JSRunLoop.main.schedule(completion, target, null);
|
|
@@ -190,7 +190,6 @@ JSClass("SECCipherAESCipherBlockChaining", SECCipher, {
|
|
|
190
190
|
JSClass("SECCipherAESCounter", SECCipher, {
|
|
191
191
|
|
|
192
192
|
encryptedMessageId: 0,
|
|
193
|
-
decryptedMessageId: 0,
|
|
194
193
|
|
|
195
194
|
ensureUniqueMessageID: function(){
|
|
196
195
|
if (this.encryptedMessageId == 9007199254740991){
|
|
@@ -205,7 +204,6 @@ JSClass("SECCipherAESCounter", SECCipher, {
|
|
|
205
204
|
JSClass("SECCipherAESGaloisCounterMode", SECCipher, {
|
|
206
205
|
|
|
207
206
|
encryptedMessageId: 0,
|
|
208
|
-
decryptedMessageId: 0,
|
|
209
207
|
|
|
210
208
|
ensureUniqueMessageID: function(){
|
|
211
209
|
if (this.encryptedMessageId == 9007199254740991){
|
|
@@ -213,7 +211,39 @@ JSClass("SECCipherAESGaloisCounterMode", SECCipher, {
|
|
|
213
211
|
}
|
|
214
212
|
++this.encryptedMessageId;
|
|
215
213
|
return true;
|
|
216
|
-
}
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
encrypt: function(data, key, completion, target){
|
|
217
|
+
if (!completion){
|
|
218
|
+
completion = Promise.completion(Promise.resolveNonNull);
|
|
219
|
+
}
|
|
220
|
+
if (!this.ensureUniqueMessageID()){
|
|
221
|
+
JSRunLoop.main.schedule(completion, target, null);
|
|
222
|
+
return completion.promise;
|
|
223
|
+
}
|
|
224
|
+
var nonce = JSData.initWithArray([
|
|
225
|
+
1,
|
|
226
|
+
((this.encryptedMessageId / 0x100000000) >> 16) & 0xFF,
|
|
227
|
+
((this.encryptedMessageId / 0x100000000) >> 8) & 0xFF,
|
|
228
|
+
(this.encryptedMessageId / 0x100000000) & 0xFF,
|
|
229
|
+
(this.encryptedMessageId >> 24) & 0xFF,
|
|
230
|
+
(this.encryptedMessageId >> 16) & 0xFF,
|
|
231
|
+
(this.encryptedMessageId >> 8) & 0xFF,
|
|
232
|
+
this.encryptedMessageId & 0xF
|
|
233
|
+
]);
|
|
234
|
+
this.encryptWithNonce(nonce, data, key, completion, target, 16);
|
|
235
|
+
return completion.promise;
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
decrypt: function(data, key, completion, target){
|
|
239
|
+
return this.decryptWithNonceLength(8, data, key, completion, target, 16);
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
encryptWithNonce: function(nonce, data, key, completion, target){
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
decryptWithNonceLength: function(nonceLength, data, key, completion, target){
|
|
246
|
+
},
|
|
217
247
|
|
|
218
248
|
});
|
|
219
249
|
|
|
@@ -64,4 +64,21 @@ SECHMAC.Algorithm = {
|
|
|
64
64
|
sha256: "sha256",
|
|
65
65
|
sha384: "sha384",
|
|
66
66
|
sha512: "sha512"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
SECHMAC.digest = function(algorithm, keyData, data, completion, target){
|
|
70
|
+
if (!completion){
|
|
71
|
+
completion = Promise.completion(Promise.resolveNonNull);
|
|
72
|
+
}
|
|
73
|
+
var hmac = SECHMAC.initWithAlgorithm(algorithm);
|
|
74
|
+
hmac.createKeyWithData(keyData, function(key){
|
|
75
|
+
if (key === null){
|
|
76
|
+
completion.call(target, null);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
hmac.key = key;
|
|
80
|
+
hmac.update(data);
|
|
81
|
+
hmac.sign(completion, target);
|
|
82
|
+
});
|
|
83
|
+
return completion.promise;
|
|
67
84
|
};
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
6
|
-
"JSBundleVersion": "2023.
|
|
6
|
+
"JSBundleVersion": "2023.22.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
11
11
|
"node": "SecurityKit+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "c5e74a677a557876be14d6e2bf15b95202dcea6e"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
package/Info.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "node",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.22.0",
|
|
5
5
|
"JSExecutableName": "jskit",
|
|
6
6
|
"NPMOrganization": "breakside",
|
|
7
7
|
"JSResources": [
|
|
8
8
|
"Tests/HTMLTestRunner.js",
|
|
9
9
|
"Tests/NodeTestRunner.js"
|
|
10
10
|
],
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "c5e74a677a557876be14d6e2bf15b95202dcea6e"
|
|
12
12
|
}
|