balanceofsatoshis 23.1.1 → 23.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Versions
2
2
 
3
- ## 23.1.1
3
+ ## 23.1.3
4
+
5
+ - Dependency cleanup: remove crypto js dependency
6
+
7
+ ## 23.1.2
4
8
 
5
9
  - Add `--avoid-append` to add failing edges to an avoid list based on formula
6
10
  - Add support for LND 0.20.2
@@ -1,6 +1,5 @@
1
1
  const certExpiration = require('./cert_expiration');
2
2
  const decryptCiphertext = require('./decrypt_ciphertext');
3
- const decryptPayload = require('./decrypt_payload');
4
3
  const decryptWithNode = require('./decrypt_with_node');
5
4
  const derAsPem = require('./der_as_pem');
6
5
  const encryptToNode = require('./encrypt_to_node');
@@ -10,7 +9,6 @@ const pemAsDer = require('./pem_as_der');
10
9
  module.exports = {
11
10
  certExpiration,
12
11
  decryptCiphertext,
13
- decryptPayload,
14
12
  decryptWithNode,
15
13
  derAsPem,
16
14
  encryptToNode,
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/alexbosworth/balanceofsatoshis/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@alexbosworth/blockchain": "3.2.0",
13
+ "@alexbosworth/blockchain": "4.0.0",
14
14
  "@alexbosworth/caporal": "2.0.0",
15
15
  "@alexbosworth/fiat": "2.0.0",
16
16
  "@alexbosworth/formulas": "1.4.0",
@@ -28,8 +28,7 @@
28
28
  "bolt07": "1.9.5",
29
29
  "cbor": "10.0.12",
30
30
  "colorette": "2.0.20",
31
- "crypto-js": "4.2.0",
32
- "csv-parse": "7.0.1",
31
+ "csv-parse": "7.0.2",
33
32
  "goldengate": "16.0.4",
34
33
  "grammy": "1.45.1",
35
34
  "import-lazy": "4.0.0",
@@ -38,10 +37,10 @@
38
37
  "ln-accounting": "10.0.4",
39
38
  "ln-service": "59.2.3",
40
39
  "ln-sync": "8.0.3",
41
- "ln-telegram": "8.0.4",
40
+ "ln-telegram": "8.0.5",
42
41
  "minimist": "1.2.8",
43
42
  "moment": "2.30.1",
44
- "paid-services": "8.0.4",
43
+ "paid-services": "8.0.5",
45
44
  "probing": "7.0.0",
46
45
  "qrcode-terminal": "0.12.0",
47
46
  "sanitize-filename": "1.6.4",
@@ -80,5 +79,5 @@
80
79
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
81
80
  "test": "node --experimental-test-coverage --test test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/peers/*.js test/responses/*.js test/routing/*.js test/services/*.js test/swaps/*.js test/tags/*.js test/telegram/*.js test/wallets/*.js"
82
81
  },
83
- "version": "23.1.1"
82
+ "version": "23.1.3"
84
83
  }
@@ -1,54 +0,0 @@
1
- const {AES} = require('crypto-js');
2
- const {enc} = require('crypto-js');
3
- const {lib} = require('crypto-js');
4
- const {mode} = require('crypto-js');
5
- const {pad} = require('crypto-js');
6
-
7
- const {decrypt} = AES;
8
- const {Hex} = enc;
9
- const padding = pad.NoPadding;
10
- const takeCipherWords = words => words.slice(4);
11
- const takeIvWords = words => words.slice(0, 4);
12
- const trim = (hex, index) => hex.slice(0, index === 0 ? undefined : index);
13
- const {WordArray} = lib;
14
- const zeroIndex = h => h.split('').slice().reverse().findIndex(n => n !== '0');
15
-
16
- /** Decrypt encrypted payload
17
-
18
- {
19
- encrypted: <Encrypted Data Hex String>
20
- secret: <Secret Key String>
21
- }
22
-
23
- @throws
24
- <Error>
25
-
26
- @returns
27
- {
28
- payload: <UTF8 Payload String>
29
- }
30
- */
31
- module.exports = ({encrypted, secret}) => {
32
- if (!encrypted) {
33
- throw new Error('ExpectedEncryptedPayloadToDecrypt');
34
- }
35
-
36
- if (!secret) {
37
- throw new Error('ExpectedDecryptionSecretKeyToDecrypt');
38
- }
39
-
40
- const [key, payload] = [secret, encrypted].map(Hex.parse);
41
-
42
- const hex = WordArray.create(takeCipherWords(payload.words)).toString(Hex);
43
- const iv = WordArray.create(takeIvWords(payload.words));
44
-
45
- const ciphertext = Hex.parse(trim(hex, hex.length - zeroIndex(hex)));
46
-
47
- try {
48
- const clear = decrypt({ciphertext}, key, {iv, padding, mode: mode.CFB});
49
-
50
- return {payload: clear.toString(enc.Utf8)};
51
- } catch (err) {
52
- throw new Error('FailedToDecryptCipherTextWithSecretKey');
53
- }
54
- };
@@ -1,55 +0,0 @@
1
- const {equal} = require('node:assert').strict;
2
- const test = require('node:test');
3
- const {throws} = require('node:assert').strict;
4
-
5
- const {decryptPayload} = require('./../../encryption');
6
- const {encrypted} = require('./fixtures');
7
- const {secret} = require('./fixtures');
8
-
9
- const {parse} = JSON;
10
-
11
- const tests = [
12
- {
13
- args: {},
14
- description: 'An encrypted payload is required',
15
- error: 'ExpectedEncryptedPayloadToDecrypt',
16
- },
17
- {
18
- args: {encrypted},
19
- description: 'A secret key is required',
20
- error: 'ExpectedDecryptionSecretKeyToDecrypt',
21
- },
22
- {
23
- args: {encrypted, secret: 'ff'},
24
- description: 'A valid secret key is required',
25
- error: 'FailedToDecryptCipherTextWithSecretKey',
26
- },
27
- {
28
- args: {
29
- secret,
30
- encrypted: Buffer.from(encrypted, 'base64').toString('hex'),
31
- },
32
- description: 'Paylaod is decrypted',
33
- expected: {
34
- pair: 'BTCUSD',
35
- price: 4004.14,
36
- timestamp: '2019-01-10T00:00:11.000Z',
37
- },
38
- },
39
- ];
40
-
41
- tests.forEach(({args, description, error, expected}) => {
42
- return test(description, (t, end) => {
43
- if (!!error) {
44
- throws(() => decryptPayload(args), new Error(error), 'Got error');
45
- } else {
46
- const [{pair, price, timestamp}] = parse(decryptPayload(args).payload);
47
-
48
- equal(pair, expected.pair, 'Got expected pair');
49
- equal(price, expected.price, 'Got expectd price');
50
- equal(timestamp, expected.timestamp, 'Got expected timestamp');
51
- }
52
-
53
- return end();
54
- });
55
- });