Documentation ¶
Overview ¶
Package security provides functions for group authentication and HMAC encryption/decryption
Index ¶
- func AuthenticateGroup(group string, key string, groups *[]config.SecurityGroups) (authenticated bool)
- func DecodeHMAC(key string, encodedmessage []byte, verifyTimeout int64) (decodedMessage string, err error)
- func EncodeHMAC(key string, rawmessage string, timestamp string) (encodedmessage []byte, err error)
- func GetKeyFromGroup(group string, groups *[]config.SecurityGroups) (key string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateGroup ¶
func AuthenticateGroup(group string, key string, groups *[]config.SecurityGroups) (authenticated bool)
AuthenticateGroup takes a group name, the key they've submitted, and Config's groups+keys. If the key & group received match a group within Config, return true (authentic). If no match is found, return false.
func DecodeHMAC ¶
func DecodeHMAC(key string, encodedmessage []byte, verifyTimeout int64) (decodedMessage string, err error)
DecodeHMAC takes an hmac key and the ciphered message []byte they would like to decode. It matches the key with the group, then encodes the message using that key. It returns the decoded message as a string or an error. A message must be decoded within the timeout threshold (default is 30 seconds) of when it was encoded.
func EncodeHMAC ¶
EncodeHMAC takes * An hmac key * The raw string they would like to encode * The current timestamp (a payload with a timestamp of greater than or less than the timeout threshold (default is 30 seconds) will not be decrypted.) It encodes the message using the key. It returns an encrypted message []byte or an error. A message must be decoded within the timeout threshold (default of 30 seconds) of when it was encoded.
func GetKeyFromGroup ¶
func GetKeyFromGroup(group string, groups *[]config.SecurityGroups) (key string, err error)
GetKeyFromGroup takes a group name and a pointer to array of groups. It returns the matching hmac key
Types ¶
This section is empty.