SecureWallet

Function and data to recover, sign transaction and hold the account information

@safe
struct SecureWallet (
Net : SecureNet
) {
protected
SecureNet _net;
enum long snavs_byte_fee;
}

Constructors

this
this(DevicePIN pin, RecoverGenerator wallet, AccountDetails account)
this
this(const(string[]) questions, const(char[][]) answers, uint confidence, const(char[]) pincode)

Creates a wallet from a list for questions and answers

Members

Functions

available_balance
TagionCurrency available_balance()

Calculates the amount which can be activate

changePincode
bool changePincode(const(char[]) pincode, const(char[]) new_pincode)

Check the pincode

checkLogin
void checkLogin()

Throws a WalletExceptions if the wallet is not logged in

checkPincode
bool checkPincode(const(char[]) pincode)

Checks if the pincode is correct

confidence
uint confidence()
correct
bool correct(const(string[]) questions, const(char[][]) answers)

Checks that the answers to the question is correct

differenceInIndices
const(HiRPC.Sender) differenceInIndices(const(HiRPC.Receiver) receiver)

Second stage in updating wallet. Takes a read trt.dartRead recorder. Creates an array of DARTindices from readIndicesByPubkey recorder If some indices were found in the wallet but not in the trt, the indices are removed from the wallet. If some indices were found in the trt but not in the wallet, the indices are put into a new dartRead request.

getRequestUpdateWallet
deprecated const(HiRPC.Sender) getRequestUpdateWallet(HiRPC hirpc)

Creates HiRPC to request an wallet update

isLoggedin
bool isLoggedin()

Checks if the wallet contains a key-pair

locked_balance
TagionCurrency locked_balance()

Calcutales the locked amount in the network

login
bool login(const(char[]) pincode)

Generates the key-pair from the pin code

logout
void logout()

Removes the key-pair

payment
Result!bool payment(const(Invoice[]) orders, SignedContract signed_contract, TagionCurrency fees)

Create a payment to a list of Invoices and produces a signed-contract Collect the bill need and sign them in the contract

pin
const(DevicePIN) pin()

Retrieve the device-pin generation

readContractsTRT
const(HiRPC.Sender) readContractsTRT(const(Document)[] contracts, HiRPC hirpc)

Used for reading contract from TRT. Creates a trt.dartRead command for the TRT. Takes hash of given contract and creates dart index with #contract for lookup in TRT These indices are put into the trt.dartRead specifying the command.

readIndicesByPubkey
const(HiRPC.Sender) readIndicesByPubkey(HiRPC hirpc)

Used for first step in updating wallet from TRT. Creates a trt.dartRead command for the TRT. Takes all derivers in the wallet and convert the pubkeys to #pubkey for lookup in TRT These indices are put into the trt.dartRead specifying the command.

recover
bool recover(const(string[]) questions, const(char[][]) answers, const(char[]) pincode)

Recover the key-pair from the quiz or the device-pincode

registerInvoice
void registerInvoice(Invoice invoice)

Register an invoice to the wallet

setAccount
void setAccount(const(Document) account_doc)

Set the account.hibon file

setEncrAccount
void setEncrAccount(const(CiphDoc) cipher_doc)

Set encrypted account.hibon file

setResponseUpdateWallet
bool setResponseUpdateWallet(const(HiRPC.Receiver) receiver)

Update the the wallet for a request update

total_balance
TagionCurrency total_balance()

Calcutales the total amount

unlockBills
void unlockBills()

Clear the locked bills

updateFromRead
bool updateFromRead(const(HiRPC.Receiver) receiver)

Updates the wallet based on the received dartRead

wallet
const(RecoverGenerator) wallet()

Static functions

calcTotal
TagionCurrency calcTotal(const(TagionBill[]) bills)

Calculates the amount in a list of bills

createInvoice
Invoice createInvoice(string label, TagionCurrency amount, Document info)

Create a new invoice which can be send to a payee

Variables

_pin
DevicePIN _pin;

Information to check the Pin code

_wallet
RecoverGenerator _wallet;

Information to recover the seed-generator

account
AccountDetails account;

Account-details holding the bills and generator