aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWycheproof Team <noreply@google.com>2024-01-30 22:31:44 -0800
committerCopybara-Service <copybara-worker@google.com>2024-01-30 22:32:14 -0800
commit3ea6fe11370fd0dd6ba5a68129ce82045b0e81ec (patch)
treed001b17b3d662d0aba20802ca1b6b817275d69ea
parentd9f6ec7d8bd8c96da05368999094e4a75ba5cb3d (diff)
downloadwycheproof-3ea6fe11370fd0dd6ba5a68129ce82045b0e81ec.tar.gz
Correct type annotations to improve type checking.
PiperOrigin-RevId: 602941791
-rw-r--r--javascript/BigInteger.js5
-rw-r--r--javascript/EcUtil.js1
-rw-r--r--javascript/TestUtil.js2
-rw-r--r--javascript/webcryptoapi/testcases/EcdhTest.js6
-rw-r--r--javascript/webcryptoapi/testcases/EcdsaTest.js4
5 files changed, 10 insertions, 8 deletions
diff --git a/javascript/BigInteger.js b/javascript/BigInteger.js
index 906641a..f495fd3 100644
--- a/javascript/BigInteger.js
+++ b/javascript/BigInteger.js
@@ -30,9 +30,10 @@ goog.require('wycheproof.TestUtil');
var TestUtil = wycheproof.TestUtil;
+
/**
* Non-negative arbitrary-precision integers.
- * @param {(!Array<Byte>|!Uint8Array)=} optValue
+ * @param {(!Array<number>|!Uint8Array)=} optValue
* The value of the BigInteger in big endian.
* @constructor
* @extends {e2e.BigNum}
@@ -100,7 +101,7 @@ wycheproof.BigInteger.prototype.toArrayBuffer = function(optValue) {
/**
* Odd prime big integer that could be use as the modulus in modular arithmetic
* operations in crypto schemes such as ECDSA or ECDH.
- * @param {!Array<Byte>|!Uint8Array} modulus The modulus to use.
+ * @param {!Array<number>|!Uint8Array} modulus The modulus to use.
* @constructor
* @extends {e2e.BigPrimeNum}
*/
diff --git a/javascript/EcUtil.js b/javascript/EcUtil.js
index 47efb25..9828bfe 100644
--- a/javascript/EcUtil.js
+++ b/javascript/EcUtil.js
@@ -26,6 +26,7 @@ var BigInteger = wycheproof.BigInteger;
var BigPrimeInteger = wycheproof.BigPrimeInteger;
/**
+ * @constructor
* Parameters of a NIST-recommended curve.
* @param {!number} keySize The bit length of the order n
* @param {!string} hexP The prime modulus p in hex format
diff --git a/javascript/TestUtil.js b/javascript/TestUtil.js
index ec26735..5d65b51 100644
--- a/javascript/TestUtil.js
+++ b/javascript/TestUtil.js
@@ -27,7 +27,7 @@ goog.requireType('goog.testing.TestCase.Result');
* Reads test vectors in JSON format from a file.
* @param {string} filename
*
- * @return {!JSONObject}
+ * @return {?}
*/
wycheproof.TestUtil.readJsonTestVectorsFromFile = function(filename){
var fileContent = goog.loadFileSync_(filename);
diff --git a/javascript/webcryptoapi/testcases/EcdhTest.js b/javascript/webcryptoapi/testcases/EcdhTest.js
index 3fddfc5..6042c02 100644
--- a/javascript/webcryptoapi/testcases/EcdhTest.js
+++ b/javascript/webcryptoapi/testcases/EcdhTest.js
@@ -55,7 +55,7 @@ Ecdh.generateKey = function(curveName) {
/**
* Imports a ECDH key from the given key data.
- * @param {!JSONObject} keyData The key data in JWK format
+ * @param {?} keyData The key data in JWK format
* @param {!Array<string>} usages The usages of the key
*
* @return {!Promise}
@@ -155,8 +155,8 @@ Ecdh.testKeyDerivation = function() {
/**
* Parameters of a ECDH key derivation test.
* @param {!number} id Test case's id
- * @param {!JSONObject} privKeyData The private key's data in JWK format
- * @param {!JSONObject} pubKeyData The public key's data in JWK format
+ * @param {?} privKeyData The private key's data in JWK format
+ * @param {?} pubKeyData The public key's data in JWK format
* @param {!string} sharedKey The expected shared key
* @param {!string} result The expected result of the test case
*/
diff --git a/javascript/webcryptoapi/testcases/EcdsaTest.js b/javascript/webcryptoapi/testcases/EcdsaTest.js
index 04064ab..7588b51 100644
--- a/javascript/webcryptoapi/testcases/EcdsaTest.js
+++ b/javascript/webcryptoapi/testcases/EcdsaTest.js
@@ -72,7 +72,7 @@ Ecdsa.sign = function(sk, msg, hashAlg) {
/**
* Imports a ECDSA public key.
- * @param {!JSONObject} keyData The key data in JWK format
+ * @param {?} keyData The key data in JWK format
* @param {string} hashAlg The hash algorithm
* @param {!Array<string>} usages The usages of the key
*
@@ -148,7 +148,7 @@ Ecdsa.testVerify = function() {
/**
* Parameters of a ECDSA signature verification test.
* @param {!number} id Test case's id
- * @param {!JSONObject} keyData The key data in JWK format
+ * @param {?} keyData The key data in JWK format
* @param {string} hashAlg The hash algorithm
* @param {!ArrayBuffer} msg The message that was signed
* @param {!ArrayBuffer} sig The signature to be verified