https://github.com/gharib-uk/auth-methods
A package for encrypting and decrypting tokens and messages with Golang
https://github.com/gharib-uk/auth-methods
golang hmac hmac-authentication hmac-sha256 jwt jwt-authentication token
Last synced: 8 months ago
JSON representation
A package for encrypting and decrypting tokens and messages with Golang
- Host: GitHub
- URL: https://github.com/gharib-uk/auth-methods
- Owner: gharib-uk
- License: apache-2.0
- Created: 2021-08-07T07:17:41.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-09T20:52:03.000Z (almost 5 years ago)
- Last Synced: 2025-09-05T17:40:49.643Z (9 months ago)
- Topics: golang, hmac, hmac-authentication, hmac-sha256, jwt, jwt-authentication, token
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Authentication Methods
A package for encrypting and decrypting tokens and messages with Golang.
A layer at the top of other packages for encrypting and decrypting.
***
## HMAC/sha Method
Have to function for using them for signing and checking the validation of token
Also you can define your DataAccess layer everything you want.
***
## JWT Method
Have two handlers for signing and parsing the signed token for getting the claims.
Using Hmac/sha methods that I implemented for HMAC method section.
With creating random key for every token maybe you do not need rotating key.
You can store keys as long as its own expiration date.
```
func (conf *AppConfig) CreateSignedToken(uc *UserClaims) (string, error)
func (conf *AppConfig) ParseSignedToken(signedToken string) (*UserClaims, error)
```
***
## Base64 Method
Use these functionalities for encoding may be URLs or Messages or even
use alongside of JWT method for creating keys or tokens.