ForestAdmin/toolbelt

View on GitHub
src/utils/key-generator.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class KeyGenerator {
  constructor({ assertPresent, crypto }) {
    assertPresent({
      crypto,
    });
    this.crypto = crypto;
    this.length = 24;
  }

  generate() {
    return this.crypto.randomBytes(this.length).toString('hex');
  }
}

module.exports = KeyGenerator;