Pre-Requisite:
- Visual Studio Code
- Install Go from https://go.dev/
- Postman app from https://www.postman.com/downloads/
Check Go Configuaration using VS Terminal by running below commands
- go --version
- go env
-
Marshal Sample -- Converting Objects to json
-
Unmarshal Sample -- Converting json to objects
-
Encode and Decode Sample Program
-
Storingpassword Sample Program using bcrypt
-
HMAC Sample - Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198. An HMAC is a cryptographic hash that uses a key to sign a message. The receiver verifies the hash by recomputing it using the same key.
-
HMAC Sample 2- with Client Response and Saved Key in Cookie
-
JWT -
JWT INTRO - https://github.com/golang-jwt/jwt
Hint:
type UserClaims struct { jwt.StandardClaims SessionID int64 } after typing above code run go mod tidy and restart your VS to get the jwt intellisense.to know more about JWT in GoLang visit https://learn.vonage.com/blog/2020/03/13/using-jwt-for-authentication-in-a-golang-application-dr/
for encode and decode jwt tokens vsiit https://jwt.io/
for uuid in goLang download package using go get github.com/gofrs/uuid
-
base64 encode-decode
-
Crypto Sample
-
Crypto Sample - Abstract encrypt writer function
-
HMAC Cookie Sample
-
HMAC Cookie Sample2 -- Logged in and Not
-
JWT Cookie Sample -- Save JWT Token in Cookie and validate authentication.
-
UserLoginRegistration -- Save Password in bcrypt
- Marshal Sample
- UnMarshaling Sample
- Encode and Decode Sample Program
Encode postman Request:
Decode postman Request:
- Storingpassword Sample Program using bcrypt
- HMAC Sample
- HMAC Sample 2
- JWT Sample
- base64 encode-decode
- Crypto Sample
- Crypto Sample - Abstract encrypt writer function
- HMAC Cookie Sample
- HMAC Cookie Sample2 -- Logged in and Not
- JWT Cookie Sample
- UserLoginRegistration