@ledgerhq/speculos-device-controller 0.0.0-develop-20260902001426 → 0.0.0-develop-20260904001312
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/lib/cjs/package.json +1 -1
- package/lib/cjs/src/api/DeviceController.js +1 -1
- package/lib/cjs/src/api/DeviceController.js.map +2 -2
- package/lib/cjs/src/internal/use-cases/touchUseCases.js +1 -1
- package/lib/cjs/src/internal/use-cases/touchUseCases.js.map +3 -3
- package/lib/cjs/src/internal/use-cases/touchUseCases.test.js +1 -1
- package/lib/cjs/src/internal/use-cases/touchUseCases.test.js.map +3 -3
- package/lib/esm/package.json +1 -1
- package/lib/esm/src/api/DeviceController.js +1 -1
- package/lib/esm/src/api/DeviceController.js.map +3 -3
- package/lib/esm/src/internal/use-cases/touchUseCases.js +1 -1
- package/lib/esm/src/internal/use-cases/touchUseCases.js.map +3 -3
- package/lib/esm/src/internal/use-cases/touchUseCases.test.js +1 -1
- package/lib/esm/src/internal/use-cases/touchUseCases.test.js.map +3 -3
- package/lib/types/src/api/DeviceController.d.ts +1 -0
- package/lib/types/src/api/DeviceController.d.ts.map +1 -1
- package/lib/types/src/internal/use-cases/touchUseCases.d.ts +1 -0
- package/lib/types/src/internal/use-cases/touchUseCases.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +6 -6
package/lib/cjs/package.json
CHANGED
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
53
53
|
"watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
|
|
54
54
|
},
|
|
55
|
-
"version": "0.0.0-develop-
|
|
55
|
+
"version": "0.0.0-develop-20260904001312"
|
|
56
56
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var B=(i,n)=>{for(var r in n)l(i,r,{get:n[r],enumerable:!0})},P=(i,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of v(n))!g.call(i,t)&&t!==r&&l(i,t,{get:()=>n[t],enumerable:!(s=m(n,t))||s.enumerable});return i};var C=i=>P(l({},"__esModule",{value:!0}),i);var y={};B(y,{deviceControllerClientFactory:()=>S});module.exports=C(y);var d=require("../internal/config/defaultScreens"),u=require("../../src/internal/di"),c=require("../../src/internal/use-cases/buttonUseCases"),e=require("../../src/internal/use-cases/touchUseCases");const S=(i,n={})=>{const r={screens:n.screens??d.DEFAULT_SCREENS,timeoutMs:n.timeoutMs,clientHeader:n.clientHeader},{buttons:s,touch:t}=(0,u.createDefaultControllers)(i,r),a=(0,c.pressButtons)(s);return{buttonFactory:()=>({press:o=>s.press(o),left:()=>a.left(),right:()=>a.right(),both:()=>a.both(),pressSequence:(o,p)=>(0,c.pressSequence)(s,o,p)}),tapFactory:o=>({tapQuick:(0,e.tapQuick)(t,o),tapLong:(0,e.tapLong)(t,o),sign:(0,e.sign)(t,o),reject:(0,e.reject)(t,o),navigateNext:(0,e.navigateNext)(t,o),navigatePrevious:(0,e.navigatePrevious)(t,o),mainButton:(0,e.mainButton)(t,o),secondaryButton:(0,e.secondaryButton)(t,o),enterMenu:(0,e.enterMenu)(t,o),exitMenu:(0,e.exitMenu)(t,o),enableBlindSigningSettings:(0,e.enableBlindSigningSettings)(t,o),continueToBlindSigning:(0,e.continueToBlindSigning)(t,o),acceptBlindSigning:(0,e.acceptBlindSigning)(t,o),confirmAddressBookReview:(0,e.confirmAddressBookReview)(t,o)})}};0&&(module.exports={deviceControllerClientFactory});
|
|
2
2
|
//# sourceMappingURL=DeviceController.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/api/DeviceController.ts"],
|
|
4
|
-
"sourcesContent": ["import { DEFAULT_SCREENS } from \"@internal/config/defaultScreens\";\nimport type { ButtonController } from \"@internal/core/ButtonController\";\nimport type {\n ButtonKey,\n DeviceControllerOptions,\n DeviceScreens,\n PercentCoordinates,\n} from \"@internal/core/types\";\nimport { createDefaultControllers } from \"@root/src/internal/di\";\nimport {\n pressButtons,\n pressSequence,\n} from \"@root/src/internal/use-cases/buttonUseCases\";\nimport {\n acceptBlindSigning,\n continueToBlindSigning,\n enableBlindSigningSettings,\n enterMenu,\n exitMenu,\n mainButton,\n navigateNext,\n navigatePrevious,\n reject,\n secondaryButton,\n sign,\n tapLong,\n tapQuick,\n} from \"@root/src/internal/use-cases/touchUseCases\";\n\nexport type ButtonFactory = () => ButtonController & {\n left(): Promise<void>;\n right(): Promise<void>;\n both(): Promise<void>;\n pressSequence(keys: ButtonKey[], delayMs?: number): Promise<void>;\n};\n\nexport type TapFactory = (deviceKey: string) => {\n tapQuick: (point: PercentCoordinates) => Promise<void>;\n tapLong: (point: PercentCoordinates, delayMs?: number) => Promise<void>;\n sign: (delayMs?: number) => Promise<void>;\n reject: () => Promise<void>;\n navigateNext: () => Promise<void>;\n navigatePrevious: () => Promise<void>;\n mainButton: () => Promise<void>;\n secondaryButton: () => Promise<void>;\n enterMenu: () => Promise<void>;\n exitMenu: () => Promise<void>;\n enableBlindSigningSettings: () => Promise<void>;\n continueToBlindSigning: () => Promise<void>;\n acceptBlindSigning: () => Promise<void>;\n};\n\nexport type DeviceControllerClientFactory = (\n baseURL: string,\n opts?: {\n timeoutMs?: number;\n clientHeader?: string;\n screens?: DeviceScreens<string>;\n },\n) => DeviceControllerClient;\n\nexport type DeviceControllerClient = {\n buttonFactory: ButtonFactory;\n tapFactory: TapFactory;\n};\n\nexport const deviceControllerClientFactory: DeviceControllerClientFactory = (\n baseURL,\n opts = {},\n) => {\n const resolved: DeviceControllerOptions = {\n screens: opts.screens ?? DEFAULT_SCREENS,\n timeoutMs: opts.timeoutMs,\n clientHeader: opts.clientHeader,\n };\n\n const { buttons, touch } = createDefaultControllers(baseURL, resolved);\n const press = pressButtons(buttons);\n\n return {\n buttonFactory: () => ({\n press: (key) => buttons.press(key),\n left: () => press.left(),\n right: () => press.right(),\n both: () => press.both(),\n pressSequence: (keys, delayMs) => pressSequence(buttons, keys, delayMs),\n }),\n tapFactory: (key) => ({\n tapQuick: tapQuick(touch, key),\n tapLong: tapLong(touch, key),\n sign: sign(touch, key),\n reject: reject(touch, key),\n navigateNext: navigateNext(touch, key),\n navigatePrevious: navigatePrevious(touch, key),\n mainButton: mainButton(touch, key),\n secondaryButton: secondaryButton(touch, key),\n enterMenu: enterMenu(touch, key),\n exitMenu: exitMenu(touch, key),\n enableBlindSigningSettings: enableBlindSigningSettings(touch, key),\n continueToBlindSigning: continueToBlindSigning(touch, key),\n acceptBlindSigning: acceptBlindSigning(touch, key),\n }),\n };\n};\n\nexport type {\n ButtonKey,\n DeviceControllerOptions,\n DeviceScreens,\n PercentCoordinates,\n};\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,2CAQhCC,EAAyC,iCACzCC,EAGO,uDACPC,
|
|
4
|
+
"sourcesContent": ["import { DEFAULT_SCREENS } from \"@internal/config/defaultScreens\";\nimport type { ButtonController } from \"@internal/core/ButtonController\";\nimport type {\n ButtonKey,\n DeviceControllerOptions,\n DeviceScreens,\n PercentCoordinates,\n} from \"@internal/core/types\";\nimport { createDefaultControllers } from \"@root/src/internal/di\";\nimport {\n pressButtons,\n pressSequence,\n} from \"@root/src/internal/use-cases/buttonUseCases\";\nimport {\n acceptBlindSigning,\n confirmAddressBookReview,\n continueToBlindSigning,\n enableBlindSigningSettings,\n enterMenu,\n exitMenu,\n mainButton,\n navigateNext,\n navigatePrevious,\n reject,\n secondaryButton,\n sign,\n tapLong,\n tapQuick,\n} from \"@root/src/internal/use-cases/touchUseCases\";\n\nexport type ButtonFactory = () => ButtonController & {\n left(): Promise<void>;\n right(): Promise<void>;\n both(): Promise<void>;\n pressSequence(keys: ButtonKey[], delayMs?: number): Promise<void>;\n};\n\nexport type TapFactory = (deviceKey: string) => {\n tapQuick: (point: PercentCoordinates) => Promise<void>;\n tapLong: (point: PercentCoordinates, delayMs?: number) => Promise<void>;\n sign: (delayMs?: number) => Promise<void>;\n reject: () => Promise<void>;\n navigateNext: () => Promise<void>;\n navigatePrevious: () => Promise<void>;\n mainButton: () => Promise<void>;\n secondaryButton: () => Promise<void>;\n enterMenu: () => Promise<void>;\n exitMenu: () => Promise<void>;\n enableBlindSigningSettings: () => Promise<void>;\n continueToBlindSigning: () => Promise<void>;\n acceptBlindSigning: () => Promise<void>;\n confirmAddressBookReview: () => Promise<void>;\n};\n\nexport type DeviceControllerClientFactory = (\n baseURL: string,\n opts?: {\n timeoutMs?: number;\n clientHeader?: string;\n screens?: DeviceScreens<string>;\n },\n) => DeviceControllerClient;\n\nexport type DeviceControllerClient = {\n buttonFactory: ButtonFactory;\n tapFactory: TapFactory;\n};\n\nexport const deviceControllerClientFactory: DeviceControllerClientFactory = (\n baseURL,\n opts = {},\n) => {\n const resolved: DeviceControllerOptions = {\n screens: opts.screens ?? DEFAULT_SCREENS,\n timeoutMs: opts.timeoutMs,\n clientHeader: opts.clientHeader,\n };\n\n const { buttons, touch } = createDefaultControllers(baseURL, resolved);\n const press = pressButtons(buttons);\n\n return {\n buttonFactory: () => ({\n press: (key) => buttons.press(key),\n left: () => press.left(),\n right: () => press.right(),\n both: () => press.both(),\n pressSequence: (keys, delayMs) => pressSequence(buttons, keys, delayMs),\n }),\n tapFactory: (key) => ({\n tapQuick: tapQuick(touch, key),\n tapLong: tapLong(touch, key),\n sign: sign(touch, key),\n reject: reject(touch, key),\n navigateNext: navigateNext(touch, key),\n navigatePrevious: navigatePrevious(touch, key),\n mainButton: mainButton(touch, key),\n secondaryButton: secondaryButton(touch, key),\n enterMenu: enterMenu(touch, key),\n exitMenu: exitMenu(touch, key),\n enableBlindSigningSettings: enableBlindSigningSettings(touch, key),\n continueToBlindSigning: continueToBlindSigning(touch, key),\n acceptBlindSigning: acceptBlindSigning(touch, key),\n confirmAddressBookReview: confirmAddressBookReview(touch, key),\n }),\n };\n};\n\nexport type {\n ButtonKey,\n DeviceControllerOptions,\n DeviceScreens,\n PercentCoordinates,\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,2CAQhCC,EAAyC,iCACzCC,EAGO,uDACPC,EAeO,sDAwCA,MAAML,EAA+D,CAC1EM,EACAC,EAAO,CAAC,IACL,CACH,MAAMC,EAAoC,CACxC,QAASD,EAAK,SAAW,kBACzB,UAAWA,EAAK,UAChB,aAAcA,EAAK,YACrB,EAEM,CAAE,QAAAE,EAAS,MAAAC,CAAM,KAAI,4BAAyBJ,EAASE,CAAQ,EAC/DG,KAAQ,gBAAaF,CAAO,EAElC,MAAO,CACL,cAAe,KAAO,CACpB,MAAQG,GAAQH,EAAQ,MAAMG,CAAG,EACjC,KAAM,IAAMD,EAAM,KAAK,EACvB,MAAO,IAAMA,EAAM,MAAM,EACzB,KAAM,IAAMA,EAAM,KAAK,EACvB,cAAe,CAACE,EAAMC,OAAY,iBAAcL,EAASI,EAAMC,CAAO,CACxE,GACA,WAAaF,IAAS,CACpB,YAAU,YAASF,EAAOE,CAAG,EAC7B,WAAS,WAAQF,EAAOE,CAAG,EAC3B,QAAM,QAAKF,EAAOE,CAAG,EACrB,UAAQ,UAAOF,EAAOE,CAAG,EACzB,gBAAc,gBAAaF,EAAOE,CAAG,EACrC,oBAAkB,oBAAiBF,EAAOE,CAAG,EAC7C,cAAY,cAAWF,EAAOE,CAAG,EACjC,mBAAiB,mBAAgBF,EAAOE,CAAG,EAC3C,aAAW,aAAUF,EAAOE,CAAG,EAC/B,YAAU,YAASF,EAAOE,CAAG,EAC7B,8BAA4B,8BAA2BF,EAAOE,CAAG,EACjE,0BAAwB,0BAAuBF,EAAOE,CAAG,EACzD,sBAAoB,sBAAmBF,EAAOE,CAAG,EACjD,4BAA0B,4BAAyBF,EAAOE,CAAG,CAC/D,EACF,CACF",
|
|
6
6
|
"names": ["DeviceController_exports", "__export", "deviceControllerClientFactory", "__toCommonJS", "import_defaultScreens", "import_di", "import_buttonUseCases", "import_touchUseCases", "baseURL", "opts", "resolved", "buttons", "touch", "press", "key", "keys", "delayMs"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var d=(n,t)=>{for(var o in t)i(n,o,{get:t[o],enumerable:!0})},C=(n,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of l(t))!g.call(n,s)&&s!==o&&i(n,s,{get:()=>t[s],enumerable:!(r=y(t,s))||r.enumerable});return n};var p=n=>C(i({},"__esModule",{value:!0}),n);var L={};d(L,{acceptBlindSigning:()=>A,confirmAddressBookReview:()=>G,continueToBlindSigning:()=>I,enableBlindSigningSettings:()=>f,enterMenu:()=>h,exitMenu:()=>B,mainButton:()=>_,navigateNext:()=>T,navigatePrevious:()=>S,reject:()=>u,secondaryButton:()=>w,sign:()=>O,tapLong:()=>c,tapQuick:()=>e});module.exports=p(L);const a=5e3,c=(n,t)=>async(o,r=a)=>{await n.tap(t,o),await new Promise(s=>setTimeout(s,r)),await n.release(t,o)},e=(n,t)=>async o=>await n.tapAndRelease(t,o),O=(n,t)=>async(o=a)=>await c(n,t)({x:85,y:80},o),u=(n,t)=>async()=>await e(n,t)({x:20,y:90}),T=(n,t)=>async()=>await e(n,t)({x:90,y:90}),S=(n,t)=>async()=>await e(n,t)({x:45,y:90}),_=(n,t)=>async()=>await e(n,t)({x:50,y:80}),w=(n,t)=>async()=>await e(n,t)({x:50,y:90}),h=(n,t)=>async()=>await e(n,t)({x:85,y:8}),B=(n,t)=>async()=>await e(n,t)({x:10,y:4}),x={stax:{x:88,y:51},flex:{x:88,y:58},apex:{x:88,y:58}},D=n=>Object.hasOwn(x,n),R={x:88,y:51},f=(n,t)=>async()=>{const o=D(t)?x[t]:R;await e(n,t)(o)},K={stax:{x:50,y:77},flex:{x:50,y:72}},N=n=>Object.hasOwn(K,n),m={x:50,y:72},G=(n,t)=>async()=>{const o=N(t)?K[t]:m;await e(n,t)(o)},I=(n,t)=>async()=>await e(n,t)({x:50,y:94}),A=(n,t)=>async()=>await e(n,t)({x:50,y:94});0&&(module.exports={acceptBlindSigning,confirmAddressBookReview,continueToBlindSigning,enableBlindSigningSettings,enterMenu,exitMenu,mainButton,navigateNext,navigatePrevious,reject,secondaryButton,sign,tapLong,tapQuick});
|
|
2
2
|
//# sourceMappingURL=touchUseCases.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/use-cases/touchUseCases.ts"],
|
|
4
|
-
"sourcesContent": ["import type { PercentCoordinates } from \"@internal/core/types\";\nimport { type TouchController } from \"@root/src/internal/core/TouchController\";\n\nconst TAP_LONG_TIME_MS = 5000;\n\nexport const tapLong =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates, delayMs: number = TAP_LONG_TIME_MS) => {\n await touch.tap(deviceKey, point);\n await new Promise((r) => setTimeout(r, delayMs));\n await touch.release(deviceKey, point);\n };\n\nexport const tapQuick =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates) =>\n await touch.tapAndRelease(deviceKey, point);\n\nexport const sign =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (delayMs: number = TAP_LONG_TIME_MS) =>\n await tapLong(touch, deviceKey)({ x: 85, y: 80 }, delayMs);\n\nexport const reject =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 20, y: 90 });\n\nexport const navigateNext =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 90, y: 90 });\n\nexport const navigatePrevious =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 45, y: 90 });\n\nexport const mainButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 80 });\n\nexport const secondaryButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 90 });\n\nexport const enterMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 85, y: 8 });\n\nexport const exitMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 10, y: 4 });\n\nconst BLIND_SIGNING_TOGGLE_COORDS = {\n stax: { x: 88, y: 51 },\n flex: { x: 88, y: 58 },\n apex: { x: 88, y: 58 },\n} as const satisfies Record<string, PercentCoordinates>;\n\ntype BlindSigningTouchKey = keyof typeof BLIND_SIGNING_TOGGLE_COORDS;\n\nconst isBlindSigningTouchKey = (key: string): key is BlindSigningTouchKey =>\n Object.hasOwn(BLIND_SIGNING_TOGGLE_COORDS, key);\n\nconst DEFAULT_BLIND_SIGNING_TOGGLE_COORDS: PercentCoordinates = {\n x: 88,\n y: 51,\n};\n\nexport const enableBlindSigningSettings =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () => {\n const point = isBlindSigningTouchKey(deviceKey)\n ? BLIND_SIGNING_TOGGLE_COORDS[deviceKey]\n : DEFAULT_BLIND_SIGNING_TOGGLE_COORDS;\n await tapQuick(touch, deviceKey)(point);\n };\n\nexport const continueToBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n\nexport const acceptBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,2BAAAC,EAAA,+BAAAC,EAAA,cAAAC,EAAA,aAAAC,EAAA,eAAAC,EAAA,iBAAAC,EAAA,qBAAAC,EAAA,WAAAC,EAAA,oBAAAC,EAAA,SAAAC,EAAA,YAAAC,EAAA,aAAAC,IAAA,eAAAC,
|
|
6
|
-
"names": ["touchUseCases_exports", "__export", "acceptBlindSigning", "continueToBlindSigning", "enableBlindSigningSettings", "enterMenu", "exitMenu", "mainButton", "navigateNext", "navigatePrevious", "reject", "secondaryButton", "sign", "tapLong", "tapQuick", "__toCommonJS", "TAP_LONG_TIME_MS", "touch", "deviceKey", "point", "delayMs", "r", "BLIND_SIGNING_TOGGLE_COORDS", "isBlindSigningTouchKey", "key", "DEFAULT_BLIND_SIGNING_TOGGLE_COORDS"]
|
|
4
|
+
"sourcesContent": ["import type { PercentCoordinates } from \"@internal/core/types\";\nimport { type TouchController } from \"@root/src/internal/core/TouchController\";\n\nconst TAP_LONG_TIME_MS = 5000;\n\nexport const tapLong =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates, delayMs: number = TAP_LONG_TIME_MS) => {\n await touch.tap(deviceKey, point);\n await new Promise((r) => setTimeout(r, delayMs));\n await touch.release(deviceKey, point);\n };\n\nexport const tapQuick =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates) =>\n await touch.tapAndRelease(deviceKey, point);\n\nexport const sign =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (delayMs: number = TAP_LONG_TIME_MS) =>\n await tapLong(touch, deviceKey)({ x: 85, y: 80 }, delayMs);\n\nexport const reject =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 20, y: 90 });\n\nexport const navigateNext =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 90, y: 90 });\n\nexport const navigatePrevious =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 45, y: 90 });\n\nexport const mainButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 80 });\n\nexport const secondaryButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 90 });\n\nexport const enterMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 85, y: 8 });\n\nexport const exitMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 10, y: 4 });\n\nconst BLIND_SIGNING_TOGGLE_COORDS = {\n stax: { x: 88, y: 51 },\n flex: { x: 88, y: 58 },\n apex: { x: 88, y: 58 },\n} as const satisfies Record<string, PercentCoordinates>;\n\ntype BlindSigningTouchKey = keyof typeof BLIND_SIGNING_TOGGLE_COORDS;\n\nconst isBlindSigningTouchKey = (key: string): key is BlindSigningTouchKey =>\n Object.hasOwn(BLIND_SIGNING_TOGGLE_COORDS, key);\n\nconst DEFAULT_BLIND_SIGNING_TOGGLE_COORDS: PercentCoordinates = {\n x: 88,\n y: 51,\n};\n\nexport const enableBlindSigningSettings =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () => {\n const point = isBlindSigningTouchKey(deviceKey)\n ? BLIND_SIGNING_TOGGLE_COORDS[deviceKey]\n : DEFAULT_BLIND_SIGNING_TOGGLE_COORDS;\n await tapQuick(touch, deviceKey)(point);\n };\n\n/**\n * Confirm button of the Address Book review (REGISTER IDENTITY). NBGL's\n * \"review light\" puts this button above the page footer rather than in it, so\n * neither mainButton() nor secondaryButton() reaches it. Measured on Speculos:\n * flex 480x600 -> button centre y=436 (72%), stax 400x672 -> y=520 (77%).\n */\nconst ADDRESS_BOOK_CONFIRM_COORDS = {\n stax: { x: 50, y: 77 },\n flex: { x: 50, y: 72 },\n} as const satisfies Record<string, PercentCoordinates>;\n\ntype AddressBookConfirmKey = keyof typeof ADDRESS_BOOK_CONFIRM_COORDS;\n\nconst isAddressBookConfirmKey = (key: string): key is AddressBookConfirmKey =>\n Object.hasOwn(ADDRESS_BOOK_CONFIRM_COORDS, key);\n\n/** Flex's placement, used for any touchscreen model not measured above. */\nconst DEFAULT_ADDRESS_BOOK_CONFIRM_COORDS: PercentCoordinates = {\n x: 50,\n y: 72,\n};\n\nexport const confirmAddressBookReview =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () => {\n const point = isAddressBookConfirmKey(deviceKey)\n ? ADDRESS_BOOK_CONFIRM_COORDS[deviceKey]\n : DEFAULT_ADDRESS_BOOK_CONFIRM_COORDS;\n await tapQuick(touch, deviceKey)(point);\n };\n\nexport const continueToBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n\nexport const acceptBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,6BAAAC,EAAA,2BAAAC,EAAA,+BAAAC,EAAA,cAAAC,EAAA,aAAAC,EAAA,eAAAC,EAAA,iBAAAC,EAAA,qBAAAC,EAAA,WAAAC,EAAA,oBAAAC,EAAA,SAAAC,EAAA,YAAAC,EAAA,aAAAC,IAAA,eAAA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AAE,CAAC,EAE9CI,EAA8B,CAClC,KAAM,CAAE,EAAG,GAAI,EAAG,EAAG,EACrB,KAAM,CAAE,EAAG,GAAI,EAAG,EAAG,EACrB,KAAM,CAAE,EAAG,GAAI,EAAG,EAAG,CACvB,EAIMC,EAA0BC,GAC9B,OAAO,OAAOF,EAA6BE,CAAG,EAE1CC,EAA0D,CAC9D,EAAG,GACH,EAAG,EACL,EAEarB,EACX,CAAmBa,EAA2BC,IAC9C,SAAY,CACV,MAAMC,EAAQI,EAAuBL,CAAS,EAC1CI,EAA4BJ,CAAS,EACrCO,EACJ,MAAMX,EAASG,EAAOC,CAAS,EAAEC,CAAK,CACxC,EAQIO,EAA8B,CAClC,KAAM,CAAE,EAAG,GAAI,EAAG,EAAG,EACrB,KAAM,CAAE,EAAG,GAAI,EAAG,EAAG,CACvB,EAIMC,EAA2BH,GAC/B,OAAO,OAAOE,EAA6BF,CAAG,EAG1CI,EAA0D,CAC9D,EAAG,GACH,EAAG,EACL,EAEa1B,EACX,CAAmBe,EAA2BC,IAC9C,SAAY,CACV,MAAMC,EAAQQ,EAAwBT,CAAS,EAC3CQ,EAA4BR,CAAS,EACrCU,EACJ,MAAMd,EAASG,EAAOC,CAAS,EAAEC,CAAK,CACxC,EAEWhB,EACX,CAAmBc,EAA2BC,IAC9C,SACE,MAAMJ,EAASG,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCjB,EACX,CAAmBgB,EAA2BC,IAC9C,SACE,MAAMJ,EAASG,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC",
|
|
6
|
+
"names": ["touchUseCases_exports", "__export", "acceptBlindSigning", "confirmAddressBookReview", "continueToBlindSigning", "enableBlindSigningSettings", "enterMenu", "exitMenu", "mainButton", "navigateNext", "navigatePrevious", "reject", "secondaryButton", "sign", "tapLong", "tapQuick", "__toCommonJS", "TAP_LONG_TIME_MS", "touch", "deviceKey", "point", "delayMs", "r", "BLIND_SIGNING_TOGGLE_COORDS", "isBlindSigningTouchKey", "key", "DEFAULT_BLIND_SIGNING_TOGGLE_COORDS", "ADDRESS_BOOK_CONFIRM_COORDS", "isAddressBookConfirmKey", "DEFAULT_ADDRESS_BOOK_CONFIRM_COORDS"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var t=require("./touchUseCases");describe("touchUsecases",()=>{const s="devA",i={x:50,y:30};let e;beforeEach(()=>{e={tap:vi.fn().mockResolvedValue(void 0),release:vi.fn().mockResolvedValue(void 0),tapAndRelease:vi.fn().mockResolvedValue(void 0)},vi.restoreAllMocks(),vi.useRealTimers()}),it("tapQuick calls tapAndRelease with the same deviceKey and point",async()=>{await(0,t.tapQuick)(e,s)(i),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(s,i),expect(e.tap).not.toHaveBeenCalled(),expect(e.release).not.toHaveBeenCalled()}),it("tapLong taps, waits default timeout, then releases",async()=>{vi.useFakeTimers();const a=vi.spyOn(globalThis,"setTimeout"),o=(0,t.tapLong)(e,s)(i);await Promise.resolve(),expect(e.tap).toHaveBeenCalledTimes(1),expect(e.tap).toHaveBeenCalledWith(s,i),expect(a).toHaveBeenCalledTimes(1),expect(a).toHaveBeenLastCalledWith(expect.any(Function),5e3),expect(e.release).not.toHaveBeenCalled(),await vi.advanceTimersByTimeAsync(5e3),await o,expect(e.release).toHaveBeenCalledTimes(1),expect(e.release).toHaveBeenCalledWith(s,i)}),it("tapLong uses the provided delayMs value",async()=>{vi.useFakeTimers();const a=vi.spyOn(globalThis,"setTimeout"),n=1234,l=(0,t.tapLong)(e,s)(i,n);await Promise.resolve(),expect(e.tap).toHaveBeenCalledTimes(1),expect(e.tap).toHaveBeenCalledWith(s,i),expect(a).toHaveBeenCalledTimes(1),expect(a).toHaveBeenLastCalledWith(expect.any(Function),n),expect(e.release).not.toHaveBeenCalled(),await vi.advanceTimersByTimeAsync(n),await l,expect(e.release).toHaveBeenCalledTimes(1),expect(e.release).toHaveBeenCalledWith(s,i)}),it("tapLong propagates error if tap() rejects (no release)",async()=>{vi.useFakeTimers();const a=new Error("tap failed");e.tap.mockRejectedValueOnce(a);const o=(0,t.tapLong)(e,s)(i);await expect(o).rejects.toThrow("tap failed"),expect(e.release).not.toHaveBeenCalled()}),it("tapLong propagates error if release() rejects",async()=>{vi.useFakeTimers();const a=new Error("release failed");e.release.mockRejectedValueOnce(a);const n=(0,t.tapLong)(e,s)(i),o=expect(n).rejects.toThrow("release failed");await Promise.resolve(),await vi.advanceTimersByTimeAsync(5e3),await o,expect(e.tap).toHaveBeenCalledTimes(1),expect(e.release).toHaveBeenCalledTimes(1)}),describe("enableBlindSigningSettings",()=>{it.each([["stax",{x:88,y:51}],["flex",{x:88,y:58}],["apex",{x:88,y:58}]])("taps the blind-signing toggle at the %s coordinates",async(a,n)=>{await(0,t.enableBlindSigningSettings)(e,a)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(a,n)}),it("falls back to default coordinates for an unknown device key",async()=>{const a="unknown";await(0,t.enableBlindSigningSettings)(e,a)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(a,{x:88,y:51})})}),describe("fixed-coordinate taps",()=>{it.each([["reject",t.reject,{x:20,y:90}],["navigateNext",t.navigateNext,{x:90,y:90}],["navigatePrevious",t.navigatePrevious,{x:45,y:90}],["mainButton",t.mainButton,{x:50,y:80}],["secondaryButton",t.secondaryButton,{x:50,y:90}],["enterMenu",t.enterMenu,{x:85,y:8}],["exitMenu",t.exitMenu,{x:10,y:4}],["continueToBlindSigning",t.continueToBlindSigning,{x:50,y:94}],["acceptBlindSigning",t.acceptBlindSigning,{x:50,y:94}]])("%s taps %o",async(a,n,o)=>{await n(e,s)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(s,o)})}),describe("sign",()=>{const a={x:85,y:80};it("holds the sign button for the default 5s",async()=>{vi.useFakeTimers();const n=vi.spyOn(globalThis,"setTimeout"),o=(0,t.sign)(e,s)();await Promise.resolve(),expect(e.tap).toHaveBeenCalledWith(s,a),expect(n).toHaveBeenLastCalledWith(expect.any(Function),5e3),await vi.advanceTimersByTimeAsync(5e3),await o,expect(e.release).toHaveBeenCalledWith(s,a)}),it("holds the sign button for the provided delay",async()=>{vi.useFakeTimers();const n=vi.spyOn(globalThis,"setTimeout"),o=250,l=(0,t.sign)(e,s)(o);await Promise.resolve(),expect(n).toHaveBeenLastCalledWith(expect.any(Function),o),await vi.advanceTimersByTimeAsync(o),await l,expect(e.release).toHaveBeenCalledTimes(1)})}),describe("confirmAddressBookReview",()=>{it.each([["stax",{x:50,y:77}],["flex",{x:50,y:72}]])("taps the Confirm button at the %s coordinates",async(a,n)=>{await(0,t.confirmAddressBookReview)(e,a)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(a,n)}),it("falls back to Flex coordinates for an unmeasured device key",async()=>{const a="apex";await(0,t.confirmAddressBookReview)(e,a)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(a,{x:50,y:72})})})});
|
|
2
2
|
//# sourceMappingURL=touchUseCases.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/use-cases/touchUseCases.test.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport type { TouchController } from \"@root/src/internal/core/TouchController\";\n\nimport {
|
|
5
|
-
"mappings": "aAMA,IAAAA,
|
|
6
|
-
"names": ["import_touchUseCases", "deviceKey", "point", "controller", "timeoutSpy", "run", "customMs", "boom", "p", "assertion", "key", "expected", "unknownKey"]
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport type { TouchController } from \"@root/src/internal/core/TouchController\";\n\nimport {\n acceptBlindSigning,\n confirmAddressBookReview,\n continueToBlindSigning,\n enableBlindSigningSettings,\n enterMenu,\n exitMenu,\n mainButton,\n navigateNext,\n navigatePrevious,\n reject,\n secondaryButton,\n sign,\n tapLong,\n tapQuick,\n} from \"./touchUseCases\";\n\ndescribe(\"touchUsecases\", () => {\n const deviceKey = \"devA\";\n const point = { x: 50, y: 30 } as any;\n\n let controller: TouchController;\n\n beforeEach(() => {\n controller = {\n tap: vi.fn().mockResolvedValue(undefined),\n release: vi.fn().mockResolvedValue(undefined),\n tapAndRelease: vi.fn().mockResolvedValue(undefined),\n } as unknown as TouchController;\n vi.restoreAllMocks();\n vi.useRealTimers();\n });\n\n it(\"tapQuick calls tapAndRelease with the same deviceKey and point\", async () => {\n const quick = tapQuick(controller, deviceKey);\n await quick(point);\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(deviceKey, point);\n expect(controller.tap).not.toHaveBeenCalled();\n expect(controller.release).not.toHaveBeenCalled();\n });\n\n it(\"tapLong taps, waits default timeout, then releases\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const longTap = tapLong(controller, deviceKey);\n const run = longTap(point);\n\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, point);\n expect(timeoutSpy).toHaveBeenCalledTimes(1);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), 5000);\n expect(controller.release).not.toHaveBeenCalled();\n\n // let the 5s timer elapse\n await vi.advanceTimersByTimeAsync(5000);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledWith(deviceKey, point);\n });\n\n it(\"tapLong uses the provided delayMs value\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const customMs = 1234;\n const longTap = tapLong(controller, deviceKey);\n const run = longTap(point, customMs);\n\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, point);\n expect(timeoutSpy).toHaveBeenCalledTimes(1);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), customMs);\n expect(controller.release).not.toHaveBeenCalled();\n\n // advance exactly customMs and ensure release happens then\n await vi.advanceTimersByTimeAsync(customMs);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledWith(deviceKey, point);\n });\n\n it(\"tapLong propagates error if tap() rejects (no release)\", async () => {\n vi.useFakeTimers();\n\n const boom = new Error(\"tap failed\");\n (controller.tap as any).mockRejectedValueOnce(boom);\n\n const longTap = tapLong(controller, deviceKey);\n const p = longTap(point);\n\n // attach rejection handler immediately\n await expect(p).rejects.toThrow(\"tap failed\");\n expect(controller.release).not.toHaveBeenCalled();\n });\n\n it(\"tapLong propagates error if release() rejects\", async () => {\n vi.useFakeTimers();\n\n const boom = new Error(\"release failed\");\n (controller.release as any).mockRejectedValueOnce(boom);\n\n const p = tapLong(controller, deviceKey)(point);\n\n const assertion = expect(p).rejects.toThrow(\"release failed\");\n\n await Promise.resolve();\n await vi.advanceTimersByTimeAsync(5000);\n\n await assertion;\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledTimes(1);\n });\n\n describe(\"enableBlindSigningSettings\", () => {\n it.each([\n [\"stax\", { x: 88, y: 51 }],\n [\"flex\", { x: 88, y: 58 }],\n [\"apex\", { x: 88, y: 58 }],\n ] as const)(\n \"taps the blind-signing toggle at the %s coordinates\",\n async (key, expected) => {\n await enableBlindSigningSettings(controller, key)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(key, expected);\n },\n );\n\n it(\"falls back to default coordinates for an unknown device key\", async () => {\n const unknownKey = \"unknown\";\n await enableBlindSigningSettings(controller, unknownKey)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(unknownKey, {\n x: 88,\n y: 51,\n });\n });\n });\n\n describe(\"fixed-coordinate taps\", () => {\n it.each([\n [\"reject\", reject, { x: 20, y: 90 }],\n [\"navigateNext\", navigateNext, { x: 90, y: 90 }],\n [\"navigatePrevious\", navigatePrevious, { x: 45, y: 90 }],\n [\"mainButton\", mainButton, { x: 50, y: 80 }],\n [\"secondaryButton\", secondaryButton, { x: 50, y: 90 }],\n [\"enterMenu\", enterMenu, { x: 85, y: 8 }],\n [\"exitMenu\", exitMenu, { x: 10, y: 4 }],\n [\"continueToBlindSigning\", continueToBlindSigning, { x: 50, y: 94 }],\n [\"acceptBlindSigning\", acceptBlindSigning, { x: 50, y: 94 }],\n ] as const)(\"%s taps %o\", async (_name, useCase, expected) => {\n await useCase(controller, deviceKey)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(\n deviceKey,\n expected,\n );\n });\n });\n\n describe(\"sign\", () => {\n const HOLD_TO_SIGN = { x: 85, y: 80 };\n\n it(\"holds the sign button for the default 5s\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const run = sign(controller, deviceKey)();\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, HOLD_TO_SIGN);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), 5000);\n\n await vi.advanceTimersByTimeAsync(5000);\n await run;\n\n expect(controller.release).toHaveBeenCalledWith(deviceKey, HOLD_TO_SIGN);\n });\n\n it(\"holds the sign button for the provided delay\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const customMs = 250;\n const run = sign(controller, deviceKey)(customMs);\n await Promise.resolve();\n\n expect(timeoutSpy).toHaveBeenLastCalledWith(\n expect.any(Function),\n customMs,\n );\n\n await vi.advanceTimersByTimeAsync(customMs);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n });\n });\n\n describe(\"confirmAddressBookReview\", () => {\n // The Address Book review puts its Confirm button above the page footer,\n // so these coordinates are measured per model rather than shared with\n // mainButton/secondaryButton.\n it.each([\n [\"stax\", { x: 50, y: 77 }],\n [\"flex\", { x: 50, y: 72 }],\n ] as const)(\n \"taps the Confirm button at the %s coordinates\",\n async (key, expected) => {\n await confirmAddressBookReview(controller, key)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(key, expected);\n },\n );\n\n it(\"falls back to Flex coordinates for an unmeasured device key\", async () => {\n const unknownKey = \"apex\";\n await confirmAddressBookReview(controller, unknownKey)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(unknownKey, {\n x: 50,\n y: 72,\n });\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAMA,IAAAA,EAeO,2BAEP,SAAS,gBAAiB,IAAM,CAC9B,MAAMC,EAAY,OACZC,EAAQ,CAAE,EAAG,GAAI,EAAG,EAAG,EAE7B,IAAIC,EAEJ,WAAW,IAAM,CACfA,EAAa,CACX,IAAK,GAAG,GAAG,EAAE,kBAAkB,MAAS,EACxC,QAAS,GAAG,GAAG,EAAE,kBAAkB,MAAS,EAC5C,cAAe,GAAG,GAAG,EAAE,kBAAkB,MAAS,CAC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vD,OAAOT,EAAW,aAAa,EAAE,sBAAsB,CAAC,EACxD,OAAOA,EAAW,aAAa,EAAE,qBAAqBS,EAAY,CAChE,EAAG,GACH,EAAG,EACL,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_touchUseCases", "deviceKey", "point", "controller", "timeoutSpy", "run", "customMs", "boom", "p", "assertion", "key", "expected", "unknownKey", "_name", "useCase", "HOLD_TO_SIGN"]
|
|
7
7
|
}
|
package/lib/esm/package.json
CHANGED
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
53
53
|
"watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
|
|
54
54
|
},
|
|
55
|
-
"version": "0.0.0-develop-
|
|
55
|
+
"version": "0.0.0-develop-20260904001312"
|
|
56
56
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DEFAULT_SCREENS as a}from"../internal/config/defaultScreens";import{createDefaultControllers as l}from"../../src/internal/di";import{pressButtons as
|
|
1
|
+
import{DEFAULT_SCREENS as a}from"../internal/config/defaultScreens";import{createDefaultControllers as l}from"../../src/internal/di";import{pressButtons as d,pressSequence as u}from"../../src/internal/use-cases/buttonUseCases";import{acceptBlindSigning as p,confirmAddressBookReview as m,continueToBlindSigning as v,enableBlindSigningSettings as g,enterMenu as B,exitMenu as P,mainButton as C,navigateNext as S,navigatePrevious as y,reject as b,secondaryButton as f,sign as x,tapLong as D,tapQuick as F}from"../../src/internal/use-cases/touchUseCases";const R=(r,o={})=>{const s={screens:o.screens??a,timeoutMs:o.timeoutMs,clientHeader:o.clientHeader},{buttons:n,touch:t}=l(r,s),i=d(n);return{buttonFactory:()=>({press:e=>n.press(e),left:()=>i.left(),right:()=>i.right(),both:()=>i.both(),pressSequence:(e,c)=>u(n,e,c)}),tapFactory:e=>({tapQuick:F(t,e),tapLong:D(t,e),sign:x(t,e),reject:b(t,e),navigateNext:S(t,e),navigatePrevious:y(t,e),mainButton:C(t,e),secondaryButton:f(t,e),enterMenu:B(t,e),exitMenu:P(t,e),enableBlindSigningSettings:g(t,e),continueToBlindSigning:v(t,e),acceptBlindSigning:p(t,e),confirmAddressBookReview:m(t,e)})}};export{R as deviceControllerClientFactory};
|
|
2
2
|
//# sourceMappingURL=DeviceController.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/api/DeviceController.ts"],
|
|
4
|
-
"sourcesContent": ["import { DEFAULT_SCREENS } from \"@internal/config/defaultScreens\";\nimport type { ButtonController } from \"@internal/core/ButtonController\";\nimport type {\n ButtonKey,\n DeviceControllerOptions,\n DeviceScreens,\n PercentCoordinates,\n} from \"@internal/core/types\";\nimport { createDefaultControllers } from \"@root/src/internal/di\";\nimport {\n pressButtons,\n pressSequence,\n} from \"@root/src/internal/use-cases/buttonUseCases\";\nimport {\n acceptBlindSigning,\n continueToBlindSigning,\n enableBlindSigningSettings,\n enterMenu,\n exitMenu,\n mainButton,\n navigateNext,\n navigatePrevious,\n reject,\n secondaryButton,\n sign,\n tapLong,\n tapQuick,\n} from \"@root/src/internal/use-cases/touchUseCases\";\n\nexport type ButtonFactory = () => ButtonController & {\n left(): Promise<void>;\n right(): Promise<void>;\n both(): Promise<void>;\n pressSequence(keys: ButtonKey[], delayMs?: number): Promise<void>;\n};\n\nexport type TapFactory = (deviceKey: string) => {\n tapQuick: (point: PercentCoordinates) => Promise<void>;\n tapLong: (point: PercentCoordinates, delayMs?: number) => Promise<void>;\n sign: (delayMs?: number) => Promise<void>;\n reject: () => Promise<void>;\n navigateNext: () => Promise<void>;\n navigatePrevious: () => Promise<void>;\n mainButton: () => Promise<void>;\n secondaryButton: () => Promise<void>;\n enterMenu: () => Promise<void>;\n exitMenu: () => Promise<void>;\n enableBlindSigningSettings: () => Promise<void>;\n continueToBlindSigning: () => Promise<void>;\n acceptBlindSigning: () => Promise<void>;\n};\n\nexport type DeviceControllerClientFactory = (\n baseURL: string,\n opts?: {\n timeoutMs?: number;\n clientHeader?: string;\n screens?: DeviceScreens<string>;\n },\n) => DeviceControllerClient;\n\nexport type DeviceControllerClient = {\n buttonFactory: ButtonFactory;\n tapFactory: TapFactory;\n};\n\nexport const deviceControllerClientFactory: DeviceControllerClientFactory = (\n baseURL,\n opts = {},\n) => {\n const resolved: DeviceControllerOptions = {\n screens: opts.screens ?? DEFAULT_SCREENS,\n timeoutMs: opts.timeoutMs,\n clientHeader: opts.clientHeader,\n };\n\n const { buttons, touch } = createDefaultControllers(baseURL, resolved);\n const press = pressButtons(buttons);\n\n return {\n buttonFactory: () => ({\n press: (key) => buttons.press(key),\n left: () => press.left(),\n right: () => press.right(),\n both: () => press.both(),\n pressSequence: (keys, delayMs) => pressSequence(buttons, keys, delayMs),\n }),\n tapFactory: (key) => ({\n tapQuick: tapQuick(touch, key),\n tapLong: tapLong(touch, key),\n sign: sign(touch, key),\n reject: reject(touch, key),\n navigateNext: navigateNext(touch, key),\n navigatePrevious: navigatePrevious(touch, key),\n mainButton: mainButton(touch, key),\n secondaryButton: secondaryButton(touch, key),\n enterMenu: enterMenu(touch, key),\n exitMenu: exitMenu(touch, key),\n enableBlindSigningSettings: enableBlindSigningSettings(touch, key),\n continueToBlindSigning: continueToBlindSigning(touch, key),\n acceptBlindSigning: acceptBlindSigning(touch, key),\n }),\n };\n};\n\nexport type {\n ButtonKey,\n DeviceControllerOptions,\n DeviceScreens,\n PercentCoordinates,\n};\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,kCAQhC,OAAS,4BAAAC,MAAgC,wBACzC,OACE,gBAAAC,EACA,iBAAAC,MACK,8CACP,OACE,sBAAAC,EACA,0BAAAC,EACA,8BAAAC,EACA,aAAAC,EACA,YAAAC,EACA,cAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,mBAAAC,EACA,QAAAC,EACA,WAAAC,EACA,YAAAC,MACK,
|
|
6
|
-
"names": ["DEFAULT_SCREENS", "createDefaultControllers", "pressButtons", "pressSequence", "acceptBlindSigning", "continueToBlindSigning", "enableBlindSigningSettings", "enterMenu", "exitMenu", "mainButton", "navigateNext", "navigatePrevious", "reject", "secondaryButton", "sign", "tapLong", "tapQuick", "deviceControllerClientFactory", "baseURL", "opts", "resolved", "buttons", "touch", "press", "key", "keys", "delayMs"]
|
|
4
|
+
"sourcesContent": ["import { DEFAULT_SCREENS } from \"@internal/config/defaultScreens\";\nimport type { ButtonController } from \"@internal/core/ButtonController\";\nimport type {\n ButtonKey,\n DeviceControllerOptions,\n DeviceScreens,\n PercentCoordinates,\n} from \"@internal/core/types\";\nimport { createDefaultControllers } from \"@root/src/internal/di\";\nimport {\n pressButtons,\n pressSequence,\n} from \"@root/src/internal/use-cases/buttonUseCases\";\nimport {\n acceptBlindSigning,\n confirmAddressBookReview,\n continueToBlindSigning,\n enableBlindSigningSettings,\n enterMenu,\n exitMenu,\n mainButton,\n navigateNext,\n navigatePrevious,\n reject,\n secondaryButton,\n sign,\n tapLong,\n tapQuick,\n} from \"@root/src/internal/use-cases/touchUseCases\";\n\nexport type ButtonFactory = () => ButtonController & {\n left(): Promise<void>;\n right(): Promise<void>;\n both(): Promise<void>;\n pressSequence(keys: ButtonKey[], delayMs?: number): Promise<void>;\n};\n\nexport type TapFactory = (deviceKey: string) => {\n tapQuick: (point: PercentCoordinates) => Promise<void>;\n tapLong: (point: PercentCoordinates, delayMs?: number) => Promise<void>;\n sign: (delayMs?: number) => Promise<void>;\n reject: () => Promise<void>;\n navigateNext: () => Promise<void>;\n navigatePrevious: () => Promise<void>;\n mainButton: () => Promise<void>;\n secondaryButton: () => Promise<void>;\n enterMenu: () => Promise<void>;\n exitMenu: () => Promise<void>;\n enableBlindSigningSettings: () => Promise<void>;\n continueToBlindSigning: () => Promise<void>;\n acceptBlindSigning: () => Promise<void>;\n confirmAddressBookReview: () => Promise<void>;\n};\n\nexport type DeviceControllerClientFactory = (\n baseURL: string,\n opts?: {\n timeoutMs?: number;\n clientHeader?: string;\n screens?: DeviceScreens<string>;\n },\n) => DeviceControllerClient;\n\nexport type DeviceControllerClient = {\n buttonFactory: ButtonFactory;\n tapFactory: TapFactory;\n};\n\nexport const deviceControllerClientFactory: DeviceControllerClientFactory = (\n baseURL,\n opts = {},\n) => {\n const resolved: DeviceControllerOptions = {\n screens: opts.screens ?? DEFAULT_SCREENS,\n timeoutMs: opts.timeoutMs,\n clientHeader: opts.clientHeader,\n };\n\n const { buttons, touch } = createDefaultControllers(baseURL, resolved);\n const press = pressButtons(buttons);\n\n return {\n buttonFactory: () => ({\n press: (key) => buttons.press(key),\n left: () => press.left(),\n right: () => press.right(),\n both: () => press.both(),\n pressSequence: (keys, delayMs) => pressSequence(buttons, keys, delayMs),\n }),\n tapFactory: (key) => ({\n tapQuick: tapQuick(touch, key),\n tapLong: tapLong(touch, key),\n sign: sign(touch, key),\n reject: reject(touch, key),\n navigateNext: navigateNext(touch, key),\n navigatePrevious: navigatePrevious(touch, key),\n mainButton: mainButton(touch, key),\n secondaryButton: secondaryButton(touch, key),\n enterMenu: enterMenu(touch, key),\n exitMenu: exitMenu(touch, key),\n enableBlindSigningSettings: enableBlindSigningSettings(touch, key),\n continueToBlindSigning: continueToBlindSigning(touch, key),\n acceptBlindSigning: acceptBlindSigning(touch, key),\n confirmAddressBookReview: confirmAddressBookReview(touch, key),\n }),\n };\n};\n\nexport type {\n ButtonKey,\n DeviceControllerOptions,\n DeviceScreens,\n PercentCoordinates,\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,kCAQhC,OAAS,4BAAAC,MAAgC,wBACzC,OACE,gBAAAC,EACA,iBAAAC,MACK,8CACP,OACE,sBAAAC,EACA,4BAAAC,EACA,0BAAAC,EACA,8BAAAC,EACA,aAAAC,EACA,YAAAC,EACA,cAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,mBAAAC,EACA,QAAAC,EACA,WAAAC,EACA,YAAAC,MACK,6CAwCA,MAAMC,EAA+D,CAC1EC,EACAC,EAAO,CAAC,IACL,CACH,MAAMC,EAAoC,CACxC,QAASD,EAAK,SAAWpB,EACzB,UAAWoB,EAAK,UAChB,aAAcA,EAAK,YACrB,EAEM,CAAE,QAAAE,EAAS,MAAAC,CAAM,EAAItB,EAAyBkB,EAASE,CAAQ,EAC/DG,EAAQtB,EAAaoB,CAAO,EAElC,MAAO,CACL,cAAe,KAAO,CACpB,MAAQG,GAAQH,EAAQ,MAAMG,CAAG,EACjC,KAAM,IAAMD,EAAM,KAAK,EACvB,MAAO,IAAMA,EAAM,MAAM,EACzB,KAAM,IAAMA,EAAM,KAAK,EACvB,cAAe,CAACE,EAAMC,IAAYxB,EAAcmB,EAASI,EAAMC,CAAO,CACxE,GACA,WAAaF,IAAS,CACpB,SAAUR,EAASM,EAAOE,CAAG,EAC7B,QAAST,EAAQO,EAAOE,CAAG,EAC3B,KAAMV,EAAKQ,EAAOE,CAAG,EACrB,OAAQZ,EAAOU,EAAOE,CAAG,EACzB,aAAcd,EAAaY,EAAOE,CAAG,EACrC,iBAAkBb,EAAiBW,EAAOE,CAAG,EAC7C,WAAYf,EAAWa,EAAOE,CAAG,EACjC,gBAAiBX,EAAgBS,EAAOE,CAAG,EAC3C,UAAWjB,EAAUe,EAAOE,CAAG,EAC/B,SAAUhB,EAASc,EAAOE,CAAG,EAC7B,2BAA4BlB,EAA2BgB,EAAOE,CAAG,EACjE,uBAAwBnB,EAAuBiB,EAAOE,CAAG,EACzD,mBAAoBrB,EAAmBmB,EAAOE,CAAG,EACjD,yBAA0BpB,EAAyBkB,EAAOE,CAAG,CAC/D,EACF,CACF",
|
|
6
|
+
"names": ["DEFAULT_SCREENS", "createDefaultControllers", "pressButtons", "pressSequence", "acceptBlindSigning", "confirmAddressBookReview", "continueToBlindSigning", "enableBlindSigningSettings", "enterMenu", "exitMenu", "mainButton", "navigateNext", "navigatePrevious", "reject", "secondaryButton", "sign", "tapLong", "tapQuick", "deviceControllerClientFactory", "baseURL", "opts", "resolved", "buttons", "touch", "press", "key", "keys", "delayMs"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const s=5e3,
|
|
1
|
+
const s=5e3,x=(t,n)=>async(e,a=s)=>{await t.tap(n,e),await new Promise(c=>setTimeout(c,a)),await t.release(n,e)},o=(t,n)=>async e=>await t.tapAndRelease(n,e),d=(t,n)=>async(e=s)=>await x(t,n)({x:85,y:80},e),C=(t,n)=>async()=>await o(t,n)({x:20,y:90}),p=(t,n)=>async()=>await o(t,n)({x:90,y:90}),O=(t,n)=>async()=>await o(t,n)({x:45,y:90}),u=(t,n)=>async()=>await o(t,n)({x:50,y:80}),T=(t,n)=>async()=>await o(t,n)({x:50,y:90}),S=(t,n)=>async()=>await o(t,n)({x:85,y:8}),_=(t,n)=>async()=>await o(t,n)({x:10,y:4}),r={stax:{x:88,y:51},flex:{x:88,y:58},apex:{x:88,y:58}},K=t=>Object.hasOwn(r,t),y={x:88,y:51},w=(t,n)=>async()=>{const e=K(n)?r[n]:y;await o(t,n)(e)},i={stax:{x:50,y:77},flex:{x:50,y:72}},l=t=>Object.hasOwn(i,t),g={x:50,y:72},h=(t,n)=>async()=>{const e=l(n)?i[n]:g;await o(t,n)(e)},B=(t,n)=>async()=>await o(t,n)({x:50,y:94}),D=(t,n)=>async()=>await o(t,n)({x:50,y:94});export{D as acceptBlindSigning,h as confirmAddressBookReview,B as continueToBlindSigning,w as enableBlindSigningSettings,S as enterMenu,_ as exitMenu,u as mainButton,p as navigateNext,O as navigatePrevious,C as reject,T as secondaryButton,d as sign,x as tapLong,o as tapQuick};
|
|
2
2
|
//# sourceMappingURL=touchUseCases.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/use-cases/touchUseCases.ts"],
|
|
4
|
-
"sourcesContent": ["import type { PercentCoordinates } from \"@internal/core/types\";\nimport { type TouchController } from \"@root/src/internal/core/TouchController\";\n\nconst TAP_LONG_TIME_MS = 5000;\n\nexport const tapLong =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates, delayMs: number = TAP_LONG_TIME_MS) => {\n await touch.tap(deviceKey, point);\n await new Promise((r) => setTimeout(r, delayMs));\n await touch.release(deviceKey, point);\n };\n\nexport const tapQuick =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates) =>\n await touch.tapAndRelease(deviceKey, point);\n\nexport const sign =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (delayMs: number = TAP_LONG_TIME_MS) =>\n await tapLong(touch, deviceKey)({ x: 85, y: 80 }, delayMs);\n\nexport const reject =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 20, y: 90 });\n\nexport const navigateNext =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 90, y: 90 });\n\nexport const navigatePrevious =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 45, y: 90 });\n\nexport const mainButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 80 });\n\nexport const secondaryButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 90 });\n\nexport const enterMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 85, y: 8 });\n\nexport const exitMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 10, y: 4 });\n\nconst BLIND_SIGNING_TOGGLE_COORDS = {\n stax: { x: 88, y: 51 },\n flex: { x: 88, y: 58 },\n apex: { x: 88, y: 58 },\n} as const satisfies Record<string, PercentCoordinates>;\n\ntype BlindSigningTouchKey = keyof typeof BLIND_SIGNING_TOGGLE_COORDS;\n\nconst isBlindSigningTouchKey = (key: string): key is BlindSigningTouchKey =>\n Object.hasOwn(BLIND_SIGNING_TOGGLE_COORDS, key);\n\nconst DEFAULT_BLIND_SIGNING_TOGGLE_COORDS: PercentCoordinates = {\n x: 88,\n y: 51,\n};\n\nexport const enableBlindSigningSettings =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () => {\n const point = isBlindSigningTouchKey(deviceKey)\n ? BLIND_SIGNING_TOGGLE_COORDS[deviceKey]\n : DEFAULT_BLIND_SIGNING_TOGGLE_COORDS;\n await tapQuick(touch, deviceKey)(point);\n };\n\nexport const continueToBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n\nexport const acceptBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n"],
|
|
5
|
-
"mappings": "AAGA,MAAMA,EAAmB,IAEZC,EACX,CAAmBC,EAA2BC,IAC9C,MAAOC,EAA2BC,EAAkBL,IAAqB,CACvE,MAAME,EAAM,IAAIC,EAAWC,CAAK,EAChC,MAAM,IAAI,QAASE,GAAM,WAAWA,EAAGD,CAAO,CAAC,EAC/C,MAAMH,EAAM,QAAQC,EAAWC,CAAK,CACtC,EAEWG,EACX,CAAmBL,EAA2BC,IAC9C,MAAOC,GACL,MAAMF,EAAM,cAAcC,EAAWC,CAAK,EAEjCI,EACX,CAAmBN,EAA2BC,IAC9C,MAAOE,EAAkBL,IACvB,MAAMC,EAAQC,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,EAAGE,CAAO,EAEhDI,EACX,CAAmBP,EAA2BC,IAC9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ject", "navigateNext", "navigatePrevious", "mainButton", "secondaryButton", "enterMenu", "exitMenu", "BLIND_SIGNING_TOGGLE_COORDS", "isBlindSigningTouchKey", "key", "DEFAULT_BLIND_SIGNING_TOGGLE_COORDS", "enableBlindSigningSettings", "continueToBlindSigning", "acceptBlindSigning"]
|
|
4
|
+
"sourcesContent": ["import type { PercentCoordinates } from \"@internal/core/types\";\nimport { type TouchController } from \"@root/src/internal/core/TouchController\";\n\nconst TAP_LONG_TIME_MS = 5000;\n\nexport const tapLong =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates, delayMs: number = TAP_LONG_TIME_MS) => {\n await touch.tap(deviceKey, point);\n await new Promise((r) => setTimeout(r, delayMs));\n await touch.release(deviceKey, point);\n };\n\nexport const tapQuick =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates) =>\n await touch.tapAndRelease(deviceKey, point);\n\nexport const sign =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (delayMs: number = TAP_LONG_TIME_MS) =>\n await tapLong(touch, deviceKey)({ x: 85, y: 80 }, delayMs);\n\nexport const reject =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 20, y: 90 });\n\nexport const navigateNext =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 90, y: 90 });\n\nexport const navigatePrevious =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 45, y: 90 });\n\nexport const mainButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 80 });\n\nexport const secondaryButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 90 });\n\nexport const enterMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 85, y: 8 });\n\nexport const exitMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 10, y: 4 });\n\nconst BLIND_SIGNING_TOGGLE_COORDS = {\n stax: { x: 88, y: 51 },\n flex: { x: 88, y: 58 },\n apex: { x: 88, y: 58 },\n} as const satisfies Record<string, PercentCoordinates>;\n\ntype BlindSigningTouchKey = keyof typeof BLIND_SIGNING_TOGGLE_COORDS;\n\nconst isBlindSigningTouchKey = (key: string): key is BlindSigningTouchKey =>\n Object.hasOwn(BLIND_SIGNING_TOGGLE_COORDS, key);\n\nconst DEFAULT_BLIND_SIGNING_TOGGLE_COORDS: PercentCoordinates = {\n x: 88,\n y: 51,\n};\n\nexport const enableBlindSigningSettings =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () => {\n const point = isBlindSigningTouchKey(deviceKey)\n ? BLIND_SIGNING_TOGGLE_COORDS[deviceKey]\n : DEFAULT_BLIND_SIGNING_TOGGLE_COORDS;\n await tapQuick(touch, deviceKey)(point);\n };\n\n/**\n * Confirm button of the Address Book review (REGISTER IDENTITY). NBGL's\n * \"review light\" puts this button above the page footer rather than in it, so\n * neither mainButton() nor secondaryButton() reaches it. Measured on Speculos:\n * flex 480x600 -> button centre y=436 (72%), stax 400x672 -> y=520 (77%).\n */\nconst ADDRESS_BOOK_CONFIRM_COORDS = {\n stax: { x: 50, y: 77 },\n flex: { x: 50, y: 72 },\n} as const satisfies Record<string, PercentCoordinates>;\n\ntype AddressBookConfirmKey = keyof typeof ADDRESS_BOOK_CONFIRM_COORDS;\n\nconst isAddressBookConfirmKey = (key: string): key is AddressBookConfirmKey =>\n Object.hasOwn(ADDRESS_BOOK_CONFIRM_COORDS, key);\n\n/** Flex's placement, used for any touchscreen model not measured above. */\nconst DEFAULT_ADDRESS_BOOK_CONFIRM_COORDS: PercentCoordinates = {\n x: 50,\n y: 72,\n};\n\nexport const confirmAddressBookReview =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () => {\n const point = isAddressBookConfirmKey(deviceKey)\n ? ADDRESS_BOOK_CONFIRM_COORDS[deviceKey]\n : DEFAULT_ADDRESS_BOOK_CONFIRM_COORDS;\n await tapQuick(touch, deviceKey)(point);\n };\n\nexport const continueToBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n\nexport const acceptBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n"],
|
|
5
|
+
"mappings": "AAGA,MAAMA,EAAmB,IAEZC,EACX,CAAmBC,EAA2BC,IAC9C,MAAOC,EAA2BC,EAAkBL,IAAqB,CACvE,MAAME,EAAM,IAAIC,EAAWC,CAAK,EAChC,MAAM,IAAI,QAASE,GAAM,WAAWA,EAAGD,CAAO,CAAC,EAC/C,MAAMH,EAAM,QAAQC,EAAWC,CAAK,CACtC,EAEWG,EACX,CAAmBL,EAA2BC,IAC9C,MAAOC,GACL,MAAMF,EAAM,cAAcC,EAAWC,CAAK,EAEjCI,EACX,CAAmBN,EAA2BC,IAC9C,MAAOE,EAAkBL,IACvB,MAAMC,EAAQC,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,EAAGE,CAAO,EAEhDI,EACX,CAAmBP,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCO,EACX,CAAmBR,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCQ,EACX,CAAmBT,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCS,EACX,CAAmBV,EAA2BC,IA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MI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCuB,EACX,CAAmBxB,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC",
|
|
6
|
+
"names": ["TAP_LONG_TIME_MS", "tapLong", "touch", "deviceKey", "point", "delayMs", "r", "tapQuick", "sign", "reject", "navigateNext", "navigatePrevious", "mainButton", "secondaryButton", "enterMenu", "exitMenu", "BLIND_SIGNING_TOGGLE_COORDS", "isBlindSigningTouchKey", "key", "DEFAULT_BLIND_SIGNING_TOGGLE_COORDS", "enableBlindSigningSettings", "ADDRESS_BOOK_CONFIRM_COORDS", "isAddressBookConfirmKey", "DEFAULT_ADDRESS_BOOK_CONFIRM_COORDS", "confirmAddressBookReview", "continueToBlindSigning", "acceptBlindSigning"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{enableBlindSigningSettings as
|
|
1
|
+
import{acceptBlindSigning as p,confirmAddressBookReview as c,continueToBlindSigning as v,enableBlindSigningSettings as r,enterMenu as x,exitMenu as u,mainButton as m,navigateNext as y,navigatePrevious as T,reject as B,secondaryButton as h,sign as d,tapLong as i,tapQuick as g}from"./touchUseCases";describe("touchUsecases",()=>{const n="devA",o={x:50,y:30};let e;beforeEach(()=>{e={tap:vi.fn().mockResolvedValue(void 0),release:vi.fn().mockResolvedValue(void 0),tapAndRelease:vi.fn().mockResolvedValue(void 0)},vi.restoreAllMocks(),vi.useRealTimers()}),it("tapQuick calls tapAndRelease with the same deviceKey and point",async()=>{await g(e,n)(o),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(n,o),expect(e.tap).not.toHaveBeenCalled(),expect(e.release).not.toHaveBeenCalled()}),it("tapLong taps, waits default timeout, then releases",async()=>{vi.useFakeTimers();const t=vi.spyOn(globalThis,"setTimeout"),s=i(e,n)(o);await Promise.resolve(),expect(e.tap).toHaveBeenCalledTimes(1),expect(e.tap).toHaveBeenCalledWith(n,o),expect(t).toHaveBeenCalledTimes(1),expect(t).toHaveBeenLastCalledWith(expect.any(Function),5e3),expect(e.release).not.toHaveBeenCalled(),await vi.advanceTimersByTimeAsync(5e3),await s,expect(e.release).toHaveBeenCalledTimes(1),expect(e.release).toHaveBeenCalledWith(n,o)}),it("tapLong uses the provided delayMs value",async()=>{vi.useFakeTimers();const t=vi.spyOn(globalThis,"setTimeout"),a=1234,l=i(e,n)(o,a);await Promise.resolve(),expect(e.tap).toHaveBeenCalledTimes(1),expect(e.tap).toHaveBeenCalledWith(n,o),expect(t).toHaveBeenCalledTimes(1),expect(t).toHaveBeenLastCalledWith(expect.any(Function),a),expect(e.release).not.toHaveBeenCalled(),await vi.advanceTimersByTimeAsync(a),await l,expect(e.release).toHaveBeenCalledTimes(1),expect(e.release).toHaveBeenCalledWith(n,o)}),it("tapLong propagates error if tap() rejects (no release)",async()=>{vi.useFakeTimers();const t=new Error("tap failed");e.tap.mockRejectedValueOnce(t);const s=i(e,n)(o);await expect(s).rejects.toThrow("tap failed"),expect(e.release).not.toHaveBeenCalled()}),it("tapLong propagates error if release() rejects",async()=>{vi.useFakeTimers();const t=new Error("release failed");e.release.mockRejectedValueOnce(t);const a=i(e,n)(o),s=expect(a).rejects.toThrow("release failed");await Promise.resolve(),await vi.advanceTimersByTimeAsync(5e3),await s,expect(e.tap).toHaveBeenCalledTimes(1),expect(e.release).toHaveBeenCalledTimes(1)}),describe("enableBlindSigningSettings",()=>{it.each([["stax",{x:88,y:51}],["flex",{x:88,y:58}],["apex",{x:88,y:58}]])("taps the blind-signing toggle at the %s coordinates",async(t,a)=>{await r(e,t)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(t,a)}),it("falls back to default coordinates for an unknown device key",async()=>{const t="unknown";await r(e,t)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(t,{x:88,y:51})})}),describe("fixed-coordinate taps",()=>{it.each([["reject",B,{x:20,y:90}],["navigateNext",y,{x:90,y:90}],["navigatePrevious",T,{x:45,y:90}],["mainButton",m,{x:50,y:80}],["secondaryButton",h,{x:50,y:90}],["enterMenu",x,{x:85,y:8}],["exitMenu",u,{x:10,y:4}],["continueToBlindSigning",v,{x:50,y:94}],["acceptBlindSigning",p,{x:50,y:94}]])("%s taps %o",async(t,a,s)=>{await a(e,n)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(n,s)})}),describe("sign",()=>{const t={x:85,y:80};it("holds the sign button for the default 5s",async()=>{vi.useFakeTimers();const a=vi.spyOn(globalThis,"setTimeout"),s=d(e,n)();await Promise.resolve(),expect(e.tap).toHaveBeenCalledWith(n,t),expect(a).toHaveBeenLastCalledWith(expect.any(Function),5e3),await vi.advanceTimersByTimeAsync(5e3),await s,expect(e.release).toHaveBeenCalledWith(n,t)}),it("holds the sign button for the provided delay",async()=>{vi.useFakeTimers();const a=vi.spyOn(globalThis,"setTimeout"),s=250,l=d(e,n)(s);await Promise.resolve(),expect(a).toHaveBeenLastCalledWith(expect.any(Function),s),await vi.advanceTimersByTimeAsync(s),await l,expect(e.release).toHaveBeenCalledTimes(1)})}),describe("confirmAddressBookReview",()=>{it.each([["stax",{x:50,y:77}],["flex",{x:50,y:72}]])("taps the Confirm button at the %s coordinates",async(t,a)=>{await c(e,t)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(t,a)}),it("falls back to Flex coordinates for an unmeasured device key",async()=>{const t="apex";await c(e,t)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(t,{x:50,y:72})})})});
|
|
2
2
|
//# sourceMappingURL=touchUseCases.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/use-cases/touchUseCases.test.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport type { TouchController } from \"@root/src/internal/core/TouchController\";\n\nimport {
|
|
5
|
-
"mappings": "AAMA,
|
|
6
|
-
"names": ["enableBlindSigningSettings", "tapLong", "tapQuick", "deviceKey", "point", "controller", "timeoutSpy", "run", "customMs", "boom", "p", "assertion", "key", "expected", "unknownKey"]
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport type { TouchController } from \"@root/src/internal/core/TouchController\";\n\nimport {\n acceptBlindSigning,\n confirmAddressBookReview,\n continueToBlindSigning,\n enableBlindSigningSettings,\n enterMenu,\n exitMenu,\n mainButton,\n navigateNext,\n navigatePrevious,\n reject,\n secondaryButton,\n sign,\n tapLong,\n tapQuick,\n} from \"./touchUseCases\";\n\ndescribe(\"touchUsecases\", () => {\n const deviceKey = \"devA\";\n const point = { x: 50, y: 30 } as any;\n\n let controller: TouchController;\n\n beforeEach(() => {\n controller = {\n tap: vi.fn().mockResolvedValue(undefined),\n release: vi.fn().mockResolvedValue(undefined),\n tapAndRelease: vi.fn().mockResolvedValue(undefined),\n } as unknown as TouchController;\n vi.restoreAllMocks();\n vi.useRealTimers();\n });\n\n it(\"tapQuick calls tapAndRelease with the same deviceKey and point\", async () => {\n const quick = tapQuick(controller, deviceKey);\n await quick(point);\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(deviceKey, point);\n expect(controller.tap).not.toHaveBeenCalled();\n expect(controller.release).not.toHaveBeenCalled();\n });\n\n it(\"tapLong taps, waits default timeout, then releases\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const longTap = tapLong(controller, deviceKey);\n const run = longTap(point);\n\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, point);\n expect(timeoutSpy).toHaveBeenCalledTimes(1);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), 5000);\n expect(controller.release).not.toHaveBeenCalled();\n\n // let the 5s timer elapse\n await vi.advanceTimersByTimeAsync(5000);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledWith(deviceKey, point);\n });\n\n it(\"tapLong uses the provided delayMs value\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const customMs = 1234;\n const longTap = tapLong(controller, deviceKey);\n const run = longTap(point, customMs);\n\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, point);\n expect(timeoutSpy).toHaveBeenCalledTimes(1);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), customMs);\n expect(controller.release).not.toHaveBeenCalled();\n\n // advance exactly customMs and ensure release happens then\n await vi.advanceTimersByTimeAsync(customMs);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledWith(deviceKey, point);\n });\n\n it(\"tapLong propagates error if tap() rejects (no release)\", async () => {\n vi.useFakeTimers();\n\n const boom = new Error(\"tap failed\");\n (controller.tap as any).mockRejectedValueOnce(boom);\n\n const longTap = tapLong(controller, deviceKey);\n const p = longTap(point);\n\n // attach rejection handler immediately\n await expect(p).rejects.toThrow(\"tap failed\");\n expect(controller.release).not.toHaveBeenCalled();\n });\n\n it(\"tapLong propagates error if release() rejects\", async () => {\n vi.useFakeTimers();\n\n const boom = new Error(\"release failed\");\n (controller.release as any).mockRejectedValueOnce(boom);\n\n const p = tapLong(controller, deviceKey)(point);\n\n const assertion = expect(p).rejects.toThrow(\"release failed\");\n\n await Promise.resolve();\n await vi.advanceTimersByTimeAsync(5000);\n\n await assertion;\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledTimes(1);\n });\n\n describe(\"enableBlindSigningSettings\", () => {\n it.each([\n [\"stax\", { x: 88, y: 51 }],\n [\"flex\", { x: 88, y: 58 }],\n [\"apex\", { x: 88, y: 58 }],\n ] as const)(\n \"taps the blind-signing toggle at the %s coordinates\",\n async (key, expected) => {\n await enableBlindSigningSettings(controller, key)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(key, expected);\n },\n );\n\n it(\"falls back to default coordinates for an unknown device key\", async () => {\n const unknownKey = \"unknown\";\n await enableBlindSigningSettings(controller, unknownKey)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(unknownKey, {\n x: 88,\n y: 51,\n });\n });\n });\n\n describe(\"fixed-coordinate taps\", () => {\n it.each([\n [\"reject\", reject, { x: 20, y: 90 }],\n [\"navigateNext\", navigateNext, { x: 90, y: 90 }],\n [\"navigatePrevious\", navigatePrevious, { x: 45, y: 90 }],\n [\"mainButton\", mainButton, { x: 50, y: 80 }],\n [\"secondaryButton\", secondaryButton, { x: 50, y: 90 }],\n [\"enterMenu\", enterMenu, { x: 85, y: 8 }],\n [\"exitMenu\", exitMenu, { x: 10, y: 4 }],\n [\"continueToBlindSigning\", continueToBlindSigning, { x: 50, y: 94 }],\n [\"acceptBlindSigning\", acceptBlindSigning, { x: 50, y: 94 }],\n ] as const)(\"%s taps %o\", async (_name, useCase, expected) => {\n await useCase(controller, deviceKey)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(\n deviceKey,\n expected,\n );\n });\n });\n\n describe(\"sign\", () => {\n const HOLD_TO_SIGN = { x: 85, y: 80 };\n\n it(\"holds the sign button for the default 5s\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const run = sign(controller, deviceKey)();\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, HOLD_TO_SIGN);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), 5000);\n\n await vi.advanceTimersByTimeAsync(5000);\n await run;\n\n expect(controller.release).toHaveBeenCalledWith(deviceKey, HOLD_TO_SIGN);\n });\n\n it(\"holds the sign button for the provided delay\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const customMs = 250;\n const run = sign(controller, deviceKey)(customMs);\n await Promise.resolve();\n\n expect(timeoutSpy).toHaveBeenLastCalledWith(\n expect.any(Function),\n customMs,\n );\n\n await vi.advanceTimersByTimeAsync(customMs);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n });\n });\n\n describe(\"confirmAddressBookReview\", () => {\n // The Address Book review puts its Confirm button above the page footer,\n // so these coordinates are measured per model rather than shared with\n // mainButton/secondaryButton.\n it.each([\n [\"stax\", { x: 50, y: 77 }],\n [\"flex\", { x: 50, y: 72 }],\n ] as const)(\n \"taps the Confirm button at the %s coordinates\",\n async (key, expected) => {\n await confirmAddressBookReview(controller, key)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(key, expected);\n },\n );\n\n it(\"falls back to Flex coordinates for an unmeasured device key\", async () => {\n const unknownKey = \"apex\";\n await confirmAddressBookReview(controller, unknownKey)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(unknownKey, {\n x: 50,\n y: 72,\n });\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AMD,EAEN,OAAOF,EAAW,OAAO,EAAE,sBAAsB,CAAC,CACpD,CAAC,CACH,CAAC,EAED,SAAS,2BAA4B,IAAM,CAIzC,GAAG,KAAK,CACN,CAAC,OAAQ,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EACzB,CAAC,OAAQ,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,CAC3B,CAAU,EACR,gDACA,MAAOO,EAAKC,IAAa,CACvB,MAAMvB,EAAyBe,EAAYO,CAAG,EAAE,EAEhD,OAAOP,EAAW,aAAa,EAAE,sBAAsB,CAAC,EACxD,OAAOA,EAAW,aAAa,EAAE,qBAAqBO,EAAKC,CAAQ,CACrE,CACF,EAEA,GAAG,8DAA+D,SAAY,CAC5E,MAAMC,EAAa,OACnB,MAAMxB,EAAyBe,EAAYS,CAAU,EAAE,EAEvD,OAAOT,EAAW,aAAa,EAAE,sBAAsB,CAAC,EACxD,OAAOA,EAAW,aAAa,EAAE,qBAAqBS,EAAY,CAChE,EAAG,GACH,EAAG,EACL,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["acceptBlindSigning", "confirmAddressBookReview", "continueToBlindSigning", "enableBlindSigningSettings", "enterMenu", "exitMenu", "mainButton", "navigateNext", "navigatePrevious", "reject", "secondaryButton", "sign", "tapLong", "tapQuick", "deviceKey", "point", "controller", "timeoutSpy", "run", "customMs", "boom", "p", "assertion", "key", "expected", "unknownKey", "_name", "useCase", "HOLD_TO_SIGN"]
|
|
7
7
|
}
|
|
@@ -20,6 +20,7 @@ export type TapFactory = (deviceKey: string) => {
|
|
|
20
20
|
enableBlindSigningSettings: () => Promise<void>;
|
|
21
21
|
continueToBlindSigning: () => Promise<void>;
|
|
22
22
|
acceptBlindSigning: () => Promise<void>;
|
|
23
|
+
confirmAddressBookReview: () => Promise<void>;
|
|
23
24
|
};
|
|
24
25
|
export type DeviceControllerClientFactory = (baseURL: string, opts?: {
|
|
25
26
|
timeoutMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceController.d.ts","sourceRoot":"","sources":["../../../../src/api/DeviceController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"DeviceController.d.ts","sourceRoot":"","sources":["../../../../src/api/DeviceController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAuB9B,MAAM,MAAM,aAAa,GAAG,MAAM,gBAAgB,GAAG;IACnD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK;IAC9C,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,OAAO,EAAE,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,0BAA0B,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,sBAAsB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,wBAAwB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,CAC1C,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;IACL,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACjC,KACE,sBAAsB,CAAC;AAE5B,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,6BAsC3C,CAAC;AAEF,YAAY,EACV,SAAS,EACT,uBAAuB,EACvB,aAAa,EACb,kBAAkB,GACnB,CAAC"}
|
|
@@ -11,6 +11,7 @@ export declare const secondaryButton: <K extends string>(touch: TouchController<
|
|
|
11
11
|
export declare const enterMenu: <K extends string>(touch: TouchController<K>, deviceKey: K) => () => Promise<void>;
|
|
12
12
|
export declare const exitMenu: <K extends string>(touch: TouchController<K>, deviceKey: K) => () => Promise<void>;
|
|
13
13
|
export declare const enableBlindSigningSettings: <K extends string>(touch: TouchController<K>, deviceKey: K) => () => Promise<void>;
|
|
14
|
+
export declare const confirmAddressBookReview: <K extends string>(touch: TouchController<K>, deviceKey: K) => () => Promise<void>;
|
|
14
15
|
export declare const continueToBlindSigning: <K extends string>(touch: TouchController<K>, deviceKey: K) => () => Promise<void>;
|
|
15
16
|
export declare const acceptBlindSigning: <K extends string>(touch: TouchController<K>, deviceKey: K) => () => Promise<void>;
|
|
16
17
|
//# sourceMappingURL=touchUseCases.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"touchUseCases.d.ts","sourceRoot":"","sources":["../../../../../src/internal/use-cases/touchUseCases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAI/E,eAAO,MAAM,OAAO,GACjB,CAAC,SAAS,MAAM,EAAE,OAAO,eAAe,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,MACnD,OAAO,kBAAkB,EAAE,UAAS,MAAyB,kBAInE,CAAC;AAEJ,eAAO,MAAM,QAAQ,GAClB,CAAC,SAAS,MAAM,EAAE,OAAO,eAAe,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,MACnD,OAAO,kBAAkB,kBACa,CAAC;AAEhD,eAAO,MAAM,IAAI,GACd,CAAC,SAAS,MAAM,EAAE,OAAO,eAAe,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,MACnD,UAAS,MAAyB,kBACmB,CAAC;AAE/D,eAAO,MAAM,MAAM,GAChB,CAAC,SAAS,MAAM,EAAE,OAAO,eAAe,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,wBAEN,CAAC;AAEvD,eAAO,MAAM,YAAY,GACtB,CAAC,SAAS,MAAM,EAAE,OAAO,eAAe,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,wBAEN,CAAC;AAEvD,eAAO,MAAM,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