Merge branch 'main' into beta3

This commit is contained in:
Omar Khan
2023-05-16 17:58:41 -04:00
committed by GitHub
7 changed files with 22 additions and 7 deletions

View File

@@ -35,7 +35,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
node-version: [14.x]
node-version: [16.x]
steps:
- uses: actions/checkout@v3
@@ -57,7 +57,7 @@ jobs:
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3
@@ -98,7 +98,7 @@ jobs:
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3
@@ -150,7 +150,7 @@ jobs:
strategy:
matrix:
node-version: [14.x] # This just needs to be compatible w/ puppeteer
node-version: [16.x]
steps:
- uses: actions/checkout@v3

View File

@@ -12,7 +12,7 @@
### Requirements
We use Node v14 for development - that is the version that our linters require.
We use Node v16 for development - that is the version that our linters require.
You must also use `npm` v7. You can check your `npm` version with:
```bash

View File

@@ -25,7 +25,7 @@ All of which works in Node.js (tested for v14+) & web browsers (tested for Chrom
### Requirements
+ **[Node.js v14](https://nodejs.org/)** is recommended. We also support v16 and v18. Other versions may work but are not frequently tested.
+ **[Node.js v16](https://nodejs.org/)** is recommended. We also support v14, v18 and v20. Other versions may work but are not frequently tested.
### Installing xrpl.js

View File

@@ -4,6 +4,7 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
## Unreleased
### Added
* Guard check for signing algorithm used in `Wallet.generate()`
* Null and undefined values in transactions are now treated as though the field was not passed in.
* Support for the XChainBridge amendment.

View File

@@ -129,8 +129,13 @@ class Wallet {
*
* @param algorithm - The digital signature algorithm to generate an address for.
* @returns A new Wallet derived from a generated seed.
*
* @throws ValidationError when signing algorithm isn't valid
*/
public static generate(algorithm: ECDSA = DEFAULT_ALGORITHM): Wallet {
if (!Object.values(ECDSA).includes(algorithm)) {
throw new ValidationError('Invalid cryptographic signing algorithm')
}
const seed = generateSeed({ algorithm })
return Wallet.fromSeed(seed)
}

View File

@@ -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)