Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: print station-id logs to stderr #431

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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