| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0164d92 commit 607158a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -170,6 +170,10 @@ let firstByte = ecdh1.getPublicKey('buffer', 'compressed')[0]; | |||
| 170 | 170 | assert(firstByte === 2 || firstByte === 3); | |
| 171 | 171 | firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0]; | |
| 172 | 172 | assert(firstByte === 6 || firstByte === 7); | |
| 173 | + // format value should be string | ||
| 174 | + assert.throws(() => { | ||
| 175 | + ecdh1.getPublicKey('buffer', 10); | ||
| 176 | + }, /^TypeError: Bad format: 10$/); | ||
| 173 | 177 | ||
| 174 | 178 | // ECDH should check that point is on curve | |
| 175 | 179 | const ecdh3 = crypto.createECDH('secp256k1'); | |
@@ -262,3 +266,8 @@ ecdh5.setPrivateKey(cafebabeKey, 'hex'); | |||
| 262 | 266 | // Verify object state did not change. | |
| 263 | 267 | assert.equal(ecdh5.getPrivateKey('hex'), cafebabeKey); | |
| 264 | 268 | }); | |
| 269 | + | ||
| 270 | + // invalid test: curve argument is undefined | ||
| 271 | + assert.throws(() => { | ||
| 272 | + crypto.createECDH(); | ||
| 273 | + }, /^TypeError: "curve" argument should be a string$/); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments