Documentation ¶
Index ¶
- Constants
- Variables
- func FakeIDByte(id ID) byte
- type Handle
- func (h Handle) Extensions() (extensions []HandleExtension)
- func (h Handle) HasUnresolvedUsers() bool
- func (h Handle) IsConflict() bool
- func (h Handle) IsFinal() bool
- func (h Handle) IsPublic() bool
- func (h Handle) IsReader(user keybase1.UID) bool
- func (h Handle) IsWriter(user keybase1.UID) bool
- func (h Handle) ResolveAssertions(assertions map[keybase1.SocialAssertion]keybase1.UID) Handle
- func (h Handle) ResolvedUsers() []keybase1.UID
- func (h Handle) UnresolvedUsers() []keybase1.SocialAssertion
- type HandleExtension
- func NewHandleExtension(extType HandleExtensionType, num uint16, un libkb.NormalizedUsername, ...) (*HandleExtension, error)
- func NewTestHandleExtensionStaticTime(extType HandleExtensionType, num uint16, un libkb.NormalizedUsername) (*HandleExtension, error)
- func ParseHandleExtensionSuffix(s string) ([]HandleExtension, error)
- type HandleExtensionList
- type HandleExtensionMismatchError
- type HandleExtensionType
- type ID
- type InvalidIDError
- type SocialAssertionList
- type UIDList
Constants ¶
const ( // HandleExtensionSep is the string that separates the folder // participants from an extension suffix in the TLF name. HandleExtensionSep = " " // HandleExtensionStaticTestDate is a static date used for tests (2016-03-14). HandleExtensionStaticTestDate = 1457913600 )
Variables ¶
var NullID = ID{}
NullID is an empty ID
Functions ¶
func FakeIDByte ¶
FakeIDByte returns the byte used to create a fake TLF ID with FakeID.
Types ¶
type Handle ¶
type Handle struct { Writers []keybase1.UID `codec:"w,omitempty"` Readers []keybase1.UID `codec:"r,omitempty"` UnresolvedWriters []keybase1.SocialAssertion `codec:"uw,omitempty"` UnresolvedReaders []keybase1.SocialAssertion `codec:"ur,omitempty"` ConflictInfo *HandleExtension `codec:"ci,omitempty"` FinalizedInfo *HandleExtension `codec:"fi,omitempty"` }
Handle uniquely identifies top-level folders by readers and writers.
TODO: Have separate types for writers vs. readers.
func MakeHandle ¶
func MakeHandle( writers, readers []keybase1.UID, unresolvedWriters, unresolvedReaders []keybase1.SocialAssertion, extensions []HandleExtension) (Handle, error)
MakeHandle creates a Handle from the given list of readers and writers. If the given reader list contains just keybase1.PUBLIC_UID, then the returned handle will be for a public folder. Otherwise, it will be private. PUBLIC_UID shouldn't be in any list in any other case.
func (Handle) Extensions ¶
func (h Handle) Extensions() (extensions []HandleExtension)
Extensions returns a list of extensions for the given handle.
func (Handle) HasUnresolvedUsers ¶
HasUnresolvedUsers returns true if this handle has any unresolved writers or readers.
func (Handle) IsConflict ¶
IsConflict returns true if the handle is a conflict handle.
func (Handle) IsPublic ¶
IsPublic returns whether or not this Handle represents a public top-level folder.
func (Handle) IsReader ¶
IsReader returns whether or not the given user is a reader for the top-level folder represented by this Handle.
func (Handle) IsWriter ¶
IsWriter returns whether or not the given user is a writer for the top-level folder represented by this Handle.
func (Handle) ResolveAssertions ¶
ResolveAssertions creates a new Handle given an existing one with while resolving the passed assertions.
func (Handle) ResolvedUsers ¶
ResolvedUsers returns the concatenation of h.Writers and h.Readers, except if the handle is public, the returned list won't contain PUBLIC_UID.
func (Handle) UnresolvedUsers ¶
func (h Handle) UnresolvedUsers() []keybase1.SocialAssertion
UnresolvedUsers returns the concatenation of h.UnresolvedWriters and h.UnresolvedReaders.
type HandleExtension ¶
type HandleExtension struct { Date int64 `codec:"date"` Number uint16 `codec:"num"` Type HandleExtensionType `codec:"type"` Username libkb.NormalizedUsername `codec:"un,omitempty"` codec.UnknownFieldSetHandler }
HandleExtension is information which identifies a particular extension.
func NewHandleExtension ¶
func NewHandleExtension(extType HandleExtensionType, num uint16, un libkb.NormalizedUsername, now time.Time) ( *HandleExtension, error)
NewHandleExtension returns a new HandleExtension struct populated with the date from the given time and conflict number.
func NewTestHandleExtensionStaticTime ¶
func NewTestHandleExtensionStaticTime(extType HandleExtensionType, num uint16, un libkb.NormalizedUsername) ( *HandleExtension, error)
NewTestHandleExtensionStaticTime returns a new HandleExtension struct populated with a static date for testing.
func ParseHandleExtensionSuffix ¶
func ParseHandleExtensionSuffix(s string) ([]HandleExtension, error)
ParseHandleExtensionSuffix parses a TLF handle extension suffix string.
func (HandleExtension) String ¶
func (e HandleExtension) String() string
String implements the fmt.Stringer interface for HandleExtension. Ex: "(conflicted copy 2016-05-09 #2)"
type HandleExtensionList ¶
type HandleExtensionList []HandleExtension
HandleExtensionList allows us to sort extensions by type.
func (HandleExtensionList) Len ¶
func (l HandleExtensionList) Len() int
func (HandleExtensionList) Less ¶
func (l HandleExtensionList) Less(i, j int) bool
func (HandleExtensionList) Splat ¶
func (l HandleExtensionList) Splat() (ci, fi *HandleExtension)
Splat will deconstruct the list for the caller into individual extension pointers (or nil.)
func (HandleExtensionList) Suffix ¶
func (l HandleExtensionList) Suffix() string
Suffix outputs a suffix string for this extension list.
func (HandleExtensionList) Swap ¶
func (l HandleExtensionList) Swap(i, j int)
type HandleExtensionMismatchError ¶
type HandleExtensionMismatchError struct { Expected HandleExtension // Actual may be nil. Actual *HandleExtension }
HandleExtensionMismatchError indicates the expected extension doesn't match the server's extension for the given handle.
func (HandleExtensionMismatchError) Error ¶
func (e HandleExtensionMismatchError) Error() string
Error implements the error interface for HandleExtensionMismatchError
type HandleExtensionType ¶
type HandleExtensionType int
HandleExtensionType is the type of extension.
const ( // HandleExtensionConflict means the handle conflicted as a result of a social // assertion resolution. HandleExtensionConflict HandleExtensionType = iota // HandleExtensionFinalized means the folder ended up with no more valid writers as // a result of an account reset. HandleExtensionFinalized // HandleExtensionUnknown means the type is unknown. HandleExtensionUnknown )
func (HandleExtensionType) String ¶
func (et HandleExtensionType) String(username libkb.NormalizedUsername) string
String implements the fmt.Stringer interface for HandleExtensionType
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID is a top-level folder ID
func MakeRandomID ¶
MakeRandomID makes a random ID using a cryptographically secure RNG. Returns NullID on failure.
func (ID) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for ID.
func (ID) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for ID.
func (*ID) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for ID.
func (*ID) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for ID.
type InvalidIDError ¶
type InvalidIDError struct {
// contains filtered or unexported fields
}
InvalidIDError indicates that a TLF ID string is not parseable or invalid.
func (InvalidIDError) Error ¶
func (e InvalidIDError) Error() string
type SocialAssertionList ¶
type SocialAssertionList []keybase1.SocialAssertion
SocialAssertionList can be used to lexicographically sort SocialAssertions.
func (SocialAssertionList) Len ¶
func (u SocialAssertionList) Len() int
func (SocialAssertionList) Less ¶
func (u SocialAssertionList) Less(i, j int) bool
func (SocialAssertionList) Swap ¶
func (u SocialAssertionList) Swap(i, j int)