1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2024-11-21 13:35:49 +02:00

updated security.Encrypt and security.Decrypt docs

This commit is contained in:
Gani Georgiev 2024-03-17 15:42:40 +02:00
parent a5eff395b4
commit be40803d31
2 changed files with 4201 additions and 4193 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,9 @@ import (
"io"
)
// Encrypt encrypts data with key (must be valid 32 char aes key).
// Encrypt encrypts "data" with the specified "key" (must be valid 32 char AES key).
//
// This method uses AES-256-GCM block cypher mode.
func Encrypt(data []byte, key string) (string, error) {
block, err := aes.NewCipher([]byte(key))
if err != nil {
@ -34,7 +36,9 @@ func Encrypt(data []byte, key string) (string, error) {
return result, nil
}
// Decrypt decrypts encrypted text with key (must be valid 32 chars aes key).
// Decrypt decrypts encrypted text with key (must be valid 32 chars AES key).
//
// This method uses AES-256-GCM block cypher mode.
func Decrypt(cipherText string, key string) ([]byte, error) {
block, err := aes.NewCipher([]byte(key))
if err != nil {