teambot

package
v4.4.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: BSD-3-Clause, BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const MaxTeambotKeyWrongKIDPermitted = time.Hour * 24

Variables

This section is empty.

Functions

func CurrentUserIsBot

func CurrentUserIsBot(mctx libkb.MetaContext, botUID *gregor1.UID) bool

func DeleteTeambotEKForTest

func DeleteTeambotEKForTest(mctx libkb.MetaContext, teamID keybase1.TeamID,
	generation keybase1.EkGeneration) error

func DeleteTeambotKeyForTest

func DeleteTeambotKeyForTest(mctx libkb.MetaContext, teamID keybase1.TeamID,
	generation keybase1.TeambotKeyGeneration) error

func HandleNewTeambotKey

func HandleNewTeambotKey(mctx libkb.MetaContext, teamID keybase1.TeamID,
	generation keybase1.TeambotKeyGeneration) (err error)

HandleNewTeambotKey checks that the bot's team cache has at least up to the generation just created.

func HandleTeambotKeyNeeded

func HandleTeambotKeyNeeded(mctx libkb.MetaContext, teamID keybase1.TeamID, botUID keybase1.UID,
	generation keybase1.TeambotKeyGeneration) (err error)

HandleTeambotEKNeeded forces a teambot key to be generated since the bot does not have access. All team members are notified and race to publish the requested key.

func NewTeambotKeyersAndInstall

func NewTeambotKeyersAndInstall(mctx libkb.MetaContext)

func NotifyTeambotEKNeeded

func NotifyTeambotEKNeeded(mctx libkb.MetaContext, teamID keybase1.TeamID, generation keybase1.EkGeneration) error

func NotifyTeambotKeyNeeded

func NotifyTeambotKeyNeeded(mctx libkb.MetaContext, teamID keybase1.TeamID, generation keybase1.TeambotKeyGeneration) error

func ServiceInit

func ServiceInit(mctx libkb.MetaContext)

func TeambotEKWrongKIDCacheKey

func TeambotEKWrongKIDCacheKey(teamID keybase1.TeamID, botUID keybase1.UID,
	generation keybase1.EkGeneration) libkb.DbKey

func TeambotEKWrongKIDPermitted

func TeambotEKWrongKIDPermitted(mctx libkb.MetaContext, teamID keybase1.TeamID,
	botUID keybase1.UID, generation keybase1.EkGeneration, now keybase1.Time) (bool, keybase1.Time, error)

func TeambotKeyWrongKIDCacheKey

func TeambotKeyWrongKIDCacheKey(teamID keybase1.TeamID, botUID keybase1.UID,
	generation keybase1.TeambotKeyGeneration) libkb.DbKey

func TeambotKeyWrongKIDPermitted

func TeambotKeyWrongKIDPermitted(mctx libkb.MetaContext, teamID keybase1.TeamID,
	botUID keybase1.UID, generation keybase1.TeambotKeyGeneration, now keybase1.Time) (bool, keybase1.Time, error)

Types

type BotKeyer

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

func NewBotKeyer

func NewBotKeyer(mctx libkb.MetaContext) *BotKeyer

func (*BotKeyer) DeleteTeambotKeyForTest

func (k *BotKeyer) DeleteTeambotKeyForTest(mctx libkb.MetaContext, teamID keybase1.TeamID,
	generation keybase1.TeambotKeyGeneration) (err error)

func (*BotKeyer) GetLatestTeambotKey

func (k *BotKeyer) GetLatestTeambotKey(mctx libkb.MetaContext, teamID keybase1.TeamID) (key keybase1.TeambotKey, err error)

GetLatestTeambotKey finds the latest TeambotKey for *encryption*. Since bots depend on team members to derive a key for them, if the key is signed by an old PTK we allow it to be used for a short window before permanently failing, while we ask politely for a new key. If we don't have access to the latest generation we fall back to the first key we do as long as it's within the signing window.

func (*BotKeyer) GetTeambotKeyAtGeneration

func (k *BotKeyer) GetTeambotKeyAtGeneration(mctx libkb.MetaContext, teamID keybase1.TeamID,
	generation keybase1.TeambotKeyGeneration) (key keybase1.TeambotKey, err error)

GetTeambotKeyAtGeneration finds the TeambotKey at the specified generation. This is used for *decryption* since we allow a key to be signed by an old PTK. For *encryption* keys, see GetLatestTeambotKey.

func (*BotKeyer) OnDbNuke

func (k *BotKeyer) OnDbNuke(mctx libkb.MetaContext) error

func (*BotKeyer) OnLogout

func (k *BotKeyer) OnLogout(mctx libkb.MetaContext) error

func (*BotKeyer) SetClock

func (k *BotKeyer) SetClock(clock clockwork.Clock)

type MemberKeyer

type MemberKeyer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMemberKeyer

func NewMemberKeyer(mctx libkb.MetaContext) *MemberKeyer

func (*MemberKeyer) GetOrCreateTeambotKey

func (k *MemberKeyer) GetOrCreateTeambotKey(mctx libkb.MetaContext, teamID keybase1.TeamID,
	gBotUID gregor1.UID, appKey keybase1.TeamApplicationKey) (
	key keybase1.TeambotKey, created bool, err error)

GetOrCreateTeambotKey derives a TeambotKey from the given `appKey`, and posts the result to the server if necessary. An in memory cache is kept of keys that have already been posted so we don't hit the server each time.

func (*MemberKeyer) OnDbNuke

func (k *MemberKeyer) OnDbNuke(mctx libkb.MetaContext) error

func (*MemberKeyer) OnLogout

func (k *MemberKeyer) OnLogout(mctx libkb.MetaContext) error

func (*MemberKeyer) PurgeCache

func (k *MemberKeyer) PurgeCache(mctx libkb.MetaContext)

func (*MemberKeyer) PurgeCacheAtGeneration

func (k *MemberKeyer) PurgeCacheAtGeneration(mctx libkb.MetaContext, teamID keybase1.TeamID,
	botUID keybase1.UID, generation keybase1.TeambotKeyGeneration)

type TeambotKeyBoxedResponse

type TeambotKeyBoxedResponse struct {
	Result *struct {
		Box string `json:"box"`
		Sig string `json:"sig"`
	} `json:"result"`
}

type TeambotKeyResponse

type TeambotKeyResponse struct {
	Result *struct {
		Sig string `json:"sig"`
	} `json:"result"`
}

type TeambotPermanentKeyError

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

func (TeambotPermanentKeyError) Error

func (e TeambotPermanentKeyError) Error() string

type TeambotTransientKeyError

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

func (TeambotTransientKeyError) Error

func (e TeambotTransientKeyError) Error() string

Jump to

Keyboard shortcuts

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