Skip to content

Instantly share code, notes, and snippets.

@ivajloip
Last active August 1, 2016 08:41
Show Gist options
  • Save ivajloip/3d227d64b004b77a4d449e8cd6e1d1ad to your computer and use it in GitHub Desktop.
Save ivajloip/3d227d64b004b77a4d449e8cd6e1d1ad to your computer and use it in GitHub Desktop.
jwt secret obtaining
var privateKey *rsa.PrivateKey
var err error
if autogenerate {
if privateKey, err = rsa.GenerateKey(rand.Reader, 4096); err != nil {
log.Fatal("No jwt secret provided for token generation and auto-generation failed")
}
} else if privateKey, err = jwt.ParseRSAPrivateKeyFromPEM(privateKeyBytes); err != nil {
log.Fatal("Could not parse data from jwt secret")
}
publicKey := &privateKey.PublicKey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment