GeezerVison is showing github.com — test,crypto: update WebCryptoAPI WPT · nodejs/node@843df1a
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/README.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -31,7 +31,7 @@ Last update: | 31 | 31 | - user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing | 32 | 32 | - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi | 33 | 33 | - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi | 34 | | -- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/17b7ca10fd/WebCryptoAPI | | 34 | +- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/f4e7e32fd0/WebCryptoAPI | 35 | 35 | - webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/a370aad338/webidl/ecmascript-binding/es-exceptions | 36 | 36 | - webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/e97fac4791/webmessaging/broadcastchannel | 37 | 37 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/import_export/ec_importKey.https.any.js +2-43Lines changed: 2 additions & 43 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 71 | 71 | [true, false].forEach(function(extractable) { | 72 | 72 |
| 73 | 73 | // Test public keys first | 74 | | - [[]].forEach(function(usages) { // Only valid usages argument is empty array | | 74 | + allValidUsages(vector.publicUsages, true).forEach(function(usages) { | 75 | 75 | ['spki', 'spki_compressed', 'jwk', 'raw', 'raw_compressed'].forEach(function(format) { | 76 | 76 | var algorithm = {name: vector.name, namedCurve: curve}; | 77 | 77 | var data = keyData[curve]; | | 88 | 88 | ['pkcs8', 'jwk'].forEach(function(format) { | 89 | 89 | var algorithm = {name: vector.name, namedCurve: curve}; | 90 | 90 | var data = keyData[curve]; | 91 | | - allValidUsages(vector.privateUsages, []).forEach(function(usages) { | | 91 | + allValidUsages(vector.privateUsages).forEach(function(usages) { | 92 | 92 | testFormat(format, algorithm, data, curve, usages, extractable); | 93 | 93 | }); | 94 | 94 | testEmptyUsages(format, algorithm, data, curve, extractable); | | 219 | 219 | return base64String.replace(/=/g, ""); | 220 | 220 | } | 221 | 221 |
| 222 | | - // Want to test every valid combination of usages. Start by creating a list | 223 | | - // of all non-empty subsets to possible usages. | 224 | | - function allNonemptySubsetsOf(arr) { | 225 | | - var results = []; | 226 | | - var firstElement; | 227 | | - var remainingElements; | 228 | | - | 229 | | - for(var i=0; i<arr.length; i++) { | 230 | | - firstElement = arr[i]; | 231 | | - remainingElements = arr.slice(i+1); | 232 | | - results.push([firstElement]); | 233 | | - | 234 | | - if (remainingElements.length > 0) { | 235 | | - allNonemptySubsetsOf(remainingElements).forEach(function(combination) { | 236 | | - combination.push(firstElement); | 237 | | - results.push(combination); | 238 | | - }); | 239 | | - } | 240 | | - } | 241 | | - | 242 | | - return results; | 243 | | - } | 244 | | - | 245 | | - // Return a list of all valid usage combinations, given the possible ones | 246 | | - // and the ones that are required for a particular operation. | 247 | | - function allValidUsages(possibleUsages, requiredUsages) { | 248 | | - var allUsages = []; | 249 | | - | 250 | | - allNonemptySubsetsOf(possibleUsages).forEach(function(usage) { | 251 | | - for (var i=0; i<requiredUsages.length; i++) { | 252 | | - if (!usage.includes(requiredUsages[i])) { | 253 | | - return; | 254 | | - } | 255 | | - } | 256 | | - allUsages.push(usage); | 257 | | - }); | 258 | | - | 259 | | - return allUsages; | 260 | | - } | 261 | | - | 262 | 222 | // Convert method parameters to a string to uniquely name each test | 263 | 223 | function parameterString(format, compressed, data, algorithm, extractable, usages) { | 264 | 224 | if ("byteLength" in data) { | | 311 | 271 |
| 312 | 272 | return "{" + keyValuePairs.join(", ") + "}"; | 313 | 273 | } | 314 | | - |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/import_export/okp_importKey.https.any.js +2-42Lines changed: 2 additions & 42 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 72 | 72 | [true, false].forEach(function(extractable) { | 73 | 73 |
| 74 | 74 | // Test public keys first | 75 | | - [[]].forEach(function(usages) { // Only valid usages argument is empty array | | 75 | + allValidUsages(vector.publicUsages, true).forEach(function(usages) { | 76 | 76 | ['spki', 'jwk', 'raw'].forEach(function(format) { | 77 | 77 | var algorithm = {name: vector.name}; | 78 | 78 | var data = keyData[vector.name]; | | 86 | 86 | }); | 87 | 87 |
| 88 | 88 | // Next, test private keys | 89 | | - allValidUsages(vector.privateUsages, []).forEach(function(usages) { | | 89 | + allValidUsages(vector.privateUsages).forEach(function(usages) { | 90 | 90 | ['pkcs8', 'jwk'].forEach(function(format) { | 91 | 91 | var algorithm = {name: vector.name}; | 92 | 92 | var data = keyData[vector.name]; | | 194 | 194 | return base64String.replace(/=/g, ""); | 195 | 195 | } | 196 | 196 |
| 197 | | - // Want to test every valid combination of usages. Start by creating a list | 198 | | - // of all non-empty subsets to possible usages. | 199 | | - function allNonemptySubsetsOf(arr) { | 200 | | - var results = []; | 201 | | - var firstElement; | 202 | | - var remainingElements; | 203 | | - | 204 | | - for(var i=0; i<arr.length; i++) { | 205 | | - firstElement = arr[i]; | 206 | | - remainingElements = arr.slice(i+1); | 207 | | - results.push([firstElement]); | 208 | | - | 209 | | - if (remainingElements.length > 0) { | 210 | | - allNonemptySubsetsOf(remainingElements).forEach(function(combination) { | 211 | | - combination.push(firstElement); | 212 | | - results.push(combination); | 213 | | - }); | 214 | | - } | 215 | | - } | 216 | | - | 217 | | - return results; | 218 | | - } | 219 | | - | 220 | | - // Return a list of all valid usage combinations, given the possible ones | 221 | | - // and the ones that are required for a particular operation. | 222 | | - function allValidUsages(possibleUsages, requiredUsages) { | 223 | | - var allUsages = []; | 224 | | - | 225 | | - allNonemptySubsetsOf(possibleUsages).forEach(function(usage) { | 226 | | - for (var i=0; i<requiredUsages.length; i++) { | 227 | | - if (!usage.includes(requiredUsages[i])) { | 228 | | - return; | 229 | | - } | 230 | | - } | 231 | | - allUsages.push(usage); | 232 | | - }); | 233 | | - | 234 | | - return allUsages; | 235 | | - } | 236 | | - | 237 | 197 | // Convert method parameters to a string to uniquely name each test | 238 | 198 | function parameterString(format, data, algorithm, extractable, usages) { | 239 | 199 | if ("byteLength" in data) { | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/import_export/rsa_importKey.https.any.js +2-42Lines changed: 2 additions & 42 deletions Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/import_export/symmetric_importKey.https.any.js +1-41Lines changed: 1 addition & 41 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 49 | 49 | data = jwkData(keyData, algorithm); | 50 | 50 | } | 51 | 51 | // Generate all combinations of valid usages for testing | 52 | | - allValidUsages(vector.legalUsages, []).forEach(function(usages) { | | 52 | + allValidUsages(vector.legalUsages).forEach(function(usages) { | 53 | 53 | testFormat(format, algorithm, data, keyData.length * 8, usages, extractable); | 54 | 54 | }); | 55 | 55 | testEmptyUsages(format, algorithm, data, keyData.length * 8, extractable); | | 173 | 173 | return base64String.replace(/=/g, ""); | 174 | 174 | } | 175 | 175 |
| 176 | | - // Want to test every valid combination of usages. Start by creating a list | 177 | | - // of all non-empty subsets to possible usages. | 178 | | - function allNonemptySubsetsOf(arr) { | 179 | | - var results = []; | 180 | | - var firstElement; | 181 | | - var remainingElements; | 182 | | - | 183 | | - for(var i=0; i<arr.length; i++) { | 184 | | - firstElement = arr[i]; | 185 | | - remainingElements = arr.slice(i+1); | 186 | | - results.push([firstElement]); | 187 | | - | 188 | | - if (remainingElements.length > 0) { | 189 | | - allNonemptySubsetsOf(remainingElements).forEach(function(combination) { | 190 | | - combination.push(firstElement); | 191 | | - results.push(combination); | 192 | | - }); | 193 | | - } | 194 | | - } | 195 | | - | 196 | | - return results; | 197 | | - } | 198 | | - | 199 | | - // Return a list of all valid usage combinations, given the possible ones | 200 | | - // and the ones that are required for a particular operation. | 201 | | - function allValidUsages(possibleUsages, requiredUsages) { | 202 | | - var allUsages = []; | 203 | | - | 204 | | - allNonemptySubsetsOf(possibleUsages).forEach(function(usage) { | 205 | | - for (var i=0; i<requiredUsages.length; i++) { | 206 | | - if (!usage.includes(requiredUsages[i])) { | 207 | | - return; | 208 | | - } | 209 | | - } | 210 | | - allUsages.push(usage); | 211 | | - }); | 212 | | - | 213 | | - return allUsages; | 214 | | - } | 215 | | - | 216 | 176 | // Convert method parameters to a string to uniquely name each test | 217 | 177 | function parameterString(format, data, algorithm, extractable, usages) { | 218 | 178 | var result = "(" + | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/util/helpers.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -235,7 +235,7 @@ function allValidUsages(validUsages, emptyIsValid, mandatoryUsages) { | 235 | 235 | } | 236 | 236 | }); | 237 | 237 |
| 238 | | - if (emptyIsValid) { | | 238 | + if (emptyIsValid && validUsages.length !== 0) { | 239 | 239 | okaySubsets.push([]); | 240 | 240 | } | 241 | 241 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/versions.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 84 | 84 | "path": "wasm/webapi" | 85 | 85 | }, | 86 | 86 | "WebCryptoAPI": { | 87 | | - "commit": "17b7ca10fd17ab22e60d62da6bc6e7424ea52740", | | 87 | + "commit": "f4e7e32fd0d4937f5b024602c6bf665ebeb1fa17", | 88 | 88 | "path": "WebCryptoAPI" | 89 | 89 | }, | 90 | 90 | "webidl/ecmascript-binding/es-exceptions": { | |
|