Skip to content

Commit

Permalink
fix: print station-id logs to stderr (#431)
Browse files Browse the repository at this point in the history
stdout is reserved for JSON-formatted activity-log events

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
  • Loading branch information
bajtos authored Apr 29, 2024
1 parent 6e082e9 commit 2b2b649
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/station-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function getStationId ({ secretsDir, passphrase }) {

try {
const keypair = await loadKeypair(keystore, passphrase)
console.log('Loaded Station ID: %s', keypair.publicKey)
console.error('Loaded Station ID: %s', keypair.publicKey)
return keypair
} catch (err) {
if (err.code === 'ENOENT' && err.path === keystore) {
Expand Down Expand Up @@ -84,7 +84,7 @@ async function tryUpgradePlaintextToCiphertext (passphrase, keystore, maybeCiphe

// re-create the keypair file with encrypted keypair
await storeKeypair(passphrase, keystore, keypair)
console.log('Encrypted the Station ID file using the provided PASSPHRASE.')
console.error('Encrypted the Station ID file using the provided PASSPHRASE.')
return keypair
}
/**
Expand Down Expand Up @@ -120,7 +120,7 @@ async function generateKeypair (keystore, passphrase) {
)
const publicKey = Buffer.from(await subtle.exportKey('spki', keyPair.publicKey)).toString('hex')
const privateKey = Buffer.from(await subtle.exportKey('pkcs8', keyPair.privateKey)).toString('hex')
console.log('Generated a new Station ID:', publicKey)
console.error('Generated a new Station ID:', publicKey)
await storeKeypair(passphrase, keystore, { publicKey, privateKey })
return { publicKey, privateKey }
}
Expand Down

0 comments on commit 2b2b649

Please sign in to comment.