hidden

package
v4.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: BSD-3-Clause, BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFeatureGateForSupport

func CheckFeatureGateForSupport(mctx libkb.MetaContext, teamID keybase1.TeamID, isWrite bool) (err error)

func GenerateKeyRotation

func GenerateKeyRotation(mctx libkb.MetaContext, p GenerateKeyRotationParams) (ret *libkb.SigMultiItem, ratchet *keybase1.HiddenTeamChainRatchet, err error)

GenerateKeyRotation generates and signs a new sig3 KeyRotation. The result can be passed to sig/multi.json and stored along with other sig1, sig2 or sig3 signatures in an atomic transaction.

Types

type ChainManager

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

ChainManager manages a hidden team chain, and wraps put/gets to mem/disk storage. Accesses are single-flighted by TeamID. Implements that libkb.HiddenTeamChainManager interface.

func NewChainManager

func NewChainManager(g *libkb.GlobalContext) *ChainManager

func NewChainManagerAndInstall

func NewChainManagerAndInstall(g *libkb.GlobalContext) *ChainManager

func (*ChainManager) Advance

func (m *ChainManager) Advance(mctx libkb.MetaContext, dat keybase1.HiddenTeamChain, expectedPrev *keybase1.LinkTriple) (err error)

Advance the stored hidden team storage by the given update. Before this function is called, we should have checked many things:

  • that the PTKs match the unverified seeds sent down by the server.
  • that the postImages of the seedChecks are continuous, given a consistent set of seeds
  • that all full (unstubbed links) have valid reverse signatures
  • that all prevs are self consistent, and consistent with any preloaded data
  • that if the update starts in the middle of the chain, that its head has a prev, and that prev is consistent.
  • that the updates are consistent with any known ratchets

See hidden.go for and the caller of this function for where that happens.

func (*ChainManager) Freeze

func (m *ChainManager) Freeze(mctx libkb.MetaContext, id keybase1.TeamID) (err error)

func (*ChainManager) HintLatestSeqno

func (m *ChainManager) HintLatestSeqno(mctx libkb.MetaContext, id keybase1.TeamID, q keybase1.Seqno) (err error)

Load hidden team chain data from storage, either mem or disk. Will not hit the network.

func (*ChainManager) Load

Load hidden team chain data from storage, either mem or disk. Will not hit the network.

func (*ChainManager) OnDbNuke

func (m *ChainManager) OnDbNuke(mctx libkb.MetaContext) error

OnDbNuke is called when the disk cache is cleared, which purges the LRU.

func (*ChainManager) OnLogout

func (m *ChainManager) OnLogout(mctx libkb.MetaContext) error

OnLogout is called when the user logs out, which purges the LRU.

func (*ChainManager) Ratchet

func (m *ChainManager) Ratchet(mctx libkb.MetaContext, id keybase1.TeamID, ratchet keybase1.HiddenTeamChainRatchet) (err error)

Ratchet should be called when we know about advances in this chain but don't necessarily have the links to back the ratchet up. We'll check them later when next we refresh. But we do check that the ratchet is consistent with the known data (and ratchets) that we have.

func (*ChainManager) Tail

Tail returns the furthest known tail of the hidden team chain, as known to our local cache. Needed when posting new main chain links that point back to the most recently known tail.

func (*ChainManager) Tombstone

func (m *ChainManager) Tombstone(mctx libkb.MetaContext, id keybase1.TeamID) (err error)

type GenerateError

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

func NewGenerateError

func NewGenerateError(format string, args ...interface{}) GenerateError

func (GenerateError) Error

func (e GenerateError) Error() string

type GenerateKeyRotationParams

type GenerateKeyRotationParams struct {
	TeamID           keybase1.TeamID
	IsPublic         bool
	IsImplicit       bool
	MerkleRoot       *libkb.MerkleRoot
	Me               libkb.UserForSignatures
	SigningKey       libkb.GenericKey
	MainPrev         keybase1.LinkTriple
	HiddenPrev       *keybase1.LinkTriple
	Gen              keybase1.PerTeamKeyGeneration
	NewSigningKey    libkb.NaclSigningKeyPair
	NewEncryptionKey libkb.NaclDHKeyPair
	Check            keybase1.PerTeamSeedCheck
}

GenerateKeyRotationParams are for generating a sig3 KeyRotation to store on the hidden team chain. Fill in all parameters of the struct (there were too many to pass as a list)

type LoaderError

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

func NewLoaderError

func NewLoaderError(format string, args ...interface{}) LoaderError

func (LoaderError) Error

func (e LoaderError) Error() string

type LoaderPackage

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

LoaderPackage contains a snapshot of the hidden team chain, used during the process of loading a team. It additionally can have new chain links loaded from the server, since it might need to be queried in the process of loading the team as if the new links were already commited to the data store.

func NewLoaderPackage

func NewLoaderPackage(mctx libkb.MetaContext, id keybase1.TeamID, getter func() (keybase1.KID, keybase1.PerTeamKeyGeneration, error)) (ret *LoaderPackage, err error)

func NewLoaderPackageForPrecheck

func NewLoaderPackageForPrecheck(mctx libkb.MetaContext, id keybase1.TeamID, data *keybase1.HiddenTeamChain) *LoaderPackage

func (*LoaderPackage) ChainData

func (l *LoaderPackage) ChainData() *keybase1.HiddenTeamChain

ChainData returns the merge of the preloaded hidden chain data and the recently downloaded chain update.

func (*LoaderPackage) CheckUpdatesAgainstSeeds

func (l *LoaderPackage) CheckUpdatesAgainstSeeds(mctx libkb.MetaContext, f func(keybase1.PerTeamKeyGeneration) *keybase1.PerTeamSeedCheck) (err error)

CheckUpdatesAgainstSeeds checks the update inside this loader package against unverified team seeds. It enforces equality and will error out if not. Through this check, a client can convince itself that the recent keyers knew the old keys.

func (*LoaderPackage) CheckUpdatesAgainstSeedsWithMap

func (l *LoaderPackage) CheckUpdatesAgainstSeedsWithMap(mctx libkb.MetaContext, seeds map[keybase1.PerTeamKeyGeneration]keybase1.PerTeamKeySeedItem) (err error)

func (*LoaderPackage) Commit

func (l *LoaderPackage) Commit(mctx libkb.MetaContext) error

Commit the update from the server to main HiddenTeamChain storage.

func (*LoaderPackage) HasReaderPerTeamKeyAtGeneration

func (l *LoaderPackage) HasReaderPerTeamKeyAtGeneration(gen keybase1.PerTeamKeyGeneration) bool

HasReaderPerTeamKeyAtGeneration returns true if the LoaderPackage has a sigchain entry for the PTK at the given generation. Whether in the preloaded data or the udpate.

func (*LoaderPackage) IsStale

func (l *LoaderPackage) IsStale() bool

func (*LoaderPackage) LastReaderKeyRotator

func (l *LoaderPackage) LastReaderKeyRotator(mctx libkb.MetaContext) *keybase1.Signer

LastReaderKeyRotator returns a signer object that signifies the last KID/UID pair to sign a reader PTK into this chain.

func (*LoaderPackage) LastSeqno

func (l *LoaderPackage) LastSeqno() keybase1.Seqno

LastSeqno returns the last seqno when the preloaded sequence and the update are taken together.

func (*LoaderPackage) Load

func (l *LoaderPackage) Load(mctx libkb.MetaContext) (err error)

Load in data from storage for this chain. We're going to make a deep copy so that we don't worry about mutating the object in the storage layer's memory LRU.

func (*LoaderPackage) MaxRatchet

func (l *LoaderPackage) MaxRatchet() keybase1.Seqno

MaxRatchet returns the greatest sequence number across all ratchets in the loaded data and also in the data from the recent update from the server.

func (*LoaderPackage) MaxReaderPerTeamKeyGeneration

func (l *LoaderPackage) MaxReaderPerTeamKeyGeneration() keybase1.PerTeamKeyGeneration

MaxReaderTeamKeyGeneration returns the highest Reader PTK generation from the preloaded and hidden data.

func (*LoaderPackage) MerkleLoadArg

func (l *LoaderPackage) MerkleLoadArg(mctx libkb.MetaContext) (ret *libkb.LookupTeamHiddenArg, err error)

MerkleLoadArg is the argument to pass to merkle/path.json so that the state of the hidden chain can be queried along with the main team chain. If we've ever loaded this chain, we pass up the last known chain tail and the server replies with a bit saying whether it's the latest or not (this save the server from having to auth us and check if we're in the team). If we've never loaded the hidden chain for this team, we pass up a team encryption KID from the team's main chain, to prove we had access to it. The server returns one bit in that case, saying whether or not the team chain exists.

func (*LoaderPackage) Update

func (l *LoaderPackage) Update(mctx libkb.MetaContext, update []sig3.ExportJSON) (err error)

Update combines the preloaded data with any downloaded updates from the server, and stores the result local to this object.

type ManagerError

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

func NewManagerError

func NewManagerError(format string, args ...interface{}) ManagerError

func (ManagerError) Error

func (e ManagerError) Error() string

Jump to

Keyboard shortcuts

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