mirror of
https://github.com/btouchard/ackify.git
synced 2026-05-23 09:49:08 -05:00
62f8a56c7a
Add complete Go application for cryptographic document signature validation with OAuth2 authentication, Ed25519 signatures, and PostgreSQL storage following clean architecture principles.
17 lines
335 B
Go
17 lines
335 B
Go
package crypto
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/base64"
|
|
)
|
|
|
|
// GenerateNonce generates a cryptographically secure random nonce
|
|
func GenerateNonce() (string, error) {
|
|
nonceBytes := make([]byte, 16)
|
|
if _, err := rand.Read(nonceBytes); err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return base64.RawURLEncoding.EncodeToString(nonceBytes), nil
|
|
}
|