Documentation ¶
Index ¶
- Variables
- func AddAccount(bundle *stellar1.Bundle, secretKey stellar1.SecretKey, name string, ...) (err error)
- func AdvanceAccounts(prevBundle stellar1.Bundle, accountIDs []stellar1.AccountID) stellar1.Bundle
- func AdvanceBundle(prevBundle stellar1.Bundle) stellar1.Bundle
- func CreateNewAccount(bundle *stellar1.Bundle, name string, makePrimary bool) (pub stellar1.AccountID, err error)
- func MakeAllDevices(a *stellar1.Bundle, accountID stellar1.AccountID) error
- func MakeMobileOnly(a *stellar1.Bundle, accountID stellar1.AccountID) error
- func New(secret stellar1.SecretKey, name string) (*stellar1.Bundle, error)
- func NewInitial(name string) (*stellar1.Bundle, error)
- type AccountPukGens
- 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 AddAccount ¶ added in v1.0.47
func AddAccount(bundle *stellar1.Bundle, secretKey stellar1.SecretKey, name string, makePrimary bool) (err error)
AddAccount adds an account to the bundle. Mutates `bundle`.
func AdvanceAccounts ¶
AdvanceAccounts advances the revisions and hashes on the Bundle as well as on the specified Accounts. This is useful for mutating one or more of the accounts in the bundle, e.g. changing which one is Primary.
func AdvanceBundle ¶
AdvanceBundle only advances the revisions and hashes on the Bundle and not on the accounts. This is useful for adding and removing accounts but not for changing them.
func CreateNewAccount ¶
func CreateNewAccount(bundle *stellar1.Bundle, name string, makePrimary bool) (pub stellar1.AccountID, err error)
CreateNewAccount generates a Stellar key pair and adds it to the bundle. Mutates `bundle`.
func MakeAllDevices ¶
MakeAllDevices transforms an account in a stellar1.Bundle into an all-devices account. This advances the revision of the Bundle. If it's already all-devices, this function will return ErrNoChangeNecessary.
func MakeMobileOnly ¶
MakeMobileOnly transforms an account in a stellar1.Bundle into a mobile-only account. This advances the revision of the Bundle. If it's already mobile-only, this function will return ErrNoChangeNecessary.
Types ¶
type AccountPukGens ¶
type AccountPukGens map[stellar1.AccountID](keybase1.PerUserKeyGeneration)
func DecodeAndUnbox ¶
func DecodeAndUnbox(m libkb.MetaContext, finder PukFinder, encodedBundle BundleEncoded) (*stellar1.Bundle, stellar1.BundleVersion, keybase1.PerUserKeyGeneration, AccountPukGens, 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.Bundle and also returns additional information about the bundle: its version, pukGen, and the pukGens of each of the decrypted account secrets.
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 Bundle object.
func BoxAndEncode ¶
func BoxAndEncode(a *stellar1.Bundle, pukGen keybase1.PerUserKeyGeneration, puk libkb.PerUserKeySeed) (*BoxedEncoded, error)
BoxAndEncode encrypts and encodes a Bundle object.
type BundleEncoded ¶
type BundleEncoded struct { EncParent string `json:"encrypted_parent"` // base64 msgpacked Enc VisParent string `json:"visible_parent"` FormatVersionParent stellar1.BundleVersion `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 ¶
AccountWithSecret finds an account in bundle and its associated secret and extracts them into a convenience type bundle.WithSecret. It will return libkb.NotFoundError if it can't find the secret or the account in the bundle.