chat

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2016 License: BSD-3-Clause, BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPrevPointersAndGetUnpreved

func CheckPrevPointersAndGetUnpreved(thread *chat1.ThreadView) ([]chat1.MessagePreviousPointer, libkb.ChatThreadConsistencyError)

Ingest a ThreadView, check several invariants, and produce a list of prev pointers to not-yet-pointed-to messages. Check several invariants at the same time: 1. No two messages have the same ID. 2. All prev pointers point to messages with lesser IDs. 3. All prev pointers to a message agree on that message's header hash. 4. For all messages we have locally, the hashes pointing to them are actually correct. TODO: All of this should happen in the cache instead of here all at once.

func DownloadAsset

func DownloadAsset(ctx context.Context, log logger.Logger, params chat1.S3Params, asset chat1.Asset, w io.Writer, signer s3.Signer, progress ProgressReporter) error

DownloadAsset gets an object from S3 as described in asset.

func NewConversationSource

func NewConversationSource(g *libkb.GlobalContext, typ string, boxer *Boxer, storage *storage.Storage,
	ri chat1.RemoteInterface) libkb.ConversationSource

Types

type Boxer

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

func (*Boxer) BoxMessage

func (b *Boxer) BoxMessage(ctx context.Context, msg chat1.MessagePlaintext, signingKeyPair libkb.NaclSigningKeyPair) (*chat1.MessageBoxed, error)

boxMessage encrypts a keybase1.MessagePlaintext into a chat1.MessageBoxed. It finds the most recent key for the TLF.

func (*Boxer) UnboxMessage

UnboxMessage unboxes a chat1.MessageBoxed into a keybase1.Message. It finds the appropriate keybase1.CryptKey. The first return value is unusable if the err != nil Returns (_, err) for non-permanent errors, and (MessageUnboxedError, nil) for permanent errors. Permanent errors can be cached and must be treated as a value to deal with. Whereas temporary errors are transient failures.

func (*Boxer) UnboxMessages

func (b *Boxer) UnboxMessages(ctx context.Context, boxed []chat1.MessageBoxed) (unboxed []chat1.MessageUnboxed, err error)

func (*Boxer) UnboxThread

func (b *Boxer) UnboxThread(ctx context.Context, boxed chat1.ThreadViewBoxed, convID chat1.ConversationID) (thread chat1.ThreadView, err error)

unboxThread transforms a chat1.ThreadViewBoxed to a keybase1.ThreadView.

type Decrypter

type Decrypter interface {
	// Decrypt takes a ciphertext reader, encryption and verify keys.
	// It returns a plaintext reader.
	Decrypt(ciphertext io.Reader, encKey, verifyKey []byte) (plaintext io.Reader)
}

type Encrypter

type Encrypter interface {
	// EncryptedLen returns the number of bytes that the ciphertext of
	// size plaintext bytes will be.
	EncryptedLen(size int) int

	// Encrypt takes a plaintext reader and returns a ciphertext reader.
	// It generates new keys every time it is called.
	Encrypt(plaintext io.Reader) (ciphertext io.Reader, err error)

	// EncryptKey returns the ephemeral key that was used during the
	// last invocation of Encrypt.
	EncryptKey() []byte

	// VerifyKey returns the public portion of the signing key used during
	// the last invocation of Encrypt.  It can be used for signature
	// verification.
	VerifyKey() []byte
}

type HybridConversationSource

type HybridConversationSource struct {
	libkb.Contextified
	// contains filtered or unexported fields
}

func (*HybridConversationSource) Clear

func (*HybridConversationSource) Pull

func (*HybridConversationSource) Push

type KeyFinder

type KeyFinder interface {
	Find(ctx context.Context, tlf keybase1.TlfInterface, tlfName string, tlfPublic bool) (keybase1.GetTLFCryptKeysRes, error)
}

keyFinder remembers results from previous calls to CryptKeys(). It is not intended to be used by multiple concurrent goroutines or held onto for very long, just to remember the keys while unboxing a thread of messages.

func NewKeyFinder

func NewKeyFinder() KeyFinder

newKeyFinder creates a keyFinder.

type KeyFinderImpl

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

func (*KeyFinderImpl) Find

func (k *KeyFinderImpl) Find(ctx context.Context, tlf keybase1.TlfInterface, tlfName string, tlfPublic bool) (keybase1.GetTLFCryptKeysRes, error)

find finds keybase1.TLFCryptKeys for tlfName, checking for existing results.

type ProgressReporter

type ProgressReporter func(bytesCompleted, bytesTotal int)

type PutS3Result

type PutS3Result struct {
	Region   string
	Endpoint string
	Bucket   string
	Path     string
	Size     int64
}

PutS3Result is the success result of calling PutS3.

func PutS3

func PutS3(ctx context.Context, log logger.Logger, r io.Reader, size int64, params chat1.S3Params, signer s3.Signer, progress ProgressReporter) (*PutS3Result, error)

PutS3 uploads the data in Reader r to S3. It chooses whether to use putSingle or putMultiPipeline based on the size of the object.

type RemoteConversationSource

type RemoteConversationSource struct {
	libkb.Contextified
	// contains filtered or unexported fields
}

func (*RemoteConversationSource) Clear

func (*RemoteConversationSource) Pull

func (*RemoteConversationSource) Push

type SignDecrypter

type SignDecrypter struct{}

func NewSignDecrypter

func NewSignDecrypter() *SignDecrypter

func (*SignDecrypter) Decrypt

func (s *SignDecrypter) Decrypt(r io.Reader, encKey, verifyKey []byte) io.Reader

type SignEncrypter

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

func NewSignEncrypter

func NewSignEncrypter() *SignEncrypter

func (*SignEncrypter) Encrypt

func (s *SignEncrypter) Encrypt(r io.Reader) (io.Reader, error)

func (*SignEncrypter) EncryptKey

func (s *SignEncrypter) EncryptKey() []byte

func (*SignEncrypter) EncryptedLen

func (s *SignEncrypter) EncryptedLen(size int) int

func (*SignEncrypter) VerifyKey

func (s *SignEncrypter) VerifyKey() []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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