Avocado SDK encrypt with RSA keys a values to be store in the key-value store.
To start using Avocado SDK, install Go and run go get command as a follow
go get github.com/lorenzodisidoro/avocado-sdk
To use SDK methods import in your GO file
import sdk "github.com/lorenzodisidoro/avocado-sdk"
Create the storage configuration
storage := &sdk.StorageClient{
Bbolt: &sdk.BboltStorage{
SotoragePath: "./mybolt.db",
BucketName: "test",
},
}
storage := &StorageClient{
Redis: &RedisStorage{
Address: "localhost:6379",
Password: "", // no password set
DB: 0, // use default DB
},
}
Create a new SDK instance
avocado := sdk.Avocado{}
err := avocado.New(storage)
if err != nil {
return err
}
Value can be encrypted and stored using the following methods
encryptedValue, err := avocado.EecryptAndStoreValue([]byte("key1"), []byte("my value"), "/path/to/my_public_key.pem")
decryptedValue, err := avocado.FindAndDecryptValueBy([]byte("key1"), "/path/to/my_private_key.pem")
keys, err := avocado.GetAllKeys()
err := avocado.Delete([]byte("key1"))