encryption-pii

module
v1.5.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2025 License: MIT

README

go-encrypt

This project focuses on encrypting Personally Identifiable Information (PII) using the Go programming language.

Features

  • Encryption and decryption of PII data
  • Easy integration with go applications
Installation
go get github.com/dyaksa/encryption-pii@latest
Upgrade or downgrade with tag version if available
go get github.com/dyaksa/encryption-pii@v.1.0.0

Initialization

To Give key credential .env
CRYPTO_AES_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXX

CRYPTO_HMAC_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXX
To Give Key credential .env for Heap Database
CRYPTO_HEAP_DB_HOST=localhost
CRYPTO_HEAP_DB_PORT=5432
CRYPTO_HEAP_DB_USER=admin
CRYPTO_HEAP_DB_PASSWORD=password
CRYPTO_HEAP_DB_NAME=sandbox_pii

Import library

We need to create a new object by calling the crypto.New

func main() {
    crypto, err := crypto.New(
        crypto.Aes256KeySize,
        crypto.WithInitHeapConnection(),
    )
}

Encrypt Data

Define Struct Data
type Profile struct {
    Name    types.AESCipher
    Nik     types.AESCipher
    Phone   types.AESCipher
    Email   types.AESCipher
}
func main() {
    crypto, err := crypto.New(crypto.Aes256KeySize)

    profile := Profile {
        Name:   crypto.Encrypt("test", aesx.AesCBC)
        Nik:    crypto.Encrypt("123455", aesx.AesCBC)
        Phone   crypto.Encrypt("123455", aesx.AesCBC)
        Email   crypto.Encrypt("123455", aesx.AesCBC)
    }
}

Example

for reference to the use of pii implementation can check (Example)

Contributing

  • Fork the repository.
  • Create a new branch for your feature or bugfix.
  • Commit your changes and push them to your fork.
  • Create a Pull Request describing your changes.

We appreciate all contributions, whether they are documentation improvements, bug fixes, or new features!

Authors

Dyaksa Jauharuddin Nour (Github)

Directories

Path Synopsis
nik

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL