Categorygithub.com/Scalingo/go-utils/security
modulepackage
1.0.0
Repository: https://github.com/scalingo/go-utils.git
Documentation: pkg.go.dev

# README

Security Tooling v1.0.0

The package github.com/Scalingo/go-utils/security aims at providing common security helpers (e.g. token generation).

Token Manager

// Generate a time-limited token hashed with HMAC-SHA256 for the given payload.
tokenManager, _ := NewTokenManager("MY SECRET", 6 * time.Hour)
token, _ := tokenManager.GenerateToken(ctx, "payload to hash")

// Check that a hash is valid
tokenManager.CheckToken(ctx, "1663333454", "payload to hash", "a user-provided hash")

# Packages

Package securitymock is a generated GoMock package.

# Functions

NewTokenManager instantiates a new TokenGenerator with the given token configuration: - tokenSecretKey: secret to generate the token.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Token contains a hashed payload generated at a specific time.
No description provided by the author

# Interfaces

TokenChecker checks if a given payload matches a user-provided hash.
TokenGenerator lets you generate a Token.