package
0.0.0-20200202175336-d3be23c7a93b
Repository: https://github.com/hwsc-org/hwsc-lib.git
Documentation: pkg.go.dev
# Functions
ExtractUUID takes in a token string and extracts the UUID from the body.
GenerateEmailIdentification takes the user's uuid and permission to generate an email token for verification.
GenerateExpirationTimestamp returns the expiration date set with addDays parameter.
GenerateSecretKey generates a base64 URL-safe string built from securely generated random bytes.
NewAuthority makes an authority for a service with the required token and permission level.
NewToken generates token string using a header, body, and secret.
ValidateBody validates Body.
ValidateHeader validates Header.
ValidateIdentification validates Identification along with the embedded Secret.
ValidateSecret checks if the secret is still valid and has not expired.
# Constants
Admin is allowed to perform CRUD on everything.
Hs256 use SHA256.
Hs512 use SHA512 for admin level permission.
Jet JSON Email Token.
Jwt JSON Web Token.
NoAlg default zero value.
NoPermission user is not allowed to use the service.
NoType default zero value.
SecretByteSize bytes used to generate secret key.
User is only allowed to use services based on the ownership.
UserRegistration user is not allowed to use the service.
# Variables
AlgorithmMap maps permission level to algorithm type.
AlgorithmStringMap maps enum Algorithm to its string value.
PermissionEnumMap maps string permission values to its enum(int) values.
PermissionStringMap maps Permission enum(int) values to its string values.
TokenTypeStringMap maps enum TokenType to its string value.
# Type aliases
Algorithm is the type of hashing algorithm to use.
Permission required to use the service.
TokenType used for authorization.