acctbundle

package
v2.11.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 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 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 New

New creates a BundleRestricted from an existing secret key.

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

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.

Jump to

Keyboard shortcuts

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