mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-27 23:55:49 +00:00
Add guard check for signing algorithm (#2278)
Previously unsupported algorithm would not throw exceptions. Co-authored-by: Caleb Kniffen <ckniffen@ripple.com>
This commit is contained in:
@@ -57,6 +57,15 @@ describe('Wallet', function () {
|
||||
assert.isTrue(wallet.classicAddress.startsWith(classicAddressPrefix))
|
||||
})
|
||||
|
||||
it('generates a new wallet using an invalid/unknown algorithm', function () {
|
||||
const algorithm = 'test'
|
||||
|
||||
assert.throws(() => {
|
||||
// @ts-expect-error -- We know it is an invalid algorithm
|
||||
Wallet.generate(algorithm)
|
||||
}, /Invalid cryptographic signing algorithm/u)
|
||||
})
|
||||
|
||||
it('generates a new wallet using algorithm ecdsa-secp256k1', function () {
|
||||
const algorithm = ECDSA.secp256k1
|
||||
const wallet = Wallet.generate(algorithm)
|
||||
|
||||
Reference in New Issue
Block a user