Skip to content

Gunga-D/object-encrypter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-object-encrypter

build status

Implementation of node js library object encrypter on golang

Install

go get github.com/Gunga-D/object-encrypter

API

The same as ORIGINAL.

Encrypter

The Encrypter is interface of node js object encrypter(secret, options)

Create an instance of encrypter by constructor NewEncrypter(passphrase string) Encrypter. The passphrase could be string.

Important: passphrase not limited by length.

.Decrypt(rawText, obj, encoding)

Decrypt returns the encoding of obj like json Unmarshal method.

rawText is encoded utf-8 text that will be parsed to the struct obj.

encoding is binary method to parse the input rawText.

Example

package main

import (
	oe "github.com/Gunga-D/object-encrypter"	
)

type User struct {
	Name string `json:"name"`
}

func main() {
	ins := oe.NewEncrypter("123467")
	var u User
	err := ins.Decrypt("67384", &u, nil)
	if err != nil {
		panic(err)
	}
}

(c) 2023 Gunga Dondokov

About

Implementation of node js library object encrypter on golang

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages