Skip to content

Instantly share code, notes, and snippets.

@thiagozs
Created September 21, 2023 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagozs/3d375712e0a1cea70edd301999506f13 to your computer and use it in GitHub Desktop.
Save thiagozs/3d375712e0a1cea70edd301999506f13 to your computer and use it in GitHub Desktop.
Paseto secret external Hex
package main
import (
"fmt"
"aidanwoods.dev/go-paseto"
)
func main() {
secretKey := paseto.NewV4AsymmetricSecretKey() // don't share this!!!
publicKey := secretKey.Public() // DO share this one
fmt.Println("Gen SecretKey:", secretKey.ExportHex())
fmt.Println("Gen PublicKey:", publicKey.ExportHex())
secret, err := paseto.NewV4AsymmetricSecretKeyFromHex(secretKey.ExportHex())
if err != nil {
fmt.Println("Error NewV4AsymmetricSecretKeyFromHex:", err)
return
}
fmt.Println("Secret:", secret.ExportHex())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment