/ scripts / generate-passphrase.js
generate-passphrase.js
 1  /*!
 2   * scripts/generate_passphrase.js
 3   * Copyright © 2019 – Katana Cryptographic Ltd. All Rights Reserved.
 4   */
 5  
 6  
 7  import crypto from 'crypto'
 8  
 9  
10  /**
11   * Script generating a strong random string (256-bits of entropy)
12   * Useful for the generation of a strong api key or oa strong jwt secret (see /keys/index-example.js).
13   */
14  
15  function run() {
16      const secret = crypto.randomBytes(32).toString('hex')
17      console.log(`Generated secret = ${secret}`)
18  }
19  
20  
21  /**
22   * Launch the script
23   */
24  run()
25