opensc
NPCI secure-component & UPI Lite / Lite X wallet reimplementation
Loading...
Searching...
No Matches
wallet.h File Reference

The online UPI Lite wallet: onboard, isBound, balance, sync, spend, unbind. More...

#include "lite/env.h"
#include "lite/vault.h"
Include dependency graph for wallet.h:

Go to the source code of this file.

Data Structures

struct  lite_bind_info
 Result of lite_is_bound(). More...
 
struct  lite_balance_info
 Result of lite_balance(). More...
 
struct  lite_txn
 A spend request. All fields are caller-owned strings. More...
 

Enumerations

enum  { LITE_BIND_NO = 0 , LITE_BIND_YES = 1 }
 Binding status returned by lite_is_bound(). More...
 
enum  {
  LITE_SYNC_OK = 0 , LITE_SYNC_BAD_SIG = -10 , LITE_SYNC_STALE = -11 , LITE_SYNC_DEACTIVATED = -12 ,
  LITE_SPEND_SYNC_REQUIRED = -20 , LITE_SPEND_DECLINED = -21
}
 sync()/spend() result codes. More...
 

Functions

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. LITE_SYNC_* code.
 
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.
 
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_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_SYNC_* code.
 
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. LITE_OK/LITE_SPEND_*.
 
int lite_unbind (lite_env *env, const char *alias)
 Removes the device binding: deletes the alias keys and clears the vault record. LITE_OK.
 

Detailed Description

The online UPI Lite wallet: onboard, isBound, balance, sync, spend, unbind.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Binding status returned by lite_is_bound().

Enumerator
LITE_BIND_NO 

Not bound.

LITE_BIND_YES 

Bound.

◆ anonymous enum

anonymous enum

sync()/spend() result codes.

Enumerator
LITE_SYNC_OK 

State applied.

LITE_SYNC_BAD_SIG 

Incoming state signature invalid.

LITE_SYNC_STALE 

Incoming timestamp not strictly newer: the rollback-relevant gate.

LITE_SYNC_DEACTIVATED 

ACSTATUS=DA; device unbound.

LITE_SPEND_SYNC_REQUIRED 

A prior spend is unsynced (PendingTxn non-empty).

LITE_SPEND_DECLINED 

Limit / balance / ACSTATUS gate failed.