68 char *out,
size_t cap);
The injected runtime environment (crypto, keystore, store, clock, RNG) the wallet runs against.
Result of lite_balance().
Definition wallet.h:36
double non_spendable
Pending credits not yet spendable.
Definition wallet.h:38
int pending_count
Number of queued PendingTxn entries.
Definition wallet.h:39
double balance
Spendable balance.
Definition wallet.h:37
Result of lite_is_bound().
Definition wallet.h:27
int bound
1 if bound.
Definition wallet.h:28
int sync_required
1 if a spend is pending sync.
Definition wallet.h:29
Everything the wallet needs, injected so tests can pin the clock, RNG and keys.
Definition env.h:26
A spend request. All fields are caller-owned strings.
Definition wallet.h:43
const char * app_id
App package id.
Definition wallet.h:49
const char * device_id
Device id.
Definition wallet.h:51
const char * payee_addr
Payee VPA/address.
Definition wallet.h:48
const char * mobile
Payer mobile number.
Definition wallet.h:50
const char * ts
Transaction timestamp.
Definition wallet.h:46
const char * txn_id
Transaction id.
Definition wallet.h:45
const char * amount
Transaction amount (decimal string).
Definition wallet.h:44
const char * payer_lite_acc
Payer's Lite account number.
Definition wallet.h:47
The NPCICLVAULT codec: an AES-GCM-encrypted JSON doc, separately signed, with tamper-reset.
int lite_balance(lite_env *env, const char *alias, lite_balance_info *out)
Computes spendable/non-spendable balance and pending count into out. LITE_OK or LITE_ERR.
int lite_unbind(lite_env *env, const char *alias)
Removes the device binding: deletes the alias keys and clears the vault record. LITE_OK.
int lite_spend(lite_env *env, const char *alias, const lite_txn *txn, int is_credit, char *out, size_t cap)
Signs a spend, writing {"riskParams":..,"signature":..} JSON to out. Enforces the PendingTxn gate....
int lite_onboard(lite_env *env, const char *alias, const char *signed_state_json)
Establishes vault + spend key + session key, then applies the first signed state blob....
int lite_is_bound(lite_env *env, const char *alias, lite_bind_info *out)
Reports binding status into out. Returns LITE_BIND_YES or LITE_BIND_NO.
@ LITE_BIND_NO
Not bound.
Definition wallet.h:12
@ LITE_BIND_YES
Bound.
Definition wallet.h:13
int lite_sync(lite_env *env, const char *alias, const char *signed_state_json)
Applies a signed state blob: verify, require a newer timestamp, replace state, clear PendingTxn....
@ LITE_SPEND_DECLINED
Limit / balance / ACSTATUS gate failed.
Definition wallet.h:23
@ LITE_SYNC_BAD_SIG
Incoming state signature invalid.
Definition wallet.h:19
@ LITE_SPEND_SYNC_REQUIRED
A prior spend is unsynced (PendingTxn non-empty).
Definition wallet.h:22
@ LITE_SYNC_OK
State applied.
Definition wallet.h:18
@ LITE_SYNC_DEACTIVATED
ACSTATUS=DA; device unbound.
Definition wallet.h:21
@ LITE_SYNC_STALE
Incoming timestamp not strictly newer: the rollback-relevant gate.
Definition wallet.h:20