lightning 7.1.0 → 7.1.1
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/.github/workflows/unit-test.yml +1 -1
- package/CHANGELOG.md +1 -1
- package/lnd_methods/onchain/index.d.ts +2 -0
- package/lnd_methods/onchain/sign_chain_address_message.d.ts +30 -0
- package/lnd_methods/onchain/verify_chain_address_message.d.ts +32 -0
- package/package.json +5 -5
- package/test/typescript/authenticated_lightning_method.test-d.ts +18 -0
- package/test/typescript/sign_chain_address_message.test-d.ts +27 -0
- package/test/typescript/verify_chain_address_message.test-d.ts +32 -0
package/CHANGELOG.md
CHANGED
|
@@ -24,6 +24,7 @@ export * from './request_chain_fee_increase';
|
|
|
24
24
|
export * from './send_to_chain_address';
|
|
25
25
|
export * from './send_to_chain_addresses';
|
|
26
26
|
export * from './send_to_chain_output_scripts';
|
|
27
|
+
export * from './sign_chain_address_message';
|
|
27
28
|
export * from './set_autopilot';
|
|
28
29
|
export * from './sign_psbt';
|
|
29
30
|
export * from './subscribe_to_blocks';
|
|
@@ -32,3 +33,4 @@ export * from './subscribe_to_chain_spend';
|
|
|
32
33
|
export * from './subscribe_to_transactions';
|
|
33
34
|
export * from './unlock_utxo';
|
|
34
35
|
export * from './update_chain_transaction';
|
|
36
|
+
export * from './verify_chain_address_message';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthenticatedLightningArgs,
|
|
3
|
+
AuthenticatedLightningMethod,
|
|
4
|
+
} from '../../typescript';
|
|
5
|
+
|
|
6
|
+
export type SignChainAddressMessageArgs = AuthenticatedLightningArgs<{
|
|
7
|
+
/** Chain Address String */
|
|
8
|
+
address: string;
|
|
9
|
+
/** Message To Sign String */
|
|
10
|
+
message: string;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
export type SignChainAddressMessageResult = {
|
|
14
|
+
/** Hex Encoded Signature String */
|
|
15
|
+
signature: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Sign a chain address message using ECDSA
|
|
20
|
+
*
|
|
21
|
+
* Note: this method is not supported in LND versions 0.15.5 and below
|
|
22
|
+
*
|
|
23
|
+
* Requires LND built with `walletrpc` tag
|
|
24
|
+
*
|
|
25
|
+
* `onchain:write` permission is required
|
|
26
|
+
*/
|
|
27
|
+
export const signChainAddressMessage: AuthenticatedLightningMethod<
|
|
28
|
+
SignChainAddressMessageArgs,
|
|
29
|
+
SignChainAddressMessageResult
|
|
30
|
+
>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthenticatedLightningArgs,
|
|
3
|
+
AuthenticatedLightningMethod,
|
|
4
|
+
} from '../../typescript';
|
|
5
|
+
|
|
6
|
+
export type VerifyChainAddressMessageArgs = AuthenticatedLightningArgs<{
|
|
7
|
+
/** Chain Address String */
|
|
8
|
+
address: string;
|
|
9
|
+
/** Message to Verify String */
|
|
10
|
+
message: string;
|
|
11
|
+
/** Hex Encoded Signature String */
|
|
12
|
+
signature: string;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export type VerifyChainAddressMessageResult = {
|
|
16
|
+
/** Public Key Hex String */
|
|
17
|
+
signed_by: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Verify a chain address message using ECDSA
|
|
22
|
+
*
|
|
23
|
+
* Note: this method is not supported in LND versions 0.15.5 and below
|
|
24
|
+
*
|
|
25
|
+
* Requires LND built with `walletrpc` tag
|
|
26
|
+
*
|
|
27
|
+
* `onchain:write` permission is required
|
|
28
|
+
*/
|
|
29
|
+
export const verifyChainAddressMessage: AuthenticatedLightningMethod<
|
|
30
|
+
VerifyChainAddressMessageArgs,
|
|
31
|
+
VerifyChainAddressMessageResult
|
|
32
|
+
>;
|
package/package.json
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/lightning/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@grpc/grpc-js": "1.8.
|
|
10
|
+
"@grpc/grpc-js": "1.8.11",
|
|
11
11
|
"@grpc/proto-loader": "0.7.5",
|
|
12
12
|
"@types/express": "4.17.17",
|
|
13
|
-
"@types/node": "18.
|
|
13
|
+
"@types/node": "18.14.1",
|
|
14
14
|
"@types/request": "2.48.8",
|
|
15
15
|
"@types/ws": "8.5.4",
|
|
16
16
|
"async": "3.2.4",
|
|
17
17
|
"asyncjs-util": "1.2.11",
|
|
18
18
|
"bitcoinjs-lib": "6.1.0",
|
|
19
19
|
"bn.js": "5.2.1",
|
|
20
|
-
"body-parser": "1.20.
|
|
20
|
+
"body-parser": "1.20.2",
|
|
21
21
|
"bolt07": "1.8.3",
|
|
22
22
|
"bolt09": "0.2.5",
|
|
23
23
|
"cbor": "8.1.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"invoices": "2.2.3",
|
|
27
27
|
"psbt": "2.7.2",
|
|
28
28
|
"tiny-secp256k1": "2.2.1",
|
|
29
|
-
"type-fest": "3.6.
|
|
29
|
+
"type-fest": "3.6.1"
|
|
30
30
|
},
|
|
31
31
|
"description": "Lightning Network client library",
|
|
32
32
|
"devDependencies": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"directory": "test/typescript"
|
|
60
60
|
},
|
|
61
61
|
"types": "index.d.ts",
|
|
62
|
-
"version": "7.1.
|
|
62
|
+
"version": "7.1.1"
|
|
63
63
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {expectError, expectType} from 'tsd';
|
|
2
|
+
import {AuthenticatedLnd} from '../../lnd_grpc';
|
|
3
|
+
import {
|
|
4
|
+
AuthenticatedLightningArgs,
|
|
5
|
+
AuthenticatedLightningMethod,
|
|
6
|
+
} from '../../typescript';
|
|
7
|
+
|
|
8
|
+
type TestArgs = AuthenticatedLightningArgs;
|
|
9
|
+
type TestResult = unknown;
|
|
10
|
+
type TestMethod = AuthenticatedLightningMethod<TestArgs, TestResult>;
|
|
11
|
+
|
|
12
|
+
const authenticatedLightningMethod: TestMethod = async () => {};
|
|
13
|
+
|
|
14
|
+
const lnd = {} as AuthenticatedLnd;
|
|
15
|
+
|
|
16
|
+
expectError(authenticatedLightningMethod());
|
|
17
|
+
expectError(authenticatedLightningMethod({}));
|
|
18
|
+
expectType(authenticatedLightningMethod({lnd}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {expectError, expectType} from 'tsd';
|
|
2
|
+
import {AuthenticatedLnd} from '../../lnd_grpc';
|
|
3
|
+
import {
|
|
4
|
+
signChainAddressMessage,
|
|
5
|
+
SignChainAddressMessageResult,
|
|
6
|
+
} from '../../lnd_methods';
|
|
7
|
+
|
|
8
|
+
const lnd = {} as AuthenticatedLnd;
|
|
9
|
+
const address = '';
|
|
10
|
+
const message = '';
|
|
11
|
+
|
|
12
|
+
expectError(signChainAddressMessage({lnd, address}));
|
|
13
|
+
expectError(signChainAddressMessage({lnd, message}));
|
|
14
|
+
|
|
15
|
+
expectType<SignChainAddressMessageResult>(
|
|
16
|
+
await signChainAddressMessage({
|
|
17
|
+
lnd,
|
|
18
|
+
address,
|
|
19
|
+
message,
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
expectType<void>(
|
|
24
|
+
signChainAddressMessage({lnd, address, message}, (error, result) => {
|
|
25
|
+
expectType<SignChainAddressMessageResult>(result);
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {expectError, expectType} from 'tsd';
|
|
2
|
+
import {AuthenticatedLnd} from '../../lnd_grpc';
|
|
3
|
+
import {
|
|
4
|
+
verifyChainAddressMessage,
|
|
5
|
+
VerifyChainAddressMessageResult,
|
|
6
|
+
} from '../../lnd_methods';
|
|
7
|
+
|
|
8
|
+
const lnd = {} as AuthenticatedLnd;
|
|
9
|
+
const address = '';
|
|
10
|
+
const message = '';
|
|
11
|
+
const signature = '';
|
|
12
|
+
|
|
13
|
+
expectError(verifyChainAddressMessage({lnd, address}));
|
|
14
|
+
expectError(verifyChainAddressMessage({lnd, message}));
|
|
15
|
+
expectError(verifyChainAddressMessage({lnd, address, message}));
|
|
16
|
+
expectError(verifyChainAddressMessage({lnd, address, signature}));
|
|
17
|
+
expectError(verifyChainAddressMessage({lnd, message, signature}));
|
|
18
|
+
|
|
19
|
+
expectType<VerifyChainAddressMessageResult>(
|
|
20
|
+
await verifyChainAddressMessage({
|
|
21
|
+
lnd,
|
|
22
|
+
address,
|
|
23
|
+
message,
|
|
24
|
+
signature,
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
expectType<void>(
|
|
29
|
+
verifyChainAddressMessage({lnd, address, message, signature}, (error, result) => {
|
|
30
|
+
expectType<VerifyChainAddressMessageResult>(result);
|
|
31
|
+
}),
|
|
32
|
+
);
|