All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gu.play.secretrotation.SecretGenerator.scala Maven / Gradle / Ivy

There is a newer version: 13.0.0
Show newest version
package com.gu.play.secretrotation

import java.security.SecureRandom

object SecretGenerator {

  /**
    * Copied from play.sbt.ApplicationSecretGenerator#generateSecret ...we could
    * have just introduced that as a dependency, but might as well reduce the
    * size of the AWS Lambda jar...
    * @return 64-character play secret
    */
  def generateSecret = {
    val random = new SecureRandom()

    (1 to 64).map { _ =>
      (random.nextInt(75) + 48).toChar
    }.mkString.replaceAll("\\\\+", "/")
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy