Documentation ¶
Index ¶
- func DecryptVerifyToken(encodedCiphertext, keyHex string) (string, error)
- func DecryptWithKey(ciphertext, key, iv []byte) (string, error)
- func EncryptWithKey(plaintext string, key []byte) ([]byte, []byte, error)
- func GenerateDataKeyAWS(kmsClient *kms.KMS, keySpec string) (*kms.GenerateDataKeyOutput, error)
- func GenerateIV(size int) ([]byte, error)
- func GenerateVerifyToken(keyHex string) (string, string, error)
- func Hash(password string) (string, error)
- func InitializeAWSSessionAndKMSClientAWS() (*session.Session, *kms.KMS)
- func IsHashValid(password, hash string) bool
- func RetrieveEncryptionKeyAWS(keyID string) ([]byte, error)
- type AllowedByteSize
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptVerifyToken ¶
func DecryptWithKey ¶
DecryptWithKey decrypts ciphertext using a provided key and IV.
func EncryptWithKey ¶
EncryptWithKey encrypts plaintext using the provided encryption key and returns the ciphertext and IV. It uses AES-GCM mode for encryption.
func GenerateDataKeyAWS ¶
Parameters - keySpec (string): Specify the desired key specification, eg "AES_256" - kmsClient refers to an instance of the AWS Key Management Service (KMS) client
func GenerateIV ¶
GenerateIV generates a random Initialization Vector (IV) with the specified size.
func InitializeAWSSessionAndKMSClientAWS ¶
InitializeAWSSessionAndKMSClient initializes an AWS session and a KMS client.
func IsHashValid ¶
func RetrieveEncryptionKeyAWS ¶
RetrieveEncryptionKey retrieves the encryption key from AWS Key Management Service (KMS) using the specified key ID.
Types ¶
type AllowedByteSize ¶
type AllowedByteSize int
const ( ByteSize18 AllowedByteSize = 18 ByteSize32 AllowedByteSize = 32 ByteSize64 AllowedByteSize = 64 ByteSize128 AllowedByteSize = 128 ByteSize256 AllowedByteSize = 256 )
func (AllowedByteSize) GenerateKey ¶
func (bs AllowedByteSize) GenerateKey() (string, error)
GenerateKey generates a key with the specified byte size