@oobit/react-native-sdk 1.0.4 → 1.0.6
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/dist/WidgetSDK.d.ts.map +1 -1
- package/dist/WidgetSDK.js +60 -3
- package/dist/WidgetSDK.js.map +1 -1
- package/dist/biometricUtils.d.ts +66 -0
- package/dist/biometricUtils.d.ts.map +1 -0
- package/dist/biometricUtils.js +183 -0
- package/dist/biometricUtils.js.map +1 -0
- package/dist/cryptoUtils.d.ts +64 -0
- package/dist/cryptoUtils.d.ts.map +1 -0
- package/dist/cryptoUtils.js +123 -0
- package/dist/cryptoUtils.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +41 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +18 -15
- package/dist/types.js.map +1 -1
- package/package.json +7 -5
- package/src/WidgetSDK.tsx +108 -7
- package/src/biometricUtils.ts +183 -0
- package/src/cryptoUtils.ts +131 -0
- package/src/index.ts +20 -0
- package/src/types.ts +80 -44
package/dist/WidgetSDK.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetSDK.d.ts","sourceRoot":"","sources":["../src/WidgetSDK.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAON,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"WidgetSDK.d.ts","sourceRoot":"","sources":["../src/WidgetSDK.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAON,MAAM,OAAO,CAAC;AAaf,OAAO,EAIL,eAAe,EAChB,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,SAAS,sFAqVrB,CAAC"}
|
package/dist/WidgetSDK.js
CHANGED
|
@@ -41,7 +41,9 @@ exports.WidgetSDK = void 0;
|
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const react_native_1 = require("react-native");
|
|
43
43
|
const react_native_webview_1 = require("react-native-webview");
|
|
44
|
+
const biometricUtils_1 = require("./biometricUtils");
|
|
44
45
|
const config_1 = require("./config");
|
|
46
|
+
const cryptoUtils_1 = require("./cryptoUtils");
|
|
45
47
|
const walletUtils_1 = require("./walletUtils");
|
|
46
48
|
exports.WidgetSDK = (0, react_1.forwardRef)(({ accessToken, userWalletAddress, environment, onReady, onCardCreated, onError, onClose, onTransactionRequested, }, ref) => {
|
|
47
49
|
const webViewRef = (0, react_1.useRef)(null);
|
|
@@ -108,6 +110,9 @@ exports.WidgetSDK = (0, react_1.forwardRef)(({ accessToken, userWalletAddress, e
|
|
|
108
110
|
console.error("[WidgetSDK] Access token expired");
|
|
109
111
|
onError?.("TOKEN_EXPIRED", "Access token has expired");
|
|
110
112
|
break;
|
|
113
|
+
case "widget:request-card-details-session":
|
|
114
|
+
handleCardDetailsRequest(message);
|
|
115
|
+
break;
|
|
111
116
|
default:
|
|
112
117
|
console.warn("[WidgetSDK] Unknown message type:", message);
|
|
113
118
|
}
|
|
@@ -168,6 +173,58 @@ exports.WidgetSDK = (0, react_1.forwardRef)(({ accessToken, userWalletAddress, e
|
|
|
168
173
|
});
|
|
169
174
|
onTransactionRequested?.(token, cryptoAmount, depositAddress, depositAddressTag);
|
|
170
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* Handle card details session request from widget
|
|
178
|
+
* 1. Show biometric prompt for user authentication
|
|
179
|
+
* 2. Generate cryptographically linked sessionId + secretKey pair
|
|
180
|
+
* 3. Send credentials back to widget for API call and decryption
|
|
181
|
+
*/
|
|
182
|
+
const handleCardDetailsRequest = async (message) => {
|
|
183
|
+
if (message.type !== "widget:request-card-details-session")
|
|
184
|
+
return;
|
|
185
|
+
const { publicKey } = message.payload;
|
|
186
|
+
console.log("[WidgetSDK] Card details requested, initiating biometric auth...");
|
|
187
|
+
// Step 1: Authenticate with biometrics
|
|
188
|
+
const biometricResult = await (0, biometricUtils_1.authenticateWithBiometrics)("Authenticate to view card details");
|
|
189
|
+
if (!biometricResult.success) {
|
|
190
|
+
console.log("[WidgetSDK] Biometric auth failed:", biometricResult.error);
|
|
191
|
+
const failedMessage = {
|
|
192
|
+
type: "native:biometric-failed",
|
|
193
|
+
payload: {
|
|
194
|
+
reason: biometricResult.error?.reason || "failed",
|
|
195
|
+
message: biometricResult.error?.message,
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
sendMessageToWidget(failedMessage);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
// Step 2: Generate session credentials
|
|
202
|
+
try {
|
|
203
|
+
console.log("[WidgetSDK] Biometric auth successful, generating session credentials...");
|
|
204
|
+
const { secretKeyHex, sessionId } = await (0, cryptoUtils_1.generateSessionCredentials)(publicKey);
|
|
205
|
+
console.log("[WidgetSDK] Session credentials generated successfully");
|
|
206
|
+
// Step 3: Send credentials to widget
|
|
207
|
+
const sessionMessage = {
|
|
208
|
+
type: "native:card-details-session",
|
|
209
|
+
payload: {
|
|
210
|
+
sessionId,
|
|
211
|
+
secretKey: secretKeyHex,
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
sendMessageToWidget(sessionMessage);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
console.error("[WidgetSDK] Failed to generate session credentials:", error);
|
|
218
|
+
const failedMessage = {
|
|
219
|
+
type: "native:biometric-failed",
|
|
220
|
+
payload: {
|
|
221
|
+
reason: "failed",
|
|
222
|
+
message: "Failed to generate secure session",
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
sendMessageToWidget(failedMessage);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
171
228
|
/**
|
|
172
229
|
* Send message to the web widget
|
|
173
230
|
*/
|
|
@@ -241,9 +298,9 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
241
298
|
},
|
|
242
299
|
loadingOverlay: {
|
|
243
300
|
...react_native_1.StyleSheet.absoluteFillObject,
|
|
244
|
-
backgroundColor:
|
|
245
|
-
justifyContent:
|
|
246
|
-
alignItems:
|
|
301
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
302
|
+
justifyContent: "center",
|
|
303
|
+
alignItems: "center",
|
|
247
304
|
},
|
|
248
305
|
});
|
|
249
306
|
//# sourceMappingURL=WidgetSDK.js.map
|
package/dist/WidgetSDK.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetSDK.js","sourceRoot":"","sources":["../src/WidgetSDK.tsx"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+CAOe;AACf,+
|
|
1
|
+
{"version":3,"file":"WidgetSDK.js","sourceRoot":"","sources":["../src/WidgetSDK.tsx"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+CAOe;AACf,+CAOsB;AACtB,+DAAoE;AACpE,qDAA8D;AAC9D,qCAAwC;AACxC,+CAA2D;AAO3D,+CAAoE;AAMvD,QAAA,SAAS,GAAG,IAAA,kBAAU,EACjC,CACE,EACE,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,aAAa,EACb,OAAO,EACP,OAAO,EACP,sBAAsB,GACvB,EACD,GAAG,EACH,EAAE;IACF,MAAM,UAAU,GAAG,IAAA,cAAM,EAAU,IAAI,CAAC,CAAC;IACzC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IACjD,MAAM,aAAa,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;IAEpC,qCAAqC;IACrC,I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OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,GAAG,CAAC,CAAC;gBACxD,CAAC,CAAC,CAAC;gBACH,OAAO,KAAK,CAAC,CAAC,wBAAwB;YACxC,CAAC;YAED,iCAAiC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IACF,oBAAoB;IACpB,iBAAiB,CAAC,CAAC,IAAI,CAAC,CACxB,iBAAiB,CAAC,CAAC,IAAI,CAAC,CACxB,yBAAyB,CAAC,CAAC,IAAI,CAAC;IAChC,eAAe;IACf,OAAO,CAAC,CAAC,KAAK,CAAC,CACf,mCAAmC,CAAC,CAAC,IAAI,CAAC;IAC1C,mBAAmB;IACnB,gBAAgB,CAAC,QAAQ,EAE3B;QAAA,CAAC,SAAS,IAAI,CACZ,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CACjC;YAAA,CAAC,gCAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EACjD;UAAA,EAAE,mBAAI,CAAC,CACR,CACH;MAAA,EAAE,mBAAI,CAAC,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;KACR;IACD,cAAc,EAAE;QACd,GAAG,yBAAU,CAAC,kBAAkB;QAChC,eAAe,EAAE,0BAA0B;QAC3C,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Biometric Authentication Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides cross-platform biometric authentication for card details access.
|
|
5
|
+
* Uses expo-local-authentication which works in Expo Go without native modules.
|
|
6
|
+
*
|
|
7
|
+
* @requires expo-local-authentication - included in Expo SDK
|
|
8
|
+
*/
|
|
9
|
+
import * as LocalAuthentication from 'expo-local-authentication';
|
|
10
|
+
/**
|
|
11
|
+
* Result of a biometric authentication attempt
|
|
12
|
+
*/
|
|
13
|
+
export interface BiometricResult {
|
|
14
|
+
/** Whether authentication was successful */
|
|
15
|
+
success: boolean;
|
|
16
|
+
/** Error details if authentication failed */
|
|
17
|
+
error?: {
|
|
18
|
+
reason: 'cancelled' | 'failed' | 'not_available' | 'not_enrolled';
|
|
19
|
+
message?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Information about biometric capabilities on the device
|
|
24
|
+
*/
|
|
25
|
+
export interface BiometricAvailability {
|
|
26
|
+
/** Whether any biometric authentication is available */
|
|
27
|
+
available: boolean;
|
|
28
|
+
/** The types of biometry available */
|
|
29
|
+
biometryTypes: LocalAuthentication.AuthenticationType[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks if biometric authentication is available on the device
|
|
33
|
+
*
|
|
34
|
+
* @returns Object containing availability status and biometry types
|
|
35
|
+
*/
|
|
36
|
+
export declare function isBiometricAvailable(): Promise<BiometricAvailability>;
|
|
37
|
+
/**
|
|
38
|
+
* Prompts the user for biometric authentication
|
|
39
|
+
*
|
|
40
|
+
* This function should be called before generating session credentials
|
|
41
|
+
* for viewing card details. It ensures proper user verification before
|
|
42
|
+
* accessing sensitive payment card information.
|
|
43
|
+
*
|
|
44
|
+
* @param promptMessage - Message to display in the biometric prompt
|
|
45
|
+
* @returns Result indicating success or failure with reason
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const result = await authenticateWithBiometrics('Authenticate to view card details');
|
|
50
|
+
* if (result.success) {
|
|
51
|
+
* // Proceed with generating session credentials
|
|
52
|
+
* } else {
|
|
53
|
+
* // Handle failure based on result.error.reason
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function authenticateWithBiometrics(promptMessage?: string): Promise<BiometricResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Gets a user-friendly description of the biometric type
|
|
60
|
+
*
|
|
61
|
+
* @param biometryType - The biometry type from the device
|
|
62
|
+
* @returns Human-readable string for the biometry type
|
|
63
|
+
*/
|
|
64
|
+
export declare function getBiometryTypeLabel(biometryType: LocalAuthentication.AuthenticationType): string;
|
|
65
|
+
export { AuthenticationType } from 'expo-local-authentication';
|
|
66
|
+
//# sourceMappingURL=biometricUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biometricUtils.d.ts","sourceRoot":"","sources":["../src/biometricUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,mBAAmB,MAAM,2BAA2B,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,KAAK,CAAC,EAAE;QACN,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,eAAe,GAAG,cAAc,CAAC;QAClE,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,aAAa,EAAE,mBAAmB,CAAC,kBAAkB,EAAE,CAAC;CACzD;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAiB3E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,0BAA0B,CAC9C,aAAa,GAAE,MAA4C,GAC1D,OAAO,CAAC,eAAe,CAAC,CA8E1B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,mBAAmB,CAAC,kBAAkB,GACnD,MAAM,CAWR;AAGD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Biometric Authentication Utilities
|
|
4
|
+
*
|
|
5
|
+
* Provides cross-platform biometric authentication for card details access.
|
|
6
|
+
* Uses expo-local-authentication which works in Expo Go without native modules.
|
|
7
|
+
*
|
|
8
|
+
* @requires expo-local-authentication - included in Expo SDK
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
+
}) : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
+
var ownKeys = function(o) {
|
|
28
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
+
var ar = [];
|
|
30
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
return ownKeys(o);
|
|
34
|
+
};
|
|
35
|
+
return function (mod) {
|
|
36
|
+
if (mod && mod.__esModule) return mod;
|
|
37
|
+
var result = {};
|
|
38
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.AuthenticationType = void 0;
|
|
45
|
+
exports.isBiometricAvailable = isBiometricAvailable;
|
|
46
|
+
exports.authenticateWithBiometrics = authenticateWithBiometrics;
|
|
47
|
+
exports.getBiometryTypeLabel = getBiometryTypeLabel;
|
|
48
|
+
const LocalAuthentication = __importStar(require("expo-local-authentication"));
|
|
49
|
+
/**
|
|
50
|
+
* Checks if biometric authentication is available on the device
|
|
51
|
+
*
|
|
52
|
+
* @returns Object containing availability status and biometry types
|
|
53
|
+
*/
|
|
54
|
+
async function isBiometricAvailable() {
|
|
55
|
+
try {
|
|
56
|
+
const hasHardware = await LocalAuthentication.hasHardwareAsync();
|
|
57
|
+
const isEnrolled = await LocalAuthentication.isEnrolledAsync();
|
|
58
|
+
const supportedTypes = await LocalAuthentication.supportedAuthenticationTypesAsync();
|
|
59
|
+
return {
|
|
60
|
+
available: hasHardware && isEnrolled,
|
|
61
|
+
biometryTypes: supportedTypes,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error('[BiometricUtils] Error checking biometric availability:', error);
|
|
66
|
+
return {
|
|
67
|
+
available: false,
|
|
68
|
+
biometryTypes: [],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Prompts the user for biometric authentication
|
|
74
|
+
*
|
|
75
|
+
* This function should be called before generating session credentials
|
|
76
|
+
* for viewing card details. It ensures proper user verification before
|
|
77
|
+
* accessing sensitive payment card information.
|
|
78
|
+
*
|
|
79
|
+
* @param promptMessage - Message to display in the biometric prompt
|
|
80
|
+
* @returns Result indicating success or failure with reason
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const result = await authenticateWithBiometrics('Authenticate to view card details');
|
|
85
|
+
* if (result.success) {
|
|
86
|
+
* // Proceed with generating session credentials
|
|
87
|
+
* } else {
|
|
88
|
+
* // Handle failure based on result.error.reason
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
async function authenticateWithBiometrics(promptMessage = 'Authenticate to view card details') {
|
|
93
|
+
try {
|
|
94
|
+
// First check if biometrics are available
|
|
95
|
+
const hasHardware = await LocalAuthentication.hasHardwareAsync();
|
|
96
|
+
if (!hasHardware) {
|
|
97
|
+
console.log('[BiometricUtils] Biometrics not available on device');
|
|
98
|
+
return {
|
|
99
|
+
success: false,
|
|
100
|
+
error: {
|
|
101
|
+
reason: 'not_available',
|
|
102
|
+
message: 'Biometric authentication is not available on this device',
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
// Check if biometrics are enrolled
|
|
107
|
+
const isEnrolled = await LocalAuthentication.isEnrolledAsync();
|
|
108
|
+
if (!isEnrolled) {
|
|
109
|
+
console.log('[BiometricUtils] No biometrics enrolled');
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
error: {
|
|
113
|
+
reason: 'not_enrolled',
|
|
114
|
+
message: 'No biometric authentication is set up on this device',
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
console.log('[BiometricUtils] Attempting biometric authentication...');
|
|
119
|
+
// Perform the biometric authentication
|
|
120
|
+
const result = await LocalAuthentication.authenticateAsync({
|
|
121
|
+
promptMessage,
|
|
122
|
+
cancelLabel: 'Cancel',
|
|
123
|
+
disableDeviceFallback: false, // Allow PIN/password fallback
|
|
124
|
+
fallbackLabel: 'Use Passcode',
|
|
125
|
+
});
|
|
126
|
+
if (result.success) {
|
|
127
|
+
console.log('[BiometricUtils] Biometric authentication successful');
|
|
128
|
+
return { success: true };
|
|
129
|
+
}
|
|
130
|
+
// Handle various failure reasons
|
|
131
|
+
console.log('[BiometricUtils] Biometric authentication failed:', result.error);
|
|
132
|
+
let reason = 'failed';
|
|
133
|
+
if (result.error === 'user_cancel' || result.error === 'system_cancel') {
|
|
134
|
+
reason = 'cancelled';
|
|
135
|
+
}
|
|
136
|
+
else if (result.error === 'not_enrolled') {
|
|
137
|
+
reason = 'not_enrolled';
|
|
138
|
+
}
|
|
139
|
+
else if (result.error === 'not_available') {
|
|
140
|
+
reason = 'not_available';
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
success: false,
|
|
144
|
+
error: {
|
|
145
|
+
reason,
|
|
146
|
+
message: result.warning || 'Authentication failed',
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.error('[BiometricUtils] Biometric authentication error:', error);
|
|
152
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
153
|
+
return {
|
|
154
|
+
success: false,
|
|
155
|
+
error: {
|
|
156
|
+
reason: 'failed',
|
|
157
|
+
message: errorMessage,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Gets a user-friendly description of the biometric type
|
|
164
|
+
*
|
|
165
|
+
* @param biometryType - The biometry type from the device
|
|
166
|
+
* @returns Human-readable string for the biometry type
|
|
167
|
+
*/
|
|
168
|
+
function getBiometryTypeLabel(biometryType) {
|
|
169
|
+
switch (biometryType) {
|
|
170
|
+
case LocalAuthentication.AuthenticationType.FACIAL_RECOGNITION:
|
|
171
|
+
return 'Face ID';
|
|
172
|
+
case LocalAuthentication.AuthenticationType.FINGERPRINT:
|
|
173
|
+
return 'Touch ID';
|
|
174
|
+
case LocalAuthentication.AuthenticationType.IRIS:
|
|
175
|
+
return 'Iris';
|
|
176
|
+
default:
|
|
177
|
+
return 'Biometric Authentication';
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Re-export AuthenticationType for convenience
|
|
181
|
+
var expo_local_authentication_1 = require("expo-local-authentication");
|
|
182
|
+
Object.defineProperty(exports, "AuthenticationType", { enumerable: true, get: function () { return expo_local_authentication_1.AuthenticationType; } });
|
|
183
|
+
//# sourceMappingURL=biometricUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biometricUtils.js","sourceRoot":"","sources":["../src/biometricUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCH,oDAiBC;AAsBD,gEAgFC;AAQD,oDAaC;AA1KD,+EAAiE;AAyBjE;;;;GAIG;AACI,KAAK,UAAU,oBAAoB;IACxC,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,gBAAgB,EAAE,CAAC;QACjE,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,eAAe,EAAE,CAAC;QAC/D,MAAM,cAAc,GAAG,MAAM,mBAAmB,CAAC,iCAAiC,EAAE,CAAC;QAErF,OAAO;YACL,SAAS,EAAE,WAAW,IAAI,UAAU;YACpC,aAAa,EAAE,cAAc;SAC9B,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yDAAyD,EAAE,KAAK,CAAC,CAAC;QAChF,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,EAAE;SAClB,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACI,KAAK,UAAU,0BAA0B,CAC9C,gBAAwB,mCAAmC;IAE3D,IAAI,CAAC;QACH,0CAA0C;QAC1C,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,gBAAgB,EAAE,CAAC;QAEjE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;YACnE,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACL,MAAM,EAAE,eA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L,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACL,MAAM;gBACN,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,uBAAuB;aACnD;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,kDAAkD,EAAE,KAAK,CAAC,CAAC;QAEzE,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;QAEvF,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACL,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE,YAAY;aACtB;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CAClC,YAAoD;IAEpD,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,mBAAmB,CAAC,kBAAkB,CAAC,kBAAkB;YAC5D,OAAO,SAAS,CAAC;QACnB,KAAK,mBAAmB,CAAC,kBAAkB,CAAC,WAAW;YACrD,OAAO,UAAU,CAAC;QACpB,KAAK,mBAAmB,CAAC,kBAAkB,CAAC,IAAI;YAC9C,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,0BAA0B,CAAC;IACtC,CAAC;AACH,CAAC;AAED,+CAA+C;AAC/C,uEAA+D;AAAtD,+HAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crypto Utilities for Card Details Session Generation
|
|
3
|
+
*
|
|
4
|
+
* CRITICAL: This implementation MUST match Android's PublicKeyCryptoHelper.kt exactly:
|
|
5
|
+
* - RSA Algorithm: RSA/ECB/OAEPWithSHA-1AndMGF1Padding
|
|
6
|
+
* - Secret Key: UUID without dashes (32 hex chars = 16 bytes = 128-bit)
|
|
7
|
+
* - Input to RSA: secretKey as Base64 string
|
|
8
|
+
* - Output: encrypted sessionId as Base64 string
|
|
9
|
+
*
|
|
10
|
+
* Uses node-forge for pure JavaScript RSA-OAEP encryption.
|
|
11
|
+
* This works in Expo Go without native modules.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Generates a random hex key matching Android's generateRandomHexKey()
|
|
15
|
+
*
|
|
16
|
+
* Creates a UUID v4 without dashes = 32 hex characters = 16 bytes = 128-bit key
|
|
17
|
+
* This matches the format used in Android's PublicKeyCryptoHelper
|
|
18
|
+
*
|
|
19
|
+
* @returns 32-character hexadecimal string
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateRandomHexKey(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Converts a hex string to Base64 encoding
|
|
24
|
+
* Matches Android's hexToBase64() method
|
|
25
|
+
*
|
|
26
|
+
* @param hexString - Hexadecimal string (must have even length)
|
|
27
|
+
* @returns Base64 encoded string
|
|
28
|
+
*/
|
|
29
|
+
export declare function hexToBase64(hexString: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Encrypts data using RSA with OAEP-SHA1 padding
|
|
32
|
+
*
|
|
33
|
+
* MUST match Android's RSA/ECB/OAEPWithSHA-1AndMGF1Padding algorithm
|
|
34
|
+
*
|
|
35
|
+
* @param data - Plain text data to encrypt (Base64 string of the secret key)
|
|
36
|
+
* @param publicKeyPem - RSA public key in PEM format
|
|
37
|
+
* @returns Encrypted data as Base64 string
|
|
38
|
+
* @throws Error if encryption fails
|
|
39
|
+
*/
|
|
40
|
+
export declare function encryptWithRSA(data: string, publicKeyPem: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Generates session credentials for card details API request
|
|
43
|
+
*
|
|
44
|
+
* This is the main function that creates the cryptographically linked
|
|
45
|
+
* sessionId + secretKey pair, matching Android's PublicKeyCryptoHelper.generateSessionId()
|
|
46
|
+
*
|
|
47
|
+
* Flow:
|
|
48
|
+
* 1. Generate random secretKeyHex (UUID without dashes)
|
|
49
|
+
* 2. Convert secretKeyHex to Base64
|
|
50
|
+
* 3. Encrypt Base64 key with RSA public key → sessionId
|
|
51
|
+
* 4. Return both secretKeyHex (for client-side decryption) and sessionId (for API header)
|
|
52
|
+
*
|
|
53
|
+
* @param publicKeyPem - RSA public key in PEM format (from widget)
|
|
54
|
+
* @returns Object containing:
|
|
55
|
+
* - secretKeyHex: Keep on device for AES-GCM decryption (32 hex chars)
|
|
56
|
+
* - sessionId: Send to API as SessionId header (RSA-encrypted, Base64)
|
|
57
|
+
* @throws Error if key generation or encryption fails
|
|
58
|
+
*/
|
|
59
|
+
export declare function generateSessionCredentials(publicKeyPem: string): SessionCredentials;
|
|
60
|
+
export interface SessionCredentials {
|
|
61
|
+
secretKeyHex: string;
|
|
62
|
+
sessionId: string;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=cryptoUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cryptoUtils.d.ts","sourceRoot":"","sources":["../src/cryptoUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAU7C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAUrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAmBzE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,CAqBnF;AAGD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Crypto Utilities for Card Details Session Generation
|
|
4
|
+
*
|
|
5
|
+
* CRITICAL: This implementation MUST match Android's PublicKeyCryptoHelper.kt exactly:
|
|
6
|
+
* - RSA Algorithm: RSA/ECB/OAEPWithSHA-1AndMGF1Padding
|
|
7
|
+
* - Secret Key: UUID without dashes (32 hex chars = 16 bytes = 128-bit)
|
|
8
|
+
* - Input to RSA: secretKey as Base64 string
|
|
9
|
+
* - Output: encrypted sessionId as Base64 string
|
|
10
|
+
*
|
|
11
|
+
* Uses node-forge for pure JavaScript RSA-OAEP encryption.
|
|
12
|
+
* This works in Expo Go without native modules.
|
|
13
|
+
*/
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.generateRandomHexKey = generateRandomHexKey;
|
|
19
|
+
exports.hexToBase64 = hexToBase64;
|
|
20
|
+
exports.encryptWithRSA = encryptWithRSA;
|
|
21
|
+
exports.generateSessionCredentials = generateSessionCredentials;
|
|
22
|
+
const node_forge_1 = __importDefault(require("node-forge"));
|
|
23
|
+
/**
|
|
24
|
+
* Generates a random hex key matching Android's generateRandomHexKey()
|
|
25
|
+
*
|
|
26
|
+
* Creates a UUID v4 without dashes = 32 hex characters = 16 bytes = 128-bit key
|
|
27
|
+
* This matches the format used in Android's PublicKeyCryptoHelper
|
|
28
|
+
*
|
|
29
|
+
* @returns 32-character hexadecimal string
|
|
30
|
+
*/
|
|
31
|
+
function generateRandomHexKey() {
|
|
32
|
+
// Generate UUID v4 pattern and remove dashes
|
|
33
|
+
// This matches Android's java.util.UUID.randomUUID().toString().replace("-", "")
|
|
34
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
|
35
|
+
.replace(/[xy]/g, (c) => {
|
|
36
|
+
const r = (Math.random() * 16) | 0;
|
|
37
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
38
|
+
return v.toString(16);
|
|
39
|
+
})
|
|
40
|
+
.replace(/-/g, '');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Converts a hex string to Base64 encoding
|
|
44
|
+
* Matches Android's hexToBase64() method
|
|
45
|
+
*
|
|
46
|
+
* @param hexString - Hexadecimal string (must have even length)
|
|
47
|
+
* @returns Base64 encoded string
|
|
48
|
+
*/
|
|
49
|
+
function hexToBase64(hexString) {
|
|
50
|
+
// Convert hex string to binary string
|
|
51
|
+
let binaryString = '';
|
|
52
|
+
for (let i = 0; i < hexString.length; i += 2) {
|
|
53
|
+
const byte = parseInt(hexString.substring(i, i + 2), 16);
|
|
54
|
+
binaryString += String.fromCharCode(byte);
|
|
55
|
+
}
|
|
56
|
+
// Use forge's utility for Base64 encoding
|
|
57
|
+
return node_forge_1.default.util.encode64(binaryString);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Encrypts data using RSA with OAEP-SHA1 padding
|
|
61
|
+
*
|
|
62
|
+
* MUST match Android's RSA/ECB/OAEPWithSHA-1AndMGF1Padding algorithm
|
|
63
|
+
*
|
|
64
|
+
* @param data - Plain text data to encrypt (Base64 string of the secret key)
|
|
65
|
+
* @param publicKeyPem - RSA public key in PEM format
|
|
66
|
+
* @returns Encrypted data as Base64 string
|
|
67
|
+
* @throws Error if encryption fails
|
|
68
|
+
*/
|
|
69
|
+
function encryptWithRSA(data, publicKeyPem) {
|
|
70
|
+
try {
|
|
71
|
+
// Parse the PEM-formatted public key
|
|
72
|
+
const publicKey = node_forge_1.default.pki.publicKeyFromPem(publicKeyPem);
|
|
73
|
+
// Encrypt using RSA-OAEP with SHA-1 (matches Android's OAEPWithSHA-1AndMGF1Padding)
|
|
74
|
+
const encrypted = publicKey.encrypt(data, 'RSA-OAEP', {
|
|
75
|
+
md: node_forge_1.default.md.sha1.create(),
|
|
76
|
+
mgf1: {
|
|
77
|
+
md: node_forge_1.default.md.sha1.create(),
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
// Encode to Base64
|
|
81
|
+
return node_forge_1.default.util.encode64(encrypted);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.error('[CryptoUtils] RSA encryption failed:', error);
|
|
85
|
+
throw new Error('Failed to encrypt session data');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generates session credentials for card details API request
|
|
90
|
+
*
|
|
91
|
+
* This is the main function that creates the cryptographically linked
|
|
92
|
+
* sessionId + secretKey pair, matching Android's PublicKeyCryptoHelper.generateSessionId()
|
|
93
|
+
*
|
|
94
|
+
* Flow:
|
|
95
|
+
* 1. Generate random secretKeyHex (UUID without dashes)
|
|
96
|
+
* 2. Convert secretKeyHex to Base64
|
|
97
|
+
* 3. Encrypt Base64 key with RSA public key → sessionId
|
|
98
|
+
* 4. Return both secretKeyHex (for client-side decryption) and sessionId (for API header)
|
|
99
|
+
*
|
|
100
|
+
* @param publicKeyPem - RSA public key in PEM format (from widget)
|
|
101
|
+
* @returns Object containing:
|
|
102
|
+
* - secretKeyHex: Keep on device for AES-GCM decryption (32 hex chars)
|
|
103
|
+
* - sessionId: Send to API as SessionId header (RSA-encrypted, Base64)
|
|
104
|
+
* @throws Error if key generation or encryption fails
|
|
105
|
+
*/
|
|
106
|
+
function generateSessionCredentials(publicKeyPem) {
|
|
107
|
+
// Validate public key
|
|
108
|
+
if (!publicKeyPem || !publicKeyPem.includes('BEGIN PUBLIC KEY')) {
|
|
109
|
+
throw new Error('Invalid RSA public key format');
|
|
110
|
+
}
|
|
111
|
+
// Step 1: Generate random secret key (matches Android's generateRandomHexKey)
|
|
112
|
+
const secretKeyHex = generateRandomHexKey();
|
|
113
|
+
// Step 2: Convert to Base64 (matches Android's hexToBase64)
|
|
114
|
+
const secretKeyBase64 = hexToBase64(secretKeyHex);
|
|
115
|
+
// Step 3: Encrypt with RSA public key (matches Android's encryptWithPublicKey)
|
|
116
|
+
const sessionId = encryptWithRSA(secretKeyBase64, publicKeyPem);
|
|
117
|
+
console.log('[CryptoUtils] Session credentials generated successfully');
|
|
118
|
+
return {
|
|
119
|
+
secretKeyHex,
|
|
120
|
+
sessionId,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=cryptoUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cryptoUtils.js","sourceRoot":"","sources":["../src/cryptoUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;AAYH,oDAUC;AASD,kCAUC;AAYD,wCAmBC;AAoBD,gEAqBC;AA/GD,4DAA+B;AAE/B;;;;;;;GAOG;AACH,SAAgB,oBAAoB;IAClC,6CAA6C;IAC7C,iFAAiF;IACjF,OAAO,sCAAsC;SAC1C,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;QACtB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC,CAAC;SACD,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,SAAiB;IAC3C,sCAAsC;IACtC,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzD,YAAY,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC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,CAAC,CAAC;IAEhE,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IAExE,OAAO;QACL,YAAY;QACZ,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { WidgetSDK } from './WidgetSDK';
|
|
6
6
|
export type { WidgetSDKRef } from './WidgetSDK';
|
|
7
|
-
export type { WidgetSDKConfig, WidgetEnvironment, DepositToken, WidgetMessageType, BaseWidgetMessage, WidgetMessage, WidgetReadyMessage, OpenWalletMessage, CardCreatedMessage, WidgetErrorMessage, WidgetCloseMessage, TransactionRequestedMessage, NativeMessageType, NativeMessage, NativeBackPressedMessage, NativeNavigateBackMessage, NativePlatformInfoMessage, NativeWalletOpenedMessage, } from './types';
|
|
7
|
+
export type { WidgetSDKConfig, WidgetEnvironment, DepositToken, WidgetMessageType, BaseWidgetMessage, WidgetMessage, WidgetReadyMessage, OpenWalletMessage, CardCreatedMessage, WidgetErrorMessage, WidgetCloseMessage, TransactionRequestedMessage, RequestCardDetailsSessionMessage, NativeMessageType, NativeMessage, NativeBackPressedMessage, NativeNavigateBackMessage, NativePlatformInfoMessage, NativeWalletOpenedMessage, NativeCardDetailsSessionMessage, NativeBiometricFailedMessage, } from './types';
|
|
8
8
|
export { WALLET_URLS, MessageTypes } from './types';
|
|
9
9
|
export { WIDGET_URLS, getWidgetUrl } from './config';
|
|
10
10
|
export { openNativeWallet, isWalletAvailable } from './walletUtils';
|
|
11
|
+
export { authenticateWithBiometrics, isBiometricAvailable, getBiometryTypeLabel, AuthenticationType, } from './biometricUtils';
|
|
12
|
+
export type { BiometricResult, BiometricAvailability } from './biometricUtils';
|
|
13
|
+
export { generateSessionCredentials, generateRandomHexKey, hexToBase64, } from './cryptoUtils';
|
|
14
|
+
export type { SessionCredentials } from './cryptoUtils';
|
|
11
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,YAAY,EAEV,eAAe,EACf,iBAAiB,EACjB,YAAY,EAGZ,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,YAAY,EAEV,eAAe,EACf,iBAAiB,EACjB,YAAY,EAGZ,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,gCAAgC,EAGhC,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGpE,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG/E,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Export all public components, types, and utilities
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.isWalletAvailable = exports.openNativeWallet = exports.getWidgetUrl = exports.WIDGET_URLS = exports.MessageTypes = exports.WALLET_URLS = exports.WidgetSDK = void 0;
|
|
7
|
+
exports.hexToBase64 = exports.generateRandomHexKey = exports.generateSessionCredentials = exports.AuthenticationType = exports.getBiometryTypeLabel = exports.isBiometricAvailable = exports.authenticateWithBiometrics = exports.isWalletAvailable = exports.openNativeWallet = exports.getWidgetUrl = exports.WIDGET_URLS = exports.MessageTypes = exports.WALLET_URLS = exports.WidgetSDK = void 0;
|
|
8
8
|
var WidgetSDK_1 = require("./WidgetSDK");
|
|
9
9
|
Object.defineProperty(exports, "WidgetSDK", { enumerable: true, get: function () { return WidgetSDK_1.WidgetSDK; } });
|
|
10
10
|
// Export constants
|
|
@@ -18,4 +18,15 @@ Object.defineProperty(exports, "getWidgetUrl", { enumerable: true, get: function
|
|
|
18
18
|
var walletUtils_1 = require("./walletUtils");
|
|
19
19
|
Object.defineProperty(exports, "openNativeWallet", { enumerable: true, get: function () { return walletUtils_1.openNativeWallet; } });
|
|
20
20
|
Object.defineProperty(exports, "isWalletAvailable", { enumerable: true, get: function () { return walletUtils_1.isWalletAvailable; } });
|
|
21
|
+
// Export biometric utilities
|
|
22
|
+
var biometricUtils_1 = require("./biometricUtils");
|
|
23
|
+
Object.defineProperty(exports, "authenticateWithBiometrics", { enumerable: true, get: function () { return biometricUtils_1.authenticateWithBiometrics; } });
|
|
24
|
+
Object.defineProperty(exports, "isBiometricAvailable", { enumerable: true, get: function () { return biometricUtils_1.isBiometricAvailable; } });
|
|
25
|
+
Object.defineProperty(exports, "getBiometryTypeLabel", { enumerable: true, get: function () { return biometricUtils_1.getBiometryTypeLabel; } });
|
|
26
|
+
Object.defineProperty(exports, "AuthenticationType", { enumerable: true, get: function () { return biometricUtils_1.AuthenticationType; } });
|
|
27
|
+
// Export crypto utilities (for advanced usage)
|
|
28
|
+
var cryptoUtils_1 = require("./cryptoUtils");
|
|
29
|
+
Object.defineProperty(exports, "generateSessionCredentials", { enumerable: true, get: function () { return cryptoUtils_1.generateSessionCredentials; } });
|
|
30
|
+
Object.defineProperty(exports, "generateRandomHexKey", { enumerable: true, get: function () { return cryptoUtils_1.generateRandomHexKey; } });
|
|
31
|
+
Object.defineProperty(exports, "hexToBase64", { enumerable: true, get: function () { return cryptoUtils_1.hexToBase64; } });
|
|
21
32
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAiClB,mBAAmB;AACnB,iCAAoD;AAA3C,oGAAA,WAAW,OAAA;AAAE,qGAAA,YAAY,OAAA;AAClC,mCAAqD;AAA5C,qGAAA,WAAW,OAAA;AAAE,sGAAA,YAAY,OAAA;AAElC,0BAA0B;AAC1B,6CAAoE;AAA3D,+GAAA,gBAAgB,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAE5C,6BAA6B;AAC7B,mDAK0B;AAJxB,4HAAA,0BAA0B,OAAA;AAC1B,sHAAA,oBAAoB,OAAA;AACpB,sHAAA,oBAAoB,OAAA;AACpB,oHAAA,kBAAkB,OAAA;AAIpB,+CAA+C;AAC/C,6CAIuB;AAHrB,yHAAA,0BAA0B,OAAA;AAC1B,mHAAA,oBAAoB,OAAA;AACpB,0GAAA,WAAW,OAAA"}
|