ln-service 53.18.0 → 53.19.0

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,5 +1,10 @@
1
1
  # Versions
2
2
 
3
+ ## 53.19.0
4
+
5
+ - `signBytes`: Add `type` and support for specifying `schnorr` type signing
6
+ - `verifyBytesSignature`: Add support for verifying Schnorr signatures
7
+
3
8
  ## 53.18.0
4
9
 
5
10
  - `getChannels`: Add support for `is_trusted_funding` and `other_ids`
package/README.md CHANGED
@@ -4735,15 +4735,20 @@ await settleHodlInvoice({lnd, secret});
4735
4735
 
4736
4736
  Sign a sha256 hash of arbitrary bytes
4737
4737
 
4738
+ Supported signature types: `ecdsa`, `schnorr`
4739
+
4738
4740
  Requires LND built with `signrpc` build tag
4739
4741
 
4740
4742
  Requires `signer:generate` permission
4741
4743
 
4744
+ `schnorr` signature type is not supported on LND 0.15.0 and below
4745
+
4742
4746
  {
4743
4747
  key_family: <Key Family Number>
4744
4748
  key_index: <Key Index Number>
4745
4749
  lnd: <Authenticated LND gRPC API Object>
4746
4750
  preimage: <Bytes To Hash and Sign Hex Encoded String>
4751
+ [type]: <Signature Type String>
4747
4752
  }
4748
4753
 
4749
4754
  @returns via cbk or Promise
@@ -7096,10 +7101,14 @@ const isValid = (await verifyBackups({backup, channels, lnd})).is_valid;
7096
7101
 
7097
7102
  Verify signature of arbitrary bytes
7098
7103
 
7104
+ When passing a schnorr signature, a BIP-340 x-only public key should be given
7105
+
7099
7106
  Requires LND built with `signrpc` build tag
7100
7107
 
7101
7108
  Requires `signer:read` permission
7102
7109
 
7110
+ Validating `schnorr` signatures is unsupported in LND 0.15.0 and below
7111
+
7103
7112
  {
7104
7113
  lnd: <Authenticated LND API Object>
7105
7114
  preimage: <Message Preimage Bytes Hex Encoded String>
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "cors": "2.8.5",
12
12
  "express": "4.18.1",
13
13
  "invoices": "2.1.0",
14
- "lightning": "5.17.0",
14
+ "lightning": "5.18.0",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.8.1"
@@ -71,5 +71,5 @@
71
71
  "integration-test-0.12.0": "DOCKER_LND_VERSION=v0.12.0-beta npm run test",
72
72
  "test": "echo $DOCKER_LND_VERSION && tap -j 2 --branches=1 --functions=1 --lines=1 --statements=1 -t 200 test/autopilotrpc-integration/*.js test/chainrpc-integration/*.js test/integration/*.js test/invoicesrpc-integration/*.js test/peersrpc-integration/*.js test/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
73
73
  },
74
- "version": "53.18.0"
74
+ "version": "53.19.0"
75
75
  }
@@ -51,6 +51,23 @@ test(`Sign bytes`, async ({end, equal}) => {
51
51
  equal(message, 'ExpectedSignerRpcLndBuildTagToSignBytes', 'Invalid LND');
52
52
  }
53
53
 
54
+ try {
55
+ const schnorr = await signBytes({
56
+ lnd,
57
+ key_family: 6,
58
+ key_index: 0,
59
+ preimage: Buffer.alloc(32).toString('hex'),
60
+ type: 'schnorr',
61
+ });
62
+
63
+ equal(schnorr.signature.length, 64 * 2, 'Got schnorr signature for bytes');
64
+ } catch (err) {
65
+ const [code, message] = Array.isArray(err) ? err : [];
66
+
67
+ equal(code, 503, 'A 503 code is thrown if schnorr is unsupported');
68
+ equal(message, 'UnexpectedSignatureLengthInSignBytesResponse', 'Sig len');
69
+ }
70
+
54
71
  await kill({});
55
72
 
56
73
  return end();
@@ -72,6 +72,30 @@ test(`Verify bytes signature`, async ({end, equal}) => {
72
72
  equal(message, 'ExpectedSignerRpcLndBuildTagToSignBytes', 'Invalid LND');
73
73
  }
74
74
 
75
+ try {
76
+ const schnorr = await signBytes({
77
+ lnd,
78
+ key_family: 6,
79
+ key_index: 0,
80
+ preimage: Buffer.alloc(32).toString('hex'),
81
+ type: 'schnorr',
82
+ });
83
+
84
+ const validity = await verifyBytesSignature({
85
+ lnd,
86
+ preimage: Buffer.alloc(32).toString('hex'),
87
+ public_key: id.slice(2),
88
+ signature: schnorr.signature,
89
+ });
90
+
91
+ equal(validity.is_valid, true, 'Schnorr signature is valid');
92
+ } catch (err) {
93
+ const [code, message] = Array.isArray(err) ? err : [];
94
+
95
+ equal(code, 503, 'A 503 code is thrown if schnorr is unsupported');
96
+ equal(message, 'UnexpectedSignatureLengthInSignBytesResponse', 'Sig len');
97
+ }
98
+
75
99
  await kill({});
76
100
 
77
101
  return end();