@velion-la/onboarding-sdk-react-native 1.3.0-beta.18 → 1.3.0-beta.19
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/CHANGELOG.md +4 -0
- package/README.md +7 -0
- package/android/build.gradle +15 -0
- package/android/src/main/java/la/velion/onboarding/sdk/devicekey/VelionDeviceKeyModule.kt +94 -0
- package/expo-module.config.json +9 -0
- package/ios/VelionDeviceKey.podspec +25 -0
- package/ios/VelionDeviceKeyModule.swift +76 -0
- package/lib/commonjs/steps/LivenessMatchStep.js +18 -3
- package/lib/commonjs/steps/LivenessMatchStep.js.map +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/utils/deviceIntegrity.js +26 -4
- package/lib/commonjs/utils/deviceIntegrity.js.map +1 -1
- package/lib/commonjs/utils/deviceKey.js +53 -0
- package/lib/commonjs/utils/deviceKey.js.map +1 -0
- package/lib/commonjs/utils/frameChain.js +55 -0
- package/lib/commonjs/utils/frameChain.js.map +1 -0
- package/lib/commonjs/utils/hmac.js +6 -4
- package/lib/commonjs/utils/hmac.js.map +1 -1
- package/lib/module/steps/LivenessMatchStep.js +18 -3
- package/lib/module/steps/LivenessMatchStep.js.map +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/utils/deviceIntegrity.js +26 -4
- package/lib/module/utils/deviceIntegrity.js.map +1 -1
- package/lib/module/utils/deviceKey.js +46 -0
- package/lib/module/utils/deviceKey.js.map +1 -0
- package/lib/module/utils/frameChain.js +52 -0
- package/lib/module/utils/frameChain.js.map +1 -0
- package/lib/module/utils/hmac.js +6 -4
- package/lib/module/utils/hmac.js.map +1 -1
- package/lib/typescript/steps/LivenessMatchStep.d.ts.map +1 -1
- package/lib/typescript/types/index.d.ts +7 -0
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/utils/deviceIntegrity.d.ts +10 -2
- package/lib/typescript/utils/deviceIntegrity.d.ts.map +1 -1
- package/lib/typescript/utils/deviceKey.d.ts +13 -0
- package/lib/typescript/utils/deviceKey.d.ts.map +1 -0
- package/lib/typescript/utils/frameChain.d.ts +15 -0
- package/lib/typescript/utils/frameChain.d.ts.map +1 -0
- package/lib/typescript/utils/hmac.d.ts +3 -1
- package/lib/typescript/utils/hmac.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/steps/LivenessMatchStep.tsx +18 -3
- package/src/types/index.ts +7 -0
- package/src/utils/deviceIntegrity.ts +26 -6
- package/src/utils/deviceKey.ts +52 -0
- package/src/utils/frameChain.ts +56 -0
- package/src/utils/hmac.ts +8 -5
package/src/utils/hmac.ts
CHANGED
|
@@ -34,28 +34,31 @@ export function importHmacKey(base64: string): HmacKey {
|
|
|
34
34
|
* Returns the JSON string ready to `ws.send`.
|
|
35
35
|
*/
|
|
36
36
|
export function buildSignedFrameEnvelope(args: {
|
|
37
|
-
key
|
|
37
|
+
/** `null` builds the same envelope without `mac`, for a session Iris gave no key. */
|
|
38
|
+
key: HmacKey | null;
|
|
38
39
|
sessionId: string;
|
|
39
40
|
frameId: number;
|
|
40
41
|
jpegBytes: Uint8Array;
|
|
41
42
|
jpegBase64: string;
|
|
42
43
|
/** Defaults to `Date.now()`. */
|
|
43
44
|
timestamp?: number;
|
|
44
|
-
}): { json: string; timestamp: number } {
|
|
45
|
+
}): { json: string; timestamp: number; canonical: string } {
|
|
45
46
|
const ts = args.timestamp ?? Date.now();
|
|
46
47
|
const digest = sha256(args.jpegBytes);
|
|
47
48
|
const digestHex = bytesToHexLower(digest);
|
|
48
49
|
const canonical = `${args.sessionId}\n${args.frameId}\n${ts}\n${digestHex}`;
|
|
49
|
-
const
|
|
50
|
-
|
|
50
|
+
const macHex = args.key
|
|
51
|
+
? bytesToHexLower(hmac(sha256, args.key.raw, new TextEncoder().encode(canonical)))
|
|
52
|
+
: undefined;
|
|
51
53
|
return {
|
|
52
54
|
json: JSON.stringify({
|
|
53
55
|
type: 'FRAME',
|
|
54
56
|
frameId: args.frameId,
|
|
55
57
|
timestamp: ts,
|
|
56
58
|
image: args.jpegBase64,
|
|
57
|
-
mac: macHex,
|
|
59
|
+
...(macHex !== undefined && { mac: macHex }),
|
|
58
60
|
}),
|
|
59
61
|
timestamp: ts,
|
|
62
|
+
canonical,
|
|
60
63
|
};
|
|
61
64
|
}
|