crypto

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package crypto is corresponding Go package for libindy's anoncreds namespace. We suggest that you read indy SDK documentation for more information. Unfortunately the documentation during the writing of this package was minimal to nothing. We suggest you do the same as we did, read the rust code if more detailed information is needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnonCrypt

func AnonCrypt(recipientKey string, msg []byte) ctx.Channel

AnonCrypt encrypts the msg according the recipientKey

func AnonDecrypt

func AnonDecrypt(wallet int, recipientKey string, msg []byte) ctx.Channel

AnonDecrypt decrypts the msg according the recipientKey

func AuthCrypt

func AuthCrypt(wallet int, senderKey, recipientKey string, msg []byte) ctx.Channel

AuthCrypt encrypts and sings the msg.

func AuthDecrypt

func AuthDecrypt(wallet int, recipientKey string, msg []byte) ctx.Channel

AuthDecrypt decrypts and verifies the msg.

func Pack

func Pack(wallet int, senderKey string, msg []byte, recipientKeys ...string) ctx.Channel

Pack encrypts and packs the original byte message to recipients and if sender key is set (use findy.NullString) signs it too. This is indy SDK Go wrapper.

func PackMessage

func PackMessage(wallet int, recipientKeysJSON, senderKey string, msg []byte) ctx.Channel

PackMessage encrypts and packs the original byte message to recipients and if sender key is set (use findy.NullString) signs it too. This is indy SDK Go wrapper.

func SignMsg

func SignMsg(wallet int, signerVerKey string, msg []byte) ctx.Channel

SignMsg signs a message with a verification key.

func UnpackMessage

func UnpackMessage(wallet int, msg []byte) ctx.Channel

UnpackMessage is a Go wrapper for same name indy SDK function to decrypt messages packed with PackMessage.

func VerifySignature

func VerifySignature(signerVerKey string, msg, sig []byte) ctx.Channel

VerifySignature verifies message's signature with a given verification key.

Types

type Unpacked

type Unpacked struct {
	Message         string `json:"message"`
	RecipientVerkey string `json:"recipient_verkey"`
	SenderVerkey    string `json:"sender_verkey"`
}

Unpacked is a helper struct to wrap json type UnpackMessage function is returning.

func NewUnpacked

func NewUnpacked(msg []byte) *Unpacked

NewUnpacked creates a new instance of Unpacked helper wrapper of UnpackMessage function's result.

func (*Unpacked) Bytes

func (msg *Unpacked) Bytes() []byte

Bytes returns the actual decrypted message inside the Unpacked structure and inside of Message field.

type Unpacking

type Unpacking struct {
	Unpacked
	// contains filtered or unexported fields
}

Unpacking is lazy fetch helper for UnpackMessage async method.

func NewUnpacking

func NewUnpacking(w int, msg []byte) *Unpacking

NewUnpacking inits Unpacking struct correctly i.e., it calls UnpackMessage which is async method. This makes Unpacking a lazy fetch helper. The result will be fetched with Bytes() method.

func (*Unpacking) Bytes

func (up *Unpacking) Bytes() (bytes []byte, err error)

Bytes returns previously started unpacking result bytes. Note! it's mandatory first call NewUnpacking() to start unpacking correctly.

Jump to

Keyboard shortcuts

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