Skip to content

Commit e369854

Browse files
committed
docs: update erc4361 docs
1 parent dd94310 commit e369854

File tree

1 file changed

+71
-41
lines changed

1 file changed

+71
-41
lines changed

README.md

+71-41
Original file line numberDiff line numberDiff line change
@@ -57,66 +57,72 @@ For a smooth and quick integration:
5757
* [Parameters](#parameters-9)
5858
* [signWithdrawal](#signwithdrawal)
5959
* [Parameters](#parameters-10)
60+
* [Examples](#examples-7)
61+
* [signERC4361Message](#signerc4361message)
62+
* [Parameters](#parameters-11)
63+
* [Examples](#examples-8)
6064
* [AcreBtcNew](#acrebtcnew)
6165
* [getWalletXpub](#getwalletxpub-1)
62-
* [Parameters](#parameters-11)
63-
* [getWalletPublicKey](#getwalletpublickey-1)
6466
* [Parameters](#parameters-12)
65-
* [createPaymentTransaction](#createpaymenttransaction-1)
67+
* [getWalletPublicKey](#getwalletpublickey-1)
6668
* [Parameters](#parameters-13)
67-
* [signMessage](#signmessage-1)
69+
* [createPaymentTransaction](#createpaymenttransaction-1)
6870
* [Parameters](#parameters-14)
69-
* [signWithdrawal](#signwithdrawal-1)
71+
* [signMessage](#signmessage-1)
7072
* [Parameters](#parameters-15)
73+
* [signWithdrawal](#signwithdrawal-1)
74+
* [Parameters](#parameters-16)
75+
* [signERC4361Message](#signerc4361message-1)
76+
* [Parameters](#parameters-17)
7177
* [descrTemplFrom](#descrtemplfrom)
72-
* [Parameters](#parameters-16)
78+
* [Parameters](#parameters-18)
7379
* [AcreBtcOld](#acrebtcold)
7480
* [getWalletPublicKey](#getwalletpublickey-2)
75-
* [Parameters](#parameters-17)
76-
* [Examples](#examples-7)
81+
* [Parameters](#parameters-19)
82+
* [Examples](#examples-9)
7783
* [createPaymentTransaction](#createpaymenttransaction-2)
78-
* [Parameters](#parameters-18)
79-
* [Examples](#examples-8)
84+
* [Parameters](#parameters-20)
85+
* [Examples](#examples-10)
8086
* [CreateTransactionArg](#createtransactionarg)
8187
* [Properties](#properties)
8288
* [AddressFormat](#addressformat)
8389
* [AcreWithdrawalData](#acrewithdrawaldata)
8490
* [Properties](#properties-1)
8591
* [AccountType](#accounttype)
8692
* [spendingCondition](#spendingcondition)
87-
* [Parameters](#parameters-19)
93+
* [Parameters](#parameters-21)
8894
* [setInput](#setinput)
89-
* [Parameters](#parameters-20)
95+
* [Parameters](#parameters-22)
9096
* [setOwnOutput](#setownoutput)
91-
* [Parameters](#parameters-21)
97+
* [Parameters](#parameters-23)
9298
* [getDescriptorTemplate](#getdescriptortemplate)
9399
* [SingleKeyAccount](#singlekeyaccount)
94100
* [getTaprootOutputKey](#gettaprootoutputkey)
95-
* [Parameters](#parameters-22)
101+
* [Parameters](#parameters-24)
96102
* [AppClient](#appclient)
97-
* [Parameters](#parameters-23)
103+
* [Parameters](#parameters-25)
98104
* [ClientCommandInterpreter](#clientcommandinterpreter)
99-
* [Parameters](#parameters-24)
105+
* [Parameters](#parameters-26)
100106
* [MerkelizedPsbt](#merkelizedpsbt)
101-
* [Parameters](#parameters-25)
107+
* [Parameters](#parameters-27)
102108
* [Merkle](#merkle)
103-
* [Parameters](#parameters-26)
109+
* [Parameters](#parameters-28)
104110
* [MerkleMap](#merklemap)
105-
* [Parameters](#parameters-27)
111+
* [Parameters](#parameters-29)
106112
* [WalletPolicy](#walletpolicy)
107-
* [Parameters](#parameters-28)
113+
* [Parameters](#parameters-30)
108114
* [extract](#extract)
109-
* [Parameters](#parameters-29)
115+
* [Parameters](#parameters-31)
110116
* [finalize](#finalize)
111-
* [Parameters](#parameters-30)
117+
* [Parameters](#parameters-32)
112118
* [clearFinalizedInput](#clearfinalizedinput)
113-
* [Parameters](#parameters-31)
119+
* [Parameters](#parameters-33)
114120
* [writePush](#writepush)
115-
* [Parameters](#parameters-32)
121+
* [Parameters](#parameters-34)
116122
* [PsbtV2](#psbtv2)
117123
* [serializeTransactionOutputs](#serializetransactionoutputs-1)
118-
* [Parameters](#parameters-33)
119-
* [Examples](#examples-9)
124+
* [Parameters](#parameters-35)
125+
* [Examples](#examples-11)
120126
* [SignP2SHTransactionArg](#signp2shtransactionarg)
121127
* [Properties](#properties-2)
122128
* [TransactionInput](#transactioninput)
@@ -353,8 +359,6 @@ and returns v, r, s.
353359
* `$0.path`  
354360
* `$0.withdrawalData`  
355361

356-
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
357-
358362
##### Examples
359363

360364
```javascript
@@ -377,6 +381,31 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
377381
}).catch(function(ex) {console.log(ex);});
378382
```
379383

384+
#### signERC4361Message
385+
386+
Signs an Ethereum Sign-In (ERC-4361) message with the private key at
387+
the provided derivation path according to the Bitcoin Signature format
388+
and returns v, r, s.
389+
390+
##### Parameters
391+
392+
* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
393+
* `messageHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
394+
395+
##### Examples
396+
397+
```javascript
398+
acre.signERC4361Message("44'/60'/0'/0'/0", Buffer.from("Example ERC-4361 message").toString("hex")).then(function(result) {
399+
const v = result['v'] + 27 + 4;
400+
const signature = Buffer.from(v.toString(16) + result['r'] + result['s'], 'hex').toString('base64');
401+
console.log("Signature : " + signature);
402+
}).catch(function(ex) {console.log(ex);});
403+
```
404+
405+
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
406+
407+
**Note:** The message is restricted to maximum 128 character lines.
408+
380409
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
381410

382411

@@ -492,27 +521,28 @@ and returns v, r, s.
492521

493522
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
494523

495-
### descrTemplFrom
524+
#### signERC4361Message
496525

497-
This function returns a descriptor template based on the address format.
498-
See <https://github.com/blooo-io/app-acre/blob/develop/doc/wallet.md> for details of
499-
the bitcoin descriptor template.
526+
Signs an ERC-4361 (Sign-In with Ethereum) formatted message with the private key at
527+
the provided derivation path according to the Bitcoin Signature format
528+
and returns v, r, s.
500529

501-
#### Parameters
530+
##### Parameters
502531

503-
* `addressFormat` **[AddressFormat](#addressformat)**&#x20;
532+
* `$0` **{path: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), messageHex: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}**
504533

505-
Returns **DefaultDescriptorTemplate**&#x20;
534+
* `$0.path` The BIP32 derivation path of the key to use for signing
535+
* `$0.messageHex` The ERC-4361 formatted message to sign, in hexadecimal format
506536

507-
### AcreBtcOld
537+
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
508538

509-
This old API is compatible with versions of the Bitcoin nano app that are earlier than 2.1.0 .
510-
It is never used by Acre, that is based on the latest Bitcoin nano app (2.1.0+).
511-
This class is kept for compatibility purposes.
539+
### descrTemplFrom
512540

513-
#### getWalletPublicKey
541+
This function returns a descriptor template based on the address format.
542+
See <https://github.com/blooo-io/app-acre/blob/develop/doc/wallet.md> for details of
543+
the bitcoin descriptor template.
514544

515-
##### Parameters
545+
#### Parameters
516546

517547
* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a BIP 32 path
518548
* `opts` **{verify: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, format: [AddressFormat](#addressformat)?}?**&#x20;

0 commit comments

Comments
 (0)