asticrypt

package module
v0.0.0-...-2b16230 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2017 License: MIT Imports: 14 Imported by: 2

README

TODO

Documentation

Index

Constants

View Source
const (
	NameAccountAdd   = "account.add"
	NameAccountFetch = "account.fetch"
	NameAccountList  = "account.list"
	NameError        = "error"
	NameReferences   = "references"
)

Body names

Variables

This section is empty.

Functions

This section is empty.

Types

type BodyError

type BodyError struct {
	Label string `json:"label"`
}

BodyError is a body containing an error

func (BodyError) Error

func (b BodyError) Error() string

Error implements the error interface

type BodyKey

type BodyKey struct {
	Key *PublicKey `json:"key,omitempty"`
}

BodyKey is a body containing a key

type BodyMessage

type BodyMessage struct {
	Message *EncryptedMessage `json:"message,omitempty"`
	Key     *PublicKey        `json:"key,omitempty"`
}

BodyMessage is a body containing an encrypted message

func NewBodyMessage

func NewBodyMessage(name string, i interface{}, prvSrc *PrivateKey, pubSrc, pubDst *PublicKey, now time.Time) (b BodyMessage, err error)

NewBodyMessage builds a new body containing an encrypted message and a name

func (*BodyMessage) Decrypt

func (b *BodyMessage) Decrypt(prvSrc *PrivateKey, pubDst *PublicKey, now time.Time) (m BodyMessageIn, err error)

Decrypt decrypts the body containing the message

type BodyMessageIn

type BodyMessageIn struct {
	BodyMessageOut
	Payload json.RawMessage `json:"payload"`
}

BodyMessageIn represents the body of a message coming in

type BodyMessageOut

type BodyMessageOut struct {
	CreatedAt time.Time   `json:"created_at"`
	Name      string      `json:"name"`
	Payload   interface{} `json:"payload"`
}

BodyMessageOut represents the body of a message going out

type BodyReferences

type BodyReferences struct {
	GoogleClientID     string    `json:"google_client_id"`
	GoogleClientSecret string    `json:"google_client_secret"`
	Now                time.Time `json:"now"`
}

BodyReferences represents a body containing references

type EncryptedMessage

type EncryptedMessage struct {
	Hash      []byte `json:"hash,omitempty"`
	IV        []byte `json:"iv,omitempty"`
	Key       []byte `json:"key,omitempty"`
	Message   []byte `json:"message,omitempty"`
	Signature []byte `json:"signature,omitempty"`
}

EncryptedMessage represents an encrypted message

func NewEncryptedMessage

func NewEncryptedMessage(i interface{}, prvSrc *PrivateKey, pubDst *PublicKey) (em *EncryptedMessage, err error)

NewEncryptedMessage encrypts a message

func (EncryptedMessage) Decrypt

func (m EncryptedMessage) Decrypt(o interface{}, prvSrc *PrivateKey, pubDst *PublicKey) (err error)

Decrypt decrypts a message

type PrivateKey

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

PrivateKey represents a marshalable/unmarshalable private key

func GeneratePrivateKey

func GeneratePrivateKey(passphrase string) (p *PrivateKey, err error)

GeneratePrivateKey generates a new private key

func (PrivateKey) Key

func (p PrivateKey) Key() *rsa.PrivateKey

Key returns the *rsa.PrivateKey

func (PrivateKey) MarshalText

func (p PrivateKey) MarshalText() (o []byte, err error)

MarshalText allows PrivateKey to implement the TextMarshaler interface

func (PrivateKey) Public

func (p PrivateKey) Public() *PublicKey

Public returns the *rsa.PublicKey

func (*PrivateKey) Scan

func (p *PrivateKey) Scan(value interface{}) (err error)

Scan implements the Scanner interface

func (*PrivateKey) SetPassphrase

func (p *PrivateKey) SetPassphrase(passphrase string)

SetPassphrase sets the passphrase

func (PrivateKey) String

func (p PrivateKey) String() string

String allows PrivateKey to implement the Stringer interface

func (*PrivateKey) UnmarshalText

func (p *PrivateKey) UnmarshalText(i []byte) (err error)

UnmarshalText allows PrivateKey to implement the TextUnmarshaler interface

type PublicKey

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

PublicKey represents a marshalable/unmarshalable public key

func (PublicKey) Hash

func (p PublicKey) Hash() []byte

Hash hashes the public key

func (PublicKey) Key

func (p PublicKey) Key() *rsa.PublicKey

Key returns the *rsa.PublicKey

func (PublicKey) MarshalText

func (p PublicKey) MarshalText() (o []byte, err error)

MarshalText allows PublicKey to implement the TextMarshaler interface

func (*PublicKey) Scan

func (p *PublicKey) Scan(value interface{}) (err error)

Scan implements the Scanner interface

func (PublicKey) String

func (p PublicKey) String() string

String allows PublicKey to implement the Stringer interface

func (*PublicKey) UnmarshalText

func (p *PublicKey) UnmarshalText(i []byte) (err error)

UnmarshalText allows PublicKey to implement the TextUnmarshaler interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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