letter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {

	// ID is the hash of the Marshaled Letter + the Public key of Sender
	ID string `json:"id"`
	// Timestamp is the time at which the envelope was created
	Timestamp time.Time `json:"timestamp"`
	// Sender is public key of the sender
	Sender    keypair.KeyPair `json:"sender"`
	SenderRaw string          `json:"sender_raw"`
	// Signature is the public key of the sender encrypted by
	// the Sender private key, against the public Region key
	// to authenticate sender. I.e., Sender == Decrypt(Signature) must be true.
	// A valid Signature is also used to prevent the Envelope from being deleted.
	// I.e., if a Region key is not able to decrypt it, then it is meant for another Region
	// and would be deleted.
	Signature string `json:"signature"`
	// SealedRecipients is list of encypted passphrase (used to encrypt the Content)
	// encrypted against each of the public keys of the recipients.
	SealedRecipients []string `json:"sealed_recipients"`

	// SealedLetter contains the encryoted and compressed letter, encoded as base64 string
	SealedLetter string `json:"sealed_letter,omitempty"`

	// Letter is the unsealed letter. Once a Envelope is "unsealed", then this
	// variable is set and the SealedLetter is set to "" (deleted). This will
	// then be saved in a bucket for unsealed letters. When the letter remains
	// sealed then this Letter is set to nil.
	Letter Letter `json:"letter,omitempty"`

	// Opened is a variable set to true if the Letter is opened, to make
	// it easier to index the opened/unopened letters in the database.false
	Opened bool `json:"opened"`
}

Envelope is the sealed letter to be transfered among carriers

func (*Envelope) Close

func (e *Envelope) Close()

func (Envelope) Unseal

func (e Envelope) Unseal(keysToTry []keypair.KeyPair, regionKey keypair.KeyPair) (Envelope, error)

Unseal will determine the content of the letter using the identities provided

func (Envelope) Validate

func (e Envelope) Validate(regionKey keypair.KeyPair) (err error)

type Letter

type Letter struct {
	// Purpose specifies the purpose of letter. Currently the purposes are:
	// "action-X" - used to action public data for reputation purposes (likes, follows, channel subscriptions, settting profile images and text and names)
	// "share-X" - used to share content either "post" or "image/png"/"image/jpg"
	Purpose string `json:"purpose,omitempty"`

	// To is a list of who the letter is addressed to: "public", "friends", "self" or the public key of any person
	To []string `json:"to,omitempty"`

	// Content is is the content of the letter (base64 encoded image, text, or HTML)
	Content string `json:"content,omitempty"`

	// FirstID is the first ID for chains of edits, which must be constant
	FirstID string `json:"first_id,omitempty"`

	// ReplyTo is the ID of the post being responded to
	ReplyTo string `json:"reply_to,omitempty"`
}

Letter specifies the content being transfered to the self, or other users. The Letter has a purpose - either to "share" or to do an "action". You can "share" posts or images. You action things like follows, likes, profile names, etc.

func (Letter) Seal

func (l Letter) Seal(sender keypair.KeyPair, regionkey keypair.KeyPair) (e Envelope, err error)

Seal creates an envelope and seals it for the specified recipients

Jump to

Keyboard shortcuts

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