GeezerVison is showing github.com — test,crypto: update WebCryptoAPI WPT · nodejs/node@d164e53
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/f4e7e32fd0/WebCryptoAPI | | 34 | +- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/d4e14d714c/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/okp_importKey.https.any.js +32Lines changed: 32 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 81 | 81 | } | 82 | 82 |
| 83 | 83 | testFormat(format, algorithm, data, vector.name, usages, extractable); | | 84 | + | | 85 | + // Test for https://github.com/WICG/webcrypto-secure-curves/pull/24 | | 86 | + if (format === "jwk" && extractable) { | | 87 | + testJwkAlgBehaviours(algorithm, data.jwk, vector.name, usages); | | 88 | + } | 84 | 89 | }); | 85 | 90 |
| 86 | 91 | }); | | 92 | 97 | var data = keyData[vector.name]; | 93 | 98 |
| 94 | 99 | testFormat(format, algorithm, data, vector.name, usages, extractable); | | 100 | + | | 101 | + // Test for https://github.com/WICG/webcrypto-secure-curves/pull/24 | | 102 | + if (format === "jwk" && extractable) { | | 103 | + testJwkAlgBehaviours(algorithm, data.jwk, vector.name, usages); | | 104 | + } | 95 | 105 | }); | 96 | 106 | }); | 97 | 107 | }); | | 126 | 136 | }, "Good parameters: " + keySize.toString() + " bits " + parameterString(format, keyData[format], algorithm, extractable, usages)); | 127 | 137 | } | 128 | 138 |
| | 139 | + // Test importKey/exportKey "alg" behaviours, alg is ignored upon import and alg is missing for Ed25519 and Ed448 JWK export | | 140 | + // https://github.com/WICG/webcrypto-secure-curves/pull/24 | | 141 | + function testJwkAlgBehaviours(algorithm, keyData, crv, usages) { | | 142 | + promise_test(function(test) { | | 143 | + return subtle.importKey('jwk', { ...keyData, alg: 'this is ignored' }, algorithm, true, usages). | | 144 | + then(function(key) { | | 145 | + assert_equals(key.constructor, CryptoKey, "Imported a CryptoKey object"); | | 146 | + | | 147 | + return subtle.exportKey('jwk', key). | | 148 | + then(function(result) { | | 149 | + assert_equals(Object.keys(result).length, keyData.d ? 6 : 5, "Correct number of JWK members"); | | 150 | + assert_equals(result.alg, undefined, 'No JWK "alg" member is present'); | | 151 | + assert_true(equalJwk(keyData, result), "Round trip works"); | | 152 | + }, function(err) { | | 153 | + assert_unreached("Threw an unexpected error: " + err.toString()); | | 154 | + }); | | 155 | + }, function(err) { | | 156 | + assert_unreached("Threw an unexpected error: " + err.toString()); | | 157 | + }); | | 158 | + }, "Good parameters with ignored JWK alg: " + crv.toString() + " " + parameterString('jwk', keyData, algorithm, true, usages)); | | 159 | + } | | 160 | + | 129 | 161 |
| 130 | 162 |
| 131 | 163 | // Helper methods follow: | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/sign_verify/eddsa.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -167,6 +167,7 @@ function run_test() { | 167 | 167 | promise_test(function(test) { | 168 | 168 | return subtle.sign(algorithm, vector.privateKey, vector.data) | 169 | 169 | .then(function(signature) { | | 170 | + assert_true(equalBuffers(signature, vector.signature), "Signing did not give the expected output"); | 170 | 171 | // Can we verify the signature? | 171 | 172 | return subtle.verify(algorithm, vector.publicKey, signature, vector.data) | 172 | 173 | .then(function(is_verified) { | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/sign_verify/hmac.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -117,6 +117,7 @@ function run_test() { | 117 | 117 | promise_test(function(test) { | 118 | 118 | return subtle.sign({name: "HMAC", hash: vector.hash}, vector.key, vector.plaintext) | 119 | 119 | .then(function(signature) { | | 120 | + assert_true(equalBuffers(signature, vector.signature), "Signing did not give the expected output"); | 120 | 121 | // Can we get the verify the new signature? | 121 | 122 | return subtle.verify({name: "HMAC", hash: vector.hash}, vector.key, signature, vector.plaintext) | 122 | 123 | .then(function(is_verified) { | |
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": "f4e7e32fd0d4937f5b024602c6bf665ebeb1fa17", | | 87 | + "commit": "d4e14d714c5242e174ba9aec43caf5eb514d0f09", | 88 | 88 | "path": "WebCryptoAPI" | 89 | 89 | }, | 90 | 90 | "webidl/ecmascript-binding/es-exceptions": { | |
|