Documentation
¶
Index ¶
- type AppConfig
- func (conf *AppConfig) CheckSignMsg(token, oldSign []byte) (bool, error)
- func (conf *AppConfig) ComparePassAndHash(password string) error
- func (conf *AppConfig) CreateSignedToken(uc *UserClaims) (string, error)
- func (conf *AppConfig) DecodingBase64(encodedStr string) ([]byte, error)
- func (conf *AppConfig) EncodingBase64(encoding *base64.Encoding, msg string) string
- func (conf *AppConfig) EncryptSHA256File(filepath string) ([]byte, error)
- func (conf *AppConfig) GenerateHash(password string) error
- func (conf *AppConfig) HmacSigToken(token []byte) ([]byte, error)
- func (conf *AppConfig) KeyGenerator()
- func (conf *AppConfig) ParseSignedToken(signedToken string) (*UserClaims, error)
- func (conf *AppConfig) UUIDKeyGenerator()
- type HmacConfig
- type JwtConfig
- type UserClaims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct {
HashPassword []byte
Key []byte
Cost int
HmacConf *HmacConfig
Rnd *rand.Rand
JwtConf *JwtConfig
Base64Encoder *base64.Encoding
}
AppConfig use for holding the Application configuration
func (*AppConfig) CheckSignMsg ¶
CheckSignMsg use for checking the sign of received token with existing token
func (*AppConfig) ComparePassAndHash ¶
ComparePassAndHash for comparing hashPass and password
func (*AppConfig) CreateSignedToken ¶
func (conf *AppConfig) CreateSignedToken(uc *UserClaims) (string, error)
CreateSignedToken use for creating JWT token
func (*AppConfig) DecodingBase64 ¶
DecodingBase64 use for decoding our msg to base64 for using alongside of another functionalities
func (*AppConfig) EncodingBase64 ¶
EncodingBase64 use for encoding our msg to base64 for using alongside of another functionalities
func (*AppConfig) EncryptSHA256File ¶
EncryptSHA256File use for encrypting a file with sha256 method
func (*AppConfig) GenerateHash ¶
GenerateHash with bcrypt package
func (*AppConfig) HmacSigToken ¶
HmacSigToken use for sign specific token and then return signed token
func (*AppConfig) KeyGenerator ¶
func (conf *AppConfig) KeyGenerator()
KeyGenerator use for creating the key from bytes storage
func (*AppConfig) ParseSignedToken ¶
func (conf *AppConfig) ParseSignedToken(signedToken string) (*UserClaims, error)
ParseSignedToken use for parsing the signed token to our claims
func (*AppConfig) UUIDKeyGenerator ¶
func (conf *AppConfig) UUIDKeyGenerator()
UUIDKeyGenerator use random bytes that generates by KeyGenerator function then create uuid based on that
type HmacConfig ¶
HmacConfig use for holding the HMAC configurations
type JwtConfig ¶
type JwtConfig struct {
JwtKeyMethod jwt.SigningMethod
}
JwtConfig use for holding the jwt configurations
type UserClaims ¶
type UserClaims struct {
jwt.StandardClaims
SessionID int64
}
UserClaims default claims based on jwt.StandardClaims
func (*UserClaims) Valid ¶
func (u *UserClaims) Valid() error
Valid check the validation for our JWT token