fix: operator id fetching on scripts

This commit is contained in:
Rafael Taranto 2019-11-20 13:02:06 +00:00 committed by Josh Harvey
parent 07f4bdfb66
commit 0fd0d21599
3 changed files with 13 additions and 12 deletions

View file

@ -13,5 +13,5 @@ if (process.argv.length !== 4) {
process.exit(3)
}
const masterSeed = new Buffer(masterSeedHex, 'hex')
const masterSeed = Buffer.from(masterSeedHex, 'hex')
console.log(hkdf(masterSeed, 32, { salt: 'lamassu-server-salt', info: label }).toString('hex'))

View file

@ -1,7 +1,5 @@
#!/usr/bin/env bash
SEED="$(cat ~/seeds/seed.txt)"
echo
echo "Here is the 'External ID' of your paired machine(s), for use under the 'ATM / Teller details' of your CoinATMRadar listing:"
echo
@ -9,5 +7,5 @@ su - postgres -c "psql \"lamassu\" -Atc \"select regexp_replace(device_id, '$',
echo
echo "If speaking with CoinATMRadar directly, it may be helpful to let them know your 'Operator ID':"
echo
$(npm root -g)/lamassu-server/bin/hkdf operator-id "$SEED" | cut -c -32
$(npm root -g)/lamassu-server/bin/lamassu-operator
echo

View file

@ -1,9 +1,12 @@
#!/usr/bin/env bash
#!/usr/bin/env node
SEED="$(cat ~/seeds/seed.txt)"
const fs = require('fs')
const hkdf = require('futoin-hkdf')
echo
echo "Your Operator ID for use with CoinATMRadar is:"
echo
/usr/bin/hkdf operator-id "$SEED" | cut -c -32
echo
const options = require('../lib/options')
const mnemonicHelpers = require('../lib/mnemonic-helpers')
const mnemonic = fs.readFileSync(options.mnemonicPath, 'utf8').trim()
const masterSeed = mnemonicHelpers.toEntropyBuffer(mnemonic)
console.log(hkdf(masterSeed, 16, { salt: 'lamassu-server-salt', info: 'operator-id' }).toString('hex'))