+30
scripts/setup.js
+30
scripts/setup.js
···
10
10
*/
11
11
12
12
import { webcrypto } from 'crypto'
13
+
import { writeFileSync } from 'fs'
13
14
14
15
// === ARGUMENT PARSING ===
15
16
···
388
389
return true
389
390
}
390
391
392
+
// === CREDENTIALS OUTPUT ===
393
+
394
+
function saveCredentials(filename, credentials) {
395
+
writeFileSync(filename, JSON.stringify(credentials, null, 2))
396
+
}
397
+
391
398
// === MAIN ===
392
399
393
400
async function main() {
···
440
447
console.log(' Relay notified!')
441
448
}
442
449
console.log('')
450
+
451
+
// Step 6: Save credentials
452
+
const credentials = {
453
+
handle: fullHandle,
454
+
did,
455
+
privateKeyHex: bytesToHex(keyPair.privateKey),
456
+
didKey,
457
+
pdsUrl: opts.pds,
458
+
createdAt: new Date().toISOString()
459
+
}
460
+
461
+
const credentialsFile = `./credentials-${opts.handle}.json`
462
+
saveCredentials(credentialsFile, credentials)
463
+
464
+
// Final output
465
+
console.log('Setup Complete!')
466
+
console.log('===============')
467
+
console.log(`Handle: ${fullHandle}`)
468
+
console.log(`DID: ${did}`)
469
+
console.log(`PDS: ${opts.pds}`)
470
+
console.log('')
471
+
console.log(`Credentials saved to: ${credentialsFile}`)
472
+
console.log('Keep this file safe - it contains your private key!')
443
473
}
444
474
445
475
main().catch(err => {