backuplib

package
v0.0.0-...-8cf541d Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: GPL-3.0 Imports: 25 Imported by: 0

README

backuplib

Mobile friendly backup library

Documentation

Index

Constants

View Source
const (
	ENCRYPT = iota
	DONT_ENCRYPT
)
View Source
const (
	N_ELEMENTS            = 1000 // used by walletcfg currently
	MIN_N_SHARES          = 4
	MAX_N_SHARES          = 10
	PRIME                 = ff.FF_BN256_FP
	BACKUP_FILE           = "../testdata/backup.bk"
	QR_DIR                = "../testdata/"
	PBKDF2_NITER          = 60000
	PBKDF2_SALTLEN        = 12
	PBKDF2_KEY            = fc.FC_KEY_T_PBKDF2
	SHA256_HASH           = fc.FC_HASH_SHA256
	GCM_ENCRYPTION        = fc.FC_GCM
	WEB3URL               = "https://foo.bar"
	HOLDER_TICKET_PERIOD  = 1000
	IDENTITY_MAIN_STORAGE = "identityTest"
	FOLDER_STORE          = "store"
	FOLDER_KSTORE         = "keystore"
	KSTORE_FILE           = "/idKeyStore"
	STORE_FILE            = "/idStore"
)

Configuration constants

View Source
const (
	EMAIL = iota
	PHONE
	TELEGRAM
	QR   // Generate QR
	NONE // send raw data directly
)

Attempts to emulate how we could exchage shares. QR and NONE the only one working in this demo

View Source
const (
	START_TYPES = iota
	WALLET_CONFIG
	CUSTODIAN
	SSHARING
	SHARES
	PKEYS
	STORAGE
	NTYPES
)

Types of data we can include in the backup. Needed to register the data strcuture

Variables

This section is empty.

Functions

func AddCustodian

func AddCustodian(nickname, folder string, method int, startIdx, nshares int) error

func AddToBackup

func AddToBackup(t, action int)

Record and register backup data structures

func CreateBackup

func CreateBackup(fname string) error

Generate backup file

func DecodeEncrypted

func DecodeEncrypted(fname string) error

func DecodeUnencrypted

func DecodeUnencrypted(fname string) error

Decode and decrypt file using provided key

func GenerateKey

func GenerateKey() []byte

Generate secret from shares

func GenerateShares

func GenerateShares(secret []byte)

Generate shares from secret

func GetNCustodians

func GetNCustodians() int

func GetNShares

func GetNShares() int

func GetSecretCfgOriginal

func GetSecretCfgOriginal() *shamir.Shamir

func GetStorage

func GetStorage() []db.KV

func GetkOp

func GetkOp() []byte

Getters/Setters

func Init

func Init(pass []byte, folder string)

func KeyOperational

func KeyOperational() []byte

func RestoreIdentity

func RestoreIdentity(folder string, params keystore.KeyStoreParams) (*iden3mobile.Identity, error)

func ScanQRShare

func ScanQRShare(fname string)

func SetCustodians

func SetCustodians(data *Custodians)

func SetPrivateKeys

func SetPrivateKeys(data *PrivateKeys)

func SetSecretCfg

func SetSecretCfg(data *Secret)

func SetShares

func SetShares(data *Shares)

func SetStorage

func SetStorage(data []db.KV)

func SetWallet

func SetWallet(data *WalletConfig)

func SetkOp

func SetkOp(kOp []byte)

Types

type Backup

type Backup struct {
	// contains filtered or unexported fields
}

type BackupData

type BackupData struct {
	// contains filtered or unexported fields
}

type Custodian

type Custodian struct {
	Nickname string
	NShares  int // number of shares provided
	Fname    string
}

func GetCustodian

func GetCustodian(n int) *Custodian

type Custodians

type Custodians struct {
	Data []Custodian
}
var SecretCustodians *Custodians

func GetCustodians

func GetCustodians() *Custodians

type PrivateKeys

type PrivateKeys struct {
	PK []babyjub.PrivateKey
}

func GetPrivateKeys

func GetPrivateKeys() *PrivateKeys

type Secret

type Secret struct {
	shamir.Shamir
}

func GetSecretCfg

func GetSecretCfg() *Secret

type Share

type Share struct {
	Px int
	Py []byte
}

func GetShare

func GetShare(n int) *Share

type Shares

type Shares struct {
	Data []Share
}

func GetShares

func GetShares() *Shares

type WalletConfig

type WalletConfig struct {
	Config map[string][]byte
}

Emulated wallet structure

func GetWallet

func GetWallet() *WalletConfig

Jump to

Keyboard shortcuts

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