Documentation
¶
Index ¶
- Variables
- func DecodeAndUnbox(m libkb.MetaContext, finder PukFinder, encodedBundle BundleEncoded) (*stellar1.BundleRestricted, stellar1.BundleVersion, error)
- func MakeAllDevices(a *stellar1.BundleRestricted, accountID stellar1.AccountID) error
- func MakeMobileOnly(a *stellar1.BundleRestricted, accountID stellar1.AccountID) error
- func New(secret stellar1.SecretKey, name string) (*stellar1.BundleRestricted, error)
- func NewFromBundle(bundle stellar1.Bundle) (*stellar1.BundleRestricted, error)
- func NewInitial(name string) (*stellar1.BundleRestricted, error)
- type AcctBoxedEncoded
- type BoxedEncoded
- type BundleEncoded
- type PukFinder
- type WithSecret
Constants ¶
This section is empty.
Variables ¶
var ErrNoChangeNecessary = errors.New("no account mode change is necessary")
ErrNoChangeNecessary means that any proposed change to a bundle isn't actually necessary.
Functions ¶
func DecodeAndUnbox ¶
func DecodeAndUnbox(m libkb.MetaContext, finder PukFinder, encodedBundle BundleEncoded) (*stellar1.BundleRestricted, stellar1.BundleVersion, error)
DecodeAndUnbox decodes the encrypted and visible encoded bundles and unboxes the encrypted bundle using PukFinder to find the correct puk. It combines the results into a stellar1.AccountBundle.
func MakeAllDevices ¶
func MakeAllDevices(a *stellar1.BundleRestricted, accountID stellar1.AccountID) error
MakeAllDevices transforms a stellar1.AccountBundle into an all-device bundle. This advances the revision. If it's already all-device, this function will return ErrNoChangeNecessary.
func MakeMobileOnly ¶
func MakeMobileOnly(a *stellar1.BundleRestricted, accountID stellar1.AccountID) error
MakeMobileOnly transforms a stellar1.AccountBundle into a mobile-only bundle. This advances the revision. If it's already mobile-only, this function will return ErrNoChangeNecessary.
func NewFromBundle ¶
func NewFromBundle(bundle stellar1.Bundle) (*stellar1.BundleRestricted, error)
NewFromBundle creates a BundleRestricted from a Bundle.
func NewInitial ¶
func NewInitial(name string) (*stellar1.BundleRestricted, error)
NewInitial creates a BundleRestricted with a new random secret key.
Types ¶
type AcctBoxedEncoded ¶
type AcctBoxedEncoded struct {
Enc stellar1.EncryptedAccountBundle
EncHash stellar1.Hash
EncB64 string // base64 msgpacked Enc
FormatVersion stellar1.AccountBundleVersion
}
AcctBoxedEncoded is the result of boxing and encoding the per-account secrets.
type BoxedEncoded ¶
type BoxedEncoded struct {
EncParent stellar1.EncryptedBundle
EncParentB64 string // base64 msgpacked Enc
VisParentB64 string
FormatVersionParent stellar1.BundleVersion
AcctBundles map[stellar1.AccountID]AcctBoxedEncoded
}
BoxedEncoded is the result of boxing and encoding a BundleRestricted object.
func BoxAndEncode ¶
func BoxAndEncode(a *stellar1.BundleRestricted, pukGen keybase1.PerUserKeyGeneration, puk libkb.PerUserKeySeed) (*BoxedEncoded, error)
BoxAndEncode encrypts and encodes a BundleRestricted object.
type BundleEncoded ¶
type BundleEncoded struct {
EncParent string `json:"encrypted_parent"` // base64 msgpacked Enc
VisParent string `json:"visible_parent"`
FormatVersionParent stellar1.AccountBundleVersion `json:"version_parent"`
AcctBundles map[stellar1.AccountID]string `json:"account_bundles"`
}
BundleEncoded contains all the encoded fields for communicating with the api server to post and get account bundles.
type PukFinder ¶
type PukFinder interface {
SeedByGeneration(m libkb.MetaContext, generation keybase1.PerUserKeyGeneration) (libkb.PerUserKeySeed, error)
}
PukFinder helps this package find puks.
type WithSecret ¶
type WithSecret struct {
AccountID stellar1.AccountID
Mode stellar1.AccountMode
Name string
Revision stellar1.BundleRevision
Signers []stellar1.SecretKey
}
WithSecret is a convenient summary of an individual account that includes the secret keys.
func AccountWithSecret ¶
func AccountWithSecret(bundle *stellar1.BundleRestricted, accountID stellar1.AccountID) (*WithSecret, error)
AccountWithSecret finds an account in bundle and its associated secret and extracts them into a convenience type acctbundle.WithSecret. It will return libkb.NotFoundError if it can't find the secret or the account in the bundle.