bundle

package
v5.5.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: BSD-3-Clause, BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func AdvanceAccounts(prevBundle stellar1.Bundle, accountIDs []stellar1.AccountID) stellar1.Bundle

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

func AdvanceBundle(prevBundle stellar1.Bundle) stellar1.Bundle

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

func MakeAllDevices(a *stellar1.Bundle, accountID stellar1.AccountID) error

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

func MakeMobileOnly(a *stellar1.Bundle, accountID stellar1.AccountID) error

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.

func New

func New(secret stellar1.SecretKey, name string) (*stellar1.Bundle, error)

New creates a Bundle from an existing secret key.

func NewInitial

func NewInitial(name string) (*stellar1.Bundle, error)

NewInitial creates a Bundle with a new random secret key.

Types

type AccountPukGens

type AccountPukGens map[stellar1.AccountID](keybase1.PerUserKeyGeneration)

func DecodeAndUnbox

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

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

func AccountWithSecret(bundle *stellar1.Bundle, accountID stellar1.AccountID) (*WithSecret, error)

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.

Jump to

Keyboard shortcuts

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