@breakside/jskit 2024.33.0 → 2024.40.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.
Files changed (92) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  3. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  4. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  5. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  6. package/Frameworks/Foundation.jsframework/JS/JSClass.js +4 -1
  7. package/Frameworks/Foundation.jsframework/JS/JSFile.js +23 -2
  8. package/Frameworks/Foundation.jsframework/JS/JSHTMLFile.js +4 -0
  9. package/Frameworks/Foundation.jsframework/JS/JSNodeURLSessionStreamTask.js +1 -1
  10. package/Frameworks/Foundation.jsframework/JS/JSSynchronizer.js +11 -7
  11. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  12. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  13. package/Frameworks/SecurityKit.jsframework/JS/SECCOSE.js +135 -0
  14. package/Frameworks/SecurityKit.jsframework/JS/SECCipher+HTML.js +231 -70
  15. package/Frameworks/SecurityKit.jsframework/JS/SECCipher+Node.js +155 -60
  16. package/Frameworks/SecurityKit.jsframework/JS/SECCipher.js +125 -54
  17. package/Frameworks/SecurityKit.jsframework/JS/SECDataKey.js +5 -4
  18. package/Frameworks/SecurityKit.jsframework/JS/SECHMAC+HTML.js +15 -11
  19. package/Frameworks/SecurityKit.jsframework/JS/SECHMAC+Node.js +17 -3
  20. package/Frameworks/SecurityKit.jsframework/JS/SECHTMLDeviceAuthentication.js +139 -106
  21. package/Frameworks/SecurityKit.jsframework/JS/SECHTMLKey.js +17 -0
  22. package/Frameworks/SecurityKit.jsframework/JS/SECHash.js +1 -0
  23. package/Frameworks/SecurityKit.jsframework/JS/SECJSONWebAlgorithms.js +9 -1
  24. package/Frameworks/SecurityKit.jsframework/JS/SECJSONWebEncryption.js +391 -0
  25. package/Frameworks/SecurityKit.jsframework/JS/SECJSONWebToken.js +1 -1
  26. package/Frameworks/SecurityKit.jsframework/JS/SECKey.js +14 -1
  27. package/Frameworks/SecurityKit.jsframework/JS/SECNodeKey.js +66 -1
  28. package/Frameworks/SecurityKit.jsframework/JS/SECSign+HTML.js +2 -27
  29. package/Frameworks/SecurityKit.jsframework/JS/SECSign+Node.js +103 -278
  30. package/Frameworks/SecurityKit.jsframework/JS/SECSign.js +27 -0
  31. package/Frameworks/SecurityKit.jsframework/JS/SECVerify+Node.js +60 -57
  32. package/Frameworks/SecurityKit.jsframework/JS/SecurityKit.js +1 -0
  33. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  34. package/Frameworks/SecurityKit.jsframework/sources.json +6 -0
  35. package/Info.json +2 -2
  36. package/Node/KeyCommand.js +8 -1
  37. package/Node/io.breakside.jskit-bundle.js +2 -2
  38. package/Node/jskit +1 -0
  39. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  40. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  41. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  42. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  43. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  44. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  45. package/Root/Frameworks/DBKit/DBEncryptedObject.js +2 -2
  46. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  47. package/Root/Frameworks/DOM/Info.yaml +1 -1
  48. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  49. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  50. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  51. package/Root/Frameworks/Foundation/JSClass.js +4 -1
  52. package/Root/Frameworks/Foundation/JSFile.js +23 -2
  53. package/Root/Frameworks/Foundation/JSHTMLFile.js +4 -0
  54. package/Root/Frameworks/Foundation/JSNodeURLSessionStreamTask.js +1 -1
  55. package/Root/Frameworks/Foundation/JSSynchronizer.js +11 -7
  56. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  57. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  58. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  59. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  60. package/Root/Frameworks/NotificationKit/NKWebPushService.js +2 -2
  61. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  62. package/Root/Frameworks/PDFKit/PDFEncryption.js +1 -1
  63. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  64. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  65. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  66. package/Root/Frameworks/SecurityKit/SECCOSE.js +135 -0
  67. package/Root/Frameworks/SecurityKit/SECCipher+HTML.js +231 -70
  68. package/Root/Frameworks/SecurityKit/SECCipher+Node.js +155 -60
  69. package/Root/Frameworks/SecurityKit/SECCipher.js +125 -54
  70. package/Root/Frameworks/SecurityKit/SECDataKey.js +5 -4
  71. package/Root/Frameworks/SecurityKit/SECHMAC+HTML.js +15 -11
  72. package/Root/Frameworks/SecurityKit/SECHMAC+Node.js +17 -3
  73. package/Root/Frameworks/SecurityKit/SECHTMLDeviceAuthentication.js +139 -106
  74. package/Root/Frameworks/SecurityKit/SECHTMLKey.js +17 -0
  75. package/Root/Frameworks/SecurityKit/SECHash.js +1 -0
  76. package/Root/Frameworks/SecurityKit/SECJSONWebAlgorithms.js +9 -1
  77. package/Root/Frameworks/SecurityKit/SECJSONWebEncryption.js +391 -0
  78. package/Root/Frameworks/SecurityKit/SECJSONWebToken.js +1 -1
  79. package/Root/Frameworks/SecurityKit/SECKey.js +14 -1
  80. package/Root/Frameworks/SecurityKit/SECNodeKey.js +66 -1
  81. package/Root/Frameworks/SecurityKit/SECSign+HTML.js +2 -27
  82. package/Root/Frameworks/SecurityKit/SECSign+Node.js +103 -278
  83. package/Root/Frameworks/SecurityKit/SECSign.js +27 -0
  84. package/Root/Frameworks/SecurityKit/SECVerify+Node.js +60 -57
  85. package/Root/Frameworks/SecurityKit/SecurityKit.js +1 -0
  86. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  87. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  88. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  89. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  90. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  91. package/package.json +1 -1
  92. package/Root/Templates/workspace/.gitignore +0 -4
package/Info.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "JSBundleType": "node",
3
3
  "JSBundleIdentifier": "io.breakside.jskit",
4
- "JSBundleVersion": "2024.33.0",
4
+ "JSBundleVersion": "2024.40.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": "2677079d37e78e1708c6e0985e71548b6001c1b6"
11
+ "GitRevision": "f17cafe60642c3c9674095789dec1d1803b72586"
12
12
  }
@@ -30,7 +30,14 @@ JSClass("KeyCommand", Command, {
30
30
 
31
31
  run: async function(){
32
32
  var workspaceURL = this.workingDirectoryURL;
33
- var data = SECCipher.getRandomData(this.arguments.bits >> 3);
33
+ var hmacAlgorithm = {
34
+ 256: SECHMAC.Algorithm.sha256,
35
+ 384: SECHMAC.Algorithm.sha384,
36
+ 512: SECHMAC.Algorithm.sha512
37
+ }[this.arguments.bits];
38
+ var hmac = SECHMAC.initWithAlgorithm(hmacAlgorithm);
39
+ var key = await hmac.createKey();
40
+ var data = key.getData();
34
41
  var printer = Printer.initWithLabel('key');
35
42
  if (this.arguments.format === "jwk"){
36
43
  var jwk = {
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.jskit'] = {
3
3
  "Info": {
4
4
  "JSBundleType": "node",
5
5
  "JSBundleIdentifier": "io.breakside.jskit",
6
- "JSBundleVersion": "2024.33.0",
6
+ "JSBundleVersion": "2024.40.0",
7
7
  "JSExecutableName": "jskit",
8
8
  "NPMOrganization": "breakside",
9
9
  "JSResources": [
10
10
  "Tests/HTMLTestRunner.js",
11
11
  "Tests/NodeTestRunner.js"
12
12
  ],
13
- "GitRevision": "2677079d37e78e1708c6e0985e71548b6001c1b6"
13
+ "GitRevision": "f17cafe60642c3c9674095789dec1d1803b72586"
14
14
  },
15
15
  "Resources": [
16
16
  {
package/Node/jskit CHANGED
@@ -156,6 +156,7 @@ require("./../Frameworks/SecurityKit.jsframework/JS/SECKeychain.js");
156
156
  require("./../Frameworks/SecurityKit.jsframework/JS/SECHMAC.js");
157
157
  require("./../Frameworks/SecurityKit.jsframework/JS/SECSign.js");
158
158
  require("./../Frameworks/SecurityKit.jsframework/JS/SECJSONWebToken.js");
159
+ require("./../Frameworks/SecurityKit.jsframework/JS/SECJSONWebEncryption.js");
159
160
  require("./../Frameworks/SecurityKit.jsframework/JS/SECPassword.js");
160
161
  require("./../Frameworks/SecurityKit.jsframework/JS/SECASN1.js");
161
162
  require("./../Frameworks/SecurityKit.jsframework/JS/SECASN1Parser.js");
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.APIKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSIncludeDirectories:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.APIKitTesting
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.AuthKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.CSSOM
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ChartKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2021 Breakside Inc.
6
6
  # JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ConferenceKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -65,7 +65,7 @@ JSClass("DBEncryptedObject", JSObject, {
65
65
  if (!completion){
66
66
  completion = Promise.completion(Promise.resolveTrue);
67
67
  }
68
- var cipher = SECCipher.initWithAlgorithm(algorithm, keyBitLength);
68
+ var cipher = SECCipher.initWithAlgorithm(algorithm, {keyBitLength: keyBitLength});
69
69
  var key = cipher.createKeyFromKeystore(this.keystore, keyIdentifier, function(key){
70
70
  if (key === null){
71
71
  completion.call(target, false);
@@ -101,7 +101,7 @@ JSClass("DBEncryptedObject", JSObject, {
101
101
  completion = Promise.completion(Promise.resolveNonNull);
102
102
  }
103
103
  if (this.object === null && this.encrypted !== null && this.keystore !== null){
104
- var cipher = SECCipher.initWithAlgorithm(this.algorithm, this.keyBitLength);
104
+ var cipher = SECCipher.initWithAlgorithm(this.algorithm, {keyBitLength: this.keyBitLength});
105
105
  cipher.createKeyFromKeystore(this.keystore, this.keyIdentifier, function(key){
106
106
  if (key === null){
107
107
  completion.call(target, null);
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.DBKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.DOM
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.Dispatch
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSCopyright: Copyright © 2020 Breakside Inc.
5
5
  JSBundleEnvironments:
6
6
  html: Dispatch+HTML.js
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.FontKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.Foundation
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -177,7 +177,10 @@ JSClass.prototype = {
177
177
  }
178
178
  if (result instanceof Promise){
179
179
  return result.then(function(promiseResult){
180
- return promiseResult || obj;
180
+ if (promiseResult === undefined){
181
+ return obj;
182
+ }
183
+ return promiseResult;
181
184
  });
182
185
  }
183
186
  return result;
@@ -21,8 +21,8 @@
21
21
  JSClass("JSFile", JSObject, {
22
22
 
23
23
  url: JSReadOnlyProperty(null, null, 'getURL'),
24
- name: JSReadOnlyProperty('_name', null),
25
- contentType: JSReadOnlyProperty('_contentType', null),
24
+ name: JSDynamicProperty('_name', null),
25
+ contentType: JSDynamicProperty('_contentType', null),
26
26
  size: JSReadOnlyProperty('_size', 0),
27
27
 
28
28
  initWithData: function(data, name, contentType){
@@ -55,6 +55,27 @@ JSClass("JSFile", JSObject, {
55
55
 
56
56
  });
57
57
 
58
+ JSFile.contentTypesByFileExtension = {};
59
+
60
+ JSFile.registerContentTypeForFileExtension = function(contentType, fileExtension){
61
+ fileExtension = fileExtension.toLowerCase();
62
+ JSFile.contentTypesByFileExtension[fileExtension] = contentType;
63
+ };
64
+
65
+ JSFile.unregisterContentTypeForFileExtension = function(contentType, fileExtension){
66
+ fileExtension = fileExtension.toLowerCase();
67
+ var registeredContentType = JSFile.contentTypesByFileExtension[fileExtension];
68
+ if (registeredContentType !== undefined){
69
+ if (registeredContentType.mime === contentType.mime){
70
+ delete JSFile.contentTypesByFileExtension[fileExtension];
71
+ }
72
+ }
73
+ };
74
+
75
+ JSFile.contentTypeForFileExtension = function(fileExtension){
76
+ return JSFile.contentTypesByFileExtension[fileExtension] || null;
77
+ };
78
+
58
79
  JSClass("JSDataFile", JSFile, {
59
80
 
60
81
  _data: null,
@@ -31,6 +31,10 @@ JSClass("JSHTMLFile", JSFile, {
31
31
  initWithFile: function(file){
32
32
  this.initWithBlob(file);
33
33
  this._name = file.name;
34
+ var contentType = JSFile.contentTypeForFileExtension(this._name.fileExtension);
35
+ if (contentType !== null){
36
+ this._contentType = JSMediaType(contentType);
37
+ }
34
38
  },
35
39
 
36
40
  initWithBlob: function(blob){
@@ -92,7 +92,7 @@ JSClass("JSNodeURLSessionStreamTask", JSURLSessionStreamTask, {
92
92
  },
93
93
 
94
94
  write: function(data){
95
- this.socket.write(data.nodeBuffer);
95
+ this.socket.write(data.nodeBuffer());
96
96
  },
97
97
 
98
98
  // ----------------------------------------------------------------------
@@ -45,18 +45,22 @@ JSClass("JSSynchronizer", JSObject, {
45
45
  return this._scheduleSync(0, completion, target);
46
46
  },
47
47
 
48
- _isPaused: false,
48
+ _pauseCount: 0,
49
49
  _syncOnResume: false,
50
50
 
51
51
  pause: function(){
52
- this._isPaused = true;
52
+ ++this._pauseCount;
53
53
  },
54
54
 
55
55
  resume: function(){
56
- this._isPaused = false;
57
- if (this._syncOnResume){
58
- this._syncOnResume = true;
59
- this._scheduleSync(0, function(){});
56
+ if (this._pauseCount > 0){
57
+ --this._pauseCount;
58
+ if (this._pauseCount === 0){
59
+ if (this._syncOnResume){
60
+ this._syncOnResume = false;
61
+ this._scheduleSync(0, function(){});
62
+ }
63
+ }
60
64
  }
61
65
  },
62
66
 
@@ -91,7 +95,7 @@ JSClass("JSSynchronizer", JSObject, {
91
95
  },
92
96
 
93
97
  _sync: function(){
94
- if (this._isPaused){
98
+ if (this._pauseCount > 0){
95
99
  this._syncOnResume = true;
96
100
  return;
97
101
  }
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ImageKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.MediaKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.MediaKitUI
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.NotificationKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2021 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -162,12 +162,12 @@ JSClass("NKWebPushService", JSObject, {
162
162
  }).then(function(keyAndNonce){
163
163
  var keyData = keyAndNonce[0].subdataInRange(JSRange(0, 16));
164
164
  var nonceData = keyAndNonce[1].subdataInRange(JSRange(0, 12));
165
- var cipher = SECCipher.initWithAlgorithm(SECCipher.Algorithm.aesGCM, 128);
165
+ var cipher = SECCipher.initWithAlgorithm(SECCipher.Algorithm.aesGCM, {keyBitLength: 128, iv: nonceData});
166
166
  return cipher.createKeyWithData(keyData).then(function(key){
167
167
  if (key === null){
168
168
  return;
169
169
  }
170
- return cipher.encryptWithNonce(nonceData, JSData.initWithChunks([plaintext, JSData.initWithArray([0x02])]), key);
170
+ return cipher.encrypt(JSData.initWithChunks([plaintext, JSData.initWithArray([0x02])]), key);
171
171
  });
172
172
  }).then(function(encrypted){
173
173
  var ciphertext = encrypted.subdataInRange(JSRange(12, encrypted.length - 12));
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.PDFKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -226,7 +226,7 @@ JSClass("PDFEncryption", JSObject, {
226
226
  }
227
227
 
228
228
  var keyData = this._generateObjectKeyData(stream.indirect.objectID, stream.indirect.generation, cipherAlgorithm);
229
- var cipher = SECCipher.initWithAlgorithm(cipherAlgorithm);
229
+ var cipher = SECCipher.initWithAlgorithm(cipherAlgorithm, {keyBitLength: 128});
230
230
  cipher.createKeyWithData(keyData, function(key){
231
231
  if (key === null){
232
232
  completion.call(target, null);
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.QRKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.SearchKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.SecurityKit
3
- JSBundleVersion: 2024.33.0
3
+ JSBundleVersion: 2024.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -0,0 +1,135 @@
1
+ // #import Foundation
2
+ // #import "SECCBOR.js"
3
+ // #import "SECJSONWebAlgorithms.js"
4
+ "use strict";
5
+
6
+ (function(){
7
+
8
+ JSClass("SECCOSE", JSObject, {
9
+
10
+ dictionary: null,
11
+
12
+ initWithData: function(data){
13
+ var parser = SECCBORParser.initWithData(data);
14
+ this.dictionary = parser.readNext();
15
+ },
16
+
17
+ attribute: function(attr){
18
+ return this.dictionary[attr] || null;
19
+ },
20
+
21
+ derRepresentation: function(){
22
+ return JSData.init();
23
+ },
24
+
25
+ jwkRepresentation: function(){
26
+ var jwk = {};
27
+ switch (this.attribute(SECCOSE.Attribute.kty)){
28
+ case SECCOSE.KeyType.ellipticCurve:
29
+ jwk.kty = SECJSONWebAlgorithms.KeyType.ellipticCurve;
30
+ switch (this.attribute(SECCOSE.Attribute.alg)){
31
+ case SECCOSE.Algorithm.ellipticCurveSHA256:
32
+ jwk.alg = SECJSONWebAlgorithms.Algorithm.ellipticCurveSHA256;
33
+ break;
34
+ case SECCOSE.Algorithm.ellipticCurveSHA384:
35
+ jwk.alg = SECJSONWebAlgorithms.Algorithm.ellipticCurveSHA384;
36
+ break;
37
+ case SECCOSE.Algorithm.ellipticCurveSHA512:
38
+ jwk.alg = SECJSONWebAlgorithms.Algorithm.ellipticCurveSHA512;
39
+ break;
40
+ default:
41
+ return null;
42
+ }
43
+ switch (this.attribute(SECCOSE.Attribute.ellipticCurve_crv)){
44
+ case SECCOSE.EllipticCurve.p256:
45
+ jwk.crv = SECJSONWebAlgorithms.EllipticCurve.p256;
46
+ break;
47
+ case SECCOSE.EllipticCurve.p384:
48
+ jwk.crv = SECJSONWebAlgorithms.EllipticCurve.p384;
49
+ break;
50
+ case SECCOSE.EllipticCurve.p521:
51
+ jwk.crv = SECJSONWebAlgorithms.EllipticCurve.p521;
52
+ break;
53
+ default:
54
+ return null;
55
+ }
56
+ jwk.x = this.attribute(SECCOSE.Attribute.ellipticCurve_x).base64URLStringRepresentation();
57
+ jwk.y = this.attribute(SECCOSE.Attribute.ellipticCurve_y).base64URLStringRepresentation();
58
+ break;
59
+ case SECCOSE.KeyType.rsa:
60
+ jwk.kty = SECJSONWebAlgorithms.KeyType.rsa;
61
+ switch (this.attribute(SECCOSE.Attribute.alg)){
62
+ case SECCOSE.Algorithm.rsaSHA256:
63
+ jwk.alg = SECJSONWebAlgorithms.Algorithm.rsaSHA256;
64
+ break;
65
+ case SECCOSE.Algorithm.rsaSHA384:
66
+ jwk.alg = SECJSONWebAlgorithms.Algorithm.rsaSHA384;
67
+ break;
68
+ case SECCOSE.Algorithm.rsaSHA512:
69
+ jwk.alg = SECJSONWebAlgorithms.Algorithm.rsaSHA512;
70
+ break;
71
+ default:
72
+ return null;
73
+ }
74
+ jwk.n = this.attribute(SECCOSE.Attribute.rsa_n).base64URLStringRepresentation();
75
+ jwk.e = this.attribute(SECCOSE.Attribute.rsa_e).base64URLStringRepresentation();
76
+ break;
77
+ default:
78
+ return null;
79
+ }
80
+ return jwk;
81
+ }
82
+
83
+ });
84
+
85
+ SECCOSE.KeyType = {
86
+ ellipticCurve: 2,
87
+ rsa: 3,
88
+ symmetric: 4,
89
+ };
90
+
91
+ SECCOSE.Algorithm = {
92
+ rsaSHA256: -257,
93
+ rsaSHA384: -258,
94
+ rsaSHA512: -259,
95
+ ellipticCurveSHA256: -7,
96
+ ellipticCurveSHA384: -35,
97
+ ellipticCurveSHA512: -36,
98
+ };
99
+
100
+ SECCOSE.EllipticCurve = {
101
+ p256: 1,
102
+ p384: 2,
103
+ p521: 3
104
+ };
105
+
106
+ SECCOSE.Attribute = {
107
+ kty: 1,
108
+ kid: 2,
109
+ alg: 3,
110
+ key_ops: 4,
111
+
112
+ ellipticCurve_crv: -1,
113
+ ellipticCurve_x: -2,
114
+ ellipticCurve_y: -3,
115
+ ellipticCurve_d: -4,
116
+
117
+ rsa_n: -1,
118
+ rsa_e: -2,
119
+ rsa_d: -3,
120
+ rsa_p: -4,
121
+ rsa_q: -5,
122
+ rsa_dP: -6,
123
+ rsa_dQ: -7,
124
+ rsa_qInv: -8,
125
+ rsa_other: -9,
126
+ rsa_r_i: -10,
127
+ rsa_d_i: -11,
128
+ rsa_t_i: -12,
129
+
130
+ symmetric_k: -1
131
+
132
+ };
133
+
134
+
135
+ })();