@ledgerhq/device-contacts-kit 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/api/app-binder/RenameContactDeviceActionTypes.js.map +1 -1
- package/lib/cjs/api/index.js +1 -1
- package/lib/cjs/api/index.js.map +2 -2
- package/lib/cjs/api/model/ContactsVersionRequirements.js +1 -1
- package/lib/cjs/api/model/ContactsVersionRequirements.js.map +3 -3
- package/lib/cjs/api/model/ContactsVersionRequirements.test.js +1 -1
- package/lib/cjs/api/model/ContactsVersionRequirements.test.js.map +3 -3
- package/lib/cjs/api/model/RenameContact.js.map +1 -1
- package/lib/cjs/internal/app-binder/command/EditExternalAddressIdentifierCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/EditExternalAddressIdentifierCommand.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/EditExternalAddressScopeCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/EditExternalAddressScopeCommand.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ProvideContactCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideContactCommand.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/RegisterIdentityCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/RegisterIdentityCommand.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/RenameContactCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/RenameContactCommand.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/RenameContactCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/RenameContactCommand.test.js.map +2 -2
- package/lib/cjs/internal/app-binder/contactsVersionGuards.js +1 -1
- package/lib/cjs/internal/app-binder/contactsVersionGuards.js.map +3 -3
- package/lib/cjs/internal/app-binder/contactsVersionGuards.test.js +1 -1
- package/lib/cjs/internal/app-binder/contactsVersionGuards.test.js.map +2 -2
- package/lib/cjs/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.js +1 -1
- package/lib/cjs/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.js.map +3 -3
- package/lib/cjs/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.test.js +1 -1
- package/lib/cjs/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/model/contactsConstants.js +1 -1
- package/lib/cjs/internal/app-binder/model/contactsConstants.js.map +2 -2
- package/lib/cjs/internal/app-binder/model/contactsErrors.js +1 -1
- package/lib/cjs/internal/app-binder/model/contactsErrors.js.map +3 -3
- package/lib/cjs/internal/app-binder/services/provideContact.test.js +1 -1
- package/lib/cjs/internal/app-binder/services/provideContact.test.js.map +2 -2
- package/lib/cjs/internal/app-binder/task/SendRenameContactTask.js +1 -1
- package/lib/cjs/internal/app-binder/task/SendRenameContactTask.js.map +2 -2
- package/lib/cjs/internal/app-binder/task/SendRenameContactTask.test.js +1 -1
- package/lib/cjs/internal/app-binder/task/SendRenameContactTask.test.js.map +3 -3
- package/lib/cjs/package.json +1 -1
- package/lib/esm/api/index.js +1 -1
- package/lib/esm/api/index.js.map +3 -3
- package/lib/esm/api/model/ContactsVersionRequirements.js +1 -1
- package/lib/esm/api/model/ContactsVersionRequirements.js.map +3 -3
- package/lib/esm/api/model/ContactsVersionRequirements.test.js +1 -1
- package/lib/esm/api/model/ContactsVersionRequirements.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/EditExternalAddressIdentifierCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/EditExternalAddressIdentifierCommand.js.map +3 -3
- package/lib/esm/internal/app-binder/command/EditExternalAddressScopeCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/EditExternalAddressScopeCommand.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ProvideContactCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideContactCommand.js.map +3 -3
- package/lib/esm/internal/app-binder/command/RegisterIdentityCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/RegisterIdentityCommand.js.map +3 -3
- package/lib/esm/internal/app-binder/command/RenameContactCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/RenameContactCommand.js.map +3 -3
- package/lib/esm/internal/app-binder/command/RenameContactCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/RenameContactCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/contactsVersionGuards.js +1 -1
- package/lib/esm/internal/app-binder/contactsVersionGuards.js.map +3 -3
- package/lib/esm/internal/app-binder/contactsVersionGuards.test.js +1 -1
- package/lib/esm/internal/app-binder/contactsVersionGuards.test.js.map +3 -3
- package/lib/esm/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.js +1 -1
- package/lib/esm/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.js.map +3 -3
- package/lib/esm/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.test.js +1 -1
- package/lib/esm/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.test.js.map +3 -3
- package/lib/esm/internal/app-binder/model/contactsConstants.js +1 -1
- package/lib/esm/internal/app-binder/model/contactsConstants.js.map +2 -2
- package/lib/esm/internal/app-binder/model/contactsErrors.js +1 -1
- package/lib/esm/internal/app-binder/model/contactsErrors.js.map +3 -3
- package/lib/esm/internal/app-binder/services/provideContact.test.js +1 -1
- package/lib/esm/internal/app-binder/services/provideContact.test.js.map +2 -2
- package/lib/esm/internal/app-binder/task/SendRenameContactTask.js +1 -1
- package/lib/esm/internal/app-binder/task/SendRenameContactTask.js.map +3 -3
- package/lib/esm/internal/app-binder/task/SendRenameContactTask.test.js +1 -1
- package/lib/esm/internal/app-binder/task/SendRenameContactTask.test.js.map +3 -3
- package/lib/esm/package.json +1 -1
- package/lib/types/api/app-binder/RenameContactDeviceActionTypes.d.ts +2 -1
- package/lib/types/api/app-binder/RenameContactDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/api/index.d.ts +1 -1
- package/lib/types/api/index.d.ts.map +1 -1
- package/lib/types/api/model/ContactsVersionRequirements.d.ts +36 -3
- package/lib/types/api/model/ContactsVersionRequirements.d.ts.map +1 -1
- package/lib/types/api/model/RenameContact.d.ts +5 -3
- package/lib/types/api/model/RenameContact.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/EditExternalAddressIdentifierCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/EditExternalAddressScopeCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideContactCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/RegisterIdentityCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/RenameContactCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/contactsVersionGuards.d.ts +9 -1
- package/lib/types/internal/app-binder/contactsVersionGuards.d.ts.map +1 -1
- package/lib/types/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.d.ts +4 -3
- package/lib/types/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.d.ts.map +1 -1
- package/lib/types/internal/app-binder/model/contactsConstants.d.ts +2 -2
- package/lib/types/internal/app-binder/model/contactsConstants.d.ts.map +1 -1
- package/lib/types/internal/app-binder/model/contactsErrors.d.ts +21 -2
- package/lib/types/internal/app-binder/model/contactsErrors.d.ts.map +1 -1
- package/lib/types/internal/app-binder/task/SendRenameContactTask.d.ts +8 -0
- package/lib/types/internal/app-binder/task/SendRenameContactTask.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/services/provideContact.test.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n bufferToHexaString,\n CommandResultFactory,\n CommandResultStatus,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type ProvideContactInput } from \"@api/model/ProvideContact\";\nimport { ProvideContactCommand } from \"@internal/app-binder/command/ProvideContactCommand\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\nimport { ContactsCommandError } from \"@internal/app-binder/model/contactsErrors\";\n\nimport {\n buildProvideContactPayload,\n sendProvideContactPayload,\n} from \"./provideContact\";\n\nconst IDENTIFIER = new Uint8Array(20).fill(0x11);\nconst GROUP_HANDLE = new Uint8Array(64).fill(0x22);\nconst HMAC_PROOF = new Uint8Array(32).fill(0x33);\nconst HMAC_REST = new Uint8Array(32).fill(0x44);\n\nconst INPUT: ProvideContactInput = {\n contactName: \"Alice\",\n scope: \"Ethereum\",\n identifier: IDENTIFIER,\n groupHandle: GROUP_HANDLE,\n hmacProof: HMAC_PROOF,\n hmacRest: HMAC_REST,\n blockchainFamily: \"ethereum\",\n chainId: 1n,\n};\n\n// Tags >= 0x80 use the DER long form (0x81 then the tag), hence the \"81\" prefix\n// on CONTACT_NAME (0xf0), SCOPE (0xf1), ACCOUNT_IDENTIFIER (0xf2),\n// GROUP_HANDLE (0xf6) and HMAC_REST (0xf7).\nconst STRUCT_TYPE_TLV = \"010133\";\nconst STRUCT_VERSION_TLV = \"020101\";\nconst CONTACT_NAME_TLV = \"81f005\" + \"416c696365\"; // \"Alice\"\nconst SCOPE_TLV = \"81f108\" + \"457468657265756d\"; // \"Ethereum\"\nconst IDENTIFIER_TLV = \"81f214\" + \"11\".repeat(20);\nconst GROUP_HANDLE_TLV = \"81f640\" + \"22\".repeat(64);\nconst CHAIN_ID_TLV = \"230101\";\nconst FAMILY_TLV = \"510101\";\nconst HMAC_PROOF_TLV = \"2920\" + \"33\".repeat(32);\nconst HMAC_REST_TLV = \"81f720\" + \"44\".repeat(32);\n\ndescribe(\"buildProvideContactPayload\", () => {\n it(\"encodes every tag in the order the spec lists\", () => {\n const payload = buildProvideContactPayload(INPUT);\n\n expect(bufferToHexaString(payload, false)).toBe(\n STRUCT_TYPE_TLV +\n STRUCT_VERSION_TLV +\n CONTACT_NAME_TLV +\n SCOPE_TLV +\n IDENTIFIER_TLV +\n GROUP_HANDLE_TLV +\n CHAIN_ID_TLV +\n FAMILY_TLV +\n HMAC_PROOF_TLV +\n HMAC_REST_TLV,\n );\n });\n\n it(\"fits an Ethereum contact in a single 255-byte chunk\", () => {\n expect(buildProvideContactPayload(INPUT).length).toBeLessThanOrEqual(253);\n });\n\n it(\"omits CHAIN_ID for a family that does not carry one\", () => {\n const payload = buildProvideContactPayload({\n ...INPUT,\n blockchainFamily: \"
|
|
5
|
-
"mappings": "AAAA,OACE,sBAAAA,EACA,wBAAAC,EACA,uBAAAC,MACK,kCAGP,OAAS,yBAAAC,MAA6B,qDACtC,OAAS,mCAAAC,MAAuC,oEAChD,OAAS,wBAAAC,MAA4B,4CAErC,OACE,8BAAAC,EACA,6BAAAC,MACK,mBAEP,MAAMC,EAAa,IAAI,WAAW,EAAE,EAAE,KAAK,EAAI,EACzCC,EAAe,IAAI,WAAW,EAAE,EAAE,KAAK,EAAI,EAC3CC,EAAa,IAAI,WAAW,EAAE,EAAE,KAAK,EAAI,EACzCC,EAAY,IAAI,WAAW,EAAE,EAAE,KAAK,EAAI,EAExCC,EAA6B,CACjC,YAAa,QACb,MAAO,WACP,WAAYJ,EACZ,YAAaC,EACb,UAAWC,EACX,SAAUC,EACV,iBAAkB,WAClB,QAAS,EACX,EAKME,EAAkB,SAClBC,EAAqB,SACrBC,EAAmB,mBACnBC,EAAY,yBACZC,EAAiB,SAAW,KAAK,OAAO,EAAE,EAC1CC,EAAmB,SAAW,KAAK,OAAO,EAAE,EAC5CC,EAAe,SACfC,EAAa,SACbC,EAAiB,OAAS,KAAK,OAAO,EAAE,EACxCC,EAAgB,SAAW,KAAK,OAAO,EAAE,EAE/C,SAAS,6BAA8B,IAAM,CAC3C,GAAG,gDAAiD,IAAM,CACxD,MAAMC,EAAUjB,EAA2BM,CAAK,EAEhD,OAAOZ,EAAmBuB,EAAS,EAAK,CAAC,EAAE,KACzCV,EACEC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,CACJ,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,CAC9D,OAAOhB,EAA2BM,CAAK,EAAE,MAAM,EAAE,oBAAoB,GAAG,CAC1E,CAAC,EAED,GAAG,sDAAuD,IAAM,CAC9D,MAAMW,EAAUjB,EAA2B,CACzC,GAAGM,EACH,iBAAkB,
|
|
4
|
+
"sourcesContent": ["import {\n bufferToHexaString,\n CommandResultFactory,\n CommandResultStatus,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type ProvideContactInput } from \"@api/model/ProvideContact\";\nimport { ProvideContactCommand } from \"@internal/app-binder/command/ProvideContactCommand\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\nimport { ContactsCommandError } from \"@internal/app-binder/model/contactsErrors\";\n\nimport {\n buildProvideContactPayload,\n sendProvideContactPayload,\n} from \"./provideContact\";\n\nconst IDENTIFIER = new Uint8Array(20).fill(0x11);\nconst GROUP_HANDLE = new Uint8Array(64).fill(0x22);\nconst HMAC_PROOF = new Uint8Array(32).fill(0x33);\nconst HMAC_REST = new Uint8Array(32).fill(0x44);\n\nconst INPUT: ProvideContactInput = {\n contactName: \"Alice\",\n scope: \"Ethereum\",\n identifier: IDENTIFIER,\n groupHandle: GROUP_HANDLE,\n hmacProof: HMAC_PROOF,\n hmacRest: HMAC_REST,\n blockchainFamily: \"ethereum\",\n chainId: 1n,\n};\n\n// Tags >= 0x80 use the DER long form (0x81 then the tag), hence the \"81\" prefix\n// on CONTACT_NAME (0xf0), SCOPE (0xf1), ACCOUNT_IDENTIFIER (0xf2),\n// GROUP_HANDLE (0xf6) and HMAC_REST (0xf7).\nconst STRUCT_TYPE_TLV = \"010133\";\nconst STRUCT_VERSION_TLV = \"020101\";\nconst CONTACT_NAME_TLV = \"81f005\" + \"416c696365\"; // \"Alice\"\nconst SCOPE_TLV = \"81f108\" + \"457468657265756d\"; // \"Ethereum\"\nconst IDENTIFIER_TLV = \"81f214\" + \"11\".repeat(20);\nconst GROUP_HANDLE_TLV = \"81f640\" + \"22\".repeat(64);\nconst CHAIN_ID_TLV = \"230101\";\nconst FAMILY_TLV = \"510101\";\nconst HMAC_PROOF_TLV = \"2920\" + \"33\".repeat(32);\nconst HMAC_REST_TLV = \"81f720\" + \"44\".repeat(32);\n\ndescribe(\"buildProvideContactPayload\", () => {\n it(\"encodes every tag in the order the spec lists\", () => {\n const payload = buildProvideContactPayload(INPUT);\n\n expect(bufferToHexaString(payload, false)).toBe(\n STRUCT_TYPE_TLV +\n STRUCT_VERSION_TLV +\n CONTACT_NAME_TLV +\n SCOPE_TLV +\n IDENTIFIER_TLV +\n GROUP_HANDLE_TLV +\n CHAIN_ID_TLV +\n FAMILY_TLV +\n HMAC_PROOF_TLV +\n HMAC_REST_TLV,\n );\n });\n\n it(\"fits an Ethereum contact in a single 255-byte chunk\", () => {\n expect(buildProvideContactPayload(INPUT).length).toBeLessThanOrEqual(253);\n });\n\n it(\"omits CHAIN_ID for a family that does not carry one\", () => {\n const payload = buildProvideContactPayload({\n ...INPUT,\n blockchainFamily: \"tron\",\n chainId: undefined,\n });\n\n expect(bufferToHexaString(payload, false)).toContain(\n GROUP_HANDLE_TLV + \"510106\",\n );\n });\n\n it(\"encodes a multi-byte chain id big-endian with no leading zeroes\", () => {\n const payload = buildProvideContactPayload({ ...INPUT, chainId: 8453n });\n\n expect(bufferToHexaString(payload, false)).toContain(\"2302\" + \"2105\");\n });\n\n it(\"accepts the family name case-insensitively\", () => {\n expect(\n buildProvideContactPayload({ ...INPUT, blockchainFamily: \"Ethereum\" }),\n ).toStrictEqual(buildProvideContactPayload(INPUT));\n });\n\n it(\"throws on an unknown blockchain family\", () => {\n expect(() =>\n buildProvideContactPayload({ ...INPUT, blockchainFamily: \"dogecoin\" }),\n ).toThrow(\"Unsupported blockchain family: dogecoin\");\n });\n});\n\ndescribe(\"sendProvideContactPayload\", () => {\n it(\"sends one chunk under P2=0x00, prefixed with the 2-byte BE total length\", async () => {\n const api = makeDeviceActionInternalApiMock();\n api.sendCommand.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n const payload = buildProvideContactPayload(INPUT);\n\n const result = await sendProvideContactPayload(api, { payload });\n\n expect(api.sendCommand).toHaveBeenCalledTimes(1);\n const command = api.sendCommand.mock.calls[0]![0] as ProvideContactCommand;\n expect(command).toBeInstanceOf(ProvideContactCommand);\n expect(command.args.p2).toBe(0x00);\n expect(command.args.data.slice(0, 2)).toStrictEqual(\n Uint8Array.from([(payload.length >> 8) & 0xff, payload.length & 0xff]),\n );\n expect(command.args.data.slice(2)).toStrictEqual(payload);\n expect(result.status).toBe(CommandResultStatus.Success);\n });\n\n it(\"propagates a device rejection instead of throwing\", async () => {\n const api = makeDeviceActionInternalApiMock();\n api.sendCommand.mockResolvedValue(\n CommandResultFactory({\n error: new ContactsCommandError({\n errorCode: \"6982\",\n message: \"wrong seed\",\n }),\n }),\n );\n\n const result = await sendProvideContactPayload(api, {\n payload: buildProvideContactPayload(INPUT),\n });\n\n expect(result.status).toBe(CommandResultStatus.Error);\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OACE,sBAAAA,EACA,wBAAAC,EACA,uBAAAC,MACK,kCAGP,OAAS,yBAAAC,MAA6B,qDACtC,OAAS,mCAAAC,MAAuC,oEAChD,OAAS,wBAAAC,MAA4B,4CAErC,OACE,8BAAAC,EACA,6BAAAC,MACK,mBAEP,MAAMC,EAAa,IAAI,WAAW,EAAE,EAAE,KAAK,EAAI,EACzCC,EAAe,IAAI,WAAW,EAAE,EAAE,KAAK,EAAI,EAC3CC,EAAa,IAAI,WAAW,EAAE,EAAE,KAAK,EAAI,EACzCC,EAAY,IAAI,WAAW,EAAE,EAAE,KAAK,EAAI,EAExCC,EAA6B,CACjC,YAAa,QACb,MAAO,WACP,WAAYJ,EACZ,YAAaC,EACb,UAAWC,EACX,SAAUC,EACV,iBAAkB,WAClB,QAAS,EACX,EAKME,EAAkB,SAClBC,EAAqB,SACrBC,EAAmB,mBACnBC,EAAY,yBACZC,EAA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qB,CAAE,KAAM,MAAU,CAAC,CAC1C,EACA,MAAMsB,EAAUjB,EAA2BM,CAAK,EAE1Ca,EAAS,MAAMlB,EAA0BiB,EAAK,CAAE,QAAAD,CAAQ,CAAC,EAE/D,OAAOC,EAAI,WAAW,EAAE,sBAAsB,CAAC,EAC/C,MAAME,EAAUF,EAAI,YAAY,KAAK,MAAM,CAAC,EAAG,CAAC,EAChD,OAAOE,CAAO,EAAE,eAAevB,CAAqB,EACpD,OAAOuB,EAAQ,KAAK,EAAE,EAAE,KAAK,CAAI,EACjC,OAAOA,EAAQ,KAAK,KAAK,MAAM,EAAG,CAAC,CAAC,EAAE,cACpC,WAAW,KAAK,CAAEH,EAAQ,QAAU,EAAK,IAAMA,EAAQ,OAAS,GAAI,CAAC,CACvE,EACA,OAAOG,EAAQ,KAAK,KAAK,MAAM,CAAC,CAAC,EAAE,cAAcH,CAAO,EACxD,OAAOE,EAAO,MAAM,EAAE,KAAKvB,EAAoB,OAAO,CACxD,CAAC,EAED,GAAG,oDAAqD,SAAY,CAClE,MAAMsB,EAAMpB,EAAgC,EAC5CoB,EAAI,YAAY,kBACdvB,EAAqB,CACnB,MAAO,IAAII,EAAqB,CAC9B,UAAW,OACX,QAAS,YACX,CAAC,CACH,CAAC,CACH,EAEA,MAAMoB,EAAS,MAAMlB,EAA0BiB,EAAK,CAClD,QAASlB,EAA2BM,CAAK,CAC3C,CAAC,EAED,OAAOa,EAAO,MAAM,EAAE,KAAKvB,EAAoB,KAAK,CACtD,CAAC,CACH,CAAC",
|
|
6
6
|
"names": ["bufferToHexaString", "CommandResultFactory", "CommandResultStatus", "ProvideContactCommand", "makeDeviceActionInternalApiMock", "ContactsCommandError", "buildProvideContactPayload", "sendProvideContactPayload", "IDENTIFIER", "GROUP_HANDLE", "HMAC_PROOF", "HMAC_REST", "INPUT", "STRUCT_TYPE_TLV", "STRUCT_VERSION_TLV", "CONTACT_NAME_TLV", "SCOPE_TLV", "IDENTIFIER_TLV", "GROUP_HANDLE_TLV", "CHAIN_ID_TLV", "FAMILY_TLV", "HMAC_PROOF_TLV", "HMAC_REST_TLV", "payload", "api", "result", "command"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ByteArrayBuilder as
|
|
1
|
+
import{ByteArrayBuilder as s,DmkResultFactory as n,InvalidStatusWordError as l,isSuccessCommandResult as C}from"@ledgerhq/device-management-kit";import{RenameContactCommand as T}from"../../app-binder/command/RenameContactCommand";import{RENAME_CONTACT_P1 as p}from"../../app-binder/model/contactsConstants";import{CONTACTS_TLV_TAG as r,encodeTlvAscii as i,encodeTlvBuffer as o,encodeTlvUInt8 as d,packDerivationPath as y,STRUCT_TYPE_EDIT_CONTACT_NAME as u,STRUCT_VERSION_VALUE as A}from"../../app-binder/services/contactsTlvSerializer";import{sendFramedContactsPayload as R}from"../../app-binder/services/sendFramedContactsPayload";class S{constructor(a,e){this.api=a;this.args=e}async run(){const a=this.buildPayload(this.args),e=await R(this.api,{payload:a,p1:p,makeCommand:(m,c)=>new T({data:m,p2:c}),logger:this.args.logger,commandTag:"SendRenameContactTask"});if(!C(e))return e;const{hmacProof:t}=e.data;return t?n({data:{hmacProof:t}}):n({error:new l("RenameContact final-chunk response did not carry hmac_name")})}buildPayload(a){const e=new s;return d(e,r.STRUCT_TYPE,u),d(e,r.STRUCT_VERSION,A),i(e,r.CONTACT_NAME,a.newContactName),i(e,r.PREVIOUS_CONTACT_NAME,a.previousContactName),o(e,r.GROUP_HANDLE,a.groupHandle),a.includeDerivationPath&&o(e,r.DERIVATION_PATH,y([2147483692,2147483708,2147483648,0,0])),o(e,r.HMAC_PROOF,a.hmacProof),e.build()}}export{S as SendRenameContactTask};
|
|
2
2
|
//# sourceMappingURL=SendRenameContactTask.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/task/SendRenameContactTask.ts"],
|
|
4
|
-
"sourcesContent": ["// Builds the TLV payload for the Rename Contact (EDIT CONTACT NAME) op and\n// dispatches it via the chunked-framing scheme shared with the other\n// address-book ops (2-byte BE total length + <=255B chunks). Rename is an\n// OS/dashboard command (CLA 0xE0 / INS 0x2E) \u2014 the caller runs this task after\n// navigating to the dashboard (GoToDashboardDeviceAction), never inside an app.\n//\n// The device rotates the contact-level hmac_name and returns the fresh proof on\n// the final chunk; per-entry hmac_rest values are untouched (they bind\n// gid|scope|id|family|chain_id, never the name), so a single APDU regardless of\n// the contact's entry count.\n//\n// Reference: Address Book Final Specifications \u2014 Edit Contact Name. Tag order:\n// STRUCT_TYPE, STRUCT_VERSION, CONTACT_NAME (new), PREVIOUS_CONTACT_NAME\n// (old), GROUP_HANDLE, HMAC_PROOF.\n//\n//
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["ByteArrayBuilder", "DmkResultFactory", "InvalidStatusWordError", "isSuccessCommandResult", "RenameContactCommand", "RENAME_CONTACT_P1", "CONTACTS_TLV_TAG", "encodeTlvAscii", "encodeTlvBuffer", "encodeTlvUInt8", "STRUCT_TYPE_EDIT_CONTACT_NAME", "STRUCT_VERSION_VALUE", "sendFramedContactsPayload", "SendRenameContactTask", "api", "args", "payload", "result", "chunk", "p2", "hmacProof", "builder"]
|
|
4
|
+
"sourcesContent": ["// Builds the TLV payload for the Rename Contact (EDIT CONTACT NAME) op and\n// dispatches it via the chunked-framing scheme shared with the other\n// address-book ops (2-byte BE total length + <=255B chunks). Rename is an\n// OS/dashboard command (CLA 0xE0 / INS 0x2E) \u2014 the caller runs this task after\n// navigating to the dashboard (GoToDashboardDeviceAction), never inside an app.\n//\n// The device rotates the contact-level hmac_name and returns the fresh proof on\n// the final chunk; per-entry hmac_rest values are untouched (they bind\n// gid|scope|id|family|chain_id, never the name), so a single APDU regardless of\n// the contact's entry count.\n//\n// Reference: Address Book Final Specifications \u2014 Edit Contact Name. Tag order:\n// STRUCT_TYPE, STRUCT_VERSION, CONTACT_NAME (new), PREVIOUS_CONTACT_NAME\n// (old), GROUP_HANDLE, [DERIVATION_PATH], HMAC_PROOF.\n//\n// DERIVATION_PATH (tag 0x69) is CONDITIONAL (DSDK-1481). The final product\n// serves rename from the OS, which needs no path \u2014 but the OS build decides the\n// payload shape, and the two shapes are mutually exclusive across builds:\n// - OS below the model's cutoff (e.g. Flex 1.7.0-rc2 and earlier): the path\n// is still MANDATORY, omitting it -> 0x686A (before any review screen).\n// - OS at/after the cutoff (Flex 1.7.0-rc3, final, later): the path is\n// rejected, sending it -> 0x6A80 (unknown tag).\n// So the caller passes includeDerivationPath, computed from the device OS\n// version read *freshly* from the device (renameRequiresDerivationPath), and we\n// emit the tag only for the older builds. This shim \u2014 the flag, the cutoff\n// table entries, and renameRequiresDerivationPath \u2014 is removed in one commit\n// once no in-the-field OS predates the cutoff. The rc2 requirement was verified\n// on hardware: a Flex on OS 1.7.0-rc2 rejects the path-free payload with 0x686A.\nimport {\n ByteArrayBuilder,\n type CommandResult,\n DmkResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n type LoggerPublisherService,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { RenameContactCommand } from \"@internal/app-binder/command/RenameContactCommand\";\nimport { RENAME_CONTACT_P1 } from \"@internal/app-binder/model/contactsConstants\";\nimport { type ContactsErrorCodes } from \"@internal/app-binder/model/contactsErrors\";\nimport {\n CONTACTS_TLV_TAG,\n encodeTlvAscii,\n encodeTlvBuffer,\n encodeTlvUInt8,\n packDerivationPath,\n STRUCT_TYPE_EDIT_CONTACT_NAME,\n STRUCT_VERSION_VALUE,\n} from \"@internal/app-binder/services/contactsTlvSerializer\";\nimport { sendFramedContactsPayload } from \"@internal/app-binder/services/sendFramedContactsPayload\";\n\nexport type RenameContactProof = {\n readonly hmacProof: Uint8Array;\n};\n\nexport type SendRenameContactTaskArgs = {\n readonly previousContactName: string;\n readonly newContactName: string;\n readonly groupHandle: Uint8Array;\n readonly hmacProof: Uint8Array;\n /**\n * TEMPORARY (DSDK-1481) \u2014 emit the `DERIVATION_PATH` (tag 0x69) TLV. Defaults\n * to `false` (the GA payload, path-free). The caller sets it `true` only for\n * OS builds below the model's cutoff, which still mandate the path; see\n * {@link renameRequiresDerivationPath}. Not exposed on the public\n * `RenameContactInput` \u2014 the host never chooses this.\n */\n readonly includeDerivationPath?: boolean;\n readonly logger?: LoggerPublisherService;\n};\n\nexport class SendRenameContactTask {\n constructor(\n private readonly api: InternalApi,\n private readonly args: SendRenameContactTaskArgs,\n ) {}\n\n async run(): Promise<CommandResult<RenameContactProof, ContactsErrorCodes>> {\n const payload = this.buildPayload(this.args);\n\n const result = (await sendFramedContactsPayload(this.api, {\n payload,\n p1: RENAME_CONTACT_P1,\n makeCommand: (chunk, p2) => new RenameContactCommand({ data: chunk, p2 }),\n logger: this.args.logger,\n commandTag: \"SendRenameContactTask\",\n })) as CommandResult<\n { readonly hmacProof?: Uint8Array },\n ContactsErrorCodes\n >;\n\n if (!isSuccessCommandResult(result)) {\n return result;\n }\n\n const { hmacProof } = result.data;\n if (!hmacProof) {\n return DmkResultFactory({\n error: new InvalidStatusWordError(\n \"RenameContact final-chunk response did not carry hmac_name\",\n ),\n });\n }\n return DmkResultFactory({ data: { hmacProof } });\n }\n\n private buildPayload(args: SendRenameContactTaskArgs): Uint8Array {\n const builder = new ByteArrayBuilder();\n encodeTlvUInt8(\n builder,\n CONTACTS_TLV_TAG.STRUCT_TYPE,\n STRUCT_TYPE_EDIT_CONTACT_NAME,\n );\n encodeTlvUInt8(\n builder,\n CONTACTS_TLV_TAG.STRUCT_VERSION,\n STRUCT_VERSION_VALUE,\n );\n encodeTlvAscii(builder, CONTACTS_TLV_TAG.CONTACT_NAME, args.newContactName);\n encodeTlvAscii(\n builder,\n CONTACTS_TLV_TAG.PREVIOUS_CONTACT_NAME,\n args.previousContactName,\n );\n encodeTlvBuffer(builder, CONTACTS_TLV_TAG.GROUP_HANDLE, args.groupHandle);\n // TEMPORARY (DSDK-1481): OS builds below the model's cutoff still mandate\n // DERIVATION_PATH for EDIT CONTACT NAME (0x686A without it); newer builds\n // reject it (0x6A80). The caller sets includeDerivationPath from the fresh\n // device OS version. Fixed m/44'/60'/0'/0/0 \u2014 rename is name-only, the path\n // is a payload-shape formality the old OS parser requires.\n if (args.includeDerivationPath) {\n encodeTlvBuffer(\n builder,\n CONTACTS_TLV_TAG.DERIVATION_PATH,\n packDerivationPath([0x8000002c, 0x8000003c, 0x80000000, 0, 0]),\n );\n }\n encodeTlvBuffer(builder, CONTACTS_TLV_TAG.HMAC_PROOF, args.hmacProof);\n\n return builder.build();\n }\n}\n"],
|
|
5
|
+
"mappings": "AA4BA,OACE,oBAAAA,EAEA,oBAAAC,EAEA,0BAAAC,EACA,0BAAAC,MAEK,kCAEP,OAAS,wBAAAC,MAA4B,oDACrC,OAAS,qBAAAC,MAAyB,+CAElC,OACE,oBAAAC,EACA,kBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,sBAAAC,EACA,iCAAAC,EACA,wBAAAC,MACK,sDACP,OAAS,6BAAAC,MAAiC,0DAsBnC,MAAMC,CAAsB,CACjC,YACmBC,EACAC,EACjB,CAFiB,SAAAD,EACA,UAAAC,CAChB,CAEH,MAAM,KAAsE,CAC1E,MAAMC,EAAU,KAAK,aAAa,KAAK,IAAI,EAErCC,EAAU,MAAML,EAA0B,KAAK,IAAK,CACxD,QAAAI,EACA,GAAIZ,EACJ,YAAa,CAACc,EAAOC,IAAO,IAAIhB,EAAqB,CAAE,KAAMe,EAAO,GAAAC,CAAG,CAAC,EACxE,OAAQ,KAAK,KAAK,OAClB,WAAY,uBACd,CAAC,EAKD,GAAI,CAACjB,EAAuBe,CAAM,EAChC,OAAOA,EAGT,KAAM,CAAE,UAAAG,CAAU,EAAIH,EAAO,KAC7B,OAAKG,EAOEpB,EAAiB,CAAE,KAAM,CAAE,UAAAoB,CAAU,CAAE,CAAC,EANtCpB,EAAiB,CACtB,MAAO,IAAIC,EACT,4DACF,CACF,CAAC,CAGL,CAEQ,aAAac,EAA6C,CAChE,MAAMM,EAAU,IAAItB,EACpB,OAAAS,EACEa,EACAhB,EAAiB,YACjBK,CACF,EACAF,EACEa,EACAhB,EAAiB,eACjBM,CACF,EACAL,EAAee,EAAShB,EAAiB,aAAcU,EAAK,cAAc,EAC1ET,EACEe,EACAhB,EAAiB,sBACjBU,EAAK,mBACP,EACAR,EAAgBc,EAAShB,EAAiB,aAAcU,EAAK,WAAW,EAMpEA,EAAK,uBACPR,EACEc,EACAhB,EAAiB,gBACjBI,EAAmB,CAAC,WAAY,WAAY,WAAY,EAAG,CAAC,CAAC,CAC/D,EAEFF,EAAgBc,EAAShB,EAAiB,WAAYU,EAAK,SAAS,EAE7DM,EAAQ,MAAM,CACvB,CACF",
|
|
6
|
+
"names": ["ByteArrayBuilder", "DmkResultFactory", "InvalidStatusWordError", "isSuccessCommandResult", "RenameContactCommand", "RENAME_CONTACT_P1", "CONTACTS_TLV_TAG", "encodeTlvAscii", "encodeTlvBuffer", "encodeTlvUInt8", "packDerivationPath", "STRUCT_TYPE_EDIT_CONTACT_NAME", "STRUCT_VERSION_VALUE", "sendFramedContactsPayload", "SendRenameContactTask", "api", "args", "payload", "result", "chunk", "p2", "hmacProof", "builder"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{CommandResultFactory as
|
|
1
|
+
import{CommandResultFactory as n,InvalidStatusWordError as i}from"@ledgerhq/device-management-kit";import{RenameContactCommand as l}from"../../app-binder/command/RenameContactCommand";import{SendRenameContactTask as o}from"./SendRenameContactTask";function s(e){const a=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2)a[t/2]=parseInt(e.slice(t,t+2),16);return a}const c=s("cc".repeat(64)),r=s("dd".repeat(32)),d=s("ee".repeat(32)),u=s("007901012e02010181f003426f6281f305416c69636581f640"+"cc".repeat(64)+"2920"+"dd".repeat(32));function m(){return{sendCommand:vi.fn()}}describe("SendRenameContactTask",()=>{it("assembles the rename framed chunk and dispatches RenameContactCommand",async()=>{const e=m();e.sendCommand.mockResolvedValueOnce(n({data:{hmacProof:d}}));const a=await new o(e,{previousContactName:"Alice",newContactName:"Bob",groupHandle:c,hmacProof:r}).run();expect(e.sendCommand.mock.calls).toHaveLength(1),expect(e.sendCommand.mock.calls[0][0]).toStrictEqual(new l({data:u,p2:0})),expect(a).toStrictEqual(n({data:{hmacProof:d}}))}),it("does not emit a DERIVATION_PATH tag by default",async()=>{const e=m();e.sendCommand.mockResolvedValueOnce(n({data:{hmacProof:d}})),await new o(e,{previousContactName:"Alice",newContactName:"Bob",groupHandle:c,hmacProof:r}).run();const a=e.sendCommand.mock.calls[0][0],t=Buffer.from(a.args.data).toString("hex");expect(t).not.toContain("6915"),expect(t.endsWith("81f640"+"cc".repeat(64)+"2920"+"dd".repeat(32))).toBe(!0)}),it("emits the DERIVATION_PATH tag when includeDerivationPath is set",async()=>{const e=m();e.sendCommand.mockResolvedValueOnce(n({data:{hmacProof:d}})),await new o(e,{previousContactName:"Alice",newContactName:"Bob",groupHandle:c,hmacProof:r,includeDerivationPath:!0}).run();const t=s("009001012e02010181f003426f6281f305416c69636581f640"+"cc".repeat(64)+"6915058000002c8000003c800000000000000000000000"+"2920"+"dd".repeat(32)),p=e.sendCommand.mock.calls[0][0];expect(p).toStrictEqual(new l({data:t,p2:0}))}),it("propagates command-level errors",async()=>{const e=m();e.sendCommand.mockResolvedValueOnce(n({error:new i("user cancelled")}));const a=await new o(e,{previousContactName:"Alice",newContactName:"Bob",groupHandle:c,hmacProof:r}).run();expect(a).toStrictEqual(n({error:new i("user cancelled")}))}),it("returns InvalidStatusWordError when the final response carries no hmac_name",async()=>{const e=m();e.sendCommand.mockResolvedValueOnce(n({data:{}}));const a=await new o(e,{previousContactName:"Alice",newContactName:"Bob",groupHandle:c,hmacProof:r}).run();expect(a.status).not.toBe(void 0),"error"in a&&expect(a.error).toBeInstanceOf(i)})});
|
|
2
2
|
//# sourceMappingURL=SendRenameContactTask.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/task/SendRenameContactTask.test.ts"],
|
|
4
|
-
"sourcesContent": ["// Validates that the TLV serializer + tag ordering + chunk framing produce the\n// expected wire bytes for the Rename Contact (EDIT CONTACT NAME) op. The framed\n// chunk = 2-byte BE total length + TLV. Tag order: STRUCT_TYPE, STRUCT_VERSION,\n// CONTACT_NAME (new), PREVIOUS_CONTACT_NAME (old), GROUP_HANDLE, HMAC_PROOF \u2014\n// with tags >= 0x80 (0xf0/0xf3/0xf6) encoded as the 2-byte DER form [0x81, tag].\n//
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["CommandResultFactory", "InvalidStatusWordError", "RenameContactCommand", "SendRenameContactTask", "hexToBytes", "hex", "out", "i", "GROUP_HANDLE", "HMAC_PROOF_IN", "HMAC_PROOF_OUT", "FRAMED_CHUNK", "makeApiMock", "api", "result", "command", "framedHex"]
|
|
4
|
+
"sourcesContent": ["// Validates that the TLV serializer + tag ordering + chunk framing produce the\n// expected wire bytes for the Rename Contact (EDIT CONTACT NAME) op. The framed\n// chunk = 2-byte BE total length + TLV. Tag order: STRUCT_TYPE, STRUCT_VERSION,\n// CONTACT_NAME (new), PREVIOUS_CONTACT_NAME (old), GROUP_HANDLE, HMAC_PROOF \u2014\n// with tags >= 0x80 (0xf0/0xf3/0xf6) encoded as the 2-byte DER form [0x81, tag].\n// DERIVATION_PATH (tag 0x69) is CONDITIONAL (DSDK-1481): omitted by default (the\n// GA payload), and inserted between GROUP_HANDLE and HMAC_PROOF only when the\n// caller passes includeDerivationPath \u2014 the shape older OS builds still require.\nimport {\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { RenameContactCommand } from \"@internal/app-binder/command/RenameContactCommand\";\n\nimport { SendRenameContactTask } from \"./SendRenameContactTask\";\n\nfunction hexToBytes(hex: string): Uint8Array {\n const out = new Uint8Array(hex.length / 2);\n for (let i = 0; i < hex.length; i += 2) {\n out[i / 2] = parseInt(hex.slice(i, i + 2), 16);\n }\n return out;\n}\n\nconst GROUP_HANDLE = hexToBytes(\"cc\".repeat(64));\nconst HMAC_PROOF_IN = hexToBytes(\"dd\".repeat(32));\nconst HMAC_PROOF_OUT = hexToBytes(\"ee\".repeat(32));\n\n// Framed chunk = \"00 79\" (2-byte BE total TLV length = 121) + TLV:\n// 01 01 2e STRUCT_TYPE = EDIT_CONTACT_NAME (0x2e)\n// 02 01 01 STRUCT_VERSION = 1\n// 81 f0 03 \"Bob\" CONTACT_NAME (new), tag 0xf0 -> [81 f0]\n// 81 f3 05 \"Alice\" PREVIOUS_CONTACT_NAME (old), tag 0xf3 -> [81 f3]\n// 81 f6 40 <64x cc> GROUP_HANDLE, tag 0xf6 -> [81 f6]\n// 29 20 <32x dd> HMAC_PROOF\nconst FRAMED_CHUNK = hexToBytes(\n \"0079\" +\n \"01012e\" +\n \"020101\" +\n \"81f003426f62\" +\n \"81f305416c696365\" +\n \"81f640\" +\n \"cc\".repeat(64) +\n \"2920\" +\n \"dd\".repeat(32),\n);\n\nfunction makeApiMock(): InternalApi & {\n sendCommand: ReturnType<typeof vi.fn>;\n} {\n return { sendCommand: vi.fn() } as unknown as InternalApi & {\n sendCommand: ReturnType<typeof vi.fn>;\n };\n}\n\ndescribe(\"SendRenameContactTask\", () => {\n it(\"assembles the rename framed chunk and dispatches RenameContactCommand\", async () => {\n const api = makeApiMock();\n api.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ data: { hmacProof: HMAC_PROOF_OUT } }),\n );\n\n const result = await new SendRenameContactTask(api, {\n previousContactName: \"Alice\",\n newContactName: \"Bob\",\n groupHandle: GROUP_HANDLE,\n hmacProof: HMAC_PROOF_IN,\n }).run();\n\n expect(api.sendCommand.mock.calls).toHaveLength(1);\n expect(api.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new RenameContactCommand({ data: FRAMED_CHUNK, p2: 0x00 }),\n );\n expect(result).toStrictEqual(\n CommandResultFactory({ data: { hmacProof: HMAC_PROOF_OUT } }),\n );\n });\n\n it(\"does not emit a DERIVATION_PATH tag by default\", async () => {\n const api = makeApiMock();\n api.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ data: { hmacProof: HMAC_PROOF_OUT } }),\n );\n\n await new SendRenameContactTask(api, {\n previousContactName: \"Alice\",\n newContactName: \"Bob\",\n groupHandle: GROUP_HANDLE,\n hmacProof: HMAC_PROOF_IN,\n }).run();\n\n // GA payload (includeDerivationPath omitted): newer OS builds reject tag\n // 0x69, so HMAC_PROOF (0x29) follows GROUP_HANDLE directly.\n const command = api.sendCommand.mock.calls[0]![0] as RenameContactCommand;\n const framedHex = Buffer.from(command.args.data).toString(\"hex\");\n expect(framedHex).not.toContain(\"6915\");\n expect(\n framedHex.endsWith(\"81f640\" + \"cc\".repeat(64) + \"2920\" + \"dd\".repeat(32)),\n ).toBe(true);\n });\n\n it(\"emits the DERIVATION_PATH tag when includeDerivationPath is set\", async () => {\n const api = makeApiMock();\n api.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ data: { hmacProof: HMAC_PROOF_OUT } }),\n );\n\n await new SendRenameContactTask(api, {\n previousContactName: \"Alice\",\n newContactName: \"Bob\",\n groupHandle: GROUP_HANDLE,\n hmacProof: HMAC_PROOF_IN,\n includeDerivationPath: true,\n }).run();\n\n // Older OS builds (below the model cutoff) mandate tag 0x69. The path TLV\n // (fixed m/44'/60'/0'/0/0) sits between GROUP_HANDLE and HMAC_PROOF, and the\n // framed total length grows by its 23 bytes: 0x0079 -> 0x0090.\n // 69 15 05 8000002c 8000003c 80000000 00000000 00000000\n const pathTlv =\n \"6915\" +\n \"05\" +\n \"8000002c\" +\n \"8000003c\" +\n \"80000000\" +\n \"00000000\" +\n \"00000000\";\n const expectedFramed = hexToBytes(\n \"0090\" +\n \"01012e\" +\n \"020101\" +\n \"81f003426f62\" +\n \"81f305416c696365\" +\n \"81f640\" +\n \"cc\".repeat(64) +\n pathTlv +\n \"2920\" +\n \"dd\".repeat(32),\n );\n const command = api.sendCommand.mock.calls[0]![0] as RenameContactCommand;\n expect(command).toStrictEqual(\n new RenameContactCommand({ data: expectedFramed, p2: 0x00 }),\n );\n });\n\n it(\"propagates command-level errors\", async () => {\n const api = makeApiMock();\n api.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"user cancelled\"),\n }),\n );\n\n const result = await new SendRenameContactTask(api, {\n previousContactName: \"Alice\",\n newContactName: \"Bob\",\n groupHandle: GROUP_HANDLE,\n hmacProof: HMAC_PROOF_IN,\n }).run();\n\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"user cancelled\"),\n }),\n );\n });\n\n it(\"returns InvalidStatusWordError when the final response carries no hmac_name\", async () => {\n const api = makeApiMock();\n api.sendCommand.mockResolvedValueOnce(CommandResultFactory({ data: {} }));\n\n const result = await new SendRenameContactTask(api, {\n previousContactName: \"Alice\",\n newContactName: \"Bob\",\n groupHandle: GROUP_HANDLE,\n hmacProof: HMAC_PROOF_IN,\n }).run();\n\n expect(result.status).not.toBe(undefined);\n if (\"error\" in result) {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n }\n });\n});\n"],
|
|
5
|
+
"mappings": "AAQA,OACE,wBAAAA,EAEA,0BAAAC,MACK,kCAEP,OAAS,wBAAAC,MAA4B,oDAErC,OAAS,yBAAAC,MAA6B,0BAEtC,SAASC,EAAWC,EAAyB,CAC3C,MAAMC,EAAM,IAAI,WAAWD,EAAI,OAAS,CAAC,EACzC,QAASE,EAAI,EAAGA,EAAIF,EAAI,OAAQE,GAAK,EACnCD,EAAIC,EAAI,CAAC,EAAI,SAASF,EAAI,MAAME,EAAGA,EAAI,CAAC,EAAG,EAAE,EAE/C,OAAOD,CACT,CAEA,MAAME,EAAeJ,EAAW,KAAK,OAAO,EAAE,CAAC,EACzCK,EAAgBL,EAAW,KAAK,OAAO,EAAE,CAAC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AI,KAAK,MAAS,EACpC,UAAWA,GACb,OAAOA,EAAO,KAAK,EAAE,eAAeb,CAAsB,CAE9D,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["CommandResultFactory", "InvalidStatusWordError", "RenameContactCommand", "SendRenameContactTask", "hexToBytes", "hex", "out", "i", "GROUP_HANDLE", "HMAC_PROOF_IN", "HMAC_PROOF_OUT", "FRAMED_CHUNK", "makeApiMock", "api", "result", "command", "framedHex", "expectedFramed"]
|
|
7
7
|
}
|
package/lib/esm/package.json
CHANGED
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"watch:builds": "pnpm ldmk-tool watch --entryPoints src/index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
59
59
|
"watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
|
|
60
60
|
},
|
|
61
|
-
"version": "0.
|
|
61
|
+
"version": "0.5.0"
|
|
62
62
|
}
|
|
@@ -9,7 +9,7 @@ import { type ContactsValidationError } from "../../internal/app-binder/model/co
|
|
|
9
9
|
*/
|
|
10
10
|
export type RenameContactDAInput = RenameContactInput;
|
|
11
11
|
export type RenameContactDAOutput = RenameContactOutput;
|
|
12
|
-
export type RenameContactDAError = GoToDashboardDAError | ContactsValidationError | ContactsVersionRequirementError | CommandErrorResult<ContactsErrorCodes>["error"];
|
|
12
|
+
export type RenameContactDAError = GoToDashboardDAError | ContactsValidationError | ContactsVersionRequirementError | CommandErrorResult["error"] | CommandErrorResult<ContactsErrorCodes>["error"];
|
|
13
13
|
export type RenameContactDARequiredInteraction = GoToDashboardDARequiredInteraction | UserInteractionRequired.RegisterWallet;
|
|
14
14
|
export type RenameContactDAIntermediateValue = {
|
|
15
15
|
readonly requiredUserInteraction: RenameContactDARequiredInteraction;
|
|
@@ -17,6 +17,7 @@ export type RenameContactDAIntermediateValue = {
|
|
|
17
17
|
export type RenameContactDAState = DeviceActionState<RenameContactDAOutput, RenameContactDAError, RenameContactDAIntermediateValue>;
|
|
18
18
|
export type RenameContactDAInternalState = {
|
|
19
19
|
readonly error: RenameContactDAError | null;
|
|
20
|
+
readonly osVersion: string | null;
|
|
20
21
|
readonly proof: {
|
|
21
22
|
readonly hmacProof: Uint8Array;
|
|
22
23
|
} | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenameContactDeviceActionTypes.d.ts","sourceRoot":"","sources":["../../../../src/api/app-binder/RenameContactDeviceActionTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,kCAAkC,EACvC,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EACrC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAE7F;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAC5B,oBAAoB,GACpB,uBAAuB,GACvB,+BAA+B,
|
|
1
|
+
{"version":3,"file":"RenameContactDeviceActionTypes.d.ts","sourceRoot":"","sources":["../../../../src/api/app-binder/RenameContactDeviceActionTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,kCAAkC,EACvC,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EACrC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAE7F;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAC5B,oBAAoB,GACpB,uBAAuB,GACvB,+BAA+B,GAI/B,kBAAkB,CAAC,OAAO,CAAC,GAC3B,kBAAkB,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,CAAC;AAEpD,MAAM,MAAM,kCAAkC,GAC1C,kCAAkC,GAClC,uBAAuB,CAAC,cAAc,CAAC;AAE3C,MAAM,MAAM,gCAAgC,GAAG;IAC7C,QAAQ,CAAC,uBAAuB,EAAE,kCAAkC,CAAC;CACtE,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAClD,qBAAqB,EACrB,oBAAoB,EACpB,gCAAgC,CACjC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAI5C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;KAChC,GAAG,IAAI,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,6BAA6B,CACnE,qBAAqB,EACrB,oBAAoB,EACpB,gCAAgC,CACjC,CAAC"}
|
package/lib/types/api/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { type RegisterExternalAddressDAError, type RegisterExternalAddressDAInpu
|
|
|
4
4
|
export { type RenameContactDAError, type RenameContactDAInput, type RenameContactDAIntermediateValue, type RenameContactDAOutput, type RenameContactDARequiredInteraction, type RenameContactDAReturnType, type RenameContactDAState, } from "./app-binder/RenameContactDeviceActionTypes";
|
|
5
5
|
export { type ContactsManager } from "./ContactsManager";
|
|
6
6
|
export { ContactsManagerBuilder } from "./ContactsManagerBuilder";
|
|
7
|
-
export { CONTACTS_VERSION_REQUIREMENTS, type ContactsModelRequirement, type ContactsModelSupport, type ContactsModelUnsupported, type ContactsVersionRequirements, ETHEREUM_APP_NAME, isVersionAtLeast, resolveContactsVersionRequirements, } from "./model/ContactsVersionRequirements";
|
|
7
|
+
export { CONTACTS_VERSION_REQUIREMENTS, type ContactsModelRequirement, type ContactsModelSupport, type ContactsModelUnsupported, type ContactsVersionRequirements, ETHEREUM_APP_NAME, isVersionAtLeast, resolveContactsVersionRequirements, TRON_APP_NAME, } from "./model/ContactsVersionRequirements";
|
|
8
8
|
export { type EditExternalAddressIdentifierInput, type EditExternalAddressIdentifierOutput, } from "./model/EditExternalAddressIdentifier";
|
|
9
9
|
export { type EditExternalAddressScopeInput, type EditExternalAddressScopeOutput, } from "./model/EditExternalAddressScope";
|
|
10
10
|
export { type ProvideContactInput } from "./model/ProvideContact";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EACzC,KAAK,gDAAgD,EACrD,KAAK,qCAAqC,EAC1C,KAAK,kDAAkD,EACvD,KAAK,yCAAyC,EAC9C,KAAK,oCAAoC,GAC1C,MAAM,gEAAgE,CAAC;AACxE,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACpC,KAAK,2CAA2C,EAChD,KAAK,gCAAgC,EACrC,KAAK,6CAA6C,EAClD,KAAK,oCAAoC,EACzC,KAAK,+BAA+B,GACrC,MAAM,2DAA2D,CAAC;AACnE,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACnC,KAAK,0CAA0C,EAC/C,KAAK,+BAA+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gC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,kCAAkC,EACvC,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,GAC1B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,6BAA6B,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,iBAAiB,EACjB,gBAAgB,EAChB,kCAAkC,EAClC,aAAa,GACd,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,mCAAmC,GACzC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,GACpC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,GACnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,KAAK,6BAA6B,GACnC,MAAM,8CAA8C,CAAC"}
|
|
@@ -8,13 +8,24 @@ import { DeviceModelId } from "@ledgerhq/device-management-kit";
|
|
|
8
8
|
* device dashboard), which are served by the device OS.
|
|
9
9
|
* - `minAppVersion` gates app-owned operations (registering / editing external
|
|
10
10
|
* addresses and Ledger accounts), which are served by the embedded app. It is
|
|
11
|
-
* keyed by app name because the required version differs per app
|
|
12
|
-
* Ethereum only.
|
|
11
|
+
* keyed by app name because the required version differs per app.
|
|
13
12
|
*/
|
|
14
13
|
export type ContactsModelSupport = {
|
|
15
14
|
readonly supported: true;
|
|
16
15
|
readonly minOsVersion: string;
|
|
17
16
|
readonly minAppVersion: Readonly<Record<string, string>>;
|
|
17
|
+
/**
|
|
18
|
+
* TEMPORARY (DSDK-1481) — the first OS build for this model that no longer
|
|
19
|
+
* wants the `DERIVATION_PATH` (tag 0x69) on EDIT CONTACT NAME. Rename is
|
|
20
|
+
* served by the OS, and OS builds *below* this version still require the path
|
|
21
|
+
* (omitting it yields 0x686A), while this build and later reject it
|
|
22
|
+
* (0x6A80). So the path is sent only when the device OS is below this
|
|
23
|
+
* cutoff. Absent means the model never wanted the path (send nothing — the
|
|
24
|
+
* GA end-state). Delete this field, its constants, and
|
|
25
|
+
* {@link renameRequiresDerivationPath} once no in-the-field OS predates the
|
|
26
|
+
* cutoff.
|
|
27
|
+
*/
|
|
28
|
+
readonly renameDerivationPathRequiredBelowOsVersion?: string;
|
|
18
29
|
};
|
|
19
30
|
/** Marks a device model on which Contacts is not supported at all. */
|
|
20
31
|
export type ContactsModelUnsupported = {
|
|
@@ -28,8 +39,9 @@ export type ContactsModelRequirement = ContactsModelSupport | ContactsModelUnsup
|
|
|
28
39
|
* app-readiness checks, without duplicating the values.
|
|
29
40
|
*/
|
|
30
41
|
export type ContactsVersionRequirements = Readonly<Record<DeviceModelId, ContactsModelRequirement>>;
|
|
31
|
-
/**
|
|
42
|
+
/** Names of embedded apps supporting Contacts. */
|
|
32
43
|
export declare const ETHEREUM_APP_NAME = "Ethereum";
|
|
44
|
+
export declare const TRON_APP_NAME = "Tron";
|
|
33
45
|
/**
|
|
34
46
|
* Contacts APDUs are supported on the touchscreen device models (Stax, Flex,
|
|
35
47
|
* Apex) and on Nano X / Nano SP. Nano S does not support Contacts at all.
|
|
@@ -49,4 +61,25 @@ export declare function resolveContactsVersionRequirements(deviceModelId: Device
|
|
|
49
61
|
* passes a check.
|
|
50
62
|
*/
|
|
51
63
|
export declare function isVersionAtLeast(actual: string, minimum: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether `actual` is strictly less than `boundary`, comparing as semver with
|
|
66
|
+
* prerelease precedence preserved — unlike {@link isVersionAtLeast}, neither
|
|
67
|
+
* side is coerced, so `1.7.0-rc2` sorts *below* `1.7.0-rc3` (and both below the
|
|
68
|
+
* `1.7.0` release). Used to tell release candidates apart for the DSDK-1481
|
|
69
|
+
* derivation-path cutoff, which `isVersionAtLeast` cannot do (it drops the
|
|
70
|
+
* `-rcN` tag). Requires strict semver on both sides; returns `false` when
|
|
71
|
+
* either cannot be parsed, so an unknown version is treated as *not* below the
|
|
72
|
+
* boundary (i.e. the newer/GA payload shape).
|
|
73
|
+
*/
|
|
74
|
+
export declare function isVersionBelow(actual: string, boundary: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* TEMPORARY (DSDK-1481) — whether the EDIT CONTACT NAME (rename) payload must
|
|
77
|
+
* carry the `DERIVATION_PATH` (tag 0x69) for a device on `osVersion`. True only
|
|
78
|
+
* when the model is supported, declares a
|
|
79
|
+
* {@link ContactsModelSupport.renameDerivationPathRequiredBelowOsVersion}
|
|
80
|
+
* cutoff, and the fresh device OS version is strictly below that cutoff
|
|
81
|
+
* (prerelease-aware). Callers pass the OS version read freshly from the device
|
|
82
|
+
* (not the session state, which may be stale/absent on the dashboard path).
|
|
83
|
+
*/
|
|
84
|
+
export declare function renameRequiresDerivationPath(deviceModelId: DeviceModelId, osVersion: string): boolean;
|
|
52
85
|
//# sourceMappingURL=ContactsVersionRequirements.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactsVersionRequirements.d.ts","sourceRoot":"","sources":["../../../../src/api/model/ContactsVersionRequirements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGhE
|
|
1
|
+
{"version":3,"file":"ContactsVersionRequirements.d.ts","sourceRoot":"","sources":["../../../../src/api/model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,OAAO,CAMT"}
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* name proof needs re-persisting.
|
|
9
9
|
*
|
|
10
10
|
* Proof material (`groupHandle`, `hmacProof`) is passed and returned as raw
|
|
11
|
-
* bytes; the host owns persistence and address-book state.
|
|
12
|
-
*
|
|
13
|
-
* (a
|
|
11
|
+
* bytes; the host owns persistence and address-book state. The rename itself is
|
|
12
|
+
* name-only, so no derivation path is exposed. As a temporary compatibility
|
|
13
|
+
* shim (DSDK-1481), the kit sends a fixed `m/44'/60'/0'/0/0` on the wire only
|
|
14
|
+
* for OS builds below the model's cutoff, which still mandate it; newer builds
|
|
15
|
+
* send nothing. Either way the host never chooses this.
|
|
14
16
|
*/
|
|
15
17
|
export type RenameContactInput = {
|
|
16
18
|
/** The contact's current name, proven to the device via `hmacProof`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenameContact.d.ts","sourceRoot":"","sources":["../../../../src/api/model/RenameContact.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"RenameContact.d.ts","sourceRoot":"","sources":["../../../../src/api/model/RenameContact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,wEAAwE;IACxE,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,mDAAmD;IACnD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;IACjC,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;CAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditExternalAddressIdentifierCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/EditExternalAddressIdentifierCommand.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,IAAI,EAGT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"EditExternalAddressIdentifierCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/EditExternalAddressIdentifierCommand.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,IAAI,EAGT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;AASzC,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2CAA2C,CAAC;AAGnD,MAAM,MAAM,wCAAwC,GAAG;IACrD,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC,CAAC;AAkBF,qBAAa,oCACX,YACE,OAAO,CACL,4CAA4C,EAC5C,wCAAwC,EACxC,kBAAkB,CACnB;IAEH,QAAQ,CAAC,IAAI,mCAAmC;IAChD,QAAQ,CAAC,IAAI,EAAE,wCAAwC,CAAC;IACxD,OAAO,CAAC,QAAQ,CAAC,WAAW,CACqD;gBAErE,IAAI,EAAE,wCAAwC;IAI1D,OAAO,IAAI,IAAI;IAWf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CACd,4CAA4C,EAC5C,kBAAkB,CACnB;CAoCF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditExternalAddressScopeCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/EditExternalAddressScopeCommand.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,IAAI,EAGT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"EditExternalAddressScopeCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/EditExternalAddressScopeCommand.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,IAAI,EAGT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;AASzC,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2CAA2C,CAAC;AAGnD,MAAM,MAAM,mCAAmC,GAAG;IAChD,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uCAAuC,GAAG;IACpD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC,CAAC;AAkBF,qBAAa,+BACX,YACE,OAAO,CACL,uCAAuC,EACvC,mCAAmC,EACnC,kBAAkB,CACnB;IAEH,QAAQ,CAAC,IAAI,8BAA8B;IAC3C,QAAQ,CAAC,IAAI,EAAE,mCAAmC,CAAC;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CACgD;gBAEhE,IAAI,EAAE,mCAAmC;IAIrD,OAAO,IAAI,IAAI;IAWf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CACd,uCAAuC,EACvC,kBAAkB,CACnB;CAoCF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvideContactCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/ProvideContactCommand.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,IAAI,EAET,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAEnB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"ProvideContactCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/ProvideContactCommand.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,IAAI,EAET,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAEnB,MAAM,iCAAiC,CAAC;AAQzC,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,MAAM,yBAAyB,GAAG;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAEjD,qBAAa,qBACX,YACE,OAAO,CACL,6BAA6B,EAC7B,yBAAyB,EACzB,kBAAkB,CACnB;IAEH,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,OAAO,CAAC,QAAQ,CAAC,WAAW,CACsC;gBAEtD,IAAI,EAAE,yBAAyB;IAI3C,OAAO,IAAI,IAAI;IAWf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CAAC,6BAA6B,EAAE,kBAAkB,CAAC;CASpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegisterIdentityCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/RegisterIdentityCommand.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,IAAI,EAGT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"RegisterIdentityCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/RegisterIdentityCommand.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,IAAI,EAGT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;AAWzC,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,MAAM,2BAA2B,GAAG;IACxC,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC,CAAC;AAkBF,qBAAa,uBACX,YACE,OAAO,CACL,+BAA+B,EAC/B,2BAA2B,EAC3B,kBAAkB,CACnB;IAEH,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,WAAW,CACwC;gBAExD,IAAI,EAAE,2BAA2B;IAI7C,OAAO,IAAI,IAAI;IAWf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CAAC,+BAA+B,EAAE,kBAAkB,CAAC;CAoDtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenameContactCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/RenameContactCommand.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,IAAI,EAGT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"RenameContactCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/RenameContactCommand.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,IAAI,EAGT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;AASzC,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2CAA2C,CAAC;AAGnD,MAAM,MAAM,wBAAwB,GAAG;IACrC,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC;CACjC,CAAC;AAkBF,qBAAa,oBACX,YACE,OAAO,CACL,4BAA4B,EAC5B,wBAAwB,EACxB,kBAAkB,CACnB;IAEH,QAAQ,CAAC,IAAI,mBAAmB;IAChC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CACqC;gBAErD,IAAI,EAAE,wBAAwB;IAI1C,OAAO,IAAI,IAAI;IAWf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC;CAoCnE"}
|
|
@@ -15,9 +15,17 @@ export type RunningApp = {
|
|
|
15
15
|
* The running-app dimension is intentionally skipped: on the dashboard there is
|
|
16
16
|
* no embedded app to gate on (the running "app" is BOLOS).
|
|
17
17
|
*
|
|
18
|
+
* The OS `version` is supplied by the caller so it can come from a fresh
|
|
19
|
+
* `GetOsVersion` result rather than the device session state, whose
|
|
20
|
+
* `firmwareVersion` is often absent on the dashboard path (the session
|
|
21
|
+
* refresher and `GoToDashboard` re-read only the running app, never the OS
|
|
22
|
+
* version). The model comes from the session state, which does not change
|
|
23
|
+
* under the caller's feet the way a stale/missing OS version would.
|
|
24
|
+
*
|
|
18
25
|
* @param internalApi - the DeviceAction's internal API for the current session.
|
|
26
|
+
* @param osVersion - the device OS version, read freshly from the device.
|
|
19
27
|
*/
|
|
20
|
-
export declare function
|
|
28
|
+
export declare function isContactsOsVersionSupportedForSession(internalApi: InternalApi, osVersion: string): boolean;
|
|
21
29
|
/**
|
|
22
30
|
* Session-aware Contacts support check, for internal consumption by app-owned
|
|
23
31
|
* Contacts `DeviceAction`s (registering / editing external addresses). These
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactsVersionGuards.d.ts","sourceRoot":"","sources":["../../../../src/internal/app-binder/contactsVersionGuards.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAWzC,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AASF
|
|
1
|
+
{"version":3,"file":"contactsVersionGuards.d.ts","sourceRoot":"","sources":["../../../../src/internal/app-binder/contactsVersionGuards.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAWzC,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AASF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sCAAsC,CACpD,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAQT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uCAAuC,CACrD,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,UAAU,GACd,OAAO,CAiBT"}
|
package/lib/types/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type DeviceActionStateMachine, type InternalApi, XStateDeviceAction } from "@ledgerhq/device-management-kit";
|
|
1
|
+
import { type DeviceActionStateMachine, type GetOsVersionCommandResult, type InternalApi, XStateDeviceAction } from "@ledgerhq/device-management-kit";
|
|
2
2
|
import { type RenameContactDAError, type RenameContactDAInput, type RenameContactDAIntermediateValue, type RenameContactDAInternalState, type RenameContactDAOutput } from "../../../../api/app-binder/RenameContactDeviceActionTypes";
|
|
3
3
|
import { type RenameContactProof, SendRenameContactTask } from "../../../app-binder/task/SendRenameContactTask";
|
|
4
4
|
export type RenameContactMachineDependencies = {
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
5
|
+
readonly getOsVersion: () => Promise<GetOsVersionCommandResult>;
|
|
6
|
+
readonly isOsVersionSupported: (osVersion: string) => boolean;
|
|
7
|
+
readonly renameContact: (input: RenameContactDAInput, includeDerivationPath: boolean) => Promise<Awaited<ReturnType<SendRenameContactTask["run"]>>>;
|
|
7
8
|
};
|
|
8
9
|
export declare class RenameContactDeviceAction extends XStateDeviceAction<RenameContactDAOutput, RenameContactDAInput, RenameContactDAError, RenameContactDAIntermediateValue, RenameContactDAInternalState> {
|
|
9
10
|
makeStateMachine(internalApi: InternalApi): DeviceActionStateMachine<RenameContactDAOutput, RenameContactDAInput, RenameContactDAError, RenameContactDAIntermediateValue, RenameContactDAInternalState>;
|
package/lib/types/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenameContactDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,WAAW,EAKhB,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC3B,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"RenameContactDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/app-binder/device-action/RenameContact/RenameContactDeviceAction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,yBAAyB,EAE9B,KAAK,WAAW,EAKhB,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC3B,MAAM,gDAAgD,CAAC;AAIxD,OAAO,EACL,KAAK,kBAAkB,EACvB,qBAAqB,EACtB,MAAM,iDAAiD,CAAC;AAIzD,MAAM,MAAM,gCAAgC,GAAG;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAChE,QAAQ,CAAC,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9D,QAAQ,CAAC,aAAa,EAAE,CACtB,KAAK,EAAE,oBAAoB,EAC3B,qBAAqB,EAAE,OAAO,KAC3B,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;CACjE,CAAC;AAEF,qBAAa,yBAA0B,SAAQ,kBAAkB,CAC/D,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,gCAAgC,EAChC,4BAA4B,CAC7B;IACC,gBAAgB,CACd,WAAW,EAAE,WAAW,GACvB,wBAAwB,CACzB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,gCAAgC,EAChC,4BAA4B,CAC7B;IAwQD,mBAAmB,CACjB,WAAW,EAAE,WAAW,GACvB,gCAAgC;CAqBpC;AAED,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -45,8 +45,8 @@ export declare const HMAC_REST_BYTES = 32;
|
|
|
45
45
|
export declare const HMAC_NAME_BYTES = 32;
|
|
46
46
|
/**
|
|
47
47
|
* Blockchain-family byte encoded in the `BLOCKCHAIN_FAMILY` TLV, keyed by a
|
|
48
|
-
* lowercase family name.
|
|
49
|
-
*
|
|
48
|
+
* lowercase family name. Values follow the BOLOS Address Book family enum
|
|
49
|
+
* (`BlockchainFamily` in ragger / ledger-secure-sdk).
|
|
50
50
|
*/
|
|
51
51
|
export declare const BLOCKCHAIN_FAMILY_BY_NAME: Readonly<Record<string, number>>;
|
|
52
52
|
//# sourceMappingURL=contactsConstants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactsConstants.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/model/contactsConstants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,MAAO,CAAC;AACtC,eAAO,MAAM,iBAAiB,KAAO,CAAC;AAEtC,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,IAAO,CAAC;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,KAAO,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,IAAO,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,IAAO,CAAC;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,MAAO,CAAC;AAC5C,eAAO,MAAM,uBAAuB,KAAO,CAAC;AAC5C,eAAO,MAAM,iBAAiB,IAAO,CAAC;AAEtC,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"contactsConstants.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/model/contactsConstants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,MAAO,CAAC;AACtC,eAAO,MAAM,iBAAiB,KAAO,CAAC;AAEtC,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,IAAO,CAAC;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,KAAO,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,IAAO,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,IAAO,CAAC;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,MAAO,CAAC;AAC5C,eAAO,MAAM,uBAAuB,KAAO,CAAC;AAC5C,eAAO,MAAM,iBAAiB,IAAO,CAAC;AAEtC,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQtE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type CommandErrorArgs, type CommandErrors, DeviceExchangeError, type DmkError } from "@ledgerhq/device-management-kit";
|
|
1
|
+
import { type ApduResponse, type CommandErrorArgs, type CommandErrors, type CommandResult, DeviceExchangeError, type DmkError } from "@ledgerhq/device-management-kit";
|
|
2
|
+
import { CommandErrorHelper } from "@ledgerhq/signer-utils";
|
|
2
3
|
/**
|
|
3
4
|
* Status word returned by the app's Address Book *edit* operations when the
|
|
4
5
|
* seed-bound HMAC / group-handle verification fails — i.e. the entry was
|
|
@@ -10,12 +11,30 @@ import { type CommandErrorArgs, type CommandErrors, DeviceExchangeError, type Dm
|
|
|
10
11
|
* signal that consumers (e.g. Ledger Wallet) can catch to guide the user.
|
|
11
12
|
*/
|
|
12
13
|
export declare const CONTACT_SEED_MISMATCH_ERROR_CODE: "6982";
|
|
13
|
-
export type ContactsErrorCodes = "6982" | "6800" | "6983" | "6984" | "6985" | "6a80" | "6a84" | "6a88" | "6af0" | "6b00" | "6f00";
|
|
14
|
+
export type ContactsErrorCodes = "6982" | "6800" | "6983" | "6984" | "6985" | "686a" | "6a80" | "6a84" | "6a88" | "6af0" | "6b00" | "6f00";
|
|
14
15
|
export declare const CONTACTS_APP_ERRORS: CommandErrors<ContactsErrorCodes>;
|
|
15
16
|
export declare class ContactsCommandError extends DeviceExchangeError<ContactsErrorCodes> {
|
|
16
17
|
constructor(args: CommandErrorArgs<ContactsErrorCodes>);
|
|
17
18
|
}
|
|
18
19
|
export declare const contactsCommandErrorFactory: (args: CommandErrorArgs<ContactsErrorCodes>) => ContactsCommandError;
|
|
20
|
+
/**
|
|
21
|
+
* A {@link CommandErrorHelper} preconfigured with the Contacts error map, that
|
|
22
|
+
* additionally guarantees no address-book command ever surfaces a bare
|
|
23
|
+
* `UnknownDeviceExchangeError`.
|
|
24
|
+
*
|
|
25
|
+
* The base helper maps known status words to a {@link ContactsCommandError} and
|
|
26
|
+
* falls back to the global handler for the rest — which, for a status word in
|
|
27
|
+
* neither the Contacts nor the global dictionary (e.g. 0x686A before it was
|
|
28
|
+
* mapped), yields an `UnknownDeviceExchangeError` whose message is a generic
|
|
29
|
+
* "Unexpected device exchange error happened." with no status word and no
|
|
30
|
+
* guidance. This subclass replaces that specific case with an
|
|
31
|
+
* `InvalidStatusWordError` naming the actual status word and pointing at a
|
|
32
|
+
* firmware/app update, so the host always has something actionable to show.
|
|
33
|
+
*/
|
|
34
|
+
export declare class ContactsCommandErrorHelper<Response> extends CommandErrorHelper<Response, ContactsErrorCodes> {
|
|
35
|
+
constructor();
|
|
36
|
+
getError(apduResponse: ApduResponse): CommandResult<Response, ContactsErrorCodes> | undefined;
|
|
37
|
+
}
|
|
19
38
|
/**
|
|
20
39
|
* Raised by a Contacts `DeviceAction` when the connected device model, app
|
|
21
40
|
* version, or OS version does not meet the Contacts requirements — i.e. the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactsErrors.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/model/contactsErrors.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"contactsErrors.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/model/contactsErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAErB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,QAAQ,EAId,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,gCAAgC,EAAG,MAAe,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,CAAC;AAEX,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,kBAAkB,CA2BjE,CAAC;AAEF,qBAAa,oBAAqB,SAAQ,mBAAmB,CAAC,kBAAkB,CAAC;gBACnE,IAAI,EAAE,gBAAgB,CAAC,kBAAkB,CAAC;CAGvD;AAED,eAAO,MAAM,2BAA2B,GACtC,MAAM,gBAAgB,CAAC,kBAAkB,CAAC,yBACT,CAAC;AAEpC;;;;;;;;;;;;;GAaG;AACH,qBAAa,0BAA0B,CAAC,QAAQ,CAAE,SAAQ,kBAAkB,CAC1E,QAAQ,EACR,kBAAkB,CACnB;;IAKU,QAAQ,CACf,YAAY,EAAE,YAAY,GACzB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,CAAC,GAAG,SAAS;CAqB3D;AAED;;;;GAIG;AACH,qBAAa,+BAAgC,YAAW,QAAQ;IAI5D,QAAQ,CAAC,OAAO;IAHlB,QAAQ,CAAC,IAAI,qCAAqC;IAClD,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;gBAEtB,OAAO,SAAiF;CAEpG"}
|
|
@@ -8,6 +8,14 @@ export type SendRenameContactTaskArgs = {
|
|
|
8
8
|
readonly newContactName: string;
|
|
9
9
|
readonly groupHandle: Uint8Array;
|
|
10
10
|
readonly hmacProof: Uint8Array;
|
|
11
|
+
/**
|
|
12
|
+
* TEMPORARY (DSDK-1481) — emit the `DERIVATION_PATH` (tag 0x69) TLV. Defaults
|
|
13
|
+
* to `false` (the GA payload, path-free). The caller sets it `true` only for
|
|
14
|
+
* OS builds below the model's cutoff, which still mandate the path; see
|
|
15
|
+
* {@link renameRequiresDerivationPath}. Not exposed on the public
|
|
16
|
+
* `RenameContactInput` — the host never chooses this.
|
|
17
|
+
*/
|
|
18
|
+
readonly includeDerivationPath?: boolean;
|
|
11
19
|
readonly logger?: LoggerPublisherService;
|
|
12
20
|
};
|
|
13
21
|
export declare class SendRenameContactTask {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SendRenameContactTask.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/task/SendRenameContactTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SendRenameContactTask.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/task/SendRenameContactTask.ts"],"names":[],"mappings":"AA4BA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,WAAW,EAGhB,KAAK,sBAAsB,EAC5B,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAYpF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,sBAAsB,CAAC;CAC1C,CAAC;AAEF,qBAAa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,yBAAyB;IAG5C,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;IA6B3E,OAAO,CAAC,YAAY;CAmCrB"}
|