idutil

package
v0.0.0-...-66acf6f Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: BSD-3-Clause, BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PublicUIDName is the name given to keybase1.PublicUID.  This string
	// should correspond to an illegal or reserved Keybase user name.
	PublicUIDName = "_public"
)

Variables

This section is empty.

Functions

func MakeLocalTLFCryptKeyOrBust

func MakeLocalTLFCryptKeyOrBust(
	name string, keyGen kbfsmd.KeyGen) kbfscrypto.TLFCryptKey

MakeLocalTLFCryptKeyOrBust returns a unique private symmetric key for a TLF.

func MakeLocalUserCryptPrivateKeyOrBust

func MakeLocalUserCryptPrivateKeyOrBust(
	name kbname.NormalizedUsername) kbfscrypto.CryptPrivateKey

MakeLocalUserCryptPrivateKeyOrBust returns a unique private encryption key for this user.

func MakeLocalUserCryptPublicKeyOrBust

func MakeLocalUserCryptPublicKeyOrBust(
	name kbname.NormalizedUsername) kbfscrypto.CryptPublicKey

MakeLocalUserCryptPublicKeyOrBust returns the public key corresponding to the crypt private key for this user.

func MakeLocalUserSigningKeyOrBust

func MakeLocalUserSigningKeyOrBust(
	name kbname.NormalizedUsername) kbfscrypto.SigningKey

MakeLocalUserSigningKeyOrBust returns a unique signing key for this user.

func MakeLocalUserVerifyingKeyOrBust

func MakeLocalUserVerifyingKeyOrBust(
	name kbname.NormalizedUsername) kbfscrypto.VerifyingKey

MakeLocalUserVerifyingKeyOrBust makes a new verifying key corresponding to the signing key for this user.

func NormalizeNamesInTLF

func NormalizeNamesInTLF(writerNames, readerNames []string,
	t tlf.Type, extensionSuffix string) (normalizedName string,
	changesMade bool, err error)

NormalizeNamesInTLF takes a split TLF name and, without doing any resolutions or identify calls, normalizes all elements of the name. It then returns the normalized name and a boolean flag whether any names were modified. This modifies the slices passed as arguments.

func SplitAndNormalizeTLFName

func SplitAndNormalizeTLFName(name string, t tlf.Type) (
	writerNames, readerNames []string,
	extensionSuffix string, err error)

SplitAndNormalizeTLFName takes a tlf name as a string and tries to normalize it offline. In addition to other checks it returns TlfNameNotCanonical if it does not look canonical. Note that ordering differences do not result in TlfNameNotCanonical being returned.

Types

type BadTLFNameError

type BadTLFNameError struct {
	Name      string
	NameToLog string
}

BadTLFNameError indicates a top-level folder name that has an incorrect format.

func (BadTLFNameError) Error

func (e BadTLFNameError) Error() string

Error implements the error interface for BadTLFNameError.

type Clock

type Clock interface {
	// Now returns the current time.
	Now() time.Time
}

Clock is an interface for getting the current time

type CurrentSessionGetter

type CurrentSessionGetter interface {
	// GetCurrentSession gets the current session info.
	GetCurrentSession(ctx context.Context) (SessionInfo, error)
}

CurrentSessionGetter is an interface for objects that can return session info.

type DaemonLocal

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

DaemonLocal implements KeybaseDaemon using an in-memory user and session store, and a given favorite store.

func NewDaemonLocal

func NewDaemonLocal(
	currentUID keybase1.UID, users []LocalUser,
	teams []TeamInfo, codec kbfscodec.Codec) *DaemonLocal

NewDaemonLocal constructs a new DaemonLocal, initialized to contain the given users and teams.

func (*DaemonLocal) AddNewAssertionForTest

func (dl *DaemonLocal) AddNewAssertionForTest(
	oldAssertion, newAssertion string) (keybase1.UID, error)

AddNewAssertionForTest makes newAssertion, which should be a single assertion that doesn't already resolve to anything, resolve to the same UID as oldAssertion, which should be an arbitrary assertion that does already resolve to something. It returns the UID of the user associated with the given assertions.

func (*DaemonLocal) AddNewAssertionForTestOrBust

func (dl *DaemonLocal) AddNewAssertionForTestOrBust(
	oldAssertion, newAssertion string) keybase1.UID

AddNewAssertionForTestOrBust is like AddNewAssertionForTest, but panics if there's an error.

func (*DaemonLocal) AddTeamKeyForTest

func (dl *DaemonLocal) AddTeamKeyForTest(
	tid keybase1.TeamID, newKeyGen kbfsmd.KeyGen,
	newKey kbfscrypto.TLFCryptKey) error

AddTeamKeyForTest adds a key to a team. Should only be used by tests.

func (*DaemonLocal) AddTeamReaderForTest

func (dl *DaemonLocal) AddTeamReaderForTest(
	tid keybase1.TeamID, uid keybase1.UID) (kbname.NormalizedUsername, error)

AddTeamReaderForTest adds a reader to a team. Should only be used by tests.

func (*DaemonLocal) AddTeamWriterForTest

func (dl *DaemonLocal) AddTeamWriterForTest(
	tid keybase1.TeamID, uid keybase1.UID) (
	username kbname.NormalizedUsername, isImplicit bool, err error)

AddTeamWriterForTest adds a writer to a team. Should only be used by tests.

func (*DaemonLocal) AddTeamsForTest

func (dl *DaemonLocal) AddTeamsForTest(teams []TeamInfo)

AddTeamsForTest adds teams to this daemon. Should only be used by tests.

func (*DaemonLocal) ChangeTeamNameForTest

func (dl *DaemonLocal) ChangeTeamNameForTest(
	oldName, newName string) (keybase1.TeamID, error)

ChangeTeamNameForTest updates the name of an existing team.

func (*DaemonLocal) CreateTeamTLF

func (dl *DaemonLocal) CreateTeamTLF(
	ctx context.Context, teamID keybase1.TeamID, tlfID tlf.ID) (err error)

CreateTeamTLF implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) CurrentSession

func (dl *DaemonLocal) CurrentSession(ctx context.Context, sessionID int) (
	SessionInfo, error)

CurrentSession implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) GetCurrentMerkleRoot

func (dl *DaemonLocal) GetCurrentMerkleRoot(ctx context.Context) (
	keybase1.MerkleRootV2, time.Time, error)

GetCurrentMerkleRoot implements the MerkleRootGetter interface for DaemonLocal.

func (*DaemonLocal) GetIDForAssertion

func (dl *DaemonLocal) GetIDForAssertion(assertion string) (
	keybase1.UserOrTeamID, bool)

GetIDForAssertion returns the UID associated with the given assertion.

func (*DaemonLocal) GetLocalUser

func (dl *DaemonLocal) GetLocalUser(uid keybase1.UID) (LocalUser, error)

GetLocalUser returns the `LocalUser` object for the given UID.

func (*DaemonLocal) GetLocalUsers

func (dl *DaemonLocal) GetLocalUsers() (res []LocalUser)

GetLocalUsers returns all of the users tracked by this daemon.

func (*DaemonLocal) GetTeamSettings

func (dl *DaemonLocal) GetTeamSettings(
	ctx context.Context, teamID keybase1.TeamID,
	_ keybase1.OfflineAvailability) (
	settings keybase1.KBFSTeamSettings, err error)

GetTeamSettings implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) Identify

Identify implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) LoadTeamPlusKeys

LoadTeamPlusKeys implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) LoadUserPlusKeys

func (dl *DaemonLocal) LoadUserPlusKeys(
	ctx context.Context, uid keybase1.UID, _ keybase1.KID,
	_ keybase1.OfflineAvailability) (UserInfo, error)

LoadUserPlusKeys implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) NormalizeSocialAssertion

func (dl *DaemonLocal) NormalizeSocialAssertion(
	ctx context.Context, assertion string) (keybase1.SocialAssertion, error)

NormalizeSocialAssertion implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) RemoveAssertionForTest

func (dl *DaemonLocal) RemoveAssertionForTest(assertion string)

RemoveAssertionForTest removes the given assertion. Should only be used by tests.

func (*DaemonLocal) RemoveTeamWriterForTest

func (dl *DaemonLocal) RemoveTeamWriterForTest(
	tid keybase1.TeamID, uid keybase1.UID) (kbname.NormalizedUsername, error)

RemoveTeamWriterForTest removes a writer from a team. Should only be used by tests.

func (*DaemonLocal) Resolve

Resolve implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) ResolveIdentifyImplicitTeam

func (dl *DaemonLocal) ResolveIdentifyImplicitTeam(
	ctx context.Context, assertions, suffix string, tlfType tlf.Type,
	doIdentifies bool, reason string, _ keybase1.OfflineAvailability) (
	ImplicitTeamInfo, error)

ResolveIdentifyImplicitTeam implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) ResolveImplicitTeamByID

func (dl *DaemonLocal) ResolveImplicitTeamByID(
	ctx context.Context, teamID keybase1.TeamID) (name string, err error)

ResolveImplicitTeamByID implements the KeybaseService interface for DaemonLocal.

func (*DaemonLocal) SetCurrentMerkleRoot

func (dl *DaemonLocal) SetCurrentMerkleRoot(
	root keybase1.MerkleRootV2, rootTime time.Time)

SetCurrentMerkleRoot is a helper function, useful for tests, to set the current Merkle root.

func (*DaemonLocal) SetCurrentUID

func (dl *DaemonLocal) SetCurrentUID(uid keybase1.UID)

SetCurrentUID sets the current UID.

func (*DaemonLocal) SetLocalUser

func (dl *DaemonLocal) SetLocalUser(uid keybase1.UID, user LocalUser)

SetLocalUser sets the `LocalUser` object for the given UID.

func (*DaemonLocal) VerifyMerkleRoot

func (dl *DaemonLocal) VerifyMerkleRoot(
	_ context.Context, _ keybase1.MerkleRootV2, _ keybase1.KBFSRoot) error

VerifyMerkleRoot implements the MerkleRootGetter interface for DaemonLocal.

type Identifier

type Identifier interface {
	// Identify resolves an assertion (which could also be a
	// username) to a UserInfo struct, spawning tracker popups if
	// necessary.  The reason string is displayed on any tracker
	// popups spawned.
	//
	// If the caller knows that the assertion needs to be identifiable
	// while offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `Identify` might block on a network call.
	Identify(ctx context.Context, assertion, reason string,
		offline keybase1.OfflineAvailability) (
		kbname.NormalizedUsername, keybase1.UserOrTeamID, error)
	// IdentifyImplicitTeam identifies (and creates if necessary) the
	// given implicit team.
	//
	// If the caller knows that the team needs to be identifiable
	// while offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `IdentifyImplicitTeam` might block on a
	// network call.
	IdentifyImplicitTeam(
		ctx context.Context, assertions, suffix string, tlfType tlf.Type,
		reason string, offline keybase1.OfflineAvailability) (
		ImplicitTeamInfo, error)
}

Identifier is an interface that can identify users and teams given assertions.

type ImplicitTeamInfo

type ImplicitTeamInfo struct {
	Name  kbname.NormalizedUsername // The "display" name for the i-team.
	TID   keybase1.TeamID
	TlfID tlf.ID
}

ImplicitTeamInfo contains information needed after resolving/identifying an implicit team. TeamInfo is used for anything else.

type KBPKI

KBPKI is an interface for something that can resolve, identify, get user names, and get the current session.

type KeybaseService

type KeybaseService interface {
	MerkleRootGetter

	// Resolve, given an assertion, resolves it to a username/UID
	// pair. The username <-> UID mapping is trusted and
	// immutable, so it can be cached. If the assertion is just
	// the username or a UID assertion, then the resolution can
	// also be trusted. If the returned pair is equal to that of
	// the current session, then it can also be
	// trusted. Otherwise, Identify() needs to be called on the
	// assertion before the assertion -> (username, UID) mapping
	// can be trusted.
	//
	// If the caller knows that the assertion needs to be resolvable
	// while offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `Resolve` might block on a network call.
	Resolve(ctx context.Context, assertion string,
		offline keybase1.OfflineAvailability) (
		kbname.NormalizedUsername, keybase1.UserOrTeamID, error)

	// Identify, given an assertion, returns a name and ID that
	// matches that assertion, or an error otherwise. The reason
	// string is displayed on any tracker popups spawned.
	//
	// If the caller knows that the assertion needs to be identifiable
	// while offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `Identify` might block on a network call.
	Identify(ctx context.Context, assertion, reason string,
		offline keybase1.OfflineAvailability) (
		kbname.NormalizedUsername, keybase1.UserOrTeamID, error)

	// NormalizeSocialAssertion creates a SocialAssertion from its input and
	// normalizes it.  The service name will be lowercased.  If the service is
	// case-insensitive, then the username will also be lowercased.  Colon
	// assertions (twitter:user) will be transformed to the user@twitter
	// format.  Only registered services are allowed.
	NormalizeSocialAssertion(
		ctx context.Context, assertion string) (keybase1.SocialAssertion, error)

	// ResolveIdentifyImplicitTeam resolves, and optionally
	// identifies, an implicit team.  If the implicit team doesn't yet
	// exist, and doIdentifies is true, one is created.
	//
	// If the caller knows that the team needs to be resolvable while
	// offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `ResolveIdentifyImplicitTeam` might block
	// on a network call.
	ResolveIdentifyImplicitTeam(
		ctx context.Context, assertions, suffix string, tlfType tlf.Type,
		doIdentifies bool, reason string,
		offline keybase1.OfflineAvailability) (ImplicitTeamInfo, error)

	// ResolveImplicitTeamByID resolves an implicit team to a team
	// name, given a team ID.
	ResolveImplicitTeamByID(
		ctx context.Context, teamID keybase1.TeamID) (string, error)

	// CreateTeamTLF associates the given TLF ID with the team ID in
	// the team's sigchain.  If the team already has a TLF ID
	// associated with it, this overwrites it.
	CreateTeamTLF(
		ctx context.Context, teamID keybase1.TeamID, tlfID tlf.ID) error

	// GetTeamSettings returns the KBFS settings for the given team.
	//
	// If the caller knows that the settings needs to be readable
	// while offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `GetTeamSettings` might block on a
	// network call.
	GetTeamSettings(
		ctx context.Context, teamID keybase1.TeamID,
		offline keybase1.OfflineAvailability) (keybase1.KBFSTeamSettings, error)

	// LoadUserPlusKeys returns a UserInfo struct for a
	// user with the specified UID.
	// If you have the UID for a user and don't require Identify to
	// validate an assertion or the identity of a user, use this to
	// get UserInfo structs as it is much cheaper than Identify.
	//
	// pollForKID, if non empty, causes `PollForKID` field to be
	// populated, which causes the service to poll for the given
	// KID. This is useful during provisioning where the provisioner
	// needs to get the MD revision that the provisionee has set the
	// rekey bit on.
	//
	// If the caller knows that the user needs to be loadable while
	// offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `LoadUserPlusKeys` might block on a
	// network call.
	LoadUserPlusKeys(
		ctx context.Context, uid keybase1.UID, pollForKID keybase1.KID,
		offline keybase1.OfflineAvailability) (UserInfo, error)

	// LoadTeamPlusKeys returns a TeamInfo struct for a team with the
	// specified TeamID.  The caller can specify `desiredKeyGen` to
	// force a server check if that particular key gen isn't yet
	// known; it may be set to UnspecifiedKeyGen if no server check is
	// required.  The caller can specify `desiredUID` and
	// `desiredRole` to force a server check if that particular UID
	// isn't a member of the team yet according to local caches; it
	// may be set to "" if no server check is required.
	//
	// If the caller knows that the team needs to be loadable while
	// offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `LoadTeamPlusKeys` might block on a
	// network call.
	LoadTeamPlusKeys(ctx context.Context, tid keybase1.TeamID,
		tlfType tlf.Type, desiredKeyGen kbfsmd.KeyGen,
		desiredUser keybase1.UserVersion, desiredKey kbfscrypto.VerifyingKey,
		desiredRole keybase1.TeamRole, offline keybase1.OfflineAvailability) (
		TeamInfo, error)

	// CurrentSession returns a SessionInfo struct with all the
	// information for the current session, or an error otherwise.
	CurrentSession(ctx context.Context, sessionID int) (
		SessionInfo, error)
}

KeybaseService is a low-level interface for interacting with the Keybase service process, for the purposes of resolving and identifying users and teams.

type LocalUser

type LocalUser struct {
	UserInfo
	Asserts []string
	// Index into UserInfo.CryptPublicKeys.
	CurrentCryptPublicKeyIndex int
	// Index into UserInfo.VerifyingKeys.
	CurrentVerifyingKeyIndex int
	// Unverified keys.
	UnverifiedKeys []keybase1.PublicKey
}

LocalUser represents a fake KBFS user, useful for testing.

func MakeLocalUsers

func MakeLocalUsers(users []kbname.NormalizedUsername) []LocalUser

MakeLocalUsers is a helper function to generate a list of LocalUsers suitable to use with KeybaseDaemonLocal.

func (LocalUser) DeepCopy

func (lu LocalUser) DeepCopy() LocalUser

DeepCopy returns a deep copy of this `LocalUser`.

func (*LocalUser) GetCurrentCryptPublicKey

func (lu *LocalUser) GetCurrentCryptPublicKey() kbfscrypto.CryptPublicKey

GetCurrentCryptPublicKey returns this LocalUser's public encryption key.

func (*LocalUser) GetCurrentVerifyingKey

func (lu *LocalUser) GetCurrentVerifyingKey() kbfscrypto.VerifyingKey

GetCurrentVerifyingKey returns this LocalUser's public signing key.

func (*LocalUser) GetPublicKeys

func (lu *LocalUser) GetPublicKeys() []keybase1.PublicKey

GetPublicKeys returns all of this LocalUser's public encryption keys.

type MerkleRootGetter

type MerkleRootGetter interface {
	// GetCurrentMerkleRoot returns the current root of the global
	// Keybase Merkle tree.
	GetCurrentMerkleRoot(ctx context.Context) (
		keybase1.MerkleRootV2, time.Time, error)
	// VerifyMerkleRoot checks that the specified merkle root
	// contains the given KBFS root; if not, it returns an error.
	VerifyMerkleRoot(
		ctx context.Context, root keybase1.MerkleRootV2,
		kbfsRoot keybase1.KBFSRoot) error
}

MerkleRootGetter is an interface for getting and verifying global Merkle roots.

type NoCurrentSessionError

type NoCurrentSessionError struct {
}

NoCurrentSessionError indicates that the daemon has no current session. This is basically a wrapper for session.ErrNoSession, needed to give the correct return error code to the OS.

func (NoCurrentSessionError) Error

func (e NoCurrentSessionError) Error() string

Error implements the error interface for NoCurrentSessionError.

type NoSigChainError

type NoSigChainError struct {
	User kbname.NormalizedUsername
}

NoSigChainError means that a user we were trying to identify does not have a sigchain.

func (NoSigChainError) Error

func (e NoSigChainError) Error() string

Error implements the error interface for NoSigChainError.

type NoSuchNameError

type NoSuchNameError struct {
	Name      string
	NameToLog string
}

NoSuchNameError indicates that the user tried to access a subdirectory entry that doesn't exist.

func (NoSuchNameError) Error

func (e NoSuchNameError) Error() string

Error implements the error interface for NoSuchNameError

type NoSuchTeamError

type NoSuchTeamError struct {
	Input string
}

NoSuchTeamError indicates that the given team couldn't be resolved.

func (NoSuchTeamError) Error

func (e NoSuchTeamError) Error() string

Error implements the error interface for NoSuchTeamError

type NoSuchUserError

type NoSuchUserError struct {
	Input string
}

NoSuchUserError indicates that the given user couldn't be resolved.

func (NoSuchUserError) Error

func (e NoSuchUserError) Error() string

Error implements the error interface for NoSuchUserError

func (NoSuchUserError) ToStatus

func (e NoSuchUserError) ToStatus() keybase1.Status

ToStatus implements the keybase1.ToStatusAble interface for NoSuchUserError

type NormalizedUsernameGetter

type NormalizedUsernameGetter interface {
	// GetNormalizedUsername returns the normalized username
	// corresponding to the given UID.
	//
	// If the caller knows that the assertion needs to be resolvable
	// while offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `GetNormalizedUsername` might block on a
	// network call.
	GetNormalizedUsername(
		ctx context.Context, id keybase1.UserOrTeamID,
		offline keybase1.OfflineAvailability) (
		kbname.NormalizedUsername, error)
}

NormalizedUsernameGetter is an interface that can get a normalized username given an ID.

type OfflineStatusGetter

type OfflineStatusGetter interface {
	OfflineAvailabilityForPath(tlfPath string) keybase1.OfflineAvailability
	OfflineAvailabilityForID(tlfID tlf.ID) keybase1.OfflineAvailability
}

OfflineStatusGetter indicates whether a given TLF needs to be available offline.

type Resolver

type Resolver interface {
	// Resolve, given an assertion, resolves it to a username/UID
	// pair. The username <-> UID mapping is trusted and
	// immutable, so it can be cached. If the assertion is just
	// the username or a UID assertion, then the resolution can
	// also be trusted. If the returned pair is equal to that of
	// the current session, then it can also be
	// trusted. Otherwise, Identify() needs to be called on the
	// assertion before the assertion -> (username, UserOrTeamID) mapping
	// can be trusted.
	//
	//
	// If the caller knows that the assertion needs to be resolvable
	// while offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `Resolve` might block on a network call.
	//
	// TODO: some of the above assumptions on cacheability aren't
	// right for subteams, which can change their name, so this may
	// need updating.
	Resolve(ctx context.Context, assertion string,
		offline keybase1.OfflineAvailability) (
		kbname.NormalizedUsername, keybase1.UserOrTeamID, error)

	// ResolveImplicitTeam resolves the given implicit team.
	//
	// If the caller knows that the team needs to be resolvable while
	// offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `ResolveImplicitTeam` might block on a
	// network call.
	ResolveImplicitTeam(
		ctx context.Context, assertions, suffix string, tlfType tlf.Type,
		offline keybase1.OfflineAvailability) (ImplicitTeamInfo, error)

	// ResolveImplicitTeamByID resolves the given implicit team, given
	// a team ID.
	//
	// If the caller knows that the team needs to be resolvable while
	// offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `ResolveImplicitTeamByID` might block on
	// a network call.
	ResolveImplicitTeamByID(
		ctx context.Context, teamID keybase1.TeamID, tlfType tlf.Type,
		offline keybase1.OfflineAvailability) (ImplicitTeamInfo, error)
	// ResolveTeamTLFID returns the TLF ID associated with a given
	// team ID, or tlf.NullID if no ID is yet associated with that
	// team.
	//
	// If the caller knows that the ID needs to be resolved while
	// offline, they should pass in
	// `keybase1.OfflineAvailability_BEST_EFFORT` as the `offline`
	// parameter.  Otherwise `ResolveTeamTLFID` might block on a
	// network call.
	ResolveTeamTLFID(
		ctx context.Context, teamID keybase1.TeamID,
		offline keybase1.OfflineAvailability) (tlf.ID, error)

	// NormalizeSocialAssertion creates a SocialAssertion from its input and
	// normalizes it.  The service name will be lowercased.  If the service is
	// case-insensitive, then the username will also be lowercased.  Colon
	// assertions (twitter:user) will be transformed to the user@twitter
	// format.  Only registered services are allowed.
	NormalizeSocialAssertion(
		ctx context.Context, assertion string) (keybase1.SocialAssertion, error)
}

Resolver is an interface to be used to resolve assertions, implicit teams and team TLF IDs.

type RevokedKeyInfo

type RevokedKeyInfo struct {
	// Fields are exported so they can be copied by the codec.
	Time       keybase1.Time
	MerkleRoot keybase1.MerkleRootV2
	// contains filtered or unexported fields
}

RevokedKeyInfo contains any KBFS-relevant data to user keys that have been revoked or belong to a account before it was reset.

func (RevokedKeyInfo) FilledInMerkle

func (rki RevokedKeyInfo) FilledInMerkle() bool

FilledInMerkle returns whether or not this key info has had its merkle data (like the sigchain location or the reset info) filled in yet.

func (RevokedKeyInfo) ResetInfo

func (rki RevokedKeyInfo) ResetInfo() (keybase1.Seqno, bool)

ResetInfo returns, if this key belongs to an account before it was reset, data about that reset.

func (*RevokedKeyInfo) SetFilledInMerkle

func (rki *RevokedKeyInfo) SetFilledInMerkle(filledIn bool)

SetFilledInMerkle sets whether or not this key info has had its merkle data (like the sigchain location or the reset info) filled in yet.

func (*RevokedKeyInfo) SetResetInfo

func (rki *RevokedKeyInfo) SetResetInfo(seqno keybase1.Seqno, isReset bool)

SetResetInfo sets, if this key belongs to an account before it was reset, data about that reset.

func (*RevokedKeyInfo) SetSigChainLocation

func (rki *RevokedKeyInfo) SetSigChainLocation(loc keybase1.SigChainLocation)

SetSigChainLocation sets the sigchain location for this revocation.

func (RevokedKeyInfo) SigChainLocation

func (rki RevokedKeyInfo) SigChainLocation() keybase1.SigChainLocation

SigChainLocation returns the sigchain location for this revocation.

type SessionInfo

type SessionInfo struct {
	Name           kbname.NormalizedUsername
	UID            keybase1.UID
	CryptPublicKey kbfscrypto.CryptPublicKey
	VerifyingKey   kbfscrypto.VerifyingKey
}

SessionInfo contains all the info about the keybase session that kbfs cares about.

func GetCurrentSessionIfPossible

func GetCurrentSessionIfPossible(
	ctx context.Context, kbpki CurrentSessionGetter, sessionNotRequired bool) (
	SessionInfo, error)

GetCurrentSessionIfPossible returns the current username and UID from kbpki.GetCurrentSession. If sessionNotRequired is true NoCurrentSessionError is ignored and empty username and uid will be returned. If it is false all errors are returned.

func SessionInfoFromProtocol

func SessionInfoFromProtocol(session keybase1.Session) (SessionInfo, error)

SessionInfoFromProtocol returns SessionInfo from Session

type TeamInfo

type TeamInfo struct {
	// Maybe this should be bare string?  The service doesn't give us
	// a nice type, unfortunately.  Also note that for implicit teams,
	// this is an auto-generated name that shouldn't be shown to
	// users.
	Name         kbname.NormalizedUsername
	TID          keybase1.TeamID
	CryptKeys    map[kbfsmd.KeyGen]kbfscrypto.TLFCryptKey
	LatestKeyGen kbfsmd.KeyGen
	RootID       keybase1.TeamID // for subteams only

	Writers map[keybase1.UID]bool
	Readers map[keybase1.UID]bool

	// Last writers map a KID to the last time the writer associated
	// with that KID trasitioned from writer to non-writer.
	LastWriters map[kbfscrypto.VerifyingKey]keybase1.MerkleRootV2
}

TeamInfo contains all the info about a keybase team that kbfs cares about.

func MakeLocalTeams

func MakeLocalTeams(teams []kbname.NormalizedUsername) []TeamInfo

MakeLocalTeams is a helper function to generate a list of local teams suitable to use with KeybaseDaemonLocal. Any subteams must come after their root team names in the `teams` slice.

type TlfNameNotCanonical

type TlfNameNotCanonical struct {
	Name, NameToTry string
}

TlfNameNotCanonical indicates that a name isn't a canonical, and that another (not necessarily canonical) name should be tried.

func (TlfNameNotCanonical) Error

func (e TlfNameNotCanonical) Error() string

Error implements the error interface for TlfNameNotCanonical.

type UserInfo

type UserInfo struct {
	Name            kbname.NormalizedUsername
	UID             keybase1.UID
	VerifyingKeys   []kbfscrypto.VerifyingKey
	CryptPublicKeys []kbfscrypto.CryptPublicKey
	KIDNames        map[keybase1.KID]string
	EldestSeqno     keybase1.Seqno

	// Revoked keys, and the time at which they were revoked.
	RevokedVerifyingKeys   map[kbfscrypto.VerifyingKey]RevokedKeyInfo
	RevokedCryptPublicKeys map[kbfscrypto.CryptPublicKey]RevokedKeyInfo
}

UserInfo contains all the info about a keybase user that kbfs cares about.

func (UserInfo) DeepCopy

func (ui UserInfo) DeepCopy() UserInfo

DeepCopy returns a copy of `ui`, including deep copies of all slice and map members.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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