opensc
NPCI secure-component & UPI Lite / Lite X wallet reimplementation
Loading...
Searching...
No Matches
vault.h
Go to the documentation of this file.
1#ifndef LITE_VAULT_H
2#define LITE_VAULT_H
3
4#include <stddef.h>
5
6#include "lite/env.h"
7
10
12enum {
13 LITE_OK = 0,
14 LITE_ERR = -1,
17};
18
20int lite_vault_open(lite_env *env, const char *alias);
21
23int lite_vault_reset(lite_env *env, const char *alias);
24
26long lite_vault_get(lite_env *env, const char *alias, const char *key, char *out, size_t cap);
27
29int lite_vault_set(lite_env *env, const char *alias, const char *key, const char *val);
30
31#endif
The injected runtime environment (crypto, keystore, store, clock, RNG) the wallet runs against.
Everything the wallet needs, injected so tests can pin the clock, RNG and keys.
Definition env.h:26
int lite_vault_open(lite_env *env, const char *alias)
Ensures the vault's AES and signing keys exist and a valid encrypted record is stored.
int lite_vault_reset(lite_env *env, const char *alias)
Replaces vault contents with an encrypted "{}" under freshly generated keys.
int lite_vault_set(lite_env *env, const char *alias, const char *key, const char *val)
Read-modify-write of one field. Verifies the current record first; resets on tamper....
long lite_vault_get(lite_env *env, const char *alias, const char *key, char *out, size_t cap)
Reads one top-level string field into out. Returns length, LITE_ERR_ABSENT, or LITE_ERR_TAMPER.
@ LITE_ERR_ABSENT
Requested field/record not present.
Definition vault.h:15
@ LITE_ERR_TAMPER
Signature invalid; the vault was reset as a side effect.
Definition vault.h:16
@ LITE_ERR
Generic failure.
Definition vault.h:14
@ LITE_OK
Success.
Definition vault.h:13