mcrypt

package
v0.0.0-...-e9f3423 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	// contains filtered or unexported fields
}

func FromURLSafe

func FromURLSafe(encodedKey string) (*Key, error)

FromURLSafe - converting web key representation for key back to native key

func NewKey

func NewKey(id interface{}) *Key

NewKey creates a key with user specificed ID

func NewKeyAutoID

func NewKeyAutoID() *Key

NewKeyAutoID creates a table reference with auto generated ID

func (*Key) Bytes

func (k *Key) Bytes() []byte

Bytes returns key in bytes including the parentId (key must have id before it has Parent)

func (*Key) Equal

func (k *Key) Equal(o *Key) bool

Equal compares keys and determines if the key contents are all equal

func (*Key) Get

func (k *Key) Get() string

Get returns string value of key

func (*Key) SetParent

func (k *Key) SetParent(parent interface{}) (*Key, error)

SetParent sets the parent key of the key

func (*Key) ToURLSafe

func (k *Key) ToURLSafe() string

ToURLSafe - converting key to be representable for web

type KeyConfig

type KeyConfig struct {
	Pub       string `json:"pub"`
	Priv      string `json:"priv"`
	PubC      string `json:"pubC"`
	PrivC     string `json:"privC"`
	Domain    string `json:"domain"`
	SecretKey string `json:"secretKey"`
	// contains filtered or unexported fields
}

KeyConfig for JSON Configuration file (stored under home folder .dtable)

type KeyValue

type KeyValue struct {
	Key   Key
	Value []byte
}

type MCrypt

type MCrypt struct {
	SignPrivKey crypt.PrivKey
	SignPubKey  crypt.PubKey
	EncPrivKey  crypt.PrivCKey
	EncPubKey   crypt.PubCKey
	// contains filtered or unexported fields
}

func GenerateRandomKeys

func GenerateRandomKeys(domain string, outputfilepath string) (*MCrypt, error)

* * Generates a new file with random encryption keys *

func NewMCrypt

func NewMCrypt(pathToJSONKey string) *MCrypt

* * Main class implementing ed25519 cruve25519 and aes256/aes512 encrrytion algorithms *

func (*MCrypt) CreateHandshake

func (mc *MCrypt) CreateHandshake(handshakePrivateKey, handshakeContract string) (*string, error)

* * ! this method should not be used server side. It's mainly to validate VerifyHandshake and for completeness sake * The handshakes are always created client side (check mobile SDK or Javascript SDK) * Creates base64 encoded signature of the contract content *

func (*MCrypt) VerifyMailioHandshake

func (mc *MCrypt) VerifyMailioHandshake(handshakeOwnersPublicKey, handshakeSignature, handshakeContract string) (bool, error)

* * Handshake signature validation * Handshake is a signed contract by the users private key * Contract can be: * - stringified json file * - user address (e.g. mailio address) * - Id reference to a unique public/private contract *

Jump to

Keyboard shortcuts

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