Documentation ¶
Index ¶
- Constants
- type BodyError
- type BodyKey
- type BodyMessage
- type BodyMessageIn
- type BodyMessageOut
- type BodyReferences
- type EncryptedMessage
- type PrivateKey
- func (p PrivateKey) Key() *rsa.PrivateKey
- func (p PrivateKey) MarshalText() (o []byte, err error)
- func (p PrivateKey) Public() *PublicKey
- func (p *PrivateKey) Scan(value interface{}) (err error)
- func (p *PrivateKey) SetPassphrase(passphrase string)
- func (p PrivateKey) String() string
- func (p *PrivateKey) UnmarshalText(i []byte) (err error)
- type PublicKey
Constants ¶
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
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) 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) MarshalText ¶
MarshalText allows PublicKey to implement the TextMarshaler interface
func (*PublicKey) UnmarshalText ¶
UnmarshalText allows PublicKey to implement the TextUnmarshaler interface