@hwlt/era-connect 0.1.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/LICENSE +201 -0
- package/NOTICE +9 -0
- package/README.md +101 -0
- package/btc/package.json +6 -0
- package/dist/btc-DfQ0q79G.d.ts +58 -0
- package/dist/btc-Dn6_Y12c.d.cts +58 -0
- package/dist/btc-Fr6Jz4Fi.cjs +104 -0
- package/dist/btc-Fr6Jz4Fi.cjs.map +1 -0
- package/dist/btc-VyJKXq7d.js +99 -0
- package/dist/btc-VyJKXq7d.js.map +1 -0
- package/dist/btc.cjs +9 -0
- package/dist/btc.d.cts +3 -0
- package/dist/btc.d.ts +3 -0
- package/dist/btc.js +3 -0
- package/dist/evm-BHj_2OTG.cjs +134 -0
- package/dist/evm-BHj_2OTG.cjs.map +1 -0
- package/dist/evm-DJxGGAbD.d.cts +76 -0
- package/dist/evm-KrV5wK08.d.ts +76 -0
- package/dist/evm-kJb3-oiR.js +117 -0
- package/dist/evm-kJb3-oiR.js.map +1 -0
- package/dist/evm.cjs +11 -0
- package/dist/evm.d.cts +3 -0
- package/dist/evm.d.ts +3 -0
- package/dist/evm.js +3 -0
- package/dist/index.cjs +530 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +285 -0
- package/dist/index.d.ts +285 -0
- package/dist/index.js +506 -0
- package/dist/index.js.map +1 -0
- package/dist/messages-17Oup0-Z.js +208 -0
- package/dist/messages-17Oup0-Z.js.map +1 -0
- package/dist/messages-BzcdWlg1.cjs +243 -0
- package/dist/messages-BzcdWlg1.cjs.map +1 -0
- package/dist/messages-DsPvW8Oi.d.cts +29 -0
- package/dist/messages-DsPvW8Oi.d.ts +29 -0
- package/dist/shared-B8Wc7ViU.js +1472 -0
- package/dist/shared-B8Wc7ViU.js.map +1 -0
- package/dist/shared-CI8zhQiE.d.cts +218 -0
- package/dist/shared-CI8zhQiE.d.ts +218 -0
- package/dist/shared-nISrEktU.cjs +1777 -0
- package/dist/shared-nISrEktU.cjs.map +1 -0
- package/dist/solana-8eOwz0gM.d.cts +49 -0
- package/dist/solana-C2Xm7w8a.d.ts +49 -0
- package/dist/solana-C7JQEAec.js +87 -0
- package/dist/solana-C7JQEAec.js.map +1 -0
- package/dist/solana-DdEn24X4.cjs +98 -0
- package/dist/solana-DdEn24X4.cjs.map +1 -0
- package/dist/solana.cjs +10 -0
- package/dist/solana.d.cts +3 -0
- package/dist/solana.d.ts +3 -0
- package/dist/solana.js +3 -0
- package/dist/tron-Bo9HnvVE.js +158 -0
- package/dist/tron-Bo9HnvVE.js.map +1 -0
- package/dist/tron-CQIEqjCA.cjs +163 -0
- package/dist/tron-CQIEqjCA.cjs.map +1 -0
- package/dist/tron-YllfTmx6.d.ts +63 -0
- package/dist/tron-gG51KMnX.d.cts +63 -0
- package/dist/tron.cjs +11 -0
- package/dist/tron.d.cts +4 -0
- package/dist/tron.d.ts +4 -0
- package/dist/tron.js +4 -0
- package/dist/verify.cjs +445 -0
- package/dist/verify.cjs.map +1 -0
- package/dist/verify.d.cts +162 -0
- package/dist/verify.d.ts +162 -0
- package/dist/verify.js +438 -0
- package/dist/verify.js.map +1 -0
- package/evm/package.json +6 -0
- package/package.json +140 -0
- package/proto/tron/base.proto +16 -0
- package/proto/tron/message.proto +12 -0
- package/proto/tron/payload.proto +35 -0
- package/proto/tron/sign_transaction_result.proto +10 -0
- package/proto/tron/sync.proto +21 -0
- package/proto/tron/transaction.proto +17 -0
- package/proto/tron/tron_transaction.proto +31 -0
- package/proto/tron/verify_address.proto +10 -0
- package/solana/package.json +6 -0
- package/tron/package.json +6 -0
- package/verify/package.json +6 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing
|
|
201
|
+
permissions and limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
ERA Connect SDK
|
|
2
|
+
Copyright 2026 ERA Wallet
|
|
3
|
+
|
|
4
|
+
This product includes Protocol Buffers schema definitions for the Tron
|
|
5
|
+
signing envelope (packages/connect/proto/tron/) that are derived from the
|
|
6
|
+
QR code data protocol published by Keystone (https://github.com/KeystoneHQ,
|
|
7
|
+
Apache License 2.0) and reference message shapes from the TRON protocol
|
|
8
|
+
(https://github.com/tronprotocol/protocol, Apache License 2.0 / LGPL-3.0
|
|
9
|
+
documentation headers as published).
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# @hwlt/era-connect
|
|
2
|
+
|
|
3
|
+
Air-gapped **ERA hardware wallet** integration for software wallets: account
|
|
4
|
+
linking and transaction signing over animated QR codes (BC-UR / Keystone-compatible
|
|
5
|
+
registry), for **EVM, Bitcoin, Solana and Tron**.
|
|
6
|
+
|
|
7
|
+
- **Headless.** You render the QR and own the camera; the SDK owns every byte
|
|
8
|
+
of the protocol. Works in React Native, Expo, browsers, extensions and Node.
|
|
9
|
+
- **Zero I/O.** No network calls, ever. No Node built-ins, no `Buffer` —
|
|
10
|
+
`Uint8Array` end-to-end.
|
|
11
|
+
- **Verified against the device.** Golden vectors are generated by the
|
|
12
|
+
reference implementation and replayed byte-for-byte in CI; the fountain
|
|
13
|
+
encoder reproduces the canonical BCR-2020-005 frames bit-for-bit and
|
|
14
|
+
round-trips against `@ngraveio/bc-ur`.
|
|
15
|
+
- **Hardened where it matters.** The scanner refuses hostile QR frames
|
|
16
|
+
(stream binding needs a second distinct fragment), every reply must echo the
|
|
17
|
+
request id byte-for-byte, gzip replies inflate under a hard ceiling, and a
|
|
18
|
+
`verify` module proves the device signed *exactly* what you sent.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install @hwlt/era-connect
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
React Native needs a CSPRNG for request ids — install
|
|
27
|
+
[`react-native-get-random-values`](https://www.npmjs.com/package/react-native-get-random-values)
|
|
28
|
+
and import it once at app start (or inject your own via `randomBytes`).
|
|
29
|
+
|
|
30
|
+
## 60 seconds to a signature
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { EraConnect, EvmChain } from '@hwlt/era-connect';
|
|
34
|
+
|
|
35
|
+
const era = new EraConnect({ origin: 'MyWallet' }); // shown on the device
|
|
36
|
+
|
|
37
|
+
// 1. LINK — the user shows the device's "connect" QR; you scan it.
|
|
38
|
+
const scanner = era.scanner({ expectedTypes: ['crypto-multi-accounts'] });
|
|
39
|
+
// feed camera frames: scanner.receivePart(text) → { kind: 'complete', ur } when done
|
|
40
|
+
const accounts = era.parseAccounts(scanner.result());
|
|
41
|
+
const evm = accounts.evm()!;
|
|
42
|
+
console.log(evm.deriveAddress(0)); // 0x... — derived locally, device not needed
|
|
43
|
+
|
|
44
|
+
// 2. SIGN — build the request, render it, scan the reply.
|
|
45
|
+
const request = era.evm.generateSignRequest({
|
|
46
|
+
signData: rlpBytes, // your unsigned tx, RLP-encoded for signing
|
|
47
|
+
dataType: EvmChain.DataType.transaction,
|
|
48
|
+
path: evm.pathFor(0),
|
|
49
|
+
xfp: evm.xfp,
|
|
50
|
+
chainId: 1,
|
|
51
|
+
address: evm.deriveAddress(0),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const animated = request.toAnimated(); // drive nextFrame() at ~8 fps
|
|
55
|
+
// render animated.nextFrame() in your QR component every 125 ms
|
|
56
|
+
|
|
57
|
+
const reply = request.scanner(); // pre-pinned to the right reply types
|
|
58
|
+
// feed camera frames: reply.receivePart(text)
|
|
59
|
+
const signature = reply.parse(); // typed; request-id echo enforced
|
|
60
|
+
|
|
61
|
+
// 3. VERIFY (recommended) + broadcast with your own stack.
|
|
62
|
+
import { verifyEvmSignature } from '@hwlt/era-connect/verify';
|
|
63
|
+
verifyEvmSignature({ signData: rlpBytes, dataType: 1,
|
|
64
|
+
signature: signature.signature, address: evm.deriveAddress(0) });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Chain support
|
|
68
|
+
|
|
69
|
+
| Chain | Sign transaction | Sign message | Subpath |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| EVM (all chains) | `eth-sign-request` | personal_sign / EIP-712 | `@hwlt/era-connect/evm` |
|
|
72
|
+
| Bitcoin | `crypto-psbt` (PSBT v0) | legacy P2PKH only | `@hwlt/era-connect/btc` |
|
|
73
|
+
| Solana | `sol-sign-request` | off-chain messages | `@hwlt/era-connect/solana` |
|
|
74
|
+
| Tron | `keystone-sign-request` (any contract via `rawData`) | UTF-8 in `rawData` | `@hwlt/era-connect/tron` |
|
|
75
|
+
|
|
76
|
+
Subpath imports keep unrelated chains (and the `verify` crypto) out of your
|
|
77
|
+
bundle. The device's chain list keeps growing — `era.raw` is the escape hatch
|
|
78
|
+
for UR types this SDK has no module for yet.
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
The full guide lives in [`docs/`](https://github.com/ERAWLT/era-connect-sdk/tree/main/docs):
|
|
83
|
+
|
|
84
|
+
1. [Install & set up](https://github.com/ERAWLT/era-connect-sdk/blob/main/docs/getting-started/01-install.md)
|
|
85
|
+
2. [Link the device](https://github.com/ERAWLT/era-connect-sdk/blob/main/docs/getting-started/02-link-device.md)
|
|
86
|
+
3. [Display a sign request](https://github.com/ERAWLT/era-connect-sdk/blob/main/docs/getting-started/03-display-request.md)
|
|
87
|
+
4. [Scan the signature](https://github.com/ERAWLT/era-connect-sdk/blob/main/docs/getting-started/04-scan-signature.md)
|
|
88
|
+
5. [Verify & broadcast](https://github.com/ERAWLT/era-connect-sdk/blob/main/docs/getting-started/05-broadcast.md)
|
|
89
|
+
|
|
90
|
+
Per-chain guides, device specifics vs. the Keystone standard, QR tuning, the
|
|
91
|
+
WalletConnect forwarding model and a migration note from
|
|
92
|
+
`@keystonehq/keystone-sdk` are under
|
|
93
|
+
[`docs/chains`](https://github.com/ERAWLT/era-connect-sdk/tree/main/docs/chains) and
|
|
94
|
+
[`docs/advanced`](https://github.com/ERAWLT/era-connect-sdk/tree/main/docs/advanced).
|
|
95
|
+
The normative wire specification is
|
|
96
|
+
[`docs/protocol`](https://github.com/ERAWLT/era-connect-sdk/tree/main/docs/protocol).
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
Apache-2.0 — see [LICENSE](https://github.com/ERAWLT/era-connect-sdk/blob/main/LICENSE)
|
|
101
|
+
and [NOTICE](https://github.com/ERAWLT/era-connect-sdk/blob/main/NOTICE).
|
package/btc/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { _ as Ur, a as SignRequest, i as ExpectedReply, r as EraConnectConfig } from "./shared-CI8zhQiE.js";
|
|
2
|
+
//#region src/chains/btc.d.ts
|
|
3
|
+
interface BtcPsbtSignRequestProps {
|
|
4
|
+
/** Raw PSBT v0 bytes (BIP-174). The device's signer relies on the global UNSIGNED_TX. */
|
|
5
|
+
readonly psbt: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
interface BtcPsbtResult {
|
|
8
|
+
/** The signed, NOT finalized PSBT. Finalize + broadcast with your own stack. */
|
|
9
|
+
readonly psbt: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
interface BtcMessageSignRequestProps {
|
|
12
|
+
readonly requestId?: Uint8Array | string;
|
|
13
|
+
readonly message: Uint8Array;
|
|
14
|
+
/** Full signing path, e.g. `m/84'/0'/0'/0/0`. */
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly xfp: string | number;
|
|
17
|
+
/**
|
|
18
|
+
* The signing address. The device's message signer supports LEGACY P2PKH
|
|
19
|
+
* (`1...`) addresses only; a segwit address yields `empty-signature`.
|
|
20
|
+
*/
|
|
21
|
+
readonly address: string;
|
|
22
|
+
readonly origin?: string;
|
|
23
|
+
}
|
|
24
|
+
interface BtcMessageSignatureResult {
|
|
25
|
+
readonly requestId: Uint8Array;
|
|
26
|
+
/** Raw 65-byte BIP-137 signature (header + r + s). */
|
|
27
|
+
readonly signature: Uint8Array;
|
|
28
|
+
/** The base64 form dApps and verifiers expect. */
|
|
29
|
+
readonly signatureBase64: string;
|
|
30
|
+
readonly publicKey: Uint8Array | undefined;
|
|
31
|
+
}
|
|
32
|
+
declare class BtcChain {
|
|
33
|
+
static readonly DataType: {
|
|
34
|
+
readonly message: 1;
|
|
35
|
+
};
|
|
36
|
+
private readonly context;
|
|
37
|
+
constructor(config?: EraConnectConfig);
|
|
38
|
+
/**
|
|
39
|
+
* Build a `crypto-psbt` (310) request: the UR payload is a bare CBOR byte
|
|
40
|
+
* string of the raw PSBT — no map, no request id, no origin.
|
|
41
|
+
*
|
|
42
|
+
* BECAUSE the protocol carries no request id on this path, the reply is
|
|
43
|
+
* bound to the request only by its content: after parsing, compare the
|
|
44
|
+
* returned PSBT's unsigned transaction against the one you sent
|
|
45
|
+
* (`verifySignedPsbt` from `@hwlt/era-connect/verify`). Skipping that
|
|
46
|
+
* check re-opens replay of a stale signed PSBT.
|
|
47
|
+
*/
|
|
48
|
+
generatePsbtSignRequest(props: BtcPsbtSignRequestProps): SignRequest<BtcPsbtResult>;
|
|
49
|
+
/** Parse a `crypto-psbt` reply: the signed (not finalized) PSBT bytes. */
|
|
50
|
+
parsePsbt(input: Ur | string): BtcPsbtResult;
|
|
51
|
+
/** Build a `btc-sign-request` (8101) for message signing. Reply: `btc-signature` (8102). */
|
|
52
|
+
generateMessageSignRequest(props: BtcMessageSignRequestProps): SignRequest<BtcMessageSignatureResult>;
|
|
53
|
+
/** Parse a `btc-signature` standalone. Prefer `SignRequest.scanner().parse()`. */
|
|
54
|
+
parseMessageSignature(input: Ur | string, expect?: ExpectedReply): BtcMessageSignatureResult;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { BtcPsbtSignRequestProps as a, BtcPsbtResult as i, BtcMessageSignRequestProps as n, BtcMessageSignatureResult as r, BtcChain as t };
|
|
58
|
+
//# sourceMappingURL=btc-DfQ0q79G.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { _ as Ur, a as SignRequest, i as ExpectedReply, r as EraConnectConfig } from "./shared-CI8zhQiE.cjs";
|
|
2
|
+
//#region src/chains/btc.d.ts
|
|
3
|
+
interface BtcPsbtSignRequestProps {
|
|
4
|
+
/** Raw PSBT v0 bytes (BIP-174). The device's signer relies on the global UNSIGNED_TX. */
|
|
5
|
+
readonly psbt: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
interface BtcPsbtResult {
|
|
8
|
+
/** The signed, NOT finalized PSBT. Finalize + broadcast with your own stack. */
|
|
9
|
+
readonly psbt: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
interface BtcMessageSignRequestProps {
|
|
12
|
+
readonly requestId?: Uint8Array | string;
|
|
13
|
+
readonly message: Uint8Array;
|
|
14
|
+
/** Full signing path, e.g. `m/84'/0'/0'/0/0`. */
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly xfp: string | number;
|
|
17
|
+
/**
|
|
18
|
+
* The signing address. The device's message signer supports LEGACY P2PKH
|
|
19
|
+
* (`1...`) addresses only; a segwit address yields `empty-signature`.
|
|
20
|
+
*/
|
|
21
|
+
readonly address: string;
|
|
22
|
+
readonly origin?: string;
|
|
23
|
+
}
|
|
24
|
+
interface BtcMessageSignatureResult {
|
|
25
|
+
readonly requestId: Uint8Array;
|
|
26
|
+
/** Raw 65-byte BIP-137 signature (header + r + s). */
|
|
27
|
+
readonly signature: Uint8Array;
|
|
28
|
+
/** The base64 form dApps and verifiers expect. */
|
|
29
|
+
readonly signatureBase64: string;
|
|
30
|
+
readonly publicKey: Uint8Array | undefined;
|
|
31
|
+
}
|
|
32
|
+
declare class BtcChain {
|
|
33
|
+
static readonly DataType: {
|
|
34
|
+
readonly message: 1;
|
|
35
|
+
};
|
|
36
|
+
private readonly context;
|
|
37
|
+
constructor(config?: EraConnectConfig);
|
|
38
|
+
/**
|
|
39
|
+
* Build a `crypto-psbt` (310) request: the UR payload is a bare CBOR byte
|
|
40
|
+
* string of the raw PSBT — no map, no request id, no origin.
|
|
41
|
+
*
|
|
42
|
+
* BECAUSE the protocol carries no request id on this path, the reply is
|
|
43
|
+
* bound to the request only by its content: after parsing, compare the
|
|
44
|
+
* returned PSBT's unsigned transaction against the one you sent
|
|
45
|
+
* (`verifySignedPsbt` from `@hwlt/era-connect/verify`). Skipping that
|
|
46
|
+
* check re-opens replay of a stale signed PSBT.
|
|
47
|
+
*/
|
|
48
|
+
generatePsbtSignRequest(props: BtcPsbtSignRequestProps): SignRequest<BtcPsbtResult>;
|
|
49
|
+
/** Parse a `crypto-psbt` reply: the signed (not finalized) PSBT bytes. */
|
|
50
|
+
parsePsbt(input: Ur | string): BtcPsbtResult;
|
|
51
|
+
/** Build a `btc-sign-request` (8101) for message signing. Reply: `btc-signature` (8102). */
|
|
52
|
+
generateMessageSignRequest(props: BtcMessageSignRequestProps): SignRequest<BtcMessageSignatureResult>;
|
|
53
|
+
/** Parse a `btc-signature` standalone. Prefer `SignRequest.scanner().parse()`. */
|
|
54
|
+
parseMessageSignature(input: Ur | string, expect?: ExpectedReply): BtcMessageSignatureResult;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { BtcPsbtSignRequestProps as a, BtcPsbtResult as i, BtcMessageSignRequestProps as n, BtcMessageSignatureResult as r, BtcChain as t };
|
|
58
|
+
//# sourceMappingURL=btc-Dn6_Y12c.d.cts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const require_shared = require("./shared-nISrEktU.cjs");
|
|
2
|
+
let _scure_base = require("@scure/base");
|
|
3
|
+
//#region src/chains/btc.ts
|
|
4
|
+
const PSBT_REPLY_TYPES = ["crypto-psbt"];
|
|
5
|
+
const MESSAGE_REPLY_TYPES = ["btc-signature"];
|
|
6
|
+
var BtcChain = class BtcChain {
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.context = require_shared.resolveContext(config);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build a `crypto-psbt` (310) request: the UR payload is a bare CBOR byte
|
|
12
|
+
* string of the raw PSBT — no map, no request id, no origin.
|
|
13
|
+
*
|
|
14
|
+
* BECAUSE the protocol carries no request id on this path, the reply is
|
|
15
|
+
* bound to the request only by its content: after parsing, compare the
|
|
16
|
+
* returned PSBT's unsigned transaction against the one you sent
|
|
17
|
+
* (`verifySignedPsbt` from `@hwlt/era-connect/verify`). Skipping that
|
|
18
|
+
* check re-opens replay of a stale signed PSBT.
|
|
19
|
+
*/
|
|
20
|
+
generatePsbtSignRequest(props) {
|
|
21
|
+
if (props.psbt.length === 0) throw new require_shared.EraSdkError("invalid-props", "psbt must not be empty");
|
|
22
|
+
const ur = new require_shared.Ur("crypto-psbt", require_shared.cborEncode(require_shared.cbBytes(props.psbt)));
|
|
23
|
+
return require_shared.makeSignRequest({
|
|
24
|
+
ur,
|
|
25
|
+
replyTypes: PSBT_REPLY_TYPES,
|
|
26
|
+
context: this.context,
|
|
27
|
+
parse: (reply) => this.parsePsbt(reply)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** Parse a `crypto-psbt` reply: the signed (not finalized) PSBT bytes. */
|
|
31
|
+
parsePsbt(input) {
|
|
32
|
+
const ur = require_shared.toUr(input);
|
|
33
|
+
require_shared.requireUrType(ur, [...PSBT_REPLY_TYPES], "crypto-psbt");
|
|
34
|
+
let decoded;
|
|
35
|
+
try {
|
|
36
|
+
decoded = require_shared.cborDecode(ur.cbor);
|
|
37
|
+
} catch (e) {
|
|
38
|
+
throw new require_shared.EraSdkError("malformed-cbor", `crypto-psbt reply: ${e.message}`);
|
|
39
|
+
}
|
|
40
|
+
const bytes = require_shared.asBytes(decoded);
|
|
41
|
+
if (!bytes) throw new require_shared.EraSdkError("malformed-reply", "crypto-psbt reply is not a byte string");
|
|
42
|
+
if (bytes.length === 0) throw new require_shared.EraSdkError("malformed-reply", "crypto-psbt reply is empty");
|
|
43
|
+
return { psbt: bytes };
|
|
44
|
+
}
|
|
45
|
+
/** Build a `btc-sign-request` (8101) for message signing. Reply: `btc-signature` (8102). */
|
|
46
|
+
generateMessageSignRequest(props) {
|
|
47
|
+
const requestId = require_shared.resolveRequestId(this.context, props.requestId);
|
|
48
|
+
const path = require_shared.parsePath(props.path);
|
|
49
|
+
const xfp = require_shared.normalizeXfp(props.xfp);
|
|
50
|
+
const ur = new require_shared.Ur("btc-sign-request", require_shared.cborEncode(require_shared.cbMap([
|
|
51
|
+
[1, require_shared.cbTag(37, require_shared.cbBytes(requestId))],
|
|
52
|
+
[2, require_shared.cbBytes(props.message)],
|
|
53
|
+
[3, require_shared.cbUint(BtcChain.DataType.message)],
|
|
54
|
+
[4, require_shared.cbArray([require_shared.keypath304(path, xfp)])],
|
|
55
|
+
[5, require_shared.cbArray([require_shared.cbText(props.address)])],
|
|
56
|
+
[6, require_shared.cbText(props.origin ?? this.context.origin)]
|
|
57
|
+
])));
|
|
58
|
+
return require_shared.makeSignRequest({
|
|
59
|
+
ur,
|
|
60
|
+
requestId,
|
|
61
|
+
replyTypes: MESSAGE_REPLY_TYPES,
|
|
62
|
+
context: this.context,
|
|
63
|
+
parse: (reply) => parseMessageSignature(reply, requestId)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/** Parse a `btc-signature` standalone. Prefer `SignRequest.scanner().parse()`. */
|
|
67
|
+
parseMessageSignature(input, expect) {
|
|
68
|
+
return parseMessageSignature(require_shared.toUr(input), expect?.requestId === void 0 ? void 0 : require_shared.normalizeRequestId(expect.requestId));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
BtcChain.DataType = { message: 1 };
|
|
72
|
+
function parseMessageSignature(ur, expectedRequestId) {
|
|
73
|
+
require_shared.requireUrType(ur, [...MESSAGE_REPLY_TYPES], "btc-signature");
|
|
74
|
+
const map = require_shared.requireReplyMap(ur, "btc-signature");
|
|
75
|
+
const requestId = require_shared.requireRequestIdEcho(map, 1, expectedRequestId, "btc-signature");
|
|
76
|
+
const sigValue = require_shared.asBytes(require_shared.mapGet(map, 2));
|
|
77
|
+
if (sigValue === void 0) throw new require_shared.EraSdkError("malformed-reply", "btc-signature is missing the signature (key 2)");
|
|
78
|
+
if (sigValue.length === 0) throw new require_shared.EraSdkError("empty-signature", "the device returned an empty signature — Bitcoin message signing supports legacy P2PKH (1...) addresses only");
|
|
79
|
+
let signature;
|
|
80
|
+
try {
|
|
81
|
+
signature = _scure_base.base64.decode(require_shared.asciiDecode(sigValue));
|
|
82
|
+
} catch {
|
|
83
|
+
signature = sigValue;
|
|
84
|
+
}
|
|
85
|
+
if (signature.length !== 65) {
|
|
86
|
+
if (sigValue.length === 65) signature = sigValue;
|
|
87
|
+
else throw new require_shared.EraSdkError("malformed-reply", `btc-signature payload does not decode to a 65-byte BIP-137 signature (${sigValue.length} bytes on the wire)`);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
requestId,
|
|
91
|
+
signature,
|
|
92
|
+
signatureBase64: _scure_base.base64.encode(signature),
|
|
93
|
+
publicKey: require_shared.asBytes(require_shared.mapGet(map, 3))
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
Object.defineProperty(exports, "BtcChain", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function() {
|
|
100
|
+
return BtcChain;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=btc-Fr6Jz4Fi.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"btc-Fr6Jz4Fi.cjs","names":["resolveContext","EraSdkError","UrValue","cborEncode","cbBytes","makeSignRequest","toUr","cborDecode","asBytes","resolveRequestId","parsePath","normalizeXfp","cbMap","cbTag","cbUint","cbArray","keypath304","cbText","normalizeRequestId","requireReplyMap","requireRequestIdEcho","mapGet","base64","asciiDecode"],"sources":["../src/chains/btc.ts"],"sourcesContent":["import { base64 } from '@scure/base';\nimport { cborDecode } from '../cbor/decode';\nimport { cborEncode } from '../cbor/encode';\nimport type { CborValue } from '../cbor/model';\nimport { asBytes, cbArray, cbBytes, cbMap, cbTag, cbText, cbUint, mapGet } from '../cbor/model';\nimport { asciiDecode } from '../core/bytes';\nimport { EraSdkError } from '../core/errors';\nimport { normalizeRequestId } from '../core/rand';\nimport { keypath304, normalizeXfp, parsePath } from '../registry/keypath';\nimport type { Ur } from '../ur/ur';\nimport { Ur as UrValue } from '../ur/ur';\nimport type { ChainContext, EraConnectConfig, ExpectedReply, SignRequest } from './shared';\nimport {\n makeSignRequest,\n requireReplyMap,\n requireRequestIdEcho,\n requireUrType,\n resolveContext,\n resolveRequestId,\n toUr,\n} from './shared';\n\nexport interface BtcPsbtSignRequestProps {\n /** Raw PSBT v0 bytes (BIP-174). The device's signer relies on the global UNSIGNED_TX. */\n readonly psbt: Uint8Array;\n}\n\nexport interface BtcPsbtResult {\n /** The signed, NOT finalized PSBT. Finalize + broadcast with your own stack. */\n readonly psbt: Uint8Array;\n}\n\nexport interface BtcMessageSignRequestProps {\n readonly requestId?: Uint8Array | string;\n readonly message: Uint8Array;\n /** Full signing path, e.g. `m/84'/0'/0'/0/0`. */\n readonly path: string;\n readonly xfp: string | number;\n /**\n * The signing address. The device's message signer supports LEGACY P2PKH\n * (`1...`) addresses only; a segwit address yields `empty-signature`.\n */\n readonly address: string;\n readonly origin?: string;\n}\n\nexport interface BtcMessageSignatureResult {\n readonly requestId: Uint8Array;\n /** Raw 65-byte BIP-137 signature (header + r + s). */\n readonly signature: Uint8Array;\n /** The base64 form dApps and verifiers expect. */\n readonly signatureBase64: string;\n readonly publicKey: Uint8Array | undefined;\n}\n\nconst PSBT_REPLY_TYPES = ['crypto-psbt'] as const;\nconst MESSAGE_REPLY_TYPES = ['btc-signature'] as const;\n\nexport class BtcChain {\n static readonly DataType = { message: 1 } as const;\n\n private readonly context: ChainContext;\n\n constructor(config?: EraConnectConfig) {\n this.context = resolveContext(config);\n }\n\n /**\n * Build a `crypto-psbt` (310) request: the UR payload is a bare CBOR byte\n * string of the raw PSBT — no map, no request id, no origin.\n *\n * BECAUSE the protocol carries no request id on this path, the reply is\n * bound to the request only by its content: after parsing, compare the\n * returned PSBT's unsigned transaction against the one you sent\n * (`verifySignedPsbt` from `@hwlt/era-connect/verify`). Skipping that\n * check re-opens replay of a stale signed PSBT.\n */\n generatePsbtSignRequest(props: BtcPsbtSignRequestProps): SignRequest<BtcPsbtResult> {\n if (props.psbt.length === 0) {\n throw new EraSdkError('invalid-props', 'psbt must not be empty');\n }\n const ur = new UrValue('crypto-psbt', cborEncode(cbBytes(props.psbt)));\n return makeSignRequest({\n ur,\n replyTypes: PSBT_REPLY_TYPES,\n context: this.context,\n parse: (reply) => this.parsePsbt(reply),\n });\n }\n\n /** Parse a `crypto-psbt` reply: the signed (not finalized) PSBT bytes. */\n parsePsbt(input: Ur | string): BtcPsbtResult {\n const ur = toUr(input);\n requireUrType(ur, [...PSBT_REPLY_TYPES], 'crypto-psbt');\n let decoded: CborValue;\n try {\n decoded = cborDecode(ur.cbor);\n } catch (e) {\n throw new EraSdkError('malformed-cbor', `crypto-psbt reply: ${(e as Error).message}`);\n }\n const bytes = asBytes(decoded);\n if (!bytes) {\n throw new EraSdkError('malformed-reply', 'crypto-psbt reply is not a byte string');\n }\n if (bytes.length === 0) {\n throw new EraSdkError('malformed-reply', 'crypto-psbt reply is empty');\n }\n return { psbt: bytes };\n }\n\n /** Build a `btc-sign-request` (8101) for message signing. Reply: `btc-signature` (8102). */\n generateMessageSignRequest(\n props: BtcMessageSignRequestProps,\n ): SignRequest<BtcMessageSignatureResult> {\n const requestId = resolveRequestId(this.context, props.requestId);\n const path = parsePath(props.path);\n const xfp = normalizeXfp(props.xfp);\n\n const ur = new UrValue(\n 'btc-sign-request',\n cborEncode(\n cbMap([\n // Tag-37-wrapped on this chain (per-chain firmware policy).\n [1, cbTag(37, cbBytes(requestId))],\n [2, cbBytes(props.message)],\n [3, cbUint(BtcChain.DataType.message)],\n [4, cbArray([keypath304(path, xfp)])],\n [5, cbArray([cbText(props.address)])],\n [6, cbText(props.origin ?? this.context.origin)],\n ]),\n ),\n );\n return makeSignRequest({\n ur,\n requestId,\n replyTypes: MESSAGE_REPLY_TYPES,\n context: this.context,\n parse: (reply) => parseMessageSignature(reply, requestId),\n });\n }\n\n /** Parse a `btc-signature` standalone. Prefer `SignRequest.scanner().parse()`. */\n parseMessageSignature(input: Ur | string, expect?: ExpectedReply): BtcMessageSignatureResult {\n return parseMessageSignature(\n toUr(input),\n expect?.requestId === undefined ? undefined : normalizeRequestId(expect.requestId),\n );\n }\n}\n\nfunction parseMessageSignature(\n ur: Ur,\n expectedRequestId: Uint8Array | undefined,\n): BtcMessageSignatureResult {\n requireUrType(ur, [...MESSAGE_REPLY_TYPES], 'btc-signature');\n const map = requireReplyMap(ur, 'btc-signature');\n const requestId = requireRequestIdEcho(map, 1, expectedRequestId, 'btc-signature');\n\n const sigValue = asBytes(mapGet(map, 2));\n if (sigValue === undefined) {\n throw new EraSdkError('malformed-reply', 'btc-signature is missing the signature (key 2)');\n }\n // The device answers a message request for an address its signer cannot\n // handle (any non-legacy script type) with an EMPTY signature.\n if (sigValue.length === 0) {\n throw new EraSdkError(\n 'empty-signature',\n 'the device returned an empty signature — Bitcoin message signing supports legacy P2PKH (1...) addresses only',\n );\n }\n\n // Device quirk: the reply bytes are the ASCII of a base64 string, not raw\n // signature bytes. Decode twice; tolerate a firmware that starts sending\n // raw 65-byte signatures directly.\n let signature: Uint8Array;\n try {\n signature = base64.decode(asciiDecode(sigValue));\n } catch {\n signature = sigValue;\n }\n if (signature.length !== 65) {\n if (sigValue.length === 65) {\n signature = sigValue;\n } else {\n throw new EraSdkError(\n 'malformed-reply',\n `btc-signature payload does not decode to a 65-byte BIP-137 signature (${sigValue.length} bytes on the wire)`,\n );\n }\n }\n return {\n requestId,\n signature,\n signatureBase64: base64.encode(signature),\n publicKey: asBytes(mapGet(map, 3)),\n };\n}\n"],"mappings":"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"}
|