Documentation ¶
Index ¶
- func CheckPrevPointersAndGetUnpreved(thread *chat1.ThreadView) ([]chat1.MessagePreviousPointer, libkb.ChatThreadConsistencyError)
- func DownloadAsset(ctx context.Context, log logger.Logger, params chat1.S3Params, ...) error
- func NewConversationSource(g *libkb.GlobalContext, typ string, boxer *Boxer, storage *storage.Storage, ...) libkb.ConversationSource
- type Boxer
- func (b *Boxer) BoxMessage(ctx context.Context, msg chat1.MessagePlaintext, ...) (*chat1.MessageBoxed, error)
- func (b *Boxer) UnboxMessage(ctx context.Context, finder KeyFinder, boxed chat1.MessageBoxed) (chat1.MessageUnboxed, libkb.ChatUnboxingError)
- func (b *Boxer) UnboxMessages(ctx context.Context, boxed []chat1.MessageBoxed) (unboxed []chat1.MessageUnboxed, err error)
- func (b *Boxer) UnboxThread(ctx context.Context, boxed chat1.ThreadViewBoxed, convID chat1.ConversationID) (thread chat1.ThreadView, err error)
- type Decrypter
- type Encrypter
- type HybridConversationSource
- func (s *HybridConversationSource) Clear(convID chat1.ConversationID, uid gregor1.UID) error
- func (s *HybridConversationSource) Pull(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, ...) (chat1.ThreadView, []*chat1.RateLimit, error)
- func (s *HybridConversationSource) Push(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, ...) (chat1.MessageUnboxed, error)
- type KeyFinder
- type KeyFinderImpl
- type ProgressReporter
- type PutS3Result
- type RemoteConversationSource
- func (s *RemoteConversationSource) Clear(convID chat1.ConversationID, uid gregor1.UID) error
- func (s *RemoteConversationSource) Pull(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, ...) (chat1.ThreadView, []*chat1.RateLimit, error)
- func (s *RemoteConversationSource) Push(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, ...) (chat1.MessageUnboxed, error)
- type SignDecrypter
- type SignEncrypter
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 NewBoxer ¶
func NewBoxer(kbCtx utils.KeybaseContext, tlf keybase1.TlfInterface, udc *utils.UserDeviceCache) *Boxer
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 ¶
func (b *Boxer) UnboxMessage(ctx context.Context, finder KeyFinder, boxed chat1.MessageBoxed) (chat1.MessageUnboxed, libkb.ChatUnboxingError)
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 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 NewHybridConversationSource ¶
func NewHybridConversationSource(g *libkb.GlobalContext, b *Boxer, storage *storage.Storage, ri chat1.RemoteInterface) *HybridConversationSource
func (*HybridConversationSource) Clear ¶
func (s *HybridConversationSource) Clear(convID chat1.ConversationID, uid gregor1.UID) error
func (*HybridConversationSource) Pull ¶
func (s *HybridConversationSource) Pull(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, query *chat1.GetThreadQuery, pagination *chat1.Pagination) (chat1.ThreadView, []*chat1.RateLimit, error)
func (*HybridConversationSource) Push ¶
func (s *HybridConversationSource) Push(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, msg chat1.MessageBoxed) (chat1.MessageUnboxed, error)
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.
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 ¶
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 NewRemoteConversationSource ¶
func NewRemoteConversationSource(g *libkb.GlobalContext, b *Boxer, ri chat1.RemoteInterface) *RemoteConversationSource
func (*RemoteConversationSource) Clear ¶
func (s *RemoteConversationSource) Clear(convID chat1.ConversationID, uid gregor1.UID) error
func (*RemoteConversationSource) Pull ¶
func (s *RemoteConversationSource) Pull(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, query *chat1.GetThreadQuery, pagination *chat1.Pagination) (chat1.ThreadView, []*chat1.RateLimit, error)
func (*RemoteConversationSource) Push ¶
func (s *RemoteConversationSource) Push(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, msg chat1.MessageBoxed) (chat1.MessageUnboxed, error)
type SignDecrypter ¶
type SignDecrypter struct{}
func NewSignDecrypter ¶
func NewSignDecrypter() *SignDecrypter
type SignEncrypter ¶
type SignEncrypter struct {
// contains filtered or unexported fields
}
func NewSignEncrypter ¶
func NewSignEncrypter() *SignEncrypter
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