@smileid/usesmileid_testing 12.3.1-SNAPSHOT.71 → 12.3.1-SNAPSHOT.75
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/android/build.gradle
CHANGED
|
@@ -32,10 +32,10 @@ android {
|
|
|
32
32
|
|
|
33
33
|
dependencies {
|
|
34
34
|
def testServer = [
|
|
35
|
-
'com.usesmileid:testing:12.3.0-
|
|
35
|
+
'com.usesmileid:testing:12.3.0-20261027.143404-254',
|
|
36
36
|
// The bridge build the testing artifact runs against, from the same publish: a snapshot names
|
|
37
37
|
// the moving x.y.z-SNAPSHOT bridge, so the build is pinned here as each provider pins it.
|
|
38
|
-
'com.usesmileid:bridge:12.3.0-
|
|
38
|
+
'com.usesmileid:bridge:12.3.0-20261027.143404-308',
|
|
39
39
|
]
|
|
40
40
|
testServer.each { debugImplementation it }
|
|
41
41
|
if (testServerInRelease) testServer.each { releaseImplementation it }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{requireNativeModule as
|
|
1
|
+
"use strict";import{requireNativeModule as c}from"expo-modules-core";import{AnalyzerFactoryKey as i,faceConfigSchema as o}from"@smileid/usesmileid_bridge";import{CaptureType as n}from"@smileid/usesmileid";import{UseSmileIDTestServer as l,testToken as f}from"./use_smile_id_test_server";const u={[i.MLKitFace]:"UseSmileIDMlkitFace",[i.HuaweiFace]:"UseSmileIDHuaweiFace",[i.VisionFace]:"UseSmileIDVisionFace"};export class UseSmileIDTest{scenario;server;native;faceKey;token=f();constructor(r,e,t,a){this.scenario=r,this.server=e,this.native=t,this.faceKey=a}static async create(r,e=c("UseSmileIDTesting")){const{port:t,faceKey:a}=await e.startTest(r.name,r.script??null);return new UseSmileIDTest(r,l.attach(e,t),e,a)}install(r){if("testRoute"in r){r.testRoute(this.server);return}if(this.scenario.isDocument)throw new Error(`${this.scenario.name}: React Native can't script a document capture yet, only a selfie`);const e=r.build().selfie;if(!e)throw new Error("Register your selfie analyzer before installing the test: the scenario runs in its native session");r.forCaptureType(n.selfie,t=>t.add(m(e,this.faceKey)))}close(){this.server.close(),this.native.unscriptFace(this.faceKey)}}function m(s,r){const e=c(u[s.key]);return{kind:"face",key:s.key,frameProcessorPluginName:s.frameProcessorPluginName,configure:t=>e.configure({...o.parse(t),analyzerFactoryKey:r}),analyzeKameraFrame:t=>e.analyzeKameraFrame(t),reset:()=>e.reset(),flush:()=>e.flush(),close:()=>e.close()}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{requireNativeModule as
|
|
1
|
+
"use strict";import{requireNativeModule as d}from"expo-modules-core";import{z as e}from"zod";const h=e.union([e.object({text:e.string()}).strict(),e.object({fileName:e.string(),size:e.number().int().nonnegative()}).strict()]),l=e.array(e.object({path:e.string(),headers:e.record(e.string(),e.string()),parts:e.record(e.string(),h)}));export const UseSmileIDTestResponse={status:(r,t="{}")=>({kind:"status",code:r,body:t}),tokenExpired:{kind:"tokenExpired"},connectionDropped:{kind:"connectionDropped"}};const f=["/v3/enhanced_kyc","/v3/registration","/v3/authentication","/v3/biometric_kyc","/v3/document_verification","/v3/enhanced_document_verification","/v3/residency_document_verification"];export class UseSmileIDTestServer{native;port;closed=!1;constructor(t,s){this.native=t,this.port=s}static async start(t=d("UseSmileIDTesting")){return new UseSmileIDTestServer(t,await t.start())}static attach(t,s){return new UseSmileIDTestServer(t,s)}testRoutePort(){return this.closed?void 0:this.port}requests(){const t=l.safeParse(JSON.parse(this.native.requests(this.port)));if(!t.success)throw new Error(`The test server answered requests in a shape it never sends: ${t.error.message}`);return t.data}submissions(){return this.requests().filter(t=>f.some(s=>t.path.startsWith(s)))}respond(t,s){this.native.respond(this.port,t,JSON.stringify(s))}close(){this.closed||(this.closed=!0,this.native.close(this.port))}}export function testToken(r){return[i('{"alg":"HS256","typ":"JWT"}'),i(JSON.stringify({partner_id:"test-partner",exp:4102444800,...r&&{payload:r}})),i("test-signature")].join(".")}const g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function i(r){let t="";for(let s=0;s<r.length;s+=3){const[o,a,c]=[0,1,2].map(n=>r.charCodeAt(s+n)),u=o<<16|(a||0)<<8|(c||0),p=s+2<r.length?4:s+1<r.length?3:2;for(let n=0;n<p;n+=1)t+=g[u>>18-6*n&63]}return t}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smileid/usesmileid_testing",
|
|
3
|
-
"version": "12.3.1-SNAPSHOT.
|
|
3
|
+
"version": "12.3.1-SNAPSHOT.75",
|
|
4
4
|
"description": "Test doubles for the UseSmileID React Native (Expo) SDK: the native SDKs' in-process test server, for your own E2E tests.",
|
|
5
5
|
"homepage": "https://usesmileid.com",
|
|
6
6
|
"repository": {
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"zod": "^4.6.7",
|
|
49
|
-
"@smileid/usesmileid_bridge": "12.3.1-SNAPSHOT.
|
|
49
|
+
"@smileid/usesmileid_bridge": "12.3.1-SNAPSHOT.75"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"expo": ">=56.0.0",
|
|
53
53
|
"expo-modules-core": ">=56.0.0",
|
|
54
54
|
"react-native": ">=0.83.0",
|
|
55
|
-
"@smileid/usesmileid": "12.3.1-SNAPSHOT.
|
|
55
|
+
"@smileid/usesmileid": "12.3.1-SNAPSHOT.75"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^26.6.4",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"expo-modules-core": "^57.0.23",
|
|
61
61
|
"react-native": "^0.86.3",
|
|
62
62
|
"typescript": "^6.0.3",
|
|
63
|
-
"@smileid/usesmileid": "12.3.1-SNAPSHOT.
|
|
63
|
+
"@smileid/usesmileid": "12.3.1-SNAPSHOT.75"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(i,t,n,e){e===void 0&&(e=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(i,e,r)}):(function(i,t,n,e){e===void 0&&(e=n),i[e]=t[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}):function(i,t){i.default=t}),__importStar=this&&this.__importStar||(function(){var i=function(t){return i=Object.getOwnPropertyNames||function(n){var e=[];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[e.length]=r);return e},i(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var e=i(t),r=0;r<e.length;r++)e[r]!=="default"&&__createBinding(n,t,e[r]);return __setModuleDefault(n,t),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.withAndroidLoopback=exports.DEBUG_CONFIG_NAME=void 0,exports.allowLoopback=allowLoopback,exports.xmlResourceName=xmlResourceName,exports.writeDebugConfig=writeDebugConfig,exports.writeDebugManifest=writeDebugManifest,exports.forgetDebugManifest=forgetDebugManifest;const config_plugins_1=require("expo/config-plugins"),fs=__importStar(require("fs")),path=__importStar(require("path"));exports.DEBUG_CONFIG_NAME="smileid_test_network_security";const LOOPBACK=["127.0.0.1","localhost"],DEBUG_ONLY_CONFIG=`<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<network-security-config>
|
|
3
3
|
<base-config cleartextTrafficPermitted="true" />
|
|
4
4
|
</network-security-config>
|
|
5
5
|
`,LOOPBACK_ONLY_CONFIG=`<?xml version="1.0" encoding="utf-8"?>
|
|
6
6
|
<network-security-config>
|
|
7
7
|
</network-security-config>
|
|
8
|
-
`;function allowLoopback(
|
|
9
|
-
`);if(!
|
|
10
|
-
</network-security-config>`)}function cleartextHosts(
|
|
8
|
+
`;function allowLoopback(i){const t=LOOPBACK.filter(e=>!cleartextHosts(i).includes(e));if(t.length===0)return i;const n=[' <domain-config cleartextTrafficPermitted="true">',...t.map(e=>` <domain includeSubdomains="false">${e}</domain>`)," </domain-config>"].join(`
|
|
9
|
+
`);if(!i.includes("</network-security-config>"))throw new Error("[usesmileid_testing] The app's network security config has no closing tag.");return i.replace("</network-security-config>",`${n}
|
|
10
|
+
</network-security-config>`)}function cleartextHosts(i){const t=[];for(const n of i.matchAll(/<domain-config\b([^>]*)>([\s\S]*?)<\/domain-config>/g))if(/cleartextTrafficPermitted="true"/.test(n[1]??""))for(const e of(n[2]??"").matchAll(/<domain\b[^>]*>\s*([^<\s]+)\s*<\/domain>/g))t.push(e[1]);return t}function xmlResourceName(i){return i?.match(/^@xml\/([A-Za-z0-9_]+)$/)?.[1]}function writeDebugConfig(i,t,n="debug"){const e=t??exports.DEBUG_CONFIG_NAME,r=path.join(i,"src","main","res","xml",`${e}.xml`);if(t!==void 0&&!fs.existsSync(r))throw new Error(`[usesmileid_testing] The app names @xml/${e}, but ${r} isn't there to extend. List @smileid/usesmileid_testing after the plugin that writes it, or keep the file in src/main/res/xml.`);const o=t!==void 0?fs.readFileSync(r,"utf-8"):n==="debug"?DEBUG_ONLY_CONFIG:LOOPBACK_ONLY_CONFIG,s=path.join(i,"src",n,"res","xml");return fs.mkdirSync(s,{recursive:!0}),fs.writeFileSync(path.join(s,`${e}.xml`),allowLoopback(o)),e}function writeDebugManifest(i,t,n="debug"){const e=path.join(i,"src",n,"AndroidManifest.xml"),r=`android:networkSecurityConfig="@xml/${t}"`;if(!fs.existsSync(e)){fs.mkdirSync(path.dirname(e),{recursive:!0}),fs.writeFileSync(e,`<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
11
11
|
<application ${r} />
|
|
12
12
|
</manifest>
|
|
13
13
|
`);return}const o=fs.readFileSync(e,"utf-8"),s=o.match(/android:networkSecurityConfig="([^"]*)"/)?.[1];if(s===`@xml/${t}`)return;if(s!==void 0)throw new Error(`[usesmileid_testing] ${e} already names ${s}; add 127.0.0.1 and localhost to it rather than have this plugin replace it.`);const c=/<application\b/.test(o)?o.replace(/<application\b/,`<application ${r}`):o.replace("</manifest>",` <application ${r} />
|
|
14
|
-
</manifest>`);if(c===o)throw new Error(`[usesmileid_testing] ${e} has neither an <application> element nor a closing </manifest> tag to add one before.`);fs.writeFileSync(e,c)}function forgetDebugManifest(
|
|
14
|
+
</manifest>`);if(c===o)throw new Error(`[usesmileid_testing] ${e} has neither an <application> element nor a closing </manifest> tag to add one before.`);fs.writeFileSync(e,c)}function forgetDebugManifest(i,t="debug"){const n=path.join(i,"src",t,"AndroidManifest.xml");if(!fs.existsSync(n))return;const e=fs.readFileSync(n,"utf-8"),r=e.replace(` android:networkSecurityConfig="@xml/${exports.DEBUG_CONFIG_NAME}"`,"");r!==e&&fs.writeFileSync(n,r)}const withAndroidLoopback=(i,t)=>(0,config_plugins_1.withAndroidManifest)(i,n=>{if(n.modRequest.introspect)return n;const e=config_plugins_1.AndroidConfig.Manifest.getMainApplicationOrThrow(n.modResults),r=xmlResourceName(e.$["android:networkSecurityConfig"]),o=path.join(n.modRequest.platformProjectRoot,"app");for(const s of t?.androidBuildTypes??["debug"]){const c=writeDebugConfig(o,r,s);r===void 0?writeDebugManifest(o,c,s):forgetDebugManifest(o,s)}return n});exports.withAndroidLoopback=withAndroidLoopback;
|