@@ -57,66 +57,72 @@ For a smooth and quick integration:
57
57
* [ Parameters] ( #parameters-9 )
58
58
* [ signWithdrawal] ( #signwithdrawal )
59
59
* [ Parameters] ( #parameters-10 )
60
+ * [ Examples] ( #examples-7 )
61
+ * [ signERC4361Message] ( #signerc4361message )
62
+ * [ Parameters] ( #parameters-11 )
63
+ * [ Examples] ( #examples-8 )
60
64
* [ AcreBtcNew] ( #acrebtcnew )
61
65
* [ getWalletXpub] ( #getwalletxpub-1 )
62
- * [ Parameters] ( #parameters-11 )
63
- * [ getWalletPublicKey] ( #getwalletpublickey-1 )
64
66
* [ Parameters] ( #parameters-12 )
65
- * [ createPaymentTransaction ] ( #createpaymenttransaction -1 )
67
+ * [ getWalletPublicKey ] ( #getwalletpublickey -1 )
66
68
* [ Parameters] ( #parameters-13 )
67
- * [ signMessage ] ( #signmessage -1 )
69
+ * [ createPaymentTransaction ] ( #createpaymenttransaction -1 )
68
70
* [ Parameters] ( #parameters-14 )
69
- * [ signWithdrawal ] ( #signwithdrawal -1 )
71
+ * [ signMessage ] ( #signmessage -1 )
70
72
* [ Parameters] ( #parameters-15 )
73
+ * [ signWithdrawal] ( #signwithdrawal-1 )
74
+ * [ Parameters] ( #parameters-16 )
75
+ * [ signERC4361Message] ( #signerc4361message-1 )
76
+ * [ Parameters] ( #parameters-17 )
71
77
* [ descrTemplFrom] ( #descrtemplfrom )
72
- * [ Parameters] ( #parameters-16 )
78
+ * [ Parameters] ( #parameters-18 )
73
79
* [ AcreBtcOld] ( #acrebtcold )
74
80
* [ getWalletPublicKey] ( #getwalletpublickey-2 )
75
- * [ Parameters] ( #parameters-17 )
76
- * [ Examples] ( #examples-7 )
81
+ * [ Parameters] ( #parameters-19 )
82
+ * [ Examples] ( #examples-9 )
77
83
* [ createPaymentTransaction] ( #createpaymenttransaction-2 )
78
- * [ Parameters] ( #parameters-18 )
79
- * [ Examples] ( #examples-8 )
84
+ * [ Parameters] ( #parameters-20 )
85
+ * [ Examples] ( #examples-10 )
80
86
* [ CreateTransactionArg] ( #createtransactionarg )
81
87
* [ Properties] ( #properties )
82
88
* [ AddressFormat] ( #addressformat )
83
89
* [ AcreWithdrawalData] ( #acrewithdrawaldata )
84
90
* [ Properties] ( #properties-1 )
85
91
* [ AccountType] ( #accounttype )
86
92
* [ spendingCondition] ( #spendingcondition )
87
- * [ Parameters] ( #parameters-19 )
93
+ * [ Parameters] ( #parameters-21 )
88
94
* [ setInput] ( #setinput )
89
- * [ Parameters] ( #parameters-20 )
95
+ * [ Parameters] ( #parameters-22 )
90
96
* [ setOwnOutput] ( #setownoutput )
91
- * [ Parameters] ( #parameters-21 )
97
+ * [ Parameters] ( #parameters-23 )
92
98
* [ getDescriptorTemplate] ( #getdescriptortemplate )
93
99
* [ SingleKeyAccount] ( #singlekeyaccount )
94
100
* [ getTaprootOutputKey] ( #gettaprootoutputkey )
95
- * [ Parameters] ( #parameters-22 )
101
+ * [ Parameters] ( #parameters-24 )
96
102
* [ AppClient] ( #appclient )
97
- * [ Parameters] ( #parameters-23 )
103
+ * [ Parameters] ( #parameters-25 )
98
104
* [ ClientCommandInterpreter] ( #clientcommandinterpreter )
99
- * [ Parameters] ( #parameters-24 )
105
+ * [ Parameters] ( #parameters-26 )
100
106
* [ MerkelizedPsbt] ( #merkelizedpsbt )
101
- * [ Parameters] ( #parameters-25 )
107
+ * [ Parameters] ( #parameters-27 )
102
108
* [ Merkle] ( #merkle )
103
- * [ Parameters] ( #parameters-26 )
109
+ * [ Parameters] ( #parameters-28 )
104
110
* [ MerkleMap] ( #merklemap )
105
- * [ Parameters] ( #parameters-27 )
111
+ * [ Parameters] ( #parameters-29 )
106
112
* [ WalletPolicy] ( #walletpolicy )
107
- * [ Parameters] ( #parameters-28 )
113
+ * [ Parameters] ( #parameters-30 )
108
114
* [ extract] ( #extract )
109
- * [ Parameters] ( #parameters-29 )
115
+ * [ Parameters] ( #parameters-31 )
110
116
* [ finalize] ( #finalize )
111
- * [ Parameters] ( #parameters-30 )
117
+ * [ Parameters] ( #parameters-32 )
112
118
* [ clearFinalizedInput] ( #clearfinalizedinput )
113
- * [ Parameters] ( #parameters-31 )
119
+ * [ Parameters] ( #parameters-33 )
114
120
* [ writePush] ( #writepush )
115
- * [ Parameters] ( #parameters-32 )
121
+ * [ Parameters] ( #parameters-34 )
116
122
* [ PsbtV2] ( #psbtv2 )
117
123
* [ serializeTransactionOutputs] ( #serializetransactionoutputs-1 )
118
- * [ Parameters] ( #parameters-33 )
119
- * [ Examples] ( #examples-9 )
124
+ * [ Parameters] ( #parameters-35 )
125
+ * [ Examples] ( #examples-11 )
120
126
* [ SignP2SHTransactionArg] ( #signp2shtransactionarg )
121
127
* [ Properties] ( #properties-2 )
122
128
* [ TransactionInput] ( #transactioninput )
@@ -353,8 +359,6 @@ and returns v, r, s.
353
359
* ` $0.path `   ;
354
360
* ` $0.withdrawalData `   ;
355
361
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 ) }>**   ;
357
-
358
362
##### Examples
359
363
360
364
``` javascript
@@ -377,6 +381,31 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
377
381
}).catch (function (ex ) {console .log (ex);});
378
382
```
379
383
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 ) **   ;
393
+ * ` messageHex ` ** [ string] ( https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String ) **   ;
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 ) }>**   ;
406
+
407
+ ** Note:** The message is restricted to maximum 128 character lines.
408
+
380
409
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 ) }>**   ;
381
410
382
411
@@ -492,27 +521,28 @@ and returns v, r, s.
492
521
493
522
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 ) }>**   ;
494
523
495
- ### descrTemplFrom
524
+ #### signERC4361Message
496
525
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 .
500
529
501
- #### Parameters
530
+ ##### Parameters
502
531
503
- * ` addressFormat ` ** [ AddressFormat ] ( #addressformat ) ** &#x 20 ;
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 ) } **
504
533
505
- Returns ** DefaultDescriptorTemplate**   ;
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
506
536
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 ) }> ** &#x 20 ;
508
538
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
512
540
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.
514
544
515
- ##### Parameters
545
+ #### Parameters
516
546
517
547
* ` path ` ** [ string] ( https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String ) ** a BIP 32 path
518
548
* ` opts ` ** {verify: [ boolean] ( https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean ) ?, format: [ AddressFormat] ( #addressformat ) ?}?**   ;
0 commit comments