mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
Set Up Secure Signing: edits per reviews
- Moved the LAN config tutorial to its own (draft) file to be finished later - Mentioned dedicated signing devices such as the Ledger Nano S - Improved the JS example's handling of secrets
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
'use strict'
|
||||
const RippleAPI = require('ripple-lib').RippleAPI
|
||||
|
||||
// Load address & secret from environment variables:
|
||||
const from_address = process.env['MY_ADDRESS']
|
||||
const secret = process.env['MY_SECRET']
|
||||
|
||||
// Can sign offline if the txJSON has all required fields
|
||||
const api = new RippleAPI()
|
||||
|
||||
const txJSON = '{"Account":"rBXsgNkPcDN2runsvWmwxk3Lh97zdgo9za", \
|
||||
"TransactionType":"Payment", \
|
||||
"Destination":"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", \
|
||||
"Amount":"13000000", \
|
||||
"Flags":2147483648, \
|
||||
"LastLedgerSequence":7835923, \
|
||||
"Fee":"13", \
|
||||
"Sequence":2}'
|
||||
|
||||
// Be careful where you store your real secret.
|
||||
const secret = 's████████████████████████████'
|
||||
const txJSON = JSON.stringify({
|
||||
"Account": from_address,
|
||||
"TransactionType":"Payment",
|
||||
"Destination":"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Amount":"13000000",
|
||||
"Flags":2147483648,
|
||||
"LastLedgerSequence":7835923,
|
||||
"Fee":"13",
|
||||
"Sequence":2
|
||||
})
|
||||
|
||||
const signed = api.sign(txJSON, secret)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user