mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-30 00:55:49 +00:00
Update sign docs with more info about keypairs (#1523)
* Add links to how to derive keypairs and examples of keypairs to the 'sign' docs
This commit is contained in:
@@ -5659,8 +5659,8 @@ Name | Type | Description
|
|||||||
---- | ---- | -----------
|
---- | ---- | -----------
|
||||||
txJSON | string | Transaction represented as a JSON string in rippled format.
|
txJSON | string | Transaction represented as a JSON string in rippled format.
|
||||||
keypair | object | *Optional* The private and public key of the account that is initiating the transaction. (This field cannot be used with secret).
|
keypair | object | *Optional* The private and public key of the account that is initiating the transaction. (This field cannot be used with secret).
|
||||||
*keypair.* privateKey | privateKey | The uppercase hexadecimal representation of the secp256k1 or Ed25519 private key.
|
*keypair.* privateKey | privateKey | The uppercase hexadecimal representation of the secp256k1 or Ed25519 private key. Ed25519 keys are prefixed with 0xED. You can read about how keys are derived [here](https://xrpl.org/cryptographic-keys.html).
|
||||||
*keypair.* publicKey | publicKey | The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key.
|
*keypair.* publicKey | publicKey | The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key. Ed25519 keys are prefixed with 0xED. You can read about how keys are derived [here](https://xrpl.org/cryptographic-keys.html).
|
||||||
options | object | *Optional* Options that control the type of signature to create.
|
options | object | *Optional* Options that control the type of signature to create.
|
||||||
*options.* signAs | [address](#address) | *Optional* The account that the signature should count for in multisigning.
|
*options.* signAs | [address](#address) | *Optional* The account that the signature should count for in multisigning.
|
||||||
secret | secret string | *Optional* The secret of the account that is initiating the transaction. (This field cannot be used with keypair).
|
secret | secret string | *Optional* The secret of the account that is initiating the transaction. (This field cannot be used with keypair).
|
||||||
@@ -5695,6 +5695,19 @@ return api.sign(txJSON, secret); // or: api.sign(txJSON, keypair);
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Example Keypairs
|
||||||
|
|
||||||
|
To learn how keypairs are derived read [here](https://xrpl.org/cryptographic-keys.html#generating-keys).
|
||||||
|
```javascript
|
||||||
|
// secp25519 (33 bytes)
|
||||||
|
const privateKey = "002512BBDFDBB77510883B7DCCBEF270B86DEAC8B64AC762873D75A1BEE6298665"
|
||||||
|
const publicKey = "0390A196799EE412284A5D80BF78C3E84CBB80E1437A0AECD9ADF94D7FEAAFA284"
|
||||||
|
|
||||||
|
// ed25519 (Note the 0xED prefixes a 32 byte value for a total of 33 bytes)
|
||||||
|
const privateKey = "ED0B6CBAC838DFE7F47EA1BD0DF00EC282FDF45510C92161072CCFB84035390C4D"
|
||||||
|
const publicKey = "ED1A7C082846CFF58FF9A892BA4BA2593151CCF1DBA59F37714CC9ED39824AF85F"
|
||||||
|
```
|
||||||
|
|
||||||
### Example (multi-signing)
|
### Example (multi-signing)
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@@ -5746,7 +5759,7 @@ const multiSignPaymentTransaction = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const multiSignPaymentInstruction = {
|
const multiSignPaymentInstruction = {
|
||||||
signersCount: 2
|
signersCount: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
const api = new RippleAPI({
|
const api = new RippleAPI({
|
||||||
|
|||||||
@@ -35,6 +35,19 @@ return api.sign(txJSON, secret); // or: api.sign(txJSON, keypair);
|
|||||||
|
|
||||||
<%- renderFixture("responses/sign.json") %>
|
<%- renderFixture("responses/sign.json") %>
|
||||||
|
|
||||||
|
### Example Keypairs
|
||||||
|
|
||||||
|
To learn how keypairs are derived read [here](https://xrpl.org/cryptographic-keys.html#generating-keys).
|
||||||
|
```javascript
|
||||||
|
// secp25519 (33 bytes)
|
||||||
|
const privateKey = "002512BBDFDBB77510883B7DCCBEF270B86DEAC8B64AC762873D75A1BEE6298665"
|
||||||
|
const publicKey = "0390A196799EE412284A5D80BF78C3E84CBB80E1437A0AECD9ADF94D7FEAAFA284"
|
||||||
|
|
||||||
|
// ed25519 (Note the 0xED prefixes a 32 byte value for a total of 33 bytes)
|
||||||
|
const privateKey = "ED0B6CBAC838DFE7F47EA1BD0DF00EC282FDF45510C92161072CCFB84035390C4D"
|
||||||
|
const publicKey = "ED1A7C082846CFF58FF9A892BA4BA2593151CCF1DBA59F37714CC9ED39824AF85F"
|
||||||
|
```
|
||||||
|
|
||||||
### Example (multi-signing)
|
### Example (multi-signing)
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|||||||
@@ -17,11 +17,11 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"privateKey": {
|
"privateKey": {
|
||||||
"type": "privateKey",
|
"type": "privateKey",
|
||||||
"description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 private key."
|
"description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 private key. Ed25519 keys are prefixed with 0xED. You can read about how keys are derived [here](https://xrpl.org/cryptographic-keys.html)."
|
||||||
},
|
},
|
||||||
"publicKey": {
|
"publicKey": {
|
||||||
"type": "publicKey",
|
"type": "publicKey",
|
||||||
"description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key."
|
"description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key. Ed25519 keys are prefixed with 0xED. You can read about how keys are derived [here](https://xrpl.org/cryptographic-keys.html)."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": "The private and public key of the account that is initiating the transaction. (This field cannot be used with secret).",
|
"description": "The private and public key of the account that is initiating the transaction. (This field cannot be used with secret).",
|
||||||
|
|||||||
Reference in New Issue
Block a user