libed

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 8 Imported by: 0

README

LIBED

libed is a golang lib to encrypt and decrypt data.

How to use

Data example

  type DataModel struct {
		Message string `json:"message"`
	}
	req := DataModel{
		Message: "Hi",
	}
  
	data, err := json.Marshal(req)
	if err != nil {
    return err
  }

Encrypt

	enc, err := GCMEncrypter(data, "key_secret")
	if err != nil {
    return err
  }
	fmt.Println(enc) // q8rBym7n5C8DRenLoRbuM9GXCbOlwvfoIwnrTFJmbmUYbX+8RzLA2uNqH8k=

Decrypt

  var res DataModel
  err = GCMDecrypter(enc, "key_secret", &res)
  if err != nil {
    return err
  }
  fmt.Println(res.Message) // Hi

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GCMDecrypter

func GCMDecrypter(data, passphrase string, res interface{}) error

GCMDecrypter is used to ...

func GCMEncrypter

func GCMEncrypter(data []byte, passphrase string) (string, error)

GCMEncrypter is ...

Types

This section is empty.

Jump to

Keyboard shortcuts

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