@devraj-labs/rn-storage-kit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +235 -0
- package/dist/debug/index.d.ts +3 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +19 -0
- package/dist/debug/index.js.map +1 -0
- package/dist/debug/storage-debug-panel/index.d.ts +3 -0
- package/dist/debug/storage-debug-panel/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-panel/index.js +19 -0
- package/dist/debug/storage-debug-panel/index.js.map +1 -0
- package/dist/debug/storage-debug-panel/storage-debug-panel-types.d.ts +4 -0
- package/dist/debug/storage-debug-panel/storage-debug-panel-types.d.ts.map +1 -0
- package/dist/debug/storage-debug-panel/storage-debug-panel-types.js +4 -0
- package/dist/debug/storage-debug-panel/storage-debug-panel-types.js.map +1 -0
- package/dist/debug/storage-debug-panel/storage-debug-panel.d.ts +3 -0
- package/dist/debug/storage-debug-panel/storage-debug-panel.d.ts.map +1 -0
- package/dist/debug/storage-debug-panel/storage-debug-panel.js +308 -0
- package/dist/debug/storage-debug-panel/storage-debug-panel.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-colors.d.ts +22 -0
- package/dist/debug/storage-debug-screen/debug-colors.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-colors.js +25 -0
- package/dist/debug/storage-debug-screen/debug-colors.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-data-row/debug-data-row.d.ts +6 -0
- package/dist/debug/storage-debug-screen/debug-data-row/debug-data-row.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-data-row/debug-data-row.js +83 -0
- package/dist/debug/storage-debug-screen/debug-data-row/debug-data-row.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-data-row/index.d.ts +2 -0
- package/dist/debug/storage-debug-screen/debug-data-row/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-data-row/index.js +18 -0
- package/dist/debug/storage-debug-screen/debug-data-row/index.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-empty/debug-empty.d.ts +7 -0
- package/dist/debug/storage-debug-screen/debug-empty/debug-empty.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-empty/debug-empty.js +17 -0
- package/dist/debug/storage-debug-screen/debug-empty/debug-empty.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-empty/index.d.ts +2 -0
- package/dist/debug/storage-debug-screen/debug-empty/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-empty/index.js +18 -0
- package/dist/debug/storage-debug-screen/debug-empty/index.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-fab/debug-fab.d.ts +7 -0
- package/dist/debug/storage-debug-screen/debug-fab/debug-fab.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-fab/debug-fab.js +21 -0
- package/dist/debug/storage-debug-screen/debug-fab/debug-fab.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-fab/index.d.ts +2 -0
- package/dist/debug/storage-debug-screen/debug-fab/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-fab/index.js +18 -0
- package/dist/debug/storage-debug-screen/debug-fab/index.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-header/debug-header-types.d.ts +8 -0
- package/dist/debug/storage-debug-screen/debug-header/debug-header-types.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-header/debug-header-types.js +3 -0
- package/dist/debug/storage-debug-screen/debug-header/debug-header-types.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-header/debug-header.d.ts +4 -0
- package/dist/debug/storage-debug-screen/debug-header/debug-header.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-header/debug-header.js +27 -0
- package/dist/debug/storage-debug-screen/debug-header/debug-header.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-header/index.d.ts +3 -0
- package/dist/debug/storage-debug-screen/debug-header/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-header/index.js +19 -0
- package/dist/debug/storage-debug-screen/debug-header/index.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-helpers/format-time.d.ts +2 -0
- package/dist/debug/storage-debug-screen/debug-helpers/format-time.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-helpers/format-time.js +12 -0
- package/dist/debug/storage-debug-screen/debug-helpers/format-time.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-helpers/index.d.ts +3 -0
- package/dist/debug/storage-debug-screen/debug-helpers/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-helpers/index.js +19 -0
- package/dist/debug/storage-debug-screen/debug-helpers/index.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-helpers/read-mmkv-data.d.ts +4 -0
- package/dist/debug/storage-debug-screen/debug-helpers/read-mmkv-data.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-helpers/read-mmkv-data.js +29 -0
- package/dist/debug/storage-debug-screen/debug-helpers/read-mmkv-data.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-log-row/debug-log-row.d.ts +9 -0
- package/dist/debug/storage-debug-screen/debug-log-row/debug-log-row.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-log-row/debug-log-row.js +120 -0
- package/dist/debug/storage-debug-screen/debug-log-row/debug-log-row.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-log-row/index.d.ts +2 -0
- package/dist/debug/storage-debug-screen/debug-log-row/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-log-row/index.js +18 -0
- package/dist/debug/storage-debug-screen/debug-log-row/index.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-tab-bar/debug-tab-bar.d.ts +6 -0
- package/dist/debug/storage-debug-screen/debug-tab-bar/debug-tab-bar.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-tab-bar/debug-tab-bar.js +51 -0
- package/dist/debug/storage-debug-screen/debug-tab-bar/debug-tab-bar.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-tab-bar/index.d.ts +2 -0
- package/dist/debug/storage-debug-screen/debug-tab-bar/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-tab-bar/index.js +18 -0
- package/dist/debug/storage-debug-screen/debug-tab-bar/index.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/debug-toolbar-types.d.ts +10 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/debug-toolbar-types.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/debug-toolbar-types.js +3 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/debug-toolbar-types.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/debug-toolbar.d.ts +4 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/debug-toolbar.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/debug-toolbar.js +22 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/debug-toolbar.js.map +1 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/index.d.ts +3 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/index.js +19 -0
- package/dist/debug/storage-debug-screen/debug-toolbar/index.js.map +1 -0
- package/dist/debug/storage-debug-screen/index.d.ts +4 -0
- package/dist/debug/storage-debug-screen/index.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/index.js +20 -0
- package/dist/debug/storage-debug-screen/index.js.map +1 -0
- package/dist/debug/storage-debug-screen/storage-debug-screen-types.d.ts +11 -0
- package/dist/debug/storage-debug-screen/storage-debug-screen-types.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/storage-debug-screen-types.js +3 -0
- package/dist/debug/storage-debug-screen/storage-debug-screen-types.js.map +1 -0
- package/dist/debug/storage-debug-screen/storage-debug-screen.d.ts +5 -0
- package/dist/debug/storage-debug-screen/storage-debug-screen.d.ts.map +1 -0
- package/dist/debug/storage-debug-screen/storage-debug-screen.js +140 -0
- package/dist/debug/storage-debug-screen/storage-debug-screen.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +19 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger-types.d.ts +29 -0
- package/dist/logger/logger-types.d.ts.map +1 -0
- package/dist/logger/logger-types.js +5 -0
- package/dist/logger/logger-types.js.map +1 -0
- package/dist/logger/logger.d.ts +10 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +151 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/mmkv-storage/index.d.ts +2 -0
- package/dist/mmkv-storage/index.d.ts.map +1 -0
- package/dist/mmkv-storage/index.js +18 -0
- package/dist/mmkv-storage/index.js.map +1 -0
- package/dist/mmkv-storage/mmkv-storage.d.ts +11 -0
- package/dist/mmkv-storage/mmkv-storage.d.ts.map +1 -0
- package/dist/mmkv-storage/mmkv-storage.js +156 -0
- package/dist/mmkv-storage/mmkv-storage.js.map +1 -0
- package/dist/secure-storage/index.d.ts +2 -0
- package/dist/secure-storage/index.d.ts.map +1 -0
- package/dist/secure-storage/index.js +18 -0
- package/dist/secure-storage/index.js.map +1 -0
- package/dist/secure-storage/secure-storage.d.ts +9 -0
- package/dist/secure-storage/secure-storage.d.ts.map +1 -0
- package/dist/secure-storage/secure-storage.js +225 -0
- package/dist/secure-storage/secure-storage.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/storage-adapter-types.d.ts +8 -0
- package/dist/types/storage-adapter-types.d.ts.map +1 -0
- package/dist/types/storage-adapter-types.js +3 -0
- package/dist/types/storage-adapter-types.js.map +1 -0
- package/package.json +63 -0
- package/src/index.ts +12 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SecureStorageAdapter = void 0;
|
|
37
|
+
const Keychain = __importStar(require("react-native-keychain"));
|
|
38
|
+
const react_native_mmkv_1 = require("react-native-mmkv");
|
|
39
|
+
const logger_1 = require("../logger");
|
|
40
|
+
// ─── Key index ─────────────────────────────────────────────────────────────────
|
|
41
|
+
// Keychain has no key-enumeration API so we maintain a small index in MMKV.
|
|
42
|
+
// This index stores only keys, never secret values.
|
|
43
|
+
const keysIndex = new react_native_mmkv_1.MMKV({ id: 'rn-storage-kit.secure-index' });
|
|
44
|
+
const SECURE_KEYS_INDEX = '__secure_keys__';
|
|
45
|
+
function getKeyIndex() {
|
|
46
|
+
const raw = keysIndex.getString(SECURE_KEYS_INDEX);
|
|
47
|
+
if (!raw)
|
|
48
|
+
return [];
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(raw);
|
|
51
|
+
}
|
|
52
|
+
catch (_a) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function addToKeyIndex(key) {
|
|
57
|
+
const keys = getKeyIndex();
|
|
58
|
+
if (!keys.includes(key)) {
|
|
59
|
+
keys.push(key);
|
|
60
|
+
keysIndex.set(SECURE_KEYS_INDEX, JSON.stringify(keys));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function removeFromKeyIndex(key) {
|
|
64
|
+
const keys = getKeyIndex().filter((k) => k !== key);
|
|
65
|
+
keysIndex.set(SECURE_KEYS_INDEX, JSON.stringify(keys));
|
|
66
|
+
}
|
|
67
|
+
function clearKeyIndex() {
|
|
68
|
+
keysIndex.delete(SECURE_KEYS_INDEX);
|
|
69
|
+
}
|
|
70
|
+
// ─── Value masking ─────────────────────────────────────────────────────────────
|
|
71
|
+
// Secure values are NEVER written to logs in plain text.
|
|
72
|
+
// We log the sentinel '***' so the entry shows the field exists without exposing the secret.
|
|
73
|
+
const MASKED = '***';
|
|
74
|
+
class SecureStorageAdapter {
|
|
75
|
+
async get(key) {
|
|
76
|
+
const start = Date.now();
|
|
77
|
+
try {
|
|
78
|
+
const creds = await Keychain.getGenericPassword({ service: key });
|
|
79
|
+
const raw = creds ? creds.password : null;
|
|
80
|
+
const result = raw !== null ? JSON.parse(raw) : null;
|
|
81
|
+
(0, logger_1.log)({
|
|
82
|
+
id: (0, logger_1.generateId)(),
|
|
83
|
+
timestamp: Date.now(),
|
|
84
|
+
adapter: 'secure',
|
|
85
|
+
operation: 'get',
|
|
86
|
+
key,
|
|
87
|
+
result: result !== null ? MASKED : null,
|
|
88
|
+
durationMs: Date.now() - start,
|
|
89
|
+
secure: true,
|
|
90
|
+
});
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
(0, logger_1.log)({
|
|
95
|
+
id: (0, logger_1.generateId)(),
|
|
96
|
+
timestamp: Date.now(),
|
|
97
|
+
adapter: 'secure',
|
|
98
|
+
operation: 'get',
|
|
99
|
+
key,
|
|
100
|
+
error: String(e),
|
|
101
|
+
durationMs: Date.now() - start,
|
|
102
|
+
secure: true,
|
|
103
|
+
});
|
|
104
|
+
throw e;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async set(key, value) {
|
|
108
|
+
const start = Date.now();
|
|
109
|
+
try {
|
|
110
|
+
const serialized = JSON.stringify(value);
|
|
111
|
+
await Keychain.setGenericPassword(key, serialized, { service: key });
|
|
112
|
+
addToKeyIndex(key);
|
|
113
|
+
(0, logger_1.log)({
|
|
114
|
+
id: (0, logger_1.generateId)(),
|
|
115
|
+
timestamp: Date.now(),
|
|
116
|
+
adapter: 'secure',
|
|
117
|
+
operation: 'set',
|
|
118
|
+
key,
|
|
119
|
+
value: MASKED,
|
|
120
|
+
durationMs: Date.now() - start,
|
|
121
|
+
secure: true,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
(0, logger_1.log)({
|
|
126
|
+
id: (0, logger_1.generateId)(),
|
|
127
|
+
timestamp: Date.now(),
|
|
128
|
+
adapter: 'secure',
|
|
129
|
+
operation: 'set',
|
|
130
|
+
key,
|
|
131
|
+
error: String(e),
|
|
132
|
+
durationMs: Date.now() - start,
|
|
133
|
+
secure: true,
|
|
134
|
+
});
|
|
135
|
+
throw e;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async remove(key) {
|
|
139
|
+
const start = Date.now();
|
|
140
|
+
try {
|
|
141
|
+
await Keychain.resetGenericPassword({ service: key });
|
|
142
|
+
removeFromKeyIndex(key);
|
|
143
|
+
(0, logger_1.log)({
|
|
144
|
+
id: (0, logger_1.generateId)(),
|
|
145
|
+
timestamp: Date.now(),
|
|
146
|
+
adapter: 'secure',
|
|
147
|
+
operation: 'remove',
|
|
148
|
+
key,
|
|
149
|
+
durationMs: Date.now() - start,
|
|
150
|
+
secure: true,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
154
|
+
(0, logger_1.log)({
|
|
155
|
+
id: (0, logger_1.generateId)(),
|
|
156
|
+
timestamp: Date.now(),
|
|
157
|
+
adapter: 'secure',
|
|
158
|
+
operation: 'remove',
|
|
159
|
+
key,
|
|
160
|
+
error: String(e),
|
|
161
|
+
durationMs: Date.now() - start,
|
|
162
|
+
secure: true,
|
|
163
|
+
});
|
|
164
|
+
throw e;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async clear() {
|
|
168
|
+
const start = Date.now();
|
|
169
|
+
try {
|
|
170
|
+
const keys = getKeyIndex();
|
|
171
|
+
await Promise.all(keys.map((k) => Keychain.resetGenericPassword({ service: k })));
|
|
172
|
+
clearKeyIndex();
|
|
173
|
+
(0, logger_1.log)({
|
|
174
|
+
id: (0, logger_1.generateId)(),
|
|
175
|
+
timestamp: Date.now(),
|
|
176
|
+
adapter: 'secure',
|
|
177
|
+
operation: 'clear',
|
|
178
|
+
durationMs: Date.now() - start,
|
|
179
|
+
secure: true,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
(0, logger_1.log)({
|
|
184
|
+
id: (0, logger_1.generateId)(),
|
|
185
|
+
timestamp: Date.now(),
|
|
186
|
+
adapter: 'secure',
|
|
187
|
+
operation: 'clear',
|
|
188
|
+
error: String(e),
|
|
189
|
+
durationMs: Date.now() - start,
|
|
190
|
+
secure: true,
|
|
191
|
+
});
|
|
192
|
+
throw e;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async getAllKeys() {
|
|
196
|
+
const start = Date.now();
|
|
197
|
+
try {
|
|
198
|
+
const keys = getKeyIndex();
|
|
199
|
+
(0, logger_1.log)({
|
|
200
|
+
id: (0, logger_1.generateId)(),
|
|
201
|
+
timestamp: Date.now(),
|
|
202
|
+
adapter: 'secure',
|
|
203
|
+
operation: 'getAllKeys',
|
|
204
|
+
result: keys.join(', ') || '(empty)',
|
|
205
|
+
durationMs: Date.now() - start,
|
|
206
|
+
secure: true,
|
|
207
|
+
});
|
|
208
|
+
return keys;
|
|
209
|
+
}
|
|
210
|
+
catch (e) {
|
|
211
|
+
(0, logger_1.log)({
|
|
212
|
+
id: (0, logger_1.generateId)(),
|
|
213
|
+
timestamp: Date.now(),
|
|
214
|
+
adapter: 'secure',
|
|
215
|
+
operation: 'getAllKeys',
|
|
216
|
+
error: String(e),
|
|
217
|
+
durationMs: Date.now() - start,
|
|
218
|
+
secure: true,
|
|
219
|
+
});
|
|
220
|
+
throw e;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
exports.SecureStorageAdapter = SecureStorageAdapter;
|
|
225
|
+
//# sourceMappingURL=secure-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secure-storage.js","sourceRoot":"","sources":["../../src/secure-storage/secure-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAkD;AAClD,yDAAyC;AACzC,sCAA4C;AAG5C,kFAAkF;AAClF,4EAA4E;AAC5E,oDAAoD;AAEpD,MAAM,SAAS,GAAG,IAAI,wBAAI,CAAC,EAAE,EAAE,EAAE,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,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./storage-adapter-types"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type TStorageAdapter<TSchema extends Record<string, unknown> = Record<string, string>> = {
|
|
2
|
+
get<K extends keyof TSchema & string>(key: K): Promise<TSchema[K] | null>;
|
|
3
|
+
set<K extends keyof TSchema & string>(key: K, value: TSchema[K]): Promise<void>;
|
|
4
|
+
remove(key: string): Promise<void>;
|
|
5
|
+
clear(): Promise<void>;
|
|
6
|
+
getAllKeys(): Promise<string[]>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=storage-adapter-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-adapter-types.d.ts","sourceRoot":"","sources":["../../src/types/storage-adapter-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI;IAC9F,GAAG,CAAC,CAAC,SAAS,MAAM,OAAO,GAAG,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1E,GAAG,CAAC,CAAC,SAAS,MAAM,OAAO,GAAG,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-adapter-types.js","sourceRoot":"","sources":["../../src/types/storage-adapter-types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@devraj-labs/rn-storage-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Unified storage API for React Native — wraps AsyncStorage and react-native-keychain with the same interface",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"types": "src/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./src/index.ts",
|
|
10
|
+
"require": "./src/index.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.build.json",
|
|
21
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
22
|
+
"format": "prettier --write 'src/**/*.{ts,tsx}'",
|
|
23
|
+
"release": "npm run build && npm publish --access public",
|
|
24
|
+
"prepare": "husky"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"react": ">=18.0.0",
|
|
28
|
+
"react-native": ">=0.73.0",
|
|
29
|
+
"react-native-keychain": ">=8.0.0",
|
|
30
|
+
"react-native-mmkv": ">=3.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/react": "^18.2.0",
|
|
34
|
+
"@types/react-native": "^0.73.0",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
36
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
37
|
+
"eslint": "^8.57.0",
|
|
38
|
+
"eslint-plugin-react": "^7.34.0",
|
|
39
|
+
"eslint-plugin-react-native": "^4.1.0",
|
|
40
|
+
"husky": "^9.0.0",
|
|
41
|
+
"lint-staged": "^15.0.0",
|
|
42
|
+
"prettier": "^3.2.0",
|
|
43
|
+
"react": "18.2.0",
|
|
44
|
+
"react-native": "0.73.0",
|
|
45
|
+
"react-native-keychain": "^8.2.0",
|
|
46
|
+
"react-native-mmkv": "^3.2.0",
|
|
47
|
+
"typescript": "^5.4.0"
|
|
48
|
+
},
|
|
49
|
+
"lint-staged": {
|
|
50
|
+
"src/**/*.{ts,tsx}": [
|
|
51
|
+
"eslint --fix",
|
|
52
|
+
"prettier --write"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/devraj-labs/rn-storage-kit.git"
|
|
58
|
+
},
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@devraj-labs/vajra-ui-core": "^2.0.1"
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// ─── Types ─────────────────────────────────────────────────────────────────────
|
|
2
|
+
export * from './types';
|
|
3
|
+
|
|
4
|
+
// ─── Storage adapters ──────────────────────────────────────────────────────────
|
|
5
|
+
export * from './mmkv-storage';
|
|
6
|
+
export * from './secure-storage';
|
|
7
|
+
|
|
8
|
+
// ─── Logger ────────────────────────────────────────────────────────────────────
|
|
9
|
+
export * from './logger';
|
|
10
|
+
|
|
11
|
+
// ─── Debug UI ──────────────────────────────────────────────────────────────────
|
|
12
|
+
export * from './debug';
|