@ledgerhq/device-contacts-kit 0.4.1 → 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.
Files changed (30) hide show
  1. package/lib/cjs/api/index.js +1 -1
  2. package/lib/cjs/api/index.js.map +2 -2
  3. package/lib/cjs/api/model/ContactsVersionRequirements.js +1 -1
  4. package/lib/cjs/api/model/ContactsVersionRequirements.js.map +3 -3
  5. package/lib/cjs/api/model/ContactsVersionRequirements.test.js +1 -1
  6. package/lib/cjs/api/model/ContactsVersionRequirements.test.js.map +3 -3
  7. package/lib/cjs/internal/app-binder/model/contactsConstants.js +1 -1
  8. package/lib/cjs/internal/app-binder/model/contactsConstants.js.map +2 -2
  9. package/lib/cjs/internal/app-binder/services/provideContact.test.js +1 -1
  10. package/lib/cjs/internal/app-binder/services/provideContact.test.js.map +2 -2
  11. package/lib/cjs/package.json +2 -2
  12. package/lib/esm/api/index.js +1 -1
  13. package/lib/esm/api/index.js.map +3 -3
  14. package/lib/esm/api/model/ContactsVersionRequirements.js +1 -1
  15. package/lib/esm/api/model/ContactsVersionRequirements.js.map +3 -3
  16. package/lib/esm/api/model/ContactsVersionRequirements.test.js +1 -1
  17. package/lib/esm/api/model/ContactsVersionRequirements.test.js.map +3 -3
  18. package/lib/esm/internal/app-binder/model/contactsConstants.js +1 -1
  19. package/lib/esm/internal/app-binder/model/contactsConstants.js.map +2 -2
  20. package/lib/esm/internal/app-binder/services/provideContact.test.js +1 -1
  21. package/lib/esm/internal/app-binder/services/provideContact.test.js.map +2 -2
  22. package/lib/esm/package.json +2 -2
  23. package/lib/types/api/index.d.ts +1 -1
  24. package/lib/types/api/index.d.ts.map +1 -1
  25. package/lib/types/api/model/ContactsVersionRequirements.d.ts +3 -3
  26. package/lib/types/api/model/ContactsVersionRequirements.d.ts.map +1 -1
  27. package/lib/types/internal/app-binder/model/contactsConstants.d.ts +2 -2
  28. package/lib/types/internal/app-binder/model/contactsConstants.d.ts.map +1 -1
  29. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  30. package/package.json +6 -6
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var y=(r,e)=>{for(var n in e)o(r,n,{get:e[n],enumerable:!0})},u=(r,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of A(e))!E.call(r,d)&&d!==n&&o(r,d,{get:()=>e[d],enumerable:!(s=i(e,d))||s.enumerable});return r};var x=r=>u(o({},"__esModule",{value:!0}),r);var l={};y(l,{CONTACTS_VERSION_REQUIREMENTS:()=>t.CONTACTS_VERSION_REQUIREMENTS,ContactsManagerBuilder:()=>a.ContactsManagerBuilder,ETHEREUM_APP_NAME:()=>t.ETHEREUM_APP_NAME,buildProvideContactPayload:()=>p.buildProvideContactPayload,isVersionAtLeast:()=>t.isVersionAtLeast,resolveContactsVersionRequirements:()=>t.resolveContactsVersionRequirements,sendProvideContactPayload:()=>p.sendProvideContactPayload});module.exports=x(l);var a=require("./ContactsManagerBuilder"),t=require("./model/ContactsVersionRequirements"),p=require("../internal/app-binder/services/provideContact");0&&(module.exports={CONTACTS_VERSION_REQUIREMENTS,ContactsManagerBuilder,ETHEREUM_APP_NAME,buildProvideContactPayload,isVersionAtLeast,resolveContactsVersionRequirements,sendProvideContactPayload});
1
+ "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var y=(r,t)=>{for(var n in t)o(r,n,{get:t[n],enumerable:!0})},u=(r,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of A(t))!E.call(r,d)&&d!==n&&o(r,d,{get:()=>t[d],enumerable:!(s=i(t,d))||s.enumerable});return r};var x=r=>u(o({},"__esModule",{value:!0}),r);var l={};y(l,{CONTACTS_VERSION_REQUIREMENTS:()=>e.CONTACTS_VERSION_REQUIREMENTS,ContactsManagerBuilder:()=>a.ContactsManagerBuilder,ETHEREUM_APP_NAME:()=>e.ETHEREUM_APP_NAME,TRON_APP_NAME:()=>e.TRON_APP_NAME,buildProvideContactPayload:()=>p.buildProvideContactPayload,isVersionAtLeast:()=>e.isVersionAtLeast,resolveContactsVersionRequirements:()=>e.resolveContactsVersionRequirements,sendProvideContactPayload:()=>p.sendProvideContactPayload});module.exports=x(l);var a=require("./ContactsManagerBuilder"),e=require("./model/ContactsVersionRequirements"),p=require("../internal/app-binder/services/provideContact");0&&(module.exports={CONTACTS_VERSION_REQUIREMENTS,ContactsManagerBuilder,ETHEREUM_APP_NAME,TRON_APP_NAME,buildProvideContactPayload,isVersionAtLeast,resolveContactsVersionRequirements,sendProvideContactPayload});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/index.ts"],
4
- "sourcesContent": ["export {\n type EditExternalAddressIdentifierDAError,\n type EditExternalAddressIdentifierDAInput,\n type EditExternalAddressIdentifierDAIntermediateValue,\n type EditExternalAddressIdentifierDAOutput,\n type EditExternalAddressIdentifierDARequiredInteraction,\n type EditExternalAddressIdentifierDAReturnType,\n type EditExternalAddressIdentifierDAState,\n} from \"@api/app-binder/EditExternalAddressIdentifierDeviceActionTypes\";\nexport {\n type EditExternalAddressScopeDAError,\n type EditExternalAddressScopeDAInput,\n type EditExternalAddressScopeDAIntermediateValue,\n type EditExternalAddressScopeDAOutput,\n type EditExternalAddressScopeDARequiredInteraction,\n type EditExternalAddressScopeDAReturnType,\n type EditExternalAddressScopeDAState,\n} from \"@api/app-binder/EditExternalAddressScopeDeviceActionTypes\";\nexport {\n type RegisterExternalAddressDAError,\n type RegisterExternalAddressDAInput,\n type RegisterExternalAddressDAIntermediateValue,\n type RegisterExternalAddressDAOutput,\n type RegisterExternalAddressDARequiredInteraction,\n type RegisterExternalAddressDAReturnType,\n type RegisterExternalAddressDAState,\n} from \"@api/app-binder/RegisterExternalAddressDeviceActionTypes\";\nexport {\n type RenameContactDAError,\n type RenameContactDAInput,\n type RenameContactDAIntermediateValue,\n type RenameContactDAOutput,\n type RenameContactDARequiredInteraction,\n type RenameContactDAReturnType,\n type RenameContactDAState,\n} from \"@api/app-binder/RenameContactDeviceActionTypes\";\nexport { type ContactsManager } from \"@api/ContactsManager\";\nexport { ContactsManagerBuilder } from \"@api/ContactsManagerBuilder\";\nexport {\n CONTACTS_VERSION_REQUIREMENTS,\n type ContactsModelRequirement,\n type ContactsModelSupport,\n type ContactsModelUnsupported,\n type ContactsVersionRequirements,\n ETHEREUM_APP_NAME,\n isVersionAtLeast,\n resolveContactsVersionRequirements,\n} from \"@api/model/ContactsVersionRequirements\";\nexport {\n type EditExternalAddressIdentifierInput,\n type EditExternalAddressIdentifierOutput,\n} from \"@api/model/EditExternalAddressIdentifier\";\nexport {\n type EditExternalAddressScopeInput,\n type EditExternalAddressScopeOutput,\n} from \"@api/model/EditExternalAddressScope\";\nexport { type ProvideContactInput } from \"@api/model/ProvideContact\";\nexport {\n type ExistingContactGroup,\n type RegisterExternalAddressInput,\n type RegisterExternalAddressMode,\n type RegisterExternalAddressOutput,\n} from \"@api/model/RegisterExternalAddress\";\nexport {\n type RenameContactInput,\n type RenameContactOutput,\n} from \"@api/model/RenameContact\";\nexport { type ContactsErrorCodes } from \"@internal/app-binder/model/contactsErrors\";\nexport {\n buildProvideContactPayload,\n sendProvideContactPayload,\n type SendProvideContactPayloadArgs,\n} from \"@internal/app-binder/services/provideContact\";\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4ZAAAE,EAAAF,GAqCA,IAAAG,EAAuC,uCACvCC,EASO,kDAqBPC,EAIO",
4
+ "sourcesContent": ["export {\n type EditExternalAddressIdentifierDAError,\n type EditExternalAddressIdentifierDAInput,\n type EditExternalAddressIdentifierDAIntermediateValue,\n type EditExternalAddressIdentifierDAOutput,\n type EditExternalAddressIdentifierDARequiredInteraction,\n type EditExternalAddressIdentifierDAReturnType,\n type EditExternalAddressIdentifierDAState,\n} from \"@api/app-binder/EditExternalAddressIdentifierDeviceActionTypes\";\nexport {\n type EditExternalAddressScopeDAError,\n type EditExternalAddressScopeDAInput,\n type EditExternalAddressScopeDAIntermediateValue,\n type EditExternalAddressScopeDAOutput,\n type EditExternalAddressScopeDARequiredInteraction,\n type EditExternalAddressScopeDAReturnType,\n type EditExternalAddressScopeDAState,\n} from \"@api/app-binder/EditExternalAddressScopeDeviceActionTypes\";\nexport {\n type RegisterExternalAddressDAError,\n type RegisterExternalAddressDAInput,\n type RegisterExternalAddressDAIntermediateValue,\n type RegisterExternalAddressDAOutput,\n type RegisterExternalAddressDARequiredInteraction,\n type RegisterExternalAddressDAReturnType,\n type RegisterExternalAddressDAState,\n} from \"@api/app-binder/RegisterExternalAddressDeviceActionTypes\";\nexport {\n type RenameContactDAError,\n type RenameContactDAInput,\n type RenameContactDAIntermediateValue,\n type RenameContactDAOutput,\n type RenameContactDARequiredInteraction,\n type RenameContactDAReturnType,\n type RenameContactDAState,\n} from \"@api/app-binder/RenameContactDeviceActionTypes\";\nexport { type ContactsManager } from \"@api/ContactsManager\";\nexport { ContactsManagerBuilder } from \"@api/ContactsManagerBuilder\";\nexport {\n CONTACTS_VERSION_REQUIREMENTS,\n type ContactsModelRequirement,\n type ContactsModelSupport,\n type ContactsModelUnsupported,\n type ContactsVersionRequirements,\n ETHEREUM_APP_NAME,\n isVersionAtLeast,\n resolveContactsVersionRequirements,\n TRON_APP_NAME,\n} from \"@api/model/ContactsVersionRequirements\";\nexport {\n type EditExternalAddressIdentifierInput,\n type EditExternalAddressIdentifierOutput,\n} from \"@api/model/EditExternalAddressIdentifier\";\nexport {\n type EditExternalAddressScopeInput,\n type EditExternalAddressScopeOutput,\n} from \"@api/model/EditExternalAddressScope\";\nexport { type ProvideContactInput } from \"@api/model/ProvideContact\";\nexport {\n type ExistingContactGroup,\n type RegisterExternalAddressInput,\n type RegisterExternalAddressMode,\n type RegisterExternalAddressOutput,\n} from \"@api/model/RegisterExternalAddress\";\nexport {\n type RenameContactInput,\n type RenameContactOutput,\n} from \"@api/model/RenameContact\";\nexport { type ContactsErrorCodes } from \"@internal/app-binder/model/contactsErrors\";\nexport {\n buildProvideContactPayload,\n sendProvideContactPayload,\n type SendProvideContactPayloadArgs,\n} from \"@internal/app-binder/services/provideContact\";\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8bAAAE,EAAAF,GAqCA,IAAAG,EAAuC,uCACvCC,EAUO,kDAqBPC,EAIO",
6
6
  "names": ["api_exports", "__export", "__toCommonJS", "import_ContactsManagerBuilder", "import_ContactsVersionRequirements", "import_provideContact"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var V=(e,n)=>{for(var o in n)u(e,o,{get:n[o],enumerable:!0})},M=(e,n,o,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let p of A(n))!m.call(e,p)&&p!==o&&u(e,p,{get:()=>n[p],enumerable:!(t=R(n,p))||t.enumerable});return e};var P=e=>M(u({},"__esModule",{value:!0}),e);var U={};V(U,{CONTACTS_VERSION_REQUIREMENTS:()=>c,ETHEREUM_APP_NAME:()=>i,isVersionAtLeast:()=>D,isVersionBelow:()=>E,renameRequiresDerivationPath:()=>F,resolveContactsVersionRequirements:()=>v});module.exports=P(U);var s=require("@ledgerhq/device-management-kit"),r=require("semver");const i="Ethereum",S={supported:!1},d="1.11.0",l="1.7.0",_="1.2.0",O="2.8.0",N="1.7.0",a="1.23.0",f=`${d}-rc3`,T=`${l}-rc3`,C=`${_}-rc3`,I=`${O}-rc3`,q=`${N}-rc3`,c={[s.DeviceModelId.NANO_S]:S,[s.DeviceModelId.NANO_SP]:{supported:!0,minOsVersion:N,minAppVersion:{[i]:a},renameDerivationPathRequiredBelowOsVersion:q},[s.DeviceModelId.NANO_X]:{supported:!0,minOsVersion:O,minAppVersion:{[i]:a},renameDerivationPathRequiredBelowOsVersion:I},[s.DeviceModelId.STAX]:{supported:!0,minOsVersion:d,minAppVersion:{[i]:a},renameDerivationPathRequiredBelowOsVersion:f},[s.DeviceModelId.FLEX]:{supported:!0,minOsVersion:l,minAppVersion:{[i]:a},renameDerivationPathRequiredBelowOsVersion:T},[s.DeviceModelId.APEX]:{supported:!0,minOsVersion:_,minAppVersion:{[i]:a},renameDerivationPathRequiredBelowOsVersion:C}};function v(e){return c[e]}function D(e,n){const o=(0,r.valid)((0,r.coerce)(e)),t=(0,r.valid)((0,r.coerce)(n));return o===null||t===null?!1:(0,r.gte)(o,t)}function E(e,n){const o=(0,r.valid)(e),t=(0,r.valid)(n);return o===null||t===null?!1:(0,r.lt)(o,t)}function F(e,n){const o=c[e];if(!o.supported)return!1;const t=o.renameDerivationPathRequiredBelowOsVersion;return t===void 0?!1:E(n,t)}0&&(module.exports={CONTACTS_VERSION_REQUIREMENTS,ETHEREUM_APP_NAME,isVersionAtLeast,isVersionBelow,renameRequiresDerivationPath,resolveContactsVersionRequirements});
1
+ "use strict";var a=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var P=(e,n)=>{for(var o in n)a(e,o,{get:n[o],enumerable:!0})},M=(e,n,o,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of V(n))!m.call(e,i)&&i!==o&&a(e,i,{get:()=>n[i],enumerable:!(t=E(n,i))||t.enumerable});return e};var S=e=>M(a({},"__esModule",{value:!0}),e);var y={};P(y,{CONTACTS_VERSION_REQUIREMENTS:()=>u,ETHEREUM_APP_NAME:()=>c,TRON_APP_NAME:()=>_,isVersionAtLeast:()=>X,isVersionBelow:()=>A,renameRequiresDerivationPath:()=>x,resolveContactsVersionRequirements:()=>U});module.exports=S(y);var s=require("@ledgerhq/device-management-kit"),r=require("semver");const c="Ethereum",_="Tron",I={supported:!1},d="1.11.0",l="1.7.0",N="1.2.0",O="2.8.0",R="1.7.0",T="1.23.0",f="0.8.0",p={[c]:T,[_]:f},C=`${d}-rc3`,q=`${l}-rc3`,v=`${N}-rc3`,D=`${O}-rc3`,F=`${R}-rc3`,u={[s.DeviceModelId.NANO_S]:I,[s.DeviceModelId.NANO_SP]:{supported:!0,minOsVersion:R,minAppVersion:p,renameDerivationPathRequiredBelowOsVersion:F},[s.DeviceModelId.NANO_X]:{supported:!0,minOsVersion:O,minAppVersion:p,renameDerivationPathRequiredBelowOsVersion:D},[s.DeviceModelId.STAX]:{supported:!0,minOsVersion:d,minAppVersion:p,renameDerivationPathRequiredBelowOsVersion:C},[s.DeviceModelId.FLEX]:{supported:!0,minOsVersion:l,minAppVersion:p,renameDerivationPathRequiredBelowOsVersion:q},[s.DeviceModelId.APEX]:{supported:!0,minOsVersion:N,minAppVersion:p,renameDerivationPathRequiredBelowOsVersion:v}};function U(e){return u[e]}function X(e,n){const o=(0,r.valid)((0,r.coerce)(e)),t=(0,r.valid)((0,r.coerce)(n));return o===null||t===null?!1:(0,r.gte)(o,t)}function A(e,n){const o=(0,r.valid)(e),t=(0,r.valid)(n);return o===null||t===null?!1:(0,r.lt)(o,t)}function x(e,n){const o=u[e];if(!o.supported)return!1;const t=o.renameDerivationPathRequiredBelowOsVersion;return t===void 0?!1:A(n,t)}0&&(module.exports={CONTACTS_VERSION_REQUIREMENTS,ETHEREUM_APP_NAME,TRON_APP_NAME,isVersionAtLeast,isVersionBelow,renameRequiresDerivationPath,resolveContactsVersionRequirements});
2
2
  //# sourceMappingURL=ContactsVersionRequirements.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/model/ContactsVersionRequirements.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { coerce, gte, lt, valid } from \"semver\";\n\n/**\n * Version requirements for a device model on which Contacts (Address Book)\n * operations are supported.\n *\n * Contacts has two independent version axes:\n * - `minOsVersion` gates OS-owned operations (e.g. renaming a contact from the\n * device dashboard), which are served by the device OS.\n * - `minAppVersion` gates app-owned operations (registering / editing external\n * addresses and Ledger accounts), which are served by the embedded app. It is\n * keyed by app name because the required version differs per app; v1 ships\n * Ethereum only.\n */\nexport type ContactsModelSupport = {\n readonly supported: true;\n readonly minOsVersion: string;\n readonly minAppVersion: Readonly<Record<string, string>>;\n /**\n * TEMPORARY (DSDK-1481) \u2014 the first OS build for this model that no longer\n * wants the `DERIVATION_PATH` (tag 0x69) on EDIT CONTACT NAME. Rename is\n * served by the OS, and OS builds *below* this version still require the path\n * (omitting it yields 0x686A), while this build and later reject it\n * (0x6A80). So the path is sent only when the device OS is below this\n * cutoff. Absent means the model never wanted the path (send nothing \u2014 the\n * GA end-state). Delete this field, its constants, and\n * {@link renameRequiresDerivationPath} once no in-the-field OS predates the\n * cutoff.\n */\n readonly renameDerivationPathRequiredBelowOsVersion?: string;\n};\n\n/** Marks a device model on which Contacts is not supported at all. */\nexport type ContactsModelUnsupported = {\n readonly supported: false;\n};\n\nexport type ContactsModelRequirement =\n | ContactsModelSupport\n | ContactsModelUnsupported;\n\n/**\n * The full, static Contacts version-requirement table, keyed by device model.\n * Serializable plain data with no runtime dependencies, so hosts (e.g. Ledger\n * Wallet) can import and consume it directly when composing their own\n * app-readiness checks, without duplicating the values.\n */\nexport type ContactsVersionRequirements = Readonly<\n Record<DeviceModelId, ContactsModelRequirement>\n>;\n\n/** The name of the Ethereum embedded app (the only app supported in v1). */\nexport const ETHEREUM_APP_NAME = \"Ethereum\";\n\nconst UNSUPPORTED: ContactsModelUnsupported = { supported: false };\n\nconst MIN_OS_VERSION_STAX = \"1.11.0\";\nconst MIN_OS_VERSION_FLEX = \"1.7.0\";\nconst MIN_OS_VERSION_APEX = \"1.2.0\";\nconst MIN_OS_VERSION_NANO_X = \"2.8.0\";\nconst MIN_OS_VERSION_NANO_SP = \"1.7.0\";\n\nconst MIN_ETHEREUM_APP_VERSION = \"1.23.0\";\n\n// TEMPORARY (DSDK-1481) \u2014 per-model cutoff below which the OS still requires the\n// EDIT CONTACT NAME derivation path. Each model's Address-Book-introducing OS\n// release shipped an rc2 that mandates the path (0x686A without it) and an rc3\n// that drops it (0x6A80 with it), so the cutoff is that release's `-rc3`. Only\n// Flex is hardware-confirmed (rc2 on a real device); the others follow the same\n// rc2/rc3 split per firmware \u2014 revise here if firmware says a model differs.\nconst RENAME_PATH_CUTOFF_STAX = `${MIN_OS_VERSION_STAX}-rc3`;\nconst RENAME_PATH_CUTOFF_FLEX = `${MIN_OS_VERSION_FLEX}-rc3`;\nconst RENAME_PATH_CUTOFF_APEX = `${MIN_OS_VERSION_APEX}-rc3`;\nconst RENAME_PATH_CUTOFF_NANO_X = `${MIN_OS_VERSION_NANO_X}-rc3`;\nconst RENAME_PATH_CUTOFF_NANO_SP = `${MIN_OS_VERSION_NANO_SP}-rc3`;\n\n/**\n * Contacts APDUs are supported on the touchscreen device models (Stax, Flex,\n * Apex) and on Nano X / Nano SP. Nano S does not support Contacts at all.\n */\nexport const CONTACTS_VERSION_REQUIREMENTS: ContactsVersionRequirements = {\n [DeviceModelId.NANO_S]: UNSUPPORTED,\n [DeviceModelId.NANO_SP]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_NANO_SP,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_NANO_SP,\n },\n [DeviceModelId.NANO_X]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_NANO_X,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_NANO_X,\n },\n [DeviceModelId.STAX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_STAX,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_STAX,\n },\n [DeviceModelId.FLEX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_FLEX,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_FLEX,\n },\n [DeviceModelId.APEX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_APEX,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_APEX,\n },\n};\n\n/**\n * Resolve the Contacts version requirements for a device model \u2014 i.e. the\n * minimum supported OS and app versions, or that the model is unsupported.\n */\nexport function resolveContactsVersionRequirements(\n deviceModelId: DeviceModelId,\n): ContactsModelRequirement {\n return CONTACTS_VERSION_REQUIREMENTS[deviceModelId];\n}\n\n/**\n * Whether `actual` is greater than or equal to `minimum`, comparing as semver.\n * Tolerant of non-strict version strings and prerelease/build tags (coerces\n * both sides, which drops them) so a release candidate such as `1.7.0-rc2`\n * counts as meeting a `1.7.0` minimum. Returns `false` (i.e. requirement not\n * met) when either version cannot be parsed, so an unknown version never\n * passes a check.\n */\nexport function isVersionAtLeast(actual: string, minimum: string): boolean {\n const a = valid(coerce(actual));\n const b = valid(coerce(minimum));\n if (a === null || b === null) return false;\n return gte(a, b);\n}\n\n/**\n * Whether `actual` is strictly less than `boundary`, comparing as semver with\n * prerelease precedence preserved \u2014 unlike {@link isVersionAtLeast}, neither\n * side is coerced, so `1.7.0-rc2` sorts *below* `1.7.0-rc3` (and both below the\n * `1.7.0` release). Used to tell release candidates apart for the DSDK-1481\n * derivation-path cutoff, which `isVersionAtLeast` cannot do (it drops the\n * `-rcN` tag). Requires strict semver on both sides; returns `false` when\n * either cannot be parsed, so an unknown version is treated as *not* below the\n * boundary (i.e. the newer/GA payload shape).\n */\nexport function isVersionBelow(actual: string, boundary: string): boolean {\n const a = valid(actual);\n const b = valid(boundary);\n if (a === null || b === null) return false;\n return lt(a, b);\n}\n\n/**\n * TEMPORARY (DSDK-1481) \u2014 whether the EDIT CONTACT NAME (rename) payload must\n * carry the `DERIVATION_PATH` (tag 0x69) for a device on `osVersion`. True only\n * when the model is supported, declares a\n * {@link ContactsModelSupport.renameDerivationPathRequiredBelowOsVersion}\n * cutoff, and the fresh device OS version is strictly below that cutoff\n * (prerelease-aware). Callers pass the OS version read freshly from the device\n * (not the session state, which may be stale/absent on the dashboard path).\n */\nexport function renameRequiresDerivationPath(\n deviceModelId: DeviceModelId,\n osVersion: string,\n): boolean {\n const requirement = CONTACTS_VERSION_REQUIREMENTS[deviceModelId];\n if (!requirement.supported) return false;\n const cutoff = requirement.renameDerivationPathRequiredBelowOsVersion;\n if (cutoff === undefined) return false;\n return isVersionBelow(osVersion, cutoff);\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,EAAA,sBAAAC,EAAA,qBAAAC,EAAA,mBAAAC,EAAA,iCAAAC,EAAA,uCAAAC,IAAA,eAAAC,EAAAR,GAAA,IAAAS,EAA8B,2CAC9BC,EAAuC,kBAoDhC,MAAMP,EAAoB,WAE3BQ,EAAwC,CAAE,UAAW,EAAM,EAE3DC,EAAsB,SACtBC,EAAsB,QACtBC,EAAsB,QACtBC,EAAwB,QACxBC,EAAyB,QAEzBC,EAA2B,SAQ3BC,EAA0B,GAAGN,CAAmB,OAChDO,EAA0B,GAAGN,CAAmB,OAChDO,EAA0B,GAAGN,CAAmB,OAChDO,EAA4B,GAAGN,CAAqB,OACpDO,EAA6B,GAAGN,CAAsB,OAM/Cd,EAA6D,CACxE,CAAC,gBAAc,MAAM,EAAGS,EACxB,CAAC,gBAAc,OAAO,EAAG,CACvB,UAAW,GACX,aAAcK,EACd,cAAe,CAAE,CAACb,CAAiB,EAAGc,CAAyB,EAC/D,2CAA4CK,CAC9C,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,UAAW,GACX,aAAcP,EACd,cAAe,CAAE,CAACZ,CAAiB,EAAGc,CAAyB,EAC/D,2CAA4CI,CAC9C,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,UAAW,GACX,aAAcT,EACd,cAAe,CAAE,CAACT,CAAiB,EAAGc,CAAyB,EAC/D,2CAA4CC,CAC9C,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,UAAW,GACX,aAAcL,EACd,cAAe,CAAE,CAACV,CAAiB,EAAGc,CAAyB,EAC/D,2CAA4CE,CAC9C,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,UAAW,GACX,aAAcL,EACd,cAAe,CAAE,CAACX,CAAiB,EAAGc,CAAyB,EAC/D,2CAA4CG,CAC9C,CACF,EAMO,SAASb,EACdgB,EAC0B,CAC1B,OAAOrB,EAA8BqB,CAAa,CACpD,CAUO,SAASnB,EAAiBoB,EAAgBC,EAA0B,CACzE,MAAMC,KAAI,YAAM,UAAOF,CAAM,CAAC,EACxBG,KAAI,YAAM,UAAOF,CAAO,CAAC,EAC/B,OAAIC,IAAM,MAAQC,IAAM,KAAa,MAC9B,OAAID,EAAGC,CAAC,CACjB,CAYO,SAAStB,EAAemB,EAAgBI,EAA2B,CACxE,MAAMF,KAAI,SAAMF,CAAM,EAChBG,KAAI,SAAMC,CAAQ,EACxB,OAAIF,IAAM,MAAQC,IAAM,KAAa,MAC9B,MAAGD,EAAGC,CAAC,CAChB,CAWO,SAASrB,EACdiB,EACAM,EACS,CACT,MAAMC,EAAc5B,EAA8BqB,CAAa,EAC/D,GAAI,CAACO,EAAY,UAAW,MAAO,GACnC,MAAMC,EAASD,EAAY,2CAC3B,OAAIC,IAAW,OAAkB,GAC1B1B,EAAewB,EAAWE,CAAM,CACzC",
6
- "names": ["ContactsVersionRequirements_exports", "__export", "CONTACTS_VERSION_REQUIREMENTS", "ETHEREUM_APP_NAME", "isVersionAtLeast", "isVersionBelow", "renameRequiresDerivationPath", "resolveContactsVersionRequirements", "__toCommonJS", "import_device_management_kit", "import_semver", "UNSUPPORTED", "MIN_OS_VERSION_STAX", "MIN_OS_VERSION_FLEX", "MIN_OS_VERSION_APEX", "MIN_OS_VERSION_NANO_X", "MIN_OS_VERSION_NANO_SP", "MIN_ETHEREUM_APP_VERSION", "RENAME_PATH_CUTOFF_STAX", "RENAME_PATH_CUTOFF_FLEX", "RENAME_PATH_CUTOFF_APEX", "RENAME_PATH_CUTOFF_NANO_X", "RENAME_PATH_CUTOFF_NANO_SP", "deviceModelId", "actual", "minimum", "a", "b", "boundary", "osVersion", "requirement", "cutoff"]
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { coerce, gte, lt, valid } from \"semver\";\n\n/**\n * Version requirements for a device model on which Contacts (Address Book)\n * operations are supported.\n *\n * Contacts has two independent version axes:\n * - `minOsVersion` gates OS-owned operations (e.g. renaming a contact from the\n * device dashboard), which are served by the device OS.\n * - `minAppVersion` gates app-owned operations (registering / editing external\n * addresses and Ledger accounts), which are served by the embedded app. It is\n * keyed by app name because the required version differs per app.\n */\nexport type ContactsModelSupport = {\n readonly supported: true;\n readonly minOsVersion: string;\n readonly minAppVersion: Readonly<Record<string, string>>;\n /**\n * TEMPORARY (DSDK-1481) \u2014 the first OS build for this model that no longer\n * wants the `DERIVATION_PATH` (tag 0x69) on EDIT CONTACT NAME. Rename is\n * served by the OS, and OS builds *below* this version still require the path\n * (omitting it yields 0x686A), while this build and later reject it\n * (0x6A80). So the path is sent only when the device OS is below this\n * cutoff. Absent means the model never wanted the path (send nothing \u2014 the\n * GA end-state). Delete this field, its constants, and\n * {@link renameRequiresDerivationPath} once no in-the-field OS predates the\n * cutoff.\n */\n readonly renameDerivationPathRequiredBelowOsVersion?: string;\n};\n\n/** Marks a device model on which Contacts is not supported at all. */\nexport type ContactsModelUnsupported = {\n readonly supported: false;\n};\n\nexport type ContactsModelRequirement =\n | ContactsModelSupport\n | ContactsModelUnsupported;\n\n/**\n * The full, static Contacts version-requirement table, keyed by device model.\n * Serializable plain data with no runtime dependencies, so hosts (e.g. Ledger\n * Wallet) can import and consume it directly when composing their own\n * app-readiness checks, without duplicating the values.\n */\nexport type ContactsVersionRequirements = Readonly<\n Record<DeviceModelId, ContactsModelRequirement>\n>;\n\n/** Names of embedded apps supporting Contacts. */\nexport const ETHEREUM_APP_NAME = \"Ethereum\";\nexport const TRON_APP_NAME = \"Tron\";\n\nconst UNSUPPORTED: ContactsModelUnsupported = { supported: false };\n\nconst MIN_OS_VERSION_STAX = \"1.11.0\";\nconst MIN_OS_VERSION_FLEX = \"1.7.0\";\nconst MIN_OS_VERSION_APEX = \"1.2.0\";\nconst MIN_OS_VERSION_NANO_X = \"2.8.0\";\nconst MIN_OS_VERSION_NANO_SP = \"1.7.0\";\n\nconst MIN_ETHEREUM_APP_VERSION = \"1.23.0\";\nconst MIN_TRON_APP_VERSION = \"0.8.0\";\n\nconst MIN_APP_VERSION = {\n [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION,\n [TRON_APP_NAME]: MIN_TRON_APP_VERSION,\n};\n\n// TEMPORARY (DSDK-1481) \u2014 per-model cutoff below which the OS still requires the\n// EDIT CONTACT NAME derivation path. Each model's Address-Book-introducing OS\n// release shipped an rc2 that mandates the path (0x686A without it) and an rc3\n// that drops it (0x6A80 with it), so the cutoff is that release's `-rc3`. Only\n// Flex is hardware-confirmed (rc2 on a real device); the others follow the same\n// rc2/rc3 split per firmware \u2014 revise here if firmware says a model differs.\nconst RENAME_PATH_CUTOFF_STAX = `${MIN_OS_VERSION_STAX}-rc3`;\nconst RENAME_PATH_CUTOFF_FLEX = `${MIN_OS_VERSION_FLEX}-rc3`;\nconst RENAME_PATH_CUTOFF_APEX = `${MIN_OS_VERSION_APEX}-rc3`;\nconst RENAME_PATH_CUTOFF_NANO_X = `${MIN_OS_VERSION_NANO_X}-rc3`;\nconst RENAME_PATH_CUTOFF_NANO_SP = `${MIN_OS_VERSION_NANO_SP}-rc3`;\n\n/**\n * Contacts APDUs are supported on the touchscreen device models (Stax, Flex,\n * Apex) and on Nano X / Nano SP. Nano S does not support Contacts at all.\n */\nexport const CONTACTS_VERSION_REQUIREMENTS: ContactsVersionRequirements = {\n [DeviceModelId.NANO_S]: UNSUPPORTED,\n [DeviceModelId.NANO_SP]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_NANO_SP,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_NANO_SP,\n },\n [DeviceModelId.NANO_X]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_NANO_X,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_NANO_X,\n },\n [DeviceModelId.STAX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_STAX,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_STAX,\n },\n [DeviceModelId.FLEX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_FLEX,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_FLEX,\n },\n [DeviceModelId.APEX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_APEX,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_APEX,\n },\n};\n\n/**\n * Resolve the Contacts version requirements for a device model \u2014 i.e. the\n * minimum supported OS and app versions, or that the model is unsupported.\n */\nexport function resolveContactsVersionRequirements(\n deviceModelId: DeviceModelId,\n): ContactsModelRequirement {\n return CONTACTS_VERSION_REQUIREMENTS[deviceModelId];\n}\n\n/**\n * Whether `actual` is greater than or equal to `minimum`, comparing as semver.\n * Tolerant of non-strict version strings and prerelease/build tags (coerces\n * both sides, which drops them) so a release candidate such as `1.7.0-rc2`\n * counts as meeting a `1.7.0` minimum. Returns `false` (i.e. requirement not\n * met) when either version cannot be parsed, so an unknown version never\n * passes a check.\n */\nexport function isVersionAtLeast(actual: string, minimum: string): boolean {\n const a = valid(coerce(actual));\n const b = valid(coerce(minimum));\n if (a === null || b === null) return false;\n return gte(a, b);\n}\n\n/**\n * Whether `actual` is strictly less than `boundary`, comparing as semver with\n * prerelease precedence preserved \u2014 unlike {@link isVersionAtLeast}, neither\n * side is coerced, so `1.7.0-rc2` sorts *below* `1.7.0-rc3` (and both below the\n * `1.7.0` release). Used to tell release candidates apart for the DSDK-1481\n * derivation-path cutoff, which `isVersionAtLeast` cannot do (it drops the\n * `-rcN` tag). Requires strict semver on both sides; returns `false` when\n * either cannot be parsed, so an unknown version is treated as *not* below the\n * boundary (i.e. the newer/GA payload shape).\n */\nexport function isVersionBelow(actual: string, boundary: string): boolean {\n const a = valid(actual);\n const b = valid(boundary);\n if (a === null || b === null) return false;\n return lt(a, b);\n}\n\n/**\n * TEMPORARY (DSDK-1481) \u2014 whether the EDIT CONTACT NAME (rename) payload must\n * carry the `DERIVATION_PATH` (tag 0x69) for a device on `osVersion`. True only\n * when the model is supported, declares a\n * {@link ContactsModelSupport.renameDerivationPathRequiredBelowOsVersion}\n * cutoff, and the fresh device OS version is strictly below that cutoff\n * (prerelease-aware). Callers pass the OS version read freshly from the device\n * (not the session state, which may be stale/absent on the dashboard path).\n */\nexport function renameRequiresDerivationPath(\n deviceModelId: DeviceModelId,\n osVersion: string,\n): boolean {\n const requirement = CONTACTS_VERSION_REQUIREMENTS[deviceModelId];\n if (!requirement.supported) return false;\n const cutoff = requirement.renameDerivationPathRequiredBelowOsVersion;\n if (cutoff === undefined) return false;\n return isVersionBelow(osVersion, cutoff);\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,EAAA,sBAAAC,EAAA,kBAAAC,EAAA,qBAAAC,EAAA,mBAAAC,EAAA,iCAAAC,EAAA,uCAAAC,IAAA,eAAAC,EAAAT,GAAA,IAAAU,EAA8B,2CAC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ChBG,KAAI,SAAMC,CAAQ,EACxB,OAAIF,IAAM,MAAQC,IAAM,KAAa,MAC9B,MAAGD,EAAGC,CAAC,CAChB,CAWO,SAASvB,EACdmB,EACAM,EACS,CACT,MAAMC,EAAc/B,EAA8BwB,CAAa,EAC/D,GAAI,CAACO,EAAY,UAAW,MAAO,GACnC,MAAMC,EAASD,EAAY,2CAC3B,OAAIC,IAAW,OAAkB,GAC1B5B,EAAe0B,EAAWE,CAAM,CACzC",
6
+ "names": ["ContactsVersionRequirements_exports", "__export", "CONTACTS_VERSION_REQUIREMENTS", "ETHEREUM_APP_NAME", "TRON_APP_NAME", "isVersionAtLeast", "isVersionBelow", "renameRequiresDerivationPath", "resolveContactsVersionRequirements", "__toCommonJS", "import_device_management_kit", "import_semver", "UNSUPPORTED", "MIN_OS_VERSION_STAX", "MIN_OS_VERSION_FLEX", "MIN_OS_VERSION_APEX", "MIN_OS_VERSION_NANO_X", "MIN_OS_VERSION_NANO_SP", "MIN_ETHEREUM_APP_VERSION", "MIN_TRON_APP_VERSION", "MIN_APP_VERSION", "RENAME_PATH_CUTOFF_STAX", "RENAME_PATH_CUTOFF_FLEX", "RENAME_PATH_CUTOFF_APEX", "RENAME_PATH_CUTOFF_NANO_X", "RENAME_PATH_CUTOFF_NANO_SP", "deviceModelId", "actual", "minimum", "a", "b", "boundary", "osVersion", "requirement", "cutoff"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("@ledgerhq/device-management-kit"),e=require("./ContactsVersionRequirements");describe("ContactsVersionRequirements",()=>{describe("resolveContactsVersionRequirements",()=>{it("marks every device model, supported or not",()=>{for(const r of Object.values(t.DeviceModelId))expect(e.CONTACTS_VERSION_REQUIREMENTS[r]).toBeDefined()}),it("reports Nano S as unsupported",()=>{expect((0,e.resolveContactsVersionRequirements)(t.DeviceModelId.NANO_S)).toEqual({supported:!1})}),it("pins the minimum OS and app versions of every supported model",()=>{const r={[e.ETHEREUM_APP_NAME]:"1.23.0"};expect(e.CONTACTS_VERSION_REQUIREMENTS).toEqual({[t.DeviceModelId.NANO_S]:{supported:!1},[t.DeviceModelId.NANO_SP]:{supported:!0,minOsVersion:"1.7.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"1.7.0-rc3"},[t.DeviceModelId.NANO_X]:{supported:!0,minOsVersion:"2.8.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"2.8.0-rc3"},[t.DeviceModelId.STAX]:{supported:!0,minOsVersion:"1.11.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"1.11.0-rc3"},[t.DeviceModelId.FLEX]:{supported:!0,minOsVersion:"1.7.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"1.7.0-rc3"},[t.DeviceModelId.APEX]:{supported:!0,minOsVersion:"1.2.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"1.2.0-rc3"}})})}),describe("isVersionAtLeast",()=>{it("compares versions as semver, inclusive of equality",()=>{expect((0,e.isVersionAtLeast)("1.2.0","1.2.0")).toBe(!0),expect((0,e.isVersionAtLeast)("1.3.0","1.2.0")).toBe(!0),expect((0,e.isVersionAtLeast)("1.1.9","1.2.0")).toBe(!1)}),it("coerces non-strict version strings",()=>{expect((0,e.isVersionAtLeast)("1.2","1.2.0")).toBe(!0)}),it("returns false when a version cannot be parsed",()=>{expect((0,e.isVersionAtLeast)("not-a-version","1.2.0")).toBe(!1),expect((0,e.isVersionAtLeast)("1.2.0","not-a-version")).toBe(!1)}),it("ignores prerelease and build tags when comparing to the minimum",()=>{expect((0,e.isVersionAtLeast)("1.7.0-rc2","1.7.0")).toBe(!0),expect((0,e.isVersionAtLeast)("1.23.0-dev","1.23.0")).toBe(!0)}),it("still fails a minimum strictly above the tagged version's core",()=>{expect((0,e.isVersionAtLeast)("1.6.9-rc5","1.7.0")).toBe(!1)})}),describe("isVersionBelow",()=>{it("orders release candidates of the same core (unlike isVersionAtLeast)",()=>{expect((0,e.isVersionBelow)("1.7.0-rc2","1.7.0-rc3")).toBe(!0),expect((0,e.isVersionBelow)("1.7.0-rc3","1.7.0-rc3")).toBe(!1),expect((0,e.isVersionBelow)("1.7.0-rc4","1.7.0-rc3")).toBe(!1)}),it("treats the final release as newer than any of its prereleases",()=>{expect((0,e.isVersionBelow)("1.7.0","1.7.0-rc3")).toBe(!1)}),it("compares the release core when it differs",()=>{expect((0,e.isVersionBelow)("1.6.9","1.7.0-rc3")).toBe(!0),expect((0,e.isVersionBelow)("1.8.0","1.7.0-rc3")).toBe(!1)}),it("does not coerce, so a non-strict version is unparseable and returns false",()=>{expect((0,e.isVersionBelow)("1.7","1.7.0-rc3")).toBe(!1),expect((0,e.isVersionBelow)("not-a-version","1.7.0-rc3")).toBe(!1),expect((0,e.isVersionBelow)("1.7.0-rc2","not-a-version")).toBe(!1)})}),describe("renameRequiresDerivationPath",()=>{it("requires the path below the model's cutoff (rc2) and not at/after it",()=>{expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"1.7.0-rc2")).toBe(!0),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"1.7.0-rc3")).toBe(!1),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"1.7.0")).toBe(!1),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"1.8.0")).toBe(!1)}),it("applies the same rc2/rc3 split to the other supported models",()=>{expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.STAX,"1.11.0-rc2")).toBe(!0),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.STAX,"1.11.0-rc3")).toBe(!1),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.NANO_SP,"1.7.0-rc2")).toBe(!0)}),it("returns false for an unsupported model",()=>{expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.NANO_S,"1.7.0-rc2")).toBe(!1)}),it("returns false (no path) when the OS version is unparseable",()=>{expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"")).toBe(!1)})})});
1
+ "use strict";var t=require("@ledgerhq/device-management-kit"),e=require("./ContactsVersionRequirements");describe("ContactsVersionRequirements",()=>{describe("resolveContactsVersionRequirements",()=>{it("marks every device model, supported or not",()=>{for(const r of Object.values(t.DeviceModelId))expect(e.CONTACTS_VERSION_REQUIREMENTS[r]).toBeDefined()}),it("reports Nano S as unsupported",()=>{expect((0,e.resolveContactsVersionRequirements)(t.DeviceModelId.NANO_S)).toEqual({supported:!1})}),it("pins the minimum OS and app versions of every supported model",()=>{const r={[e.ETHEREUM_APP_NAME]:"1.23.0",[e.TRON_APP_NAME]:"0.8.0"};expect(e.CONTACTS_VERSION_REQUIREMENTS).toEqual({[t.DeviceModelId.NANO_S]:{supported:!1},[t.DeviceModelId.NANO_SP]:{supported:!0,minOsVersion:"1.7.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"1.7.0-rc3"},[t.DeviceModelId.NANO_X]:{supported:!0,minOsVersion:"2.8.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"2.8.0-rc3"},[t.DeviceModelId.STAX]:{supported:!0,minOsVersion:"1.11.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"1.11.0-rc3"},[t.DeviceModelId.FLEX]:{supported:!0,minOsVersion:"1.7.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"1.7.0-rc3"},[t.DeviceModelId.APEX]:{supported:!0,minOsVersion:"1.2.0",minAppVersion:r,renameDerivationPathRequiredBelowOsVersion:"1.2.0-rc3"}})})}),describe("isVersionAtLeast",()=>{it("compares versions as semver, inclusive of equality",()=>{expect((0,e.isVersionAtLeast)("1.2.0","1.2.0")).toBe(!0),expect((0,e.isVersionAtLeast)("1.3.0","1.2.0")).toBe(!0),expect((0,e.isVersionAtLeast)("1.1.9","1.2.0")).toBe(!1)}),it("coerces non-strict version strings",()=>{expect((0,e.isVersionAtLeast)("1.2","1.2.0")).toBe(!0)}),it("returns false when a version cannot be parsed",()=>{expect((0,e.isVersionAtLeast)("not-a-version","1.2.0")).toBe(!1),expect((0,e.isVersionAtLeast)("1.2.0","not-a-version")).toBe(!1)}),it("ignores prerelease and build tags when comparing to the minimum",()=>{expect((0,e.isVersionAtLeast)("1.7.0-rc2","1.7.0")).toBe(!0),expect((0,e.isVersionAtLeast)("1.23.0-dev","1.23.0")).toBe(!0)}),it("still fails a minimum strictly above the tagged version's core",()=>{expect((0,e.isVersionAtLeast)("1.6.9-rc5","1.7.0")).toBe(!1)})}),describe("isVersionBelow",()=>{it("orders release candidates of the same core (unlike isVersionAtLeast)",()=>{expect((0,e.isVersionBelow)("1.7.0-rc2","1.7.0-rc3")).toBe(!0),expect((0,e.isVersionBelow)("1.7.0-rc3","1.7.0-rc3")).toBe(!1),expect((0,e.isVersionBelow)("1.7.0-rc4","1.7.0-rc3")).toBe(!1)}),it("treats the final release as newer than any of its prereleases",()=>{expect((0,e.isVersionBelow)("1.7.0","1.7.0-rc3")).toBe(!1)}),it("compares the release core when it differs",()=>{expect((0,e.isVersionBelow)("1.6.9","1.7.0-rc3")).toBe(!0),expect((0,e.isVersionBelow)("1.8.0","1.7.0-rc3")).toBe(!1)}),it("does not coerce, so a non-strict version is unparseable and returns false",()=>{expect((0,e.isVersionBelow)("1.7","1.7.0-rc3")).toBe(!1),expect((0,e.isVersionBelow)("not-a-version","1.7.0-rc3")).toBe(!1),expect((0,e.isVersionBelow)("1.7.0-rc2","not-a-version")).toBe(!1)})}),describe("renameRequiresDerivationPath",()=>{it("requires the path below the model's cutoff (rc2) and not at/after it",()=>{expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"1.7.0-rc2")).toBe(!0),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"1.7.0-rc3")).toBe(!1),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"1.7.0")).toBe(!1),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"1.8.0")).toBe(!1)}),it("applies the same rc2/rc3 split to the other supported models",()=>{expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.STAX,"1.11.0-rc2")).toBe(!0),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.STAX,"1.11.0-rc3")).toBe(!1),expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.NANO_SP,"1.7.0-rc2")).toBe(!0)}),it("returns false for an unsupported model",()=>{expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.NANO_S,"1.7.0-rc2")).toBe(!1)}),it("returns false (no path) when the OS version is unparseable",()=>{expect((0,e.renameRequiresDerivationPath)(t.DeviceModelId.FLEX,"")).toBe(!1)})})});
2
2
  //# sourceMappingURL=ContactsVersionRequirements.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/model/ContactsVersionRequirements.test.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\nimport {\n CONTACTS_VERSION_REQUIREMENTS,\n ETHEREUM_APP_NAME,\n isVersionAtLeast,\n isVersionBelow,\n renameRequiresDerivationPath,\n resolveContactsVersionRequirements,\n} from \"./ContactsVersionRequirements\";\n\ndescribe(\"ContactsVersionRequirements\", () => {\n describe(\"resolveContactsVersionRequirements\", () => {\n it(\"marks every device model, supported or not\", () => {\n for (const modelId of Object.values(DeviceModelId)) {\n expect(CONTACTS_VERSION_REQUIREMENTS[modelId]).toBeDefined();\n }\n });\n\n it(\"reports Nano S as unsupported\", () => {\n expect(resolveContactsVersionRequirements(DeviceModelId.NANO_S)).toEqual({\n supported: false,\n });\n });\n\n // Pins the minimums themselves, not just their shape: each OS version is\n // the release whose changelog introduces the Address Book feature, so a\n // change here has to be a deliberate one, reviewed against that release.\n it(\"pins the minimum OS and app versions of every supported model\", () => {\n const ethereum = { [ETHEREUM_APP_NAME]: \"1.23.0\" };\n\n expect(CONTACTS_VERSION_REQUIREMENTS).toEqual({\n [DeviceModelId.NANO_S]: { supported: false },\n [DeviceModelId.NANO_SP]: {\n supported: true,\n minOsVersion: \"1.7.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"1.7.0-rc3\",\n },\n [DeviceModelId.NANO_X]: {\n supported: true,\n minOsVersion: \"2.8.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"2.8.0-rc3\",\n },\n [DeviceModelId.STAX]: {\n supported: true,\n minOsVersion: \"1.11.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"1.11.0-rc3\",\n },\n [DeviceModelId.FLEX]: {\n supported: true,\n minOsVersion: \"1.7.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"1.7.0-rc3\",\n },\n [DeviceModelId.APEX]: {\n supported: true,\n minOsVersion: \"1.2.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"1.2.0-rc3\",\n },\n });\n });\n });\n\n describe(\"isVersionAtLeast\", () => {\n it(\"compares versions as semver, inclusive of equality\", () => {\n expect(isVersionAtLeast(\"1.2.0\", \"1.2.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.3.0\", \"1.2.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.1.9\", \"1.2.0\")).toBe(false);\n });\n\n it(\"coerces non-strict version strings\", () => {\n expect(isVersionAtLeast(\"1.2\", \"1.2.0\")).toBe(true);\n });\n\n it(\"returns false when a version cannot be parsed\", () => {\n expect(isVersionAtLeast(\"not-a-version\", \"1.2.0\")).toBe(false);\n expect(isVersionAtLeast(\"1.2.0\", \"not-a-version\")).toBe(false);\n });\n\n it(\"ignores prerelease and build tags when comparing to the minimum\", () => {\n expect(isVersionAtLeast(\"1.7.0-rc2\", \"1.7.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.23.0-dev\", \"1.23.0\")).toBe(true);\n });\n\n it(\"still fails a minimum strictly above the tagged version's core\", () => {\n expect(isVersionAtLeast(\"1.6.9-rc5\", \"1.7.0\")).toBe(false);\n });\n });\n\n describe(\"isVersionBelow\", () => {\n it(\"orders release candidates of the same core (unlike isVersionAtLeast)\", () => {\n // The whole reason this helper exists: rc2 must sort below rc3.\n expect(isVersionBelow(\"1.7.0-rc2\", \"1.7.0-rc3\")).toBe(true);\n expect(isVersionBelow(\"1.7.0-rc3\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"1.7.0-rc4\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"treats the final release as newer than any of its prereleases\", () => {\n expect(isVersionBelow(\"1.7.0\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"compares the release core when it differs\", () => {\n expect(isVersionBelow(\"1.6.9\", \"1.7.0-rc3\")).toBe(true);\n expect(isVersionBelow(\"1.8.0\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"does not coerce, so a non-strict version is unparseable and returns false\", () => {\n expect(isVersionBelow(\"1.7\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"not-a-version\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"1.7.0-rc2\", \"not-a-version\")).toBe(false);\n });\n });\n\n describe(\"renameRequiresDerivationPath\", () => {\n it(\"requires the path below the model's cutoff (rc2) and not at/after it\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0-rc2\"),\n ).toBe(true);\n expect(\n renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0-rc3\"),\n ).toBe(false);\n // GA and later never want the path.\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0\")).toBe(\n false,\n );\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.8.0\")).toBe(\n false,\n );\n });\n\n it(\"applies the same rc2/rc3 split to the other supported models\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.STAX, \"1.11.0-rc2\"),\n ).toBe(true);\n expect(\n renameRequiresDerivationPath(DeviceModelId.STAX, \"1.11.0-rc3\"),\n ).toBe(false);\n expect(\n renameRequiresDerivationPath(DeviceModelId.NANO_SP, \"1.7.0-rc2\"),\n ).toBe(true);\n });\n\n it(\"returns false for an unsupported model\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.NANO_S, \"1.7.0-rc2\"),\n ).toBe(false);\n });\n\n it(\"returns false (no path) when the OS version is unparseable\", () => {\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"\")).toBe(false);\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA8B,2CAE9BC,EAOO,yCAEP,SAAS,8BAA+B,IAAM,CAC5C,SAAS,qCAAsC,IAAM,CACnD,GAAG,6CAA8C,IAAM,CACrD,UAAWC,KAAW,OAAO,OAAO,eAAa,EAC/C,OAAO,gCAA8BA,CAAO,CAAC,EAAE,YAAY,CAE/D,CAAC,EAED,GAAG,gCAAiC,IAAM,CACxC,UAAO,sCAAmC,gBAAc,MAAM,CAAC,EAAE,QAAQ,CACvE,UAAW,EACb,CAAC,CACH,CAAC,EAKD,GAAG,gEAAiE,IAAM,CACxE,MAAMC,EAAW,CAAE,CAAC,mBAAiB,EAAG,QAAS,EAEjD,OAAO,+BAA6B,EAAE,QAAQ,CAC5C,CAAC,gBAAc,MAAM,EAAG,CAAE,UAAW,EAAM,EAC3C,CAAC,gBAAc,OAAO,EAAG,CACvB,UAAW,GACX,aAAc,QACd,cAAeA,EACf,2CAA4C,WAC9C,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,UAAW,GACX,aAAc,QACd,cAAeA,EACf,2CAA4C,WAC9C,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,UAAW,GACX,aAAc,SACd,cAAeA,EACf,2CAA4C,YAC9C,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,UAAW,GACX,aAAc,QACd,cAAeA,EACf,2CAA4C,WAC9C,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,UAAW,GACX,aAAc,QACd,cAAeA,EACf,2CAA4C,WAC9C,CACF,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,mBAAoB,IAAM,C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kBAAe,MAAO,WAAW,CAAC,EAAE,KAAK,EAAK,EACrD,UAAO,kBAAe,gBAAiB,WAAW,CAAC,EAAE,KAAK,EAAK,EAC/D,UAAO,kBAAe,YAAa,eAAe,CAAC,EAAE,KAAK,EAAK,CACjE,CAAC,CACH,CAAC,EAED,SAAS,+BAAgC,IAAM,CAC7C,GAAG,uEAAwE,IAAM,CAC/E,UACE,gCAA6B,gBAAc,KAAM,WAAW,CAC9D,EAAE,KAAK,EAAI,EACX,UACE,gCAA6B,gBAAc,KAAM,WAAW,CAC9D,EAAE,KAAK,EAAK,EAEZ,UAAO,gCAA6B,gBAAc,KAAM,OAAO,CAAC,EAAE,KAChE,EACF,EACA,UAAO,gCAA6B,gBAAc,KAAM,OAAO,CAAC,EAAE,KAChE,EACF,CACF,CAAC,EAED,GAAG,+DAAgE,IAAM,CACvE,UACE,gCAA6B,gBAAc,KAAM,YAAY,CAC/D,EAAE,KAAK,EAAI,EACX,UACE,gCAA6B,gBAAc,KAAM,YAAY,CAC/D,EAAE,KAAK,EAAK,EACZ,UACE,gCAA6B,gBAAc,QAAS,WAAW,CACjE,EAAE,KAAK,EAAI,CACb,CAAC,EAED,GAAG,yCAA0C,IAAM,CACjD,UACE,gCAA6B,gBAAc,OAAQ,WAAW,CAChE,EAAE,KAAK,EAAK,CACd,CAAC,EAED,GAAG,6DAA8D,IAAM,CACrE,UAAO,gCAA6B,gBAAc,KAAM,EAAE,CAAC,EAAE,KAAK,EAAK,CACzE,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_device_management_kit", "import_ContactsVersionRequirements", "modelId", "ethereum"]
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\nimport {\n CONTACTS_VERSION_REQUIREMENTS,\n ETHEREUM_APP_NAME,\n isVersionAtLeast,\n isVersionBelow,\n renameRequiresDerivationPath,\n resolveContactsVersionRequirements,\n TRON_APP_NAME,\n} from \"./ContactsVersionRequirements\";\n\ndescribe(\"ContactsVersionRequirements\", () => {\n describe(\"resolveContactsVersionRequirements\", () => {\n it(\"marks every device model, supported or not\", () => {\n for (const modelId of Object.values(DeviceModelId)) {\n expect(CONTACTS_VERSION_REQUIREMENTS[modelId]).toBeDefined();\n }\n });\n\n it(\"reports Nano S as unsupported\", () => {\n expect(resolveContactsVersionRequirements(DeviceModelId.NANO_S)).toEqual({\n supported: false,\n });\n });\n\n // Pins the minimums themselves, not just their shape: each OS version is\n // the release whose changelog introduces the Address Book feature, so a\n // change here has to be a deliberate one, reviewed against that release.\n it(\"pins the minimum OS and app versions of every supported model\", () => {\n const appVersions = {\n [ETHEREUM_APP_NAME]: \"1.23.0\",\n [TRON_APP_NAME]: \"0.8.0\",\n };\n\n expect(CONTACTS_VERSION_REQUIREMENTS).toEqual({\n [DeviceModelId.NANO_S]: { supported: false },\n [DeviceModelId.NANO_SP]: {\n supported: true,\n minOsVersion: \"1.7.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"1.7.0-rc3\",\n },\n [DeviceModelId.NANO_X]: {\n supported: true,\n minOsVersion: \"2.8.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"2.8.0-rc3\",\n },\n [DeviceModelId.STAX]: {\n supported: true,\n minOsVersion: \"1.11.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"1.11.0-rc3\",\n },\n [DeviceModelId.FLEX]: {\n supported: true,\n minOsVersion: \"1.7.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"1.7.0-rc3\",\n },\n [DeviceModelId.APEX]: {\n supported: true,\n minOsVersion: \"1.2.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"1.2.0-rc3\",\n },\n });\n });\n });\n\n describe(\"isVersionAtLeast\", () => {\n it(\"compares versions as semver, inclusive of equality\", () => {\n expect(isVersionAtLeast(\"1.2.0\", \"1.2.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.3.0\", \"1.2.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.1.9\", \"1.2.0\")).toBe(false);\n });\n\n it(\"coerces non-strict version strings\", () => {\n expect(isVersionAtLeast(\"1.2\", \"1.2.0\")).toBe(true);\n });\n\n it(\"returns false when a version cannot be parsed\", () => {\n expect(isVersionAtLeast(\"not-a-version\", \"1.2.0\")).toBe(false);\n expect(isVersionAtLeast(\"1.2.0\", \"not-a-version\")).toBe(false);\n });\n\n it(\"ignores prerelease and build tags when comparing to the minimum\", () => {\n expect(isVersionAtLeast(\"1.7.0-rc2\", \"1.7.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.23.0-dev\", \"1.23.0\")).toBe(true);\n });\n\n it(\"still fails a minimum strictly above the tagged version's core\", () => {\n expect(isVersionAtLeast(\"1.6.9-rc5\", \"1.7.0\")).toBe(false);\n });\n });\n\n describe(\"isVersionBelow\", () => {\n it(\"orders release candidates of the same core (unlike isVersionAtLeast)\", () => {\n // The whole reason this helper exists: rc2 must sort below rc3.\n expect(isVersionBelow(\"1.7.0-rc2\", \"1.7.0-rc3\")).toBe(true);\n expect(isVersionBelow(\"1.7.0-rc3\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"1.7.0-rc4\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"treats the final release as newer than any of its prereleases\", () => {\n expect(isVersionBelow(\"1.7.0\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"compares the release core when it differs\", () => {\n expect(isVersionBelow(\"1.6.9\", \"1.7.0-rc3\")).toBe(true);\n expect(isVersionBelow(\"1.8.0\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"does not coerce, so a non-strict version is unparseable and returns false\", () => {\n expect(isVersionBelow(\"1.7\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"not-a-version\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"1.7.0-rc2\", \"not-a-version\")).toBe(false);\n });\n });\n\n describe(\"renameRequiresDerivationPath\", () => {\n it(\"requires the path below the model's cutoff (rc2) and not at/after it\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0-rc2\"),\n ).toBe(true);\n expect(\n renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0-rc3\"),\n ).toBe(false);\n // GA and later never want the path.\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0\")).toBe(\n false,\n );\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.8.0\")).toBe(\n false,\n );\n });\n\n it(\"applies the same rc2/rc3 split to the other supported models\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.STAX, \"1.11.0-rc2\"),\n ).toBe(true);\n expect(\n renameRequiresDerivationPath(DeviceModelId.STAX, \"1.11.0-rc3\"),\n ).toBe(false);\n expect(\n renameRequiresDerivationPath(DeviceModelId.NANO_SP, \"1.7.0-rc2\"),\n ).toBe(true);\n });\n\n it(\"returns false for an unsupported model\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.NANO_S, \"1.7.0-rc2\"),\n ).toBe(false);\n });\n\n it(\"returns false (no path) when the OS version is unparseable\", () => {\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"\")).toBe(false);\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA8B,2CAE9BC,EAQO,yCAEP,SAAS,8BAA+B,IAAM,CAC5C,SAAS,qCAAsC,IAAM,CACnD,GAAG,6CAA8C,IAAM,CACrD,UAAWC,KAAW,OAAO,OAAO,eAAa,EAC/C,OAAO,gCAA8BA,CAAO,CAAC,EAAE,YAAY,CAE/D,CAAC,EAED,GAAG,gCAAiC,IAAM,CACxC,UAAO,sCAAmC,gBAAc,MAAM,CAAC,EAAE,QAAQ,CACvE,UAAW,EACb,CAAC,CACH,CAAC,EAKD,GAAG,gEAAiE,IAAM,CACxE,MAAMC,EAAc,CAClB,CAAC,mBAAiB,EAAG,SACrB,CAAC,eAAa,EAAG,OACnB,E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CAA6B,gBAAc,QAAS,WAAW,CACjE,EAAE,KAAK,EAAI,CACb,CAAC,EAED,GAAG,yCAA0C,IAAM,CACjD,UACE,gCAA6B,gBAAc,OAAQ,WAAW,CAChE,EAAE,KAAK,EAAK,CACd,CAAC,EAED,GAAG,6DAA8D,IAAM,CACrE,UAAO,gCAA6B,gBAAc,KAAM,EAAE,CAAC,EAAE,KAAK,EAAK,CACzE,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_ContactsVersionRequirements", "modelId", "appVersions"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var C=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var e=Object.prototype.hasOwnProperty;var n=(_,o)=>{for(var x in o)C(_,x,{get:o[x],enumerable:!0})},r=(_,o,x,A)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of T(o))!e.call(_,t)&&t!==x&&C(_,t,{get:()=>o[t],enumerable:!(A=E(o,t))||A.enumerable});return _};var c=_=>r(C({},"__esModule",{value:!0}),_);var H={};n(H,{BLOCKCHAIN_FAMILY_BY_NAME:()=>a,CONTACTS_APDU_CLA:()=>s,CONTACTS_APDU_INS:()=>N,GROUP_HANDLE_BYTES:()=>B,HMAC_NAME_BYTES:()=>Y,HMAC_PROOF_BYTES:()=>P,HMAC_REST_BYTES:()=>U,RENAME_CONTACT_APDU_CLA:()=>M,RENAME_CONTACT_APDU_INS:()=>O,RENAME_CONTACT_P1:()=>R,SUB_CMD_EDIT_IDENTIFIER:()=>D,SUB_CMD_EDIT_SCOPE:()=>I,SUB_CMD_PROVIDE_CONTACT:()=>S,SUB_CMD_REGISTER_IDENTITY:()=>p});module.exports=c(H);const s=176,N=16,p=1,S=32,D=3,I=4,M=224,O=46,R=0,B=64,P=32,U=32,Y=32,a={bitcoin:0,ethereum:1,solana:2,polkadot:3,cosmos:4,cardano:5};0&&(module.exports={BLOCKCHAIN_FAMILY_BY_NAME,CONTACTS_APDU_CLA,CONTACTS_APDU_INS,GROUP_HANDLE_BYTES,HMAC_NAME_BYTES,HMAC_PROOF_BYTES,HMAC_REST_BYTES,RENAME_CONTACT_APDU_CLA,RENAME_CONTACT_APDU_INS,RENAME_CONTACT_P1,SUB_CMD_EDIT_IDENTIFIER,SUB_CMD_EDIT_SCOPE,SUB_CMD_PROVIDE_CONTACT,SUB_CMD_REGISTER_IDENTITY});
1
+ "use strict";var C=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var e=Object.prototype.hasOwnProperty;var n=(_,o)=>{for(var x in o)C(_,x,{get:o[x],enumerable:!0})},r=(_,o,x,A)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of T(o))!e.call(_,t)&&t!==x&&C(_,t,{get:()=>o[t],enumerable:!(A=E(o,t))||A.enumerable});return _};var c=_=>r(C({},"__esModule",{value:!0}),_);var H={};n(H,{BLOCKCHAIN_FAMILY_BY_NAME:()=>a,CONTACTS_APDU_CLA:()=>s,CONTACTS_APDU_INS:()=>N,GROUP_HANDLE_BYTES:()=>B,HMAC_NAME_BYTES:()=>Y,HMAC_PROOF_BYTES:()=>P,HMAC_REST_BYTES:()=>U,RENAME_CONTACT_APDU_CLA:()=>M,RENAME_CONTACT_APDU_INS:()=>O,RENAME_CONTACT_P1:()=>R,SUB_CMD_EDIT_IDENTIFIER:()=>D,SUB_CMD_EDIT_SCOPE:()=>I,SUB_CMD_PROVIDE_CONTACT:()=>S,SUB_CMD_REGISTER_IDENTITY:()=>p});module.exports=c(H);const s=176,N=16,p=1,S=32,D=3,I=4,M=224,O=46,R=0,B=64,P=32,U=32,Y=32,a={bitcoin:0,ethereum:1,solana:2,polkadot:3,cosmos:4,cardano:5,tron:6};0&&(module.exports={BLOCKCHAIN_FAMILY_BY_NAME,CONTACTS_APDU_CLA,CONTACTS_APDU_INS,GROUP_HANDLE_BYTES,HMAC_NAME_BYTES,HMAC_PROOF_BYTES,HMAC_REST_BYTES,RENAME_CONTACT_APDU_CLA,RENAME_CONTACT_APDU_INS,RENAME_CONTACT_P1,SUB_CMD_EDIT_IDENTIFIER,SUB_CMD_EDIT_SCOPE,SUB_CMD_PROVIDE_CONTACT,SUB_CMD_REGISTER_IDENTITY});
2
2
  //# sourceMappingURL=contactsConstants.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/model/contactsConstants.ts"],
4
- "sourcesContent": ["/**\n * Protocol constants shared by the Contacts (Address Book) operations.\n *\n * Wire format and values follow the BOLOS SDK Address Book specification\n * (ledger-secure-sdk/app_features/address_book). Op-specific sub-command bytes\n * and response field sizes live here; TLV tags and struct-type bytes live in\n * {@link ./../services/contactsTlvSerializer}.\n */\n\n/** APDU class/instruction shared by every Address Book sub-command. */\nexport const CONTACTS_APDU_CLA = 0xb0;\nexport const CONTACTS_APDU_INS = 0x10;\n\n/** P1 sub-command selector for REGISTER IDENTITY (register external address). */\nexport const SUB_CMD_REGISTER_IDENTITY = 0x01;\n\n/** P1 sub-command selector for PROVIDE CONTACT (pre-signing decoration). */\nexport const SUB_CMD_PROVIDE_CONTACT = 0x20;\n\n/**\n * P1 sub-command selector for EDIT IDENTIFIER \u2014 an address-book app sub-command\n * (CLA 0xB0 / INS 0x10) served by the coin app, never OS-dispatched.\n */\nexport const SUB_CMD_EDIT_IDENTIFIER = 0x03;\n\n/**\n * P1 sub-command selector for EDIT SCOPE \u2014 an address-book app sub-command\n * (CLA 0xB0 / INS 0x10) served by the coin app, never OS-dispatched. Changes an\n * entry's scope while keeping its contact name and identifier.\n */\nexport const SUB_CMD_EDIT_SCOPE = 0x04;\n\n/**\n * EDIT CONTACT NAME (rename) is a blockchain-agnostic OS/dashboard command with\n * its own CLA/INS \u2014 NOT a sub-command of the address-book app APDU (0xB0/0x10).\n * The OS serves it directly, so it must run on the dashboard. P1 is a fixed\n * 0x00 (there is no sub-command selector for this command); P2 still carries the\n * chunk-continuation flag handled by {@link ./../services/sendFramedContactsPayload}.\n */\nexport const RENAME_CONTACT_APDU_CLA = 0xe0;\nexport const RENAME_CONTACT_APDU_INS = 0x2e;\nexport const RENAME_CONTACT_P1 = 0x00;\n\n/** Sizes (bytes) of the fields in the REGISTER IDENTITY final-chunk response. */\nexport const GROUP_HANDLE_BYTES = 64;\nexport const HMAC_PROOF_BYTES = 32;\nexport const HMAC_REST_BYTES = 32;\n\n/**\n * Size (bytes) of the rotated `hmac_name` returned on the EDIT CONTACT NAME\n * final-chunk response \u2014 the replacement group-level name proof.\n */\nexport const HMAC_NAME_BYTES = 32;\n\n/**\n * Blockchain-family byte encoded in the `BLOCKCHAIN_FAMILY` TLV, keyed by a\n * lowercase family name. v1 ships Ethereum only; the remaining families are\n * listed for completeness and will be enabled as their chains are supported.\n */\nexport const BLOCKCHAIN_FAMILY_BY_NAME: Readonly<Record<string, number>> = {\n bitcoin: 0x00,\n ethereum: 0x01,\n solana: 0x02,\n polkadot: 0x03,\n cosmos: 0x04,\n cardano: 0x05,\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,EAAA,sBAAAC,EAAA,sBAAAC,EAAA,uBAAAC,EAAA,oBAAAC,EAAA,qBAAAC,EAAA,oBAAAC,EAAA,4BAAAC,EAAA,4BAAAC,EAAA,sBAAAC,EAAA,4BAAAC,EAAA,uBAAAC,EAAA,4BAAAC,EAAA,8BAAAC,IAAA,eAAAC,EAAAhB,GAUO,MAAMG,EAAoB,IACpBC,EAAoB,GAGpBW,EAA4B,EAG5BD,EAA0B,GAM1BF,EAA0B,EAO1BC,EAAqB,EASrBJ,EAA0B,IAC1BC,EAA0B,GAC1BC,EAAoB,EAGpBN,EAAqB,GACrBE,EAAmB,GACnBC,EAAkB,GAMlBF,EAAkB,GAOlBJ,EAA8D,CACzE,QAAS,EACT,SAAU,EACV,OAAQ,EACR,SAAU,EACV,OAAQ,EACR,QAAS,CACX",
4
+ "sourcesContent": ["/**\n * Protocol constants shared by the Contacts (Address Book) operations.\n *\n * Wire format and values follow the BOLOS SDK Address Book specification\n * (ledger-secure-sdk/app_features/address_book). Op-specific sub-command bytes\n * and response field sizes live here; TLV tags and struct-type bytes live in\n * {@link ./../services/contactsTlvSerializer}.\n */\n\n/** APDU class/instruction shared by every Address Book sub-command. */\nexport const CONTACTS_APDU_CLA = 0xb0;\nexport const CONTACTS_APDU_INS = 0x10;\n\n/** P1 sub-command selector for REGISTER IDENTITY (register external address). */\nexport const SUB_CMD_REGISTER_IDENTITY = 0x01;\n\n/** P1 sub-command selector for PROVIDE CONTACT (pre-signing decoration). */\nexport const SUB_CMD_PROVIDE_CONTACT = 0x20;\n\n/**\n * P1 sub-command selector for EDIT IDENTIFIER \u2014 an address-book app sub-command\n * (CLA 0xB0 / INS 0x10) served by the coin app, never OS-dispatched.\n */\nexport const SUB_CMD_EDIT_IDENTIFIER = 0x03;\n\n/**\n * P1 sub-command selector for EDIT SCOPE \u2014 an address-book app sub-command\n * (CLA 0xB0 / INS 0x10) served by the coin app, never OS-dispatched. Changes an\n * entry's scope while keeping its contact name and identifier.\n */\nexport const SUB_CMD_EDIT_SCOPE = 0x04;\n\n/**\n * EDIT CONTACT NAME (rename) is a blockchain-agnostic OS/dashboard command with\n * its own CLA/INS \u2014 NOT a sub-command of the address-book app APDU (0xB0/0x10).\n * The OS serves it directly, so it must run on the dashboard. P1 is a fixed\n * 0x00 (there is no sub-command selector for this command); P2 still carries the\n * chunk-continuation flag handled by {@link ./../services/sendFramedContactsPayload}.\n */\nexport const RENAME_CONTACT_APDU_CLA = 0xe0;\nexport const RENAME_CONTACT_APDU_INS = 0x2e;\nexport const RENAME_CONTACT_P1 = 0x00;\n\n/** Sizes (bytes) of the fields in the REGISTER IDENTITY final-chunk response. */\nexport const GROUP_HANDLE_BYTES = 64;\nexport const HMAC_PROOF_BYTES = 32;\nexport const HMAC_REST_BYTES = 32;\n\n/**\n * Size (bytes) of the rotated `hmac_name` returned on the EDIT CONTACT NAME\n * final-chunk response \u2014 the replacement group-level name proof.\n */\nexport const HMAC_NAME_BYTES = 32;\n\n/**\n * Blockchain-family byte encoded in the `BLOCKCHAIN_FAMILY` TLV, keyed by a\n * lowercase family name. Values follow the BOLOS Address Book family enum\n * (`BlockchainFamily` in ragger / ledger-secure-sdk).\n */\nexport const BLOCKCHAIN_FAMILY_BY_NAME: Readonly<Record<string, number>> = {\n bitcoin: 0x00,\n ethereum: 0x01,\n solana: 0x02,\n polkadot: 0x03,\n cosmos: 0x04,\n cardano: 0x05,\n tron: 0x06,\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,EAAA,sBAAAC,EAAA,sBAAAC,EAAA,uBAAAC,EAAA,oBAAAC,EAAA,qBAAAC,EAAA,oBAAAC,EAAA,4BAAAC,EAAA,4BAAAC,EAAA,sBAAAC,EAAA,4BAAAC,EAAA,uBAAAC,EAAA,4BAAAC,EAAA,8BAAAC,IAAA,eAAAC,EAAAhB,GAUO,MAAMG,EAAoB,IACpBC,EAAoB,GAGpBW,EAA4B,EAG5BD,EAA0B,GAM1BF,EAA0B,EAO1BC,EAAqB,EASrBJ,EAA0B,IAC1BC,EAA0B,GAC1BC,EAAoB,EAGpBN,EAAqB,GACrBE,EAAmB,GACnBC,EAAkB,GAMlBF,EAAkB,GAOlBJ,EAA8D,CACzE,QAAS,EACT,SAAU,EACV,OAAQ,EACR,SAAU,EACV,OAAQ,EACR,QAAS,EACT,KAAM,CACR",
6
6
  "names": ["contactsConstants_exports", "__export", "BLOCKCHAIN_FAMILY_BY_NAME", "CONTACTS_APDU_CLA", "CONTACTS_APDU_INS", "GROUP_HANDLE_BYTES", "HMAC_NAME_BYTES", "HMAC_PROOF_BYTES", "HMAC_REST_BYTES", "RENAME_CONTACT_APDU_CLA", "RENAME_CONTACT_APDU_INS", "RENAME_CONTACT_P1", "SUB_CMD_EDIT_IDENTIFIER", "SUB_CMD_EDIT_SCOPE", "SUB_CMD_PROVIDE_CONTACT", "SUB_CMD_REGISTER_IDENTITY", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=require("@ledgerhq/device-management-kit"),r=require("../../app-binder/command/ProvideContactCommand"),i=require("../../app-binder/device-action/__test-utils__/makeInternalApi"),d=require("../../app-binder/model/contactsErrors"),t=require("./provideContact");const m=new Uint8Array(20).fill(17),p=new Uint8Array(64).fill(34),f=new Uint8Array(32).fill(51),h=new Uint8Array(32).fill(68),n={contactName:"Alice",scope:"Ethereum",identifier:m,groupHandle:p,hmacProof:f,hmacRest:h,blockchainFamily:"ethereum",chainId:1n},C="010133",u="020101",y="81f005416c696365",T="81f108457468657265756d",x="81f214"+"11".repeat(20),s="81f640"+"22".repeat(64),E="230101",P="510101",_="2920"+"33".repeat(32),I="81f720"+"44".repeat(32);describe("buildProvideContactPayload",()=>{it("encodes every tag in the order the spec lists",()=>{const e=(0,t.buildProvideContactPayload)(n);expect((0,o.bufferToHexaString)(e,!1)).toBe(C+u+y+T+x+s+E+P+_+I)}),it("fits an Ethereum contact in a single 255-byte chunk",()=>{expect((0,t.buildProvideContactPayload)(n).length).toBeLessThanOrEqual(253)}),it("omits CHAIN_ID for a family that does not carry one",()=>{const e=(0,t.buildProvideContactPayload)({...n,blockchainFamily:"bitcoin",chainId:void 0});expect((0,o.bufferToHexaString)(e,!1)).toContain(s+"510100")}),it("encodes a multi-byte chain id big-endian with no leading zeroes",()=>{const e=(0,t.buildProvideContactPayload)({...n,chainId:8453n});expect((0,o.bufferToHexaString)(e,!1)).toContain("23022105")}),it("accepts the family name case-insensitively",()=>{expect((0,t.buildProvideContactPayload)({...n,blockchainFamily:"Ethereum"})).toStrictEqual((0,t.buildProvideContactPayload)(n))}),it("throws on an unknown blockchain family",()=>{expect(()=>(0,t.buildProvideContactPayload)({...n,blockchainFamily:"dogecoin"})).toThrow("Unsupported blockchain family: dogecoin")})});describe("sendProvideContactPayload",()=>{it("sends one chunk under P2=0x00, prefixed with the 2-byte BE total length",async()=>{const e=(0,i.makeDeviceActionInternalApiMock)();e.sendCommand.mockResolvedValue((0,o.CommandResultFactory)({data:void 0}));const a=(0,t.buildProvideContactPayload)(n),l=await(0,t.sendProvideContactPayload)(e,{payload:a});expect(e.sendCommand).toHaveBeenCalledTimes(1);const c=e.sendCommand.mock.calls[0][0];expect(c).toBeInstanceOf(r.ProvideContactCommand),expect(c.args.p2).toBe(0),expect(c.args.data.slice(0,2)).toStrictEqual(Uint8Array.from([a.length>>8&255,a.length&255])),expect(c.args.data.slice(2)).toStrictEqual(a),expect(l.status).toBe(o.CommandResultStatus.Success)}),it("propagates a device rejection instead of throwing",async()=>{const e=(0,i.makeDeviceActionInternalApiMock)();e.sendCommand.mockResolvedValue((0,o.CommandResultFactory)({error:new d.ContactsCommandError({errorCode:"6982",message:"wrong seed"})}));const a=await(0,t.sendProvideContactPayload)(e,{payload:(0,t.buildProvideContactPayload)(n)});expect(a.status).toBe(o.CommandResultStatus.Error)})});
1
+ "use strict";var o=require("@ledgerhq/device-management-kit"),r=require("../../app-binder/command/ProvideContactCommand"),i=require("../../app-binder/device-action/__test-utils__/makeInternalApi"),d=require("../../app-binder/model/contactsErrors"),t=require("./provideContact");const m=new Uint8Array(20).fill(17),p=new Uint8Array(64).fill(34),f=new Uint8Array(32).fill(51),h=new Uint8Array(32).fill(68),n={contactName:"Alice",scope:"Ethereum",identifier:m,groupHandle:p,hmacProof:f,hmacRest:h,blockchainFamily:"ethereum",chainId:1n},C="010133",u="020101",y="81f005416c696365",T="81f108457468657265756d",x="81f214"+"11".repeat(20),s="81f640"+"22".repeat(64),E="230101",P="510101",_="2920"+"33".repeat(32),I="81f720"+"44".repeat(32);describe("buildProvideContactPayload",()=>{it("encodes every tag in the order the spec lists",()=>{const e=(0,t.buildProvideContactPayload)(n);expect((0,o.bufferToHexaString)(e,!1)).toBe(C+u+y+T+x+s+E+P+_+I)}),it("fits an Ethereum contact in a single 255-byte chunk",()=>{expect((0,t.buildProvideContactPayload)(n).length).toBeLessThanOrEqual(253)}),it("omits CHAIN_ID for a family that does not carry one",()=>{const e=(0,t.buildProvideContactPayload)({...n,blockchainFamily:"tron",chainId:void 0});expect((0,o.bufferToHexaString)(e,!1)).toContain(s+"510106")}),it("encodes a multi-byte chain id big-endian with no leading zeroes",()=>{const e=(0,t.buildProvideContactPayload)({...n,chainId:8453n});expect((0,o.bufferToHexaString)(e,!1)).toContain("23022105")}),it("accepts the family name case-insensitively",()=>{expect((0,t.buildProvideContactPayload)({...n,blockchainFamily:"Ethereum"})).toStrictEqual((0,t.buildProvideContactPayload)(n))}),it("throws on an unknown blockchain family",()=>{expect(()=>(0,t.buildProvideContactPayload)({...n,blockchainFamily:"dogecoin"})).toThrow("Unsupported blockchain family: dogecoin")})});describe("sendProvideContactPayload",()=>{it("sends one chunk under P2=0x00, prefixed with the 2-byte BE total length",async()=>{const e=(0,i.makeDeviceActionInternalApiMock)();e.sendCommand.mockResolvedValue((0,o.CommandResultFactory)({data:void 0}));const a=(0,t.buildProvideContactPayload)(n),l=await(0,t.sendProvideContactPayload)(e,{payload:a});expect(e.sendCommand).toHaveBeenCalledTimes(1);const c=e.sendCommand.mock.calls[0][0];expect(c).toBeInstanceOf(r.ProvideContactCommand),expect(c.args.p2).toBe(0),expect(c.args.data.slice(0,2)).toStrictEqual(Uint8Array.from([a.length>>8&255,a.length&255])),expect(c.args.data.slice(2)).toStrictEqual(a),expect(l.status).toBe(o.CommandResultStatus.Success)}),it("propagates a device rejection instead of throwing",async()=>{const e=(0,i.makeDeviceActionInternalApiMock)();e.sendCommand.mockResolvedValue((0,o.CommandResultFactory)({error:new d.ContactsCommandError({errorCode:"6982",message:"wrong seed"})}));const a=await(0,t.sendProvideContactPayload)(e,{payload:(0,t.buildProvideContactPayload)(n)});expect(a.status).toBe(o.CommandResultStatus.Error)})});
2
2
  //# sourceMappingURL=provideContact.test.js.map
@@ -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: \"bitcoin\",\n chainId: undefined,\n });\n\n expect(bufferToHexaString(payload, false)).toContain(\n GROUP_HANDLE_TLV + \"510100\",\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,IAAAA,EAIO,2CAGPC,EAAsC,8DACtCC,EAAgD,6EAChDC,EAAqC,qDAErCC,EAGO,4BAEP,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,KAAU,8BAA2BX,CAAK,EAEhD,UAAO,sBAAmBW,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Q,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,KAAK,sBAAoB,OAAO,CACxD,CAAC,EAED,GAAG,oDAAqD,SAAY,CAClE,MAAMD,KAAM,mCAAgC,EAC5CA,EAAI,YAAY,qBACd,wBAAqB,CACnB,MAAO,IAAI,uBAAqB,CAC9B,UAAW,OACX,QAAS,YACX,CAAC,CACH,CAAC,CACH,EAEA,MAAMC,EAAS,QAAM,6BAA0BD,EAAK,CAClD,WAAS,8BAA2BZ,CAAK,CAC3C,CAAC,EAED,OAAOa,EAAO,MAAM,EAAE,KAAK,sBAAoB,KAAK,CACtD,CAAC,CACH,CAAC",
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,IAAAA,EAIO,2CAGPC,EAAsC,8DACtCC,EAAgD,6EAChDC,EAAqC,qDAErCC,EAGO,4BAEP,MAAMC,EAAa,IAAI,WAAW,EAAE,EAAE,KAAK,EA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ACtD,CAAC,CACH,CAAC",
6
6
  "names": ["import_device_management_kit", "import_ProvideContactCommand", "import_makeInternalApi", "import_contactsErrors", "import_provideContact", "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
  }
@@ -36,7 +36,7 @@
36
36
  "license": "Apache-2.0",
37
37
  "name": "@ledgerhq/device-contacts-kit",
38
38
  "peerDependencies": {
39
- "@ledgerhq/device-management-kit": "^1.9.0"
39
+ "@ledgerhq/device-management-kit": "workspace:^"
40
40
  },
41
41
  "private": false,
42
42
  "repository": {
@@ -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.4.1"
61
+ "version": "0.5.0"
62
62
  }
@@ -1,2 +1,2 @@
1
- import{ContactsManagerBuilder as r}from"./ContactsManagerBuilder";import{CONTACTS_VERSION_REQUIREMENTS as n,ETHEREUM_APP_NAME as p,isVersionAtLeast as o,resolveContactsVersionRequirements as s}from"./model/ContactsVersionRequirements";import{buildProvideContactPayload as i,sendProvideContactPayload as A}from"../internal/app-binder/services/provideContact";export{n as CONTACTS_VERSION_REQUIREMENTS,r as ContactsManagerBuilder,p as ETHEREUM_APP_NAME,i as buildProvideContactPayload,o as isVersionAtLeast,s as resolveContactsVersionRequirements,A as sendProvideContactPayload};
1
+ import{ContactsManagerBuilder as r}from"./ContactsManagerBuilder";import{CONTACTS_VERSION_REQUIREMENTS as n,ETHEREUM_APP_NAME as p,isVersionAtLeast as o,resolveContactsVersionRequirements as s,TRON_APP_NAME as a}from"./model/ContactsVersionRequirements";import{buildProvideContactPayload as A,sendProvideContactPayload as E}from"../internal/app-binder/services/provideContact";export{n as CONTACTS_VERSION_REQUIREMENTS,r as ContactsManagerBuilder,p as ETHEREUM_APP_NAME,a as TRON_APP_NAME,A as buildProvideContactPayload,o as isVersionAtLeast,s as resolveContactsVersionRequirements,E as sendProvideContactPayload};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/index.ts"],
4
- "sourcesContent": ["export {\n type EditExternalAddressIdentifierDAError,\n type EditExternalAddressIdentifierDAInput,\n type EditExternalAddressIdentifierDAIntermediateValue,\n type EditExternalAddressIdentifierDAOutput,\n type EditExternalAddressIdentifierDARequiredInteraction,\n type EditExternalAddressIdentifierDAReturnType,\n type EditExternalAddressIdentifierDAState,\n} from \"@api/app-binder/EditExternalAddressIdentifierDeviceActionTypes\";\nexport {\n type EditExternalAddressScopeDAError,\n type EditExternalAddressScopeDAInput,\n type EditExternalAddressScopeDAIntermediateValue,\n type EditExternalAddressScopeDAOutput,\n type EditExternalAddressScopeDARequiredInteraction,\n type EditExternalAddressScopeDAReturnType,\n type EditExternalAddressScopeDAState,\n} from \"@api/app-binder/EditExternalAddressScopeDeviceActionTypes\";\nexport {\n type RegisterExternalAddressDAError,\n type RegisterExternalAddressDAInput,\n type RegisterExternalAddressDAIntermediateValue,\n type RegisterExternalAddressDAOutput,\n type RegisterExternalAddressDARequiredInteraction,\n type RegisterExternalAddressDAReturnType,\n type RegisterExternalAddressDAState,\n} from \"@api/app-binder/RegisterExternalAddressDeviceActionTypes\";\nexport {\n type RenameContactDAError,\n type RenameContactDAInput,\n type RenameContactDAIntermediateValue,\n type RenameContactDAOutput,\n type RenameContactDARequiredInteraction,\n type RenameContactDAReturnType,\n type RenameContactDAState,\n} from \"@api/app-binder/RenameContactDeviceActionTypes\";\nexport { type ContactsManager } from \"@api/ContactsManager\";\nexport { ContactsManagerBuilder } from \"@api/ContactsManagerBuilder\";\nexport {\n CONTACTS_VERSION_REQUIREMENTS,\n type ContactsModelRequirement,\n type ContactsModelSupport,\n type ContactsModelUnsupported,\n type ContactsVersionRequirements,\n ETHEREUM_APP_NAME,\n isVersionAtLeast,\n resolveContactsVersionRequirements,\n} from \"@api/model/ContactsVersionRequirements\";\nexport {\n type EditExternalAddressIdentifierInput,\n type EditExternalAddressIdentifierOutput,\n} from \"@api/model/EditExternalAddressIdentifier\";\nexport {\n type EditExternalAddressScopeInput,\n type EditExternalAddressScopeOutput,\n} from \"@api/model/EditExternalAddressScope\";\nexport { type ProvideContactInput } from \"@api/model/ProvideContact\";\nexport {\n type ExistingContactGroup,\n type RegisterExternalAddressInput,\n type RegisterExternalAddressMode,\n type RegisterExternalAddressOutput,\n} from \"@api/model/RegisterExternalAddress\";\nexport {\n type RenameContactInput,\n type RenameContactOutput,\n} from \"@api/model/RenameContact\";\nexport { type ContactsErrorCodes } from \"@internal/app-binder/model/contactsErrors\";\nexport {\n buildProvideContactPayload,\n sendProvideContactPayload,\n type SendProvideContactPayloadArgs,\n} from \"@internal/app-binder/services/provideContact\";\n"],
5
- "mappings": "AAqCA,OAAS,0BAAAA,MAA8B,8BACvC,OACE,iCAAAC,EAKA,qBAAAC,EACA,oBAAAC,EACA,sCAAAC,MACK,yCAqBP,OACE,8BAAAC,EACA,6BAAAC,MAEK",
6
- "names": ["ContactsManagerBuilder", "CONTACTS_VERSION_REQUIREMENTS", "ETHEREUM_APP_NAME", "isVersionAtLeast", "resolveContactsVersionRequirements", "buildProvideContactPayload", "sendProvideContactPayload"]
4
+ "sourcesContent": ["export {\n type EditExternalAddressIdentifierDAError,\n type EditExternalAddressIdentifierDAInput,\n type EditExternalAddressIdentifierDAIntermediateValue,\n type EditExternalAddressIdentifierDAOutput,\n type EditExternalAddressIdentifierDARequiredInteraction,\n type EditExternalAddressIdentifierDAReturnType,\n type EditExternalAddressIdentifierDAState,\n} from \"@api/app-binder/EditExternalAddressIdentifierDeviceActionTypes\";\nexport {\n type EditExternalAddressScopeDAError,\n type EditExternalAddressScopeDAInput,\n type EditExternalAddressScopeDAIntermediateValue,\n type EditExternalAddressScopeDAOutput,\n type EditExternalAddressScopeDARequiredInteraction,\n type EditExternalAddressScopeDAReturnType,\n type EditExternalAddressScopeDAState,\n} from \"@api/app-binder/EditExternalAddressScopeDeviceActionTypes\";\nexport {\n type RegisterExternalAddressDAError,\n type RegisterExternalAddressDAInput,\n type RegisterExternalAddressDAIntermediateValue,\n type RegisterExternalAddressDAOutput,\n type RegisterExternalAddressDARequiredInteraction,\n type RegisterExternalAddressDAReturnType,\n type RegisterExternalAddressDAState,\n} from \"@api/app-binder/RegisterExternalAddressDeviceActionTypes\";\nexport {\n type RenameContactDAError,\n type RenameContactDAInput,\n type RenameContactDAIntermediateValue,\n type RenameContactDAOutput,\n type RenameContactDARequiredInteraction,\n type RenameContactDAReturnType,\n type RenameContactDAState,\n} from \"@api/app-binder/RenameContactDeviceActionTypes\";\nexport { type ContactsManager } from \"@api/ContactsManager\";\nexport { ContactsManagerBuilder } from \"@api/ContactsManagerBuilder\";\nexport {\n CONTACTS_VERSION_REQUIREMENTS,\n type ContactsModelRequirement,\n type ContactsModelSupport,\n type ContactsModelUnsupported,\n type ContactsVersionRequirements,\n ETHEREUM_APP_NAME,\n isVersionAtLeast,\n resolveContactsVersionRequirements,\n TRON_APP_NAME,\n} from \"@api/model/ContactsVersionRequirements\";\nexport {\n type EditExternalAddressIdentifierInput,\n type EditExternalAddressIdentifierOutput,\n} from \"@api/model/EditExternalAddressIdentifier\";\nexport {\n type EditExternalAddressScopeInput,\n type EditExternalAddressScopeOutput,\n} from \"@api/model/EditExternalAddressScope\";\nexport { type ProvideContactInput } from \"@api/model/ProvideContact\";\nexport {\n type ExistingContactGroup,\n type RegisterExternalAddressInput,\n type RegisterExternalAddressMode,\n type RegisterExternalAddressOutput,\n} from \"@api/model/RegisterExternalAddress\";\nexport {\n type RenameContactInput,\n type RenameContactOutput,\n} from \"@api/model/RenameContact\";\nexport { type ContactsErrorCodes } from \"@internal/app-binder/model/contactsErrors\";\nexport {\n buildProvideContactPayload,\n sendProvideContactPayload,\n type SendProvideContactPayloadArgs,\n} from \"@internal/app-binder/services/provideContact\";\n"],
5
+ "mappings": "AAqCA,OAAS,0BAAAA,MAA8B,8BACvC,OACE,iCAAAC,EAKA,qBAAAC,EACA,oBAAAC,EACA,sCAAAC,EACA,iBAAAC,MACK,yCAqBP,OACE,8BAAAC,EACA,6BAAAC,MAEK",
6
+ "names": ["ContactsManagerBuilder", "CONTACTS_VERSION_REQUIREMENTS", "ETHEREUM_APP_NAME", "isVersionAtLeast", "resolveContactsVersionRequirements", "TRON_APP_NAME", "buildProvideContactPayload", "sendProvideContactPayload"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{DeviceModelId as r}from"@ledgerhq/device-management-kit";import{coerce as a,gte as N,lt as E,valid as p}from"semver";const s="Ethereum",R={supported:!1},u="1.11.0",c="1.7.0",d="1.2.0",l="2.8.0",_="1.7.0",i="1.23.0",A=`${u}-rc3`,m=`${c}-rc3`,V=`${d}-rc3`,M=`${l}-rc3`,P=`${_}-rc3`,O={[r.NANO_S]:R,[r.NANO_SP]:{supported:!0,minOsVersion:_,minAppVersion:{[s]:i},renameDerivationPathRequiredBelowOsVersion:P},[r.NANO_X]:{supported:!0,minOsVersion:l,minAppVersion:{[s]:i},renameDerivationPathRequiredBelowOsVersion:M},[r.STAX]:{supported:!0,minOsVersion:u,minAppVersion:{[s]:i},renameDerivationPathRequiredBelowOsVersion:A},[r.FLEX]:{supported:!0,minOsVersion:c,minAppVersion:{[s]:i},renameDerivationPathRequiredBelowOsVersion:m},[r.APEX]:{supported:!0,minOsVersion:d,minAppVersion:{[s]:i},renameDerivationPathRequiredBelowOsVersion:V}};function C(o){return O[o]}function I(o,t){const e=p(a(o)),n=p(a(t));return e===null||n===null?!1:N(e,n)}function S(o,t){const e=p(o),n=p(t);return e===null||n===null?!1:E(e,n)}function q(o,t){const e=O[o];if(!e.supported)return!1;const n=e.renameDerivationPathRequiredBelowOsVersion;return n===void 0?!1:S(t,n)}export{O as CONTACTS_VERSION_REQUIREMENTS,s as ETHEREUM_APP_NAME,I as isVersionAtLeast,S as isVersionBelow,q as renameRequiresDerivationPath,C as resolveContactsVersionRequirements};
1
+ import{DeviceModelId as r}from"@ledgerhq/device-management-kit";import{coerce as p,gte as N,lt as O,valid as i}from"semver";const R="Ethereum",A="Tron",E={supported:!1},a="1.11.0",u="1.7.0",c="1.2.0",_="2.8.0",d="1.7.0",V="1.23.0",m="0.8.0",s={[R]:V,[A]:m},P=`${a}-rc3`,M=`${u}-rc3`,S=`${c}-rc3`,I=`${_}-rc3`,T=`${d}-rc3`,l={[r.NANO_S]:E,[r.NANO_SP]:{supported:!0,minOsVersion:d,minAppVersion:s,renameDerivationPathRequiredBelowOsVersion:T},[r.NANO_X]:{supported:!0,minOsVersion:_,minAppVersion:s,renameDerivationPathRequiredBelowOsVersion:I},[r.STAX]:{supported:!0,minOsVersion:a,minAppVersion:s,renameDerivationPathRequiredBelowOsVersion:P},[r.FLEX]:{supported:!0,minOsVersion:u,minAppVersion:s,renameDerivationPathRequiredBelowOsVersion:M},[r.APEX]:{supported:!0,minOsVersion:c,minAppVersion:s,renameDerivationPathRequiredBelowOsVersion:S}};function v(o){return l[o]}function D(o,t){const e=i(p(o)),n=i(p(t));return e===null||n===null?!1:N(e,n)}function f(o,t){const e=i(o),n=i(t);return e===null||n===null?!1:O(e,n)}function F(o,t){const e=l[o];if(!e.supported)return!1;const n=e.renameDerivationPathRequiredBelowOsVersion;return n===void 0?!1:f(t,n)}export{l as CONTACTS_VERSION_REQUIREMENTS,R as ETHEREUM_APP_NAME,A as TRON_APP_NAME,D as isVersionAtLeast,f as isVersionBelow,F as renameRequiresDerivationPath,v as resolveContactsVersionRequirements};
2
2
  //# sourceMappingURL=ContactsVersionRequirements.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/model/ContactsVersionRequirements.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { coerce, gte, lt, valid } from \"semver\";\n\n/**\n * Version requirements for a device model on which Contacts (Address Book)\n * operations are supported.\n *\n * Contacts has two independent version axes:\n * - `minOsVersion` gates OS-owned operations (e.g. renaming a contact from the\n * device dashboard), which are served by the device OS.\n * - `minAppVersion` gates app-owned operations (registering / editing external\n * addresses and Ledger accounts), which are served by the embedded app. It is\n * keyed by app name because the required version differs per app; v1 ships\n * Ethereum only.\n */\nexport type ContactsModelSupport = {\n readonly supported: true;\n readonly minOsVersion: string;\n readonly minAppVersion: Readonly<Record<string, string>>;\n /**\n * TEMPORARY (DSDK-1481) \u2014 the first OS build for this model that no longer\n * wants the `DERIVATION_PATH` (tag 0x69) on EDIT CONTACT NAME. Rename is\n * served by the OS, and OS builds *below* this version still require the path\n * (omitting it yields 0x686A), while this build and later reject it\n * (0x6A80). So the path is sent only when the device OS is below this\n * cutoff. Absent means the model never wanted the path (send nothing \u2014 the\n * GA end-state). Delete this field, its constants, and\n * {@link renameRequiresDerivationPath} once no in-the-field OS predates the\n * cutoff.\n */\n readonly renameDerivationPathRequiredBelowOsVersion?: string;\n};\n\n/** Marks a device model on which Contacts is not supported at all. */\nexport type ContactsModelUnsupported = {\n readonly supported: false;\n};\n\nexport type ContactsModelRequirement =\n | ContactsModelSupport\n | ContactsModelUnsupported;\n\n/**\n * The full, static Contacts version-requirement table, keyed by device model.\n * Serializable plain data with no runtime dependencies, so hosts (e.g. Ledger\n * Wallet) can import and consume it directly when composing their own\n * app-readiness checks, without duplicating the values.\n */\nexport type ContactsVersionRequirements = Readonly<\n Record<DeviceModelId, ContactsModelRequirement>\n>;\n\n/** The name of the Ethereum embedded app (the only app supported in v1). */\nexport const ETHEREUM_APP_NAME = \"Ethereum\";\n\nconst UNSUPPORTED: ContactsModelUnsupported = { supported: false };\n\nconst MIN_OS_VERSION_STAX = \"1.11.0\";\nconst MIN_OS_VERSION_FLEX = \"1.7.0\";\nconst MIN_OS_VERSION_APEX = \"1.2.0\";\nconst MIN_OS_VERSION_NANO_X = \"2.8.0\";\nconst MIN_OS_VERSION_NANO_SP = \"1.7.0\";\n\nconst MIN_ETHEREUM_APP_VERSION = \"1.23.0\";\n\n// TEMPORARY (DSDK-1481) \u2014 per-model cutoff below which the OS still requires the\n// EDIT CONTACT NAME derivation path. Each model's Address-Book-introducing OS\n// release shipped an rc2 that mandates the path (0x686A without it) and an rc3\n// that drops it (0x6A80 with it), so the cutoff is that release's `-rc3`. Only\n// Flex is hardware-confirmed (rc2 on a real device); the others follow the same\n// rc2/rc3 split per firmware \u2014 revise here if firmware says a model differs.\nconst RENAME_PATH_CUTOFF_STAX = `${MIN_OS_VERSION_STAX}-rc3`;\nconst RENAME_PATH_CUTOFF_FLEX = `${MIN_OS_VERSION_FLEX}-rc3`;\nconst RENAME_PATH_CUTOFF_APEX = `${MIN_OS_VERSION_APEX}-rc3`;\nconst RENAME_PATH_CUTOFF_NANO_X = `${MIN_OS_VERSION_NANO_X}-rc3`;\nconst RENAME_PATH_CUTOFF_NANO_SP = `${MIN_OS_VERSION_NANO_SP}-rc3`;\n\n/**\n * Contacts APDUs are supported on the touchscreen device models (Stax, Flex,\n * Apex) and on Nano X / Nano SP. Nano S does not support Contacts at all.\n */\nexport const CONTACTS_VERSION_REQUIREMENTS: ContactsVersionRequirements = {\n [DeviceModelId.NANO_S]: UNSUPPORTED,\n [DeviceModelId.NANO_SP]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_NANO_SP,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_NANO_SP,\n },\n [DeviceModelId.NANO_X]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_NANO_X,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_NANO_X,\n },\n [DeviceModelId.STAX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_STAX,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_STAX,\n },\n [DeviceModelId.FLEX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_FLEX,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_FLEX,\n },\n [DeviceModelId.APEX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_APEX,\n minAppVersion: { [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION },\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_APEX,\n },\n};\n\n/**\n * Resolve the Contacts version requirements for a device model \u2014 i.e. the\n * minimum supported OS and app versions, or that the model is unsupported.\n */\nexport function resolveContactsVersionRequirements(\n deviceModelId: DeviceModelId,\n): ContactsModelRequirement {\n return CONTACTS_VERSION_REQUIREMENTS[deviceModelId];\n}\n\n/**\n * Whether `actual` is greater than or equal to `minimum`, comparing as semver.\n * Tolerant of non-strict version strings and prerelease/build tags (coerces\n * both sides, which drops them) so a release candidate such as `1.7.0-rc2`\n * counts as meeting a `1.7.0` minimum. Returns `false` (i.e. requirement not\n * met) when either version cannot be parsed, so an unknown version never\n * passes a check.\n */\nexport function isVersionAtLeast(actual: string, minimum: string): boolean {\n const a = valid(coerce(actual));\n const b = valid(coerce(minimum));\n if (a === null || b === null) return false;\n return gte(a, b);\n}\n\n/**\n * Whether `actual` is strictly less than `boundary`, comparing as semver with\n * prerelease precedence preserved \u2014 unlike {@link isVersionAtLeast}, neither\n * side is coerced, so `1.7.0-rc2` sorts *below* `1.7.0-rc3` (and both below the\n * `1.7.0` release). Used to tell release candidates apart for the DSDK-1481\n * derivation-path cutoff, which `isVersionAtLeast` cannot do (it drops the\n * `-rcN` tag). Requires strict semver on both sides; returns `false` when\n * either cannot be parsed, so an unknown version is treated as *not* below the\n * boundary (i.e. the newer/GA payload shape).\n */\nexport function isVersionBelow(actual: string, boundary: string): boolean {\n const a = valid(actual);\n const b = valid(boundary);\n if (a === null || b === null) return false;\n return lt(a, b);\n}\n\n/**\n * TEMPORARY (DSDK-1481) \u2014 whether the EDIT CONTACT NAME (rename) payload must\n * carry the `DERIVATION_PATH` (tag 0x69) for a device on `osVersion`. True only\n * when the model is supported, declares a\n * {@link ContactsModelSupport.renameDerivationPathRequiredBelowOsVersion}\n * cutoff, and the fresh device OS version is strictly below that cutoff\n * (prerelease-aware). Callers pass the OS version read freshly from the device\n * (not the session state, which may be stale/absent on the dashboard path).\n */\nexport function renameRequiresDerivationPath(\n deviceModelId: DeviceModelId,\n osVersion: string,\n): boolean {\n const requirement = CONTACTS_VERSION_REQUIREMENTS[deviceModelId];\n if (!requirement.supported) return false;\n const cutoff = requirement.renameDerivationPathRequiredBelowOsVersion;\n if (cutoff === undefined) return false;\n return isVersionBelow(osVersion, cutoff);\n}\n"],
5
- "mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,UAAAC,EAAQ,OAAAC,EAAK,MAAAC,EAAI,SAAAC,MAAa,SAoDhC,MAAMC,EAAoB,WAE3BC,EAAwC,CAAE,UAAW,EAAM,EAE3DC,EAAsB,SACtBC,EAAsB,QACtBC,EAAsB,QACtBC,EAAwB,QACxBC,EAAyB,QAEzBC,EAA2B,SAQ3BC,EAA0B,GAAGN,CAAmB,OAChDO,EAA0B,GAAGN,CAAmB,OAChDO,EAA0B,GAAGN,CAAmB,OAChDO,EAA4B,GAAGN,CAAqB,OACpDO,EAA6B,GAAGN,CAAsB,OAM/CO,EAA6D,CACxE,CAAClB,EAAc,MAAM,EAAGM,EACxB,CAACN,EAAc,OAAO,EA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"names": ["DeviceModelId", "coerce", "gte", "lt", "valid", "ETHEREUM_APP_NAME", "UNSUPPORTED", "MIN_OS_VERSION_STAX", "MIN_OS_VERSION_FLEX", "MIN_OS_VERSION_APEX", "MIN_OS_VERSION_NANO_X", "MIN_OS_VERSION_NANO_SP", "MIN_ETHEREUM_APP_VERSION", "RENAME_PATH_CUTOFF_STAX", "RENAME_PATH_CUTOFF_FLEX", "RENAME_PATH_CUTOFF_APEX", "RENAME_PATH_CUTOFF_NANO_X", "RENAME_PATH_CUTOFF_NANO_SP", "CONTACTS_VERSION_REQUIREMENTS", "resolveContactsVersionRequirements", "deviceModelId", "isVersionAtLeast", "actual", "minimum", "a", "b", "isVersionBelow", "boundary", "renameRequiresDerivationPath", "osVersion", "requirement", "cutoff"]
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { coerce, gte, lt, valid } from \"semver\";\n\n/**\n * Version requirements for a device model on which Contacts (Address Book)\n * operations are supported.\n *\n * Contacts has two independent version axes:\n * - `minOsVersion` gates OS-owned operations (e.g. renaming a contact from the\n * device dashboard), which are served by the device OS.\n * - `minAppVersion` gates app-owned operations (registering / editing external\n * addresses and Ledger accounts), which are served by the embedded app. It is\n * keyed by app name because the required version differs per app.\n */\nexport type ContactsModelSupport = {\n readonly supported: true;\n readonly minOsVersion: string;\n readonly minAppVersion: Readonly<Record<string, string>>;\n /**\n * TEMPORARY (DSDK-1481) \u2014 the first OS build for this model that no longer\n * wants the `DERIVATION_PATH` (tag 0x69) on EDIT CONTACT NAME. Rename is\n * served by the OS, and OS builds *below* this version still require the path\n * (omitting it yields 0x686A), while this build and later reject it\n * (0x6A80). So the path is sent only when the device OS is below this\n * cutoff. Absent means the model never wanted the path (send nothing \u2014 the\n * GA end-state). Delete this field, its constants, and\n * {@link renameRequiresDerivationPath} once no in-the-field OS predates the\n * cutoff.\n */\n readonly renameDerivationPathRequiredBelowOsVersion?: string;\n};\n\n/** Marks a device model on which Contacts is not supported at all. */\nexport type ContactsModelUnsupported = {\n readonly supported: false;\n};\n\nexport type ContactsModelRequirement =\n | ContactsModelSupport\n | ContactsModelUnsupported;\n\n/**\n * The full, static Contacts version-requirement table, keyed by device model.\n * Serializable plain data with no runtime dependencies, so hosts (e.g. Ledger\n * Wallet) can import and consume it directly when composing their own\n * app-readiness checks, without duplicating the values.\n */\nexport type ContactsVersionRequirements = Readonly<\n Record<DeviceModelId, ContactsModelRequirement>\n>;\n\n/** Names of embedded apps supporting Contacts. */\nexport const ETHEREUM_APP_NAME = \"Ethereum\";\nexport const TRON_APP_NAME = \"Tron\";\n\nconst UNSUPPORTED: ContactsModelUnsupported = { supported: false };\n\nconst MIN_OS_VERSION_STAX = \"1.11.0\";\nconst MIN_OS_VERSION_FLEX = \"1.7.0\";\nconst MIN_OS_VERSION_APEX = \"1.2.0\";\nconst MIN_OS_VERSION_NANO_X = \"2.8.0\";\nconst MIN_OS_VERSION_NANO_SP = \"1.7.0\";\n\nconst MIN_ETHEREUM_APP_VERSION = \"1.23.0\";\nconst MIN_TRON_APP_VERSION = \"0.8.0\";\n\nconst MIN_APP_VERSION = {\n [ETHEREUM_APP_NAME]: MIN_ETHEREUM_APP_VERSION,\n [TRON_APP_NAME]: MIN_TRON_APP_VERSION,\n};\n\n// TEMPORARY (DSDK-1481) \u2014 per-model cutoff below which the OS still requires the\n// EDIT CONTACT NAME derivation path. Each model's Address-Book-introducing OS\n// release shipped an rc2 that mandates the path (0x686A without it) and an rc3\n// that drops it (0x6A80 with it), so the cutoff is that release's `-rc3`. Only\n// Flex is hardware-confirmed (rc2 on a real device); the others follow the same\n// rc2/rc3 split per firmware \u2014 revise here if firmware says a model differs.\nconst RENAME_PATH_CUTOFF_STAX = `${MIN_OS_VERSION_STAX}-rc3`;\nconst RENAME_PATH_CUTOFF_FLEX = `${MIN_OS_VERSION_FLEX}-rc3`;\nconst RENAME_PATH_CUTOFF_APEX = `${MIN_OS_VERSION_APEX}-rc3`;\nconst RENAME_PATH_CUTOFF_NANO_X = `${MIN_OS_VERSION_NANO_X}-rc3`;\nconst RENAME_PATH_CUTOFF_NANO_SP = `${MIN_OS_VERSION_NANO_SP}-rc3`;\n\n/**\n * Contacts APDUs are supported on the touchscreen device models (Stax, Flex,\n * Apex) and on Nano X / Nano SP. Nano S does not support Contacts at all.\n */\nexport const CONTACTS_VERSION_REQUIREMENTS: ContactsVersionRequirements = {\n [DeviceModelId.NANO_S]: UNSUPPORTED,\n [DeviceModelId.NANO_SP]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_NANO_SP,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_NANO_SP,\n },\n [DeviceModelId.NANO_X]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_NANO_X,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_NANO_X,\n },\n [DeviceModelId.STAX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_STAX,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_STAX,\n },\n [DeviceModelId.FLEX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_FLEX,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_FLEX,\n },\n [DeviceModelId.APEX]: {\n supported: true,\n minOsVersion: MIN_OS_VERSION_APEX,\n minAppVersion: MIN_APP_VERSION,\n renameDerivationPathRequiredBelowOsVersion: RENAME_PATH_CUTOFF_APEX,\n },\n};\n\n/**\n * Resolve the Contacts version requirements for a device model \u2014 i.e. the\n * minimum supported OS and app versions, or that the model is unsupported.\n */\nexport function resolveContactsVersionRequirements(\n deviceModelId: DeviceModelId,\n): ContactsModelRequirement {\n return CONTACTS_VERSION_REQUIREMENTS[deviceModelId];\n}\n\n/**\n * Whether `actual` is greater than or equal to `minimum`, comparing as semver.\n * Tolerant of non-strict version strings and prerelease/build tags (coerces\n * both sides, which drops them) so a release candidate such as `1.7.0-rc2`\n * counts as meeting a `1.7.0` minimum. Returns `false` (i.e. requirement not\n * met) when either version cannot be parsed, so an unknown version never\n * passes a check.\n */\nexport function isVersionAtLeast(actual: string, minimum: string): boolean {\n const a = valid(coerce(actual));\n const b = valid(coerce(minimum));\n if (a === null || b === null) return false;\n return gte(a, b);\n}\n\n/**\n * Whether `actual` is strictly less than `boundary`, comparing as semver with\n * prerelease precedence preserved \u2014 unlike {@link isVersionAtLeast}, neither\n * side is coerced, so `1.7.0-rc2` sorts *below* `1.7.0-rc3` (and both below the\n * `1.7.0` release). Used to tell release candidates apart for the DSDK-1481\n * derivation-path cutoff, which `isVersionAtLeast` cannot do (it drops the\n * `-rcN` tag). Requires strict semver on both sides; returns `false` when\n * either cannot be parsed, so an unknown version is treated as *not* below the\n * boundary (i.e. the newer/GA payload shape).\n */\nexport function isVersionBelow(actual: string, boundary: string): boolean {\n const a = valid(actual);\n const b = valid(boundary);\n if (a === null || b === null) return false;\n return lt(a, b);\n}\n\n/**\n * TEMPORARY (DSDK-1481) \u2014 whether the EDIT CONTACT NAME (rename) payload must\n * carry the `DERIVATION_PATH` (tag 0x69) for a device on `osVersion`. True only\n * when the model is supported, declares a\n * {@link ContactsModelSupport.renameDerivationPathRequiredBelowOsVersion}\n * cutoff, and the fresh device OS version is strictly below that cutoff\n * (prerelease-aware). Callers pass the OS version read freshly from the device\n * (not the session state, which may be stale/absent on the dashboard path).\n */\nexport function renameRequiresDerivationPath(\n deviceModelId: DeviceModelId,\n osVersion: string,\n): boolean {\n const requirement = CONTACTS_VERSION_REQUIREMENTS[deviceModelId];\n if (!requirement.supported) return false;\n const cutoff = requirement.renameDerivationPathRequiredBelowOsVersion;\n if (cutoff === undefined) return false;\n return isVersionBelow(osVersion, cutoff);\n}\n"],
5
+ "mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,UAAAC,EAAQ,OAAAC,EA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,EAAIvB,EAAMqB,CAAM,EAChBG,EAAIxB,EAAM0B,CAAQ,EACxB,OAAIH,IAAM,MAAQC,IAAM,KAAa,GAC9BzB,EAAGwB,EAAGC,CAAC,CAChB,CAWO,SAASG,EACdR,EACAS,EACS,CACT,MAAMC,EAAcZ,EAA8BE,CAAa,EAC/D,GAAI,CAACU,EAAY,UAAW,MAAO,GACnC,MAAMC,EAASD,EAAY,2CAC3B,OAAIC,IAAW,OAAkB,GAC1BL,EAAeG,EAAWE,CAAM,CACzC",
6
+ "names": ["DeviceModelId", "coerce", "gte", "lt", "valid", "ETHEREUM_APP_NAME", "TRON_APP_NAME", "UNSUPPORTED", "MIN_OS_VERSION_STAX", "MIN_OS_VERSION_FLEX", "MIN_OS_VERSION_APEX", "MIN_OS_VERSION_NANO_X", "MIN_OS_VERSION_NANO_SP", "MIN_ETHEREUM_APP_VERSION", "MIN_TRON_APP_VERSION", "MIN_APP_VERSION", "RENAME_PATH_CUTOFF_STAX", "RENAME_PATH_CUTOFF_FLEX", "RENAME_PATH_CUTOFF_APEX", "RENAME_PATH_CUTOFF_NANO_X", "RENAME_PATH_CUTOFF_NANO_SP", "CONTACTS_VERSION_REQUIREMENTS", "resolveContactsVersionRequirements", "deviceModelId", "isVersionAtLeast", "actual", "minimum", "a", "b", "isVersionBelow", "boundary", "renameRequiresDerivationPath", "osVersion", "requirement", "cutoff"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{DeviceModelId as e}from"@ledgerhq/device-management-kit";import{CONTACTS_VERSION_REQUIREMENTS as i,ETHEREUM_APP_NAME as n,isVersionAtLeast as t,isVersionBelow as r,renameRequiresDerivationPath as s,resolveContactsVersionRequirements as a}from"./ContactsVersionRequirements";describe("ContactsVersionRequirements",()=>{describe("resolveContactsVersionRequirements",()=>{it("marks every device model, supported or not",()=>{for(const o of Object.values(e))expect(i[o]).toBeDefined()}),it("reports Nano S as unsupported",()=>{expect(a(e.NANO_S)).toEqual({supported:!1})}),it("pins the minimum OS and app versions of every supported model",()=>{const o={[n]:"1.23.0"};expect(i).toEqual({[e.NANO_S]:{supported:!1},[e.NANO_SP]:{supported:!0,minOsVersion:"1.7.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"1.7.0-rc3"},[e.NANO_X]:{supported:!0,minOsVersion:"2.8.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"2.8.0-rc3"},[e.STAX]:{supported:!0,minOsVersion:"1.11.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"1.11.0-rc3"},[e.FLEX]:{supported:!0,minOsVersion:"1.7.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"1.7.0-rc3"},[e.APEX]:{supported:!0,minOsVersion:"1.2.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"1.2.0-rc3"}})})}),describe("isVersionAtLeast",()=>{it("compares versions as semver, inclusive of equality",()=>{expect(t("1.2.0","1.2.0")).toBe(!0),expect(t("1.3.0","1.2.0")).toBe(!0),expect(t("1.1.9","1.2.0")).toBe(!1)}),it("coerces non-strict version strings",()=>{expect(t("1.2","1.2.0")).toBe(!0)}),it("returns false when a version cannot be parsed",()=>{expect(t("not-a-version","1.2.0")).toBe(!1),expect(t("1.2.0","not-a-version")).toBe(!1)}),it("ignores prerelease and build tags when comparing to the minimum",()=>{expect(t("1.7.0-rc2","1.7.0")).toBe(!0),expect(t("1.23.0-dev","1.23.0")).toBe(!0)}),it("still fails a minimum strictly above the tagged version's core",()=>{expect(t("1.6.9-rc5","1.7.0")).toBe(!1)})}),describe("isVersionBelow",()=>{it("orders release candidates of the same core (unlike isVersionAtLeast)",()=>{expect(r("1.7.0-rc2","1.7.0-rc3")).toBe(!0),expect(r("1.7.0-rc3","1.7.0-rc3")).toBe(!1),expect(r("1.7.0-rc4","1.7.0-rc3")).toBe(!1)}),it("treats the final release as newer than any of its prereleases",()=>{expect(r("1.7.0","1.7.0-rc3")).toBe(!1)}),it("compares the release core when it differs",()=>{expect(r("1.6.9","1.7.0-rc3")).toBe(!0),expect(r("1.8.0","1.7.0-rc3")).toBe(!1)}),it("does not coerce, so a non-strict version is unparseable and returns false",()=>{expect(r("1.7","1.7.0-rc3")).toBe(!1),expect(r("not-a-version","1.7.0-rc3")).toBe(!1),expect(r("1.7.0-rc2","not-a-version")).toBe(!1)})}),describe("renameRequiresDerivationPath",()=>{it("requires the path below the model's cutoff (rc2) and not at/after it",()=>{expect(s(e.FLEX,"1.7.0-rc2")).toBe(!0),expect(s(e.FLEX,"1.7.0-rc3")).toBe(!1),expect(s(e.FLEX,"1.7.0")).toBe(!1),expect(s(e.FLEX,"1.8.0")).toBe(!1)}),it("applies the same rc2/rc3 split to the other supported models",()=>{expect(s(e.STAX,"1.11.0-rc2")).toBe(!0),expect(s(e.STAX,"1.11.0-rc3")).toBe(!1),expect(s(e.NANO_SP,"1.7.0-rc2")).toBe(!0)}),it("returns false for an unsupported model",()=>{expect(s(e.NANO_S,"1.7.0-rc2")).toBe(!1)}),it("returns false (no path) when the OS version is unparseable",()=>{expect(s(e.FLEX,"")).toBe(!1)})})});
1
+ import{DeviceModelId as e}from"@ledgerhq/device-management-kit";import{CONTACTS_VERSION_REQUIREMENTS as i,ETHEREUM_APP_NAME as n,isVersionAtLeast as t,isVersionBelow as r,renameRequiresDerivationPath as s,resolveContactsVersionRequirements as a,TRON_APP_NAME as c}from"./ContactsVersionRequirements";describe("ContactsVersionRequirements",()=>{describe("resolveContactsVersionRequirements",()=>{it("marks every device model, supported or not",()=>{for(const o of Object.values(e))expect(i[o]).toBeDefined()}),it("reports Nano S as unsupported",()=>{expect(a(e.NANO_S)).toEqual({supported:!1})}),it("pins the minimum OS and app versions of every supported model",()=>{const o={[n]:"1.23.0",[c]:"0.8.0"};expect(i).toEqual({[e.NANO_S]:{supported:!1},[e.NANO_SP]:{supported:!0,minOsVersion:"1.7.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"1.7.0-rc3"},[e.NANO_X]:{supported:!0,minOsVersion:"2.8.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"2.8.0-rc3"},[e.STAX]:{supported:!0,minOsVersion:"1.11.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"1.11.0-rc3"},[e.FLEX]:{supported:!0,minOsVersion:"1.7.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"1.7.0-rc3"},[e.APEX]:{supported:!0,minOsVersion:"1.2.0",minAppVersion:o,renameDerivationPathRequiredBelowOsVersion:"1.2.0-rc3"}})})}),describe("isVersionAtLeast",()=>{it("compares versions as semver, inclusive of equality",()=>{expect(t("1.2.0","1.2.0")).toBe(!0),expect(t("1.3.0","1.2.0")).toBe(!0),expect(t("1.1.9","1.2.0")).toBe(!1)}),it("coerces non-strict version strings",()=>{expect(t("1.2","1.2.0")).toBe(!0)}),it("returns false when a version cannot be parsed",()=>{expect(t("not-a-version","1.2.0")).toBe(!1),expect(t("1.2.0","not-a-version")).toBe(!1)}),it("ignores prerelease and build tags when comparing to the minimum",()=>{expect(t("1.7.0-rc2","1.7.0")).toBe(!0),expect(t("1.23.0-dev","1.23.0")).toBe(!0)}),it("still fails a minimum strictly above the tagged version's core",()=>{expect(t("1.6.9-rc5","1.7.0")).toBe(!1)})}),describe("isVersionBelow",()=>{it("orders release candidates of the same core (unlike isVersionAtLeast)",()=>{expect(r("1.7.0-rc2","1.7.0-rc3")).toBe(!0),expect(r("1.7.0-rc3","1.7.0-rc3")).toBe(!1),expect(r("1.7.0-rc4","1.7.0-rc3")).toBe(!1)}),it("treats the final release as newer than any of its prereleases",()=>{expect(r("1.7.0","1.7.0-rc3")).toBe(!1)}),it("compares the release core when it differs",()=>{expect(r("1.6.9","1.7.0-rc3")).toBe(!0),expect(r("1.8.0","1.7.0-rc3")).toBe(!1)}),it("does not coerce, so a non-strict version is unparseable and returns false",()=>{expect(r("1.7","1.7.0-rc3")).toBe(!1),expect(r("not-a-version","1.7.0-rc3")).toBe(!1),expect(r("1.7.0-rc2","not-a-version")).toBe(!1)})}),describe("renameRequiresDerivationPath",()=>{it("requires the path below the model's cutoff (rc2) and not at/after it",()=>{expect(s(e.FLEX,"1.7.0-rc2")).toBe(!0),expect(s(e.FLEX,"1.7.0-rc3")).toBe(!1),expect(s(e.FLEX,"1.7.0")).toBe(!1),expect(s(e.FLEX,"1.8.0")).toBe(!1)}),it("applies the same rc2/rc3 split to the other supported models",()=>{expect(s(e.STAX,"1.11.0-rc2")).toBe(!0),expect(s(e.STAX,"1.11.0-rc3")).toBe(!1),expect(s(e.NANO_SP,"1.7.0-rc2")).toBe(!0)}),it("returns false for an unsupported model",()=>{expect(s(e.NANO_S,"1.7.0-rc2")).toBe(!1)}),it("returns false (no path) when the OS version is unparseable",()=>{expect(s(e.FLEX,"")).toBe(!1)})})});
2
2
  //# sourceMappingURL=ContactsVersionRequirements.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/model/ContactsVersionRequirements.test.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\nimport {\n CONTACTS_VERSION_REQUIREMENTS,\n ETHEREUM_APP_NAME,\n isVersionAtLeast,\n isVersionBelow,\n renameRequiresDerivationPath,\n resolveContactsVersionRequirements,\n} from \"./ContactsVersionRequirements\";\n\ndescribe(\"ContactsVersionRequirements\", () => {\n describe(\"resolveContactsVersionRequirements\", () => {\n it(\"marks every device model, supported or not\", () => {\n for (const modelId of Object.values(DeviceModelId)) {\n expect(CONTACTS_VERSION_REQUIREMENTS[modelId]).toBeDefined();\n }\n });\n\n it(\"reports Nano S as unsupported\", () => {\n expect(resolveContactsVersionRequirements(DeviceModelId.NANO_S)).toEqual({\n supported: false,\n });\n });\n\n // Pins the minimums themselves, not just their shape: each OS version is\n // the release whose changelog introduces the Address Book feature, so a\n // change here has to be a deliberate one, reviewed against that release.\n it(\"pins the minimum OS and app versions of every supported model\", () => {\n const ethereum = { [ETHEREUM_APP_NAME]: \"1.23.0\" };\n\n expect(CONTACTS_VERSION_REQUIREMENTS).toEqual({\n [DeviceModelId.NANO_S]: { supported: false },\n [DeviceModelId.NANO_SP]: {\n supported: true,\n minOsVersion: \"1.7.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"1.7.0-rc3\",\n },\n [DeviceModelId.NANO_X]: {\n supported: true,\n minOsVersion: \"2.8.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"2.8.0-rc3\",\n },\n [DeviceModelId.STAX]: {\n supported: true,\n minOsVersion: \"1.11.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"1.11.0-rc3\",\n },\n [DeviceModelId.FLEX]: {\n supported: true,\n minOsVersion: \"1.7.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"1.7.0-rc3\",\n },\n [DeviceModelId.APEX]: {\n supported: true,\n minOsVersion: \"1.2.0\",\n minAppVersion: ethereum,\n renameDerivationPathRequiredBelowOsVersion: \"1.2.0-rc3\",\n },\n });\n });\n });\n\n describe(\"isVersionAtLeast\", () => {\n it(\"compares versions as semver, inclusive of equality\", () => {\n expect(isVersionAtLeast(\"1.2.0\", \"1.2.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.3.0\", \"1.2.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.1.9\", \"1.2.0\")).toBe(false);\n });\n\n it(\"coerces non-strict version strings\", () => {\n expect(isVersionAtLeast(\"1.2\", \"1.2.0\")).toBe(true);\n });\n\n it(\"returns false when a version cannot be parsed\", () => {\n expect(isVersionAtLeast(\"not-a-version\", \"1.2.0\")).toBe(false);\n expect(isVersionAtLeast(\"1.2.0\", \"not-a-version\")).toBe(false);\n });\n\n it(\"ignores prerelease and build tags when comparing to the minimum\", () => {\n expect(isVersionAtLeast(\"1.7.0-rc2\", \"1.7.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.23.0-dev\", \"1.23.0\")).toBe(true);\n });\n\n it(\"still fails a minimum strictly above the tagged version's core\", () => {\n expect(isVersionAtLeast(\"1.6.9-rc5\", \"1.7.0\")).toBe(false);\n });\n });\n\n describe(\"isVersionBelow\", () => {\n it(\"orders release candidates of the same core (unlike isVersionAtLeast)\", () => {\n // The whole reason this helper exists: rc2 must sort below rc3.\n expect(isVersionBelow(\"1.7.0-rc2\", \"1.7.0-rc3\")).toBe(true);\n expect(isVersionBelow(\"1.7.0-rc3\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"1.7.0-rc4\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"treats the final release as newer than any of its prereleases\", () => {\n expect(isVersionBelow(\"1.7.0\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"compares the release core when it differs\", () => {\n expect(isVersionBelow(\"1.6.9\", \"1.7.0-rc3\")).toBe(true);\n expect(isVersionBelow(\"1.8.0\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"does not coerce, so a non-strict version is unparseable and returns false\", () => {\n expect(isVersionBelow(\"1.7\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"not-a-version\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"1.7.0-rc2\", \"not-a-version\")).toBe(false);\n });\n });\n\n describe(\"renameRequiresDerivationPath\", () => {\n it(\"requires the path below the model's cutoff (rc2) and not at/after it\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0-rc2\"),\n ).toBe(true);\n expect(\n renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0-rc3\"),\n ).toBe(false);\n // GA and later never want the path.\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0\")).toBe(\n false,\n );\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.8.0\")).toBe(\n false,\n );\n });\n\n it(\"applies the same rc2/rc3 split to the other supported models\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.STAX, \"1.11.0-rc2\"),\n ).toBe(true);\n expect(\n renameRequiresDerivationPath(DeviceModelId.STAX, \"1.11.0-rc3\"),\n ).toBe(false);\n expect(\n renameRequiresDerivationPath(DeviceModelId.NANO_SP, \"1.7.0-rc2\"),\n ).toBe(true);\n });\n\n it(\"returns false for an unsupported model\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.NANO_S, \"1.7.0-rc2\"),\n ).toBe(false);\n });\n\n it(\"returns false (no path) when the OS version is unparseable\", () => {\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"\")).toBe(false);\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAE9B,OACE,iCAAAC,EACA,qBAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,gCAAAC,EACA,sCAAAC,MACK,gCAEP,SAAS,8BAA+B,IAAM,CAC5C,SAAS,qCAAsC,IAAM,CACnD,GAAG,6CAA8C,IAAM,CACrD,UAAWC,KAAW,OAAO,OAAOP,CAAa,EAC/C,OAAOC,EAA8BM,CAAO,CAAC,EAAE,YAAY,CAE/D,CAAC,EAED,GAAG,gCAAiC,IAAM,CACxC,OAAOD,EAAmCN,EAAc,MAAM,CAAC,EAAE,QAAQ,CACvE,UAAW,EACb,CAAC,CACH,CAAC,EAKD,GAAG,gEAAiE,IAAM,CACxE,MAAMQ,EAAW,CAAE,CAACN,CAAiB,EAAG,QAAS,EAEjD,OAAOD,CAA6B,EAAE,QAAQ,CAC5C,CAACD,EAAc,MAAM,EAAG,CAAE,UAAW,EAAM,EAC3C,CAACA,EAAc,OAAO,EAAG,CACvB,UAAW,GACX,aAAc,QACd,cAAeQ,EACf,2CAA4C,WAC9C,EACA,CAACR,EAAc,MAAM,EAAG,CACtB,UAAW,GACX,aAAc,QACd,cAAeQ,EACf,2CAA4C,WAC9C,EACA,CAACR,EAAc,IAAI,EAAG,CACpB,UAAW,GACX,aAAc,SACd,cAAeQ,EACf,2CAA4C,YAC9C,EACA,CAACR,EAAc,IAAI,EAAG,CACpB,UAAW,GACX,aAA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", "resolveContactsVersionRequirements", "modelId", "ethereum"]
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\nimport {\n CONTACTS_VERSION_REQUIREMENTS,\n ETHEREUM_APP_NAME,\n isVersionAtLeast,\n isVersionBelow,\n renameRequiresDerivationPath,\n resolveContactsVersionRequirements,\n TRON_APP_NAME,\n} from \"./ContactsVersionRequirements\";\n\ndescribe(\"ContactsVersionRequirements\", () => {\n describe(\"resolveContactsVersionRequirements\", () => {\n it(\"marks every device model, supported or not\", () => {\n for (const modelId of Object.values(DeviceModelId)) {\n expect(CONTACTS_VERSION_REQUIREMENTS[modelId]).toBeDefined();\n }\n });\n\n it(\"reports Nano S as unsupported\", () => {\n expect(resolveContactsVersionRequirements(DeviceModelId.NANO_S)).toEqual({\n supported: false,\n });\n });\n\n // Pins the minimums themselves, not just their shape: each OS version is\n // the release whose changelog introduces the Address Book feature, so a\n // change here has to be a deliberate one, reviewed against that release.\n it(\"pins the minimum OS and app versions of every supported model\", () => {\n const appVersions = {\n [ETHEREUM_APP_NAME]: \"1.23.0\",\n [TRON_APP_NAME]: \"0.8.0\",\n };\n\n expect(CONTACTS_VERSION_REQUIREMENTS).toEqual({\n [DeviceModelId.NANO_S]: { supported: false },\n [DeviceModelId.NANO_SP]: {\n supported: true,\n minOsVersion: \"1.7.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"1.7.0-rc3\",\n },\n [DeviceModelId.NANO_X]: {\n supported: true,\n minOsVersion: \"2.8.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"2.8.0-rc3\",\n },\n [DeviceModelId.STAX]: {\n supported: true,\n minOsVersion: \"1.11.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"1.11.0-rc3\",\n },\n [DeviceModelId.FLEX]: {\n supported: true,\n minOsVersion: \"1.7.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"1.7.0-rc3\",\n },\n [DeviceModelId.APEX]: {\n supported: true,\n minOsVersion: \"1.2.0\",\n minAppVersion: appVersions,\n renameDerivationPathRequiredBelowOsVersion: \"1.2.0-rc3\",\n },\n });\n });\n });\n\n describe(\"isVersionAtLeast\", () => {\n it(\"compares versions as semver, inclusive of equality\", () => {\n expect(isVersionAtLeast(\"1.2.0\", \"1.2.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.3.0\", \"1.2.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.1.9\", \"1.2.0\")).toBe(false);\n });\n\n it(\"coerces non-strict version strings\", () => {\n expect(isVersionAtLeast(\"1.2\", \"1.2.0\")).toBe(true);\n });\n\n it(\"returns false when a version cannot be parsed\", () => {\n expect(isVersionAtLeast(\"not-a-version\", \"1.2.0\")).toBe(false);\n expect(isVersionAtLeast(\"1.2.0\", \"not-a-version\")).toBe(false);\n });\n\n it(\"ignores prerelease and build tags when comparing to the minimum\", () => {\n expect(isVersionAtLeast(\"1.7.0-rc2\", \"1.7.0\")).toBe(true);\n expect(isVersionAtLeast(\"1.23.0-dev\", \"1.23.0\")).toBe(true);\n });\n\n it(\"still fails a minimum strictly above the tagged version's core\", () => {\n expect(isVersionAtLeast(\"1.6.9-rc5\", \"1.7.0\")).toBe(false);\n });\n });\n\n describe(\"isVersionBelow\", () => {\n it(\"orders release candidates of the same core (unlike isVersionAtLeast)\", () => {\n // The whole reason this helper exists: rc2 must sort below rc3.\n expect(isVersionBelow(\"1.7.0-rc2\", \"1.7.0-rc3\")).toBe(true);\n expect(isVersionBelow(\"1.7.0-rc3\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"1.7.0-rc4\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"treats the final release as newer than any of its prereleases\", () => {\n expect(isVersionBelow(\"1.7.0\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"compares the release core when it differs\", () => {\n expect(isVersionBelow(\"1.6.9\", \"1.7.0-rc3\")).toBe(true);\n expect(isVersionBelow(\"1.8.0\", \"1.7.0-rc3\")).toBe(false);\n });\n\n it(\"does not coerce, so a non-strict version is unparseable and returns false\", () => {\n expect(isVersionBelow(\"1.7\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"not-a-version\", \"1.7.0-rc3\")).toBe(false);\n expect(isVersionBelow(\"1.7.0-rc2\", \"not-a-version\")).toBe(false);\n });\n });\n\n describe(\"renameRequiresDerivationPath\", () => {\n it(\"requires the path below the model's cutoff (rc2) and not at/after it\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0-rc2\"),\n ).toBe(true);\n expect(\n renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0-rc3\"),\n ).toBe(false);\n // GA and later never want the path.\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.7.0\")).toBe(\n false,\n );\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"1.8.0\")).toBe(\n false,\n );\n });\n\n it(\"applies the same rc2/rc3 split to the other supported models\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.STAX, \"1.11.0-rc2\"),\n ).toBe(true);\n expect(\n renameRequiresDerivationPath(DeviceModelId.STAX, \"1.11.0-rc3\"),\n ).toBe(false);\n expect(\n renameRequiresDerivationPath(DeviceModelId.NANO_SP, \"1.7.0-rc2\"),\n ).toBe(true);\n });\n\n it(\"returns false for an unsupported model\", () => {\n expect(\n renameRequiresDerivationPath(DeviceModelId.NANO_S, \"1.7.0-rc2\"),\n ).toBe(false);\n });\n\n it(\"returns false (no path) when the OS version is unparseable\", () => {\n expect(renameRequiresDerivationPath(DeviceModelId.FLEX, \"\")).toBe(false);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAE9B,OACE,iCAAAC,EACA,qBAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,gCAAAC,EACA,sCAAAC,EACA,iBAAAC,MACK,gCAEP,SAAS,8BAA+B,IAAM,CA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EK,EAA6BL,EAAc,KAAM,WAAW,CAC9D,EAAE,KAAK,EAAK,EAEZ,OAAOK,EAA6BL,EAAc,KAAM,OAAO,CAAC,EAAE,KAChE,EACF,EACA,OAAOK,EAA6BL,EAAc,KAAM,OAAO,CAAC,EAAE,KAChE,EACF,CACF,CAAC,EAED,GAAG,+DAAgE,IAAM,CACvE,OACEK,EAA6BL,EAAc,KAAM,YAAY,CAC/D,EAAE,KAAK,EAAI,EACX,OACEK,EAA6BL,EAAc,KAAM,YAAY,CAC/D,EAAE,KAAK,EAAK,EACZ,OACEK,EAA6BL,EAAc,QAAS,WAAW,CACjE,EAAE,KAAK,EAAI,CACb,CAAC,EAED,GAAG,yCAA0C,IAAM,CACjD,OACEK,EAA6BL,EAAc,OAAQ,WAAW,CAChE,EAAE,KAAK,EAAK,CACd,CAAC,EAED,GAAG,6DAA8D,IAAM,CACrE,OAAOK,EAA6BL,EAAc,KAAM,EAAE,CAAC,EAAE,KAAK,EAAK,CACzE,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["DeviceModelId", "CONTACTS_VERSION_REQUIREMENTS", "ETHEREUM_APP_NAME", "isVersionAtLeast", "isVersionBelow", "renameRequiresDerivationPath", "resolveContactsVersionRequirements", "TRON_APP_NAME", "modelId", "appVersions"]
7
7
  }
@@ -1,2 +1,2 @@
1
- const o=176,_=16,t=1,x=32,C=3,A=4,E=224,T=46,e=0,n=64,r=32,c=32,s=32,N={bitcoin:0,ethereum:1,solana:2,polkadot:3,cosmos:4,cardano:5};export{N as BLOCKCHAIN_FAMILY_BY_NAME,o as CONTACTS_APDU_CLA,_ as CONTACTS_APDU_INS,n as GROUP_HANDLE_BYTES,s as HMAC_NAME_BYTES,r as HMAC_PROOF_BYTES,c as HMAC_REST_BYTES,E as RENAME_CONTACT_APDU_CLA,T as RENAME_CONTACT_APDU_INS,e as RENAME_CONTACT_P1,C as SUB_CMD_EDIT_IDENTIFIER,A as SUB_CMD_EDIT_SCOPE,x as SUB_CMD_PROVIDE_CONTACT,t as SUB_CMD_REGISTER_IDENTITY};
1
+ const o=176,_=16,t=1,x=32,C=3,A=4,E=224,T=46,e=0,n=64,r=32,c=32,s=32,N={bitcoin:0,ethereum:1,solana:2,polkadot:3,cosmos:4,cardano:5,tron:6};export{N as BLOCKCHAIN_FAMILY_BY_NAME,o as CONTACTS_APDU_CLA,_ as CONTACTS_APDU_INS,n as GROUP_HANDLE_BYTES,s as HMAC_NAME_BYTES,r as HMAC_PROOF_BYTES,c as HMAC_REST_BYTES,E as RENAME_CONTACT_APDU_CLA,T as RENAME_CONTACT_APDU_INS,e as RENAME_CONTACT_P1,C as SUB_CMD_EDIT_IDENTIFIER,A as SUB_CMD_EDIT_SCOPE,x as SUB_CMD_PROVIDE_CONTACT,t as SUB_CMD_REGISTER_IDENTITY};
2
2
  //# sourceMappingURL=contactsConstants.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/model/contactsConstants.ts"],
4
- "sourcesContent": ["/**\n * Protocol constants shared by the Contacts (Address Book) operations.\n *\n * Wire format and values follow the BOLOS SDK Address Book specification\n * (ledger-secure-sdk/app_features/address_book). Op-specific sub-command bytes\n * and response field sizes live here; TLV tags and struct-type bytes live in\n * {@link ./../services/contactsTlvSerializer}.\n */\n\n/** APDU class/instruction shared by every Address Book sub-command. */\nexport const CONTACTS_APDU_CLA = 0xb0;\nexport const CONTACTS_APDU_INS = 0x10;\n\n/** P1 sub-command selector for REGISTER IDENTITY (register external address). */\nexport const SUB_CMD_REGISTER_IDENTITY = 0x01;\n\n/** P1 sub-command selector for PROVIDE CONTACT (pre-signing decoration). */\nexport const SUB_CMD_PROVIDE_CONTACT = 0x20;\n\n/**\n * P1 sub-command selector for EDIT IDENTIFIER \u2014 an address-book app sub-command\n * (CLA 0xB0 / INS 0x10) served by the coin app, never OS-dispatched.\n */\nexport const SUB_CMD_EDIT_IDENTIFIER = 0x03;\n\n/**\n * P1 sub-command selector for EDIT SCOPE \u2014 an address-book app sub-command\n * (CLA 0xB0 / INS 0x10) served by the coin app, never OS-dispatched. Changes an\n * entry's scope while keeping its contact name and identifier.\n */\nexport const SUB_CMD_EDIT_SCOPE = 0x04;\n\n/**\n * EDIT CONTACT NAME (rename) is a blockchain-agnostic OS/dashboard command with\n * its own CLA/INS \u2014 NOT a sub-command of the address-book app APDU (0xB0/0x10).\n * The OS serves it directly, so it must run on the dashboard. P1 is a fixed\n * 0x00 (there is no sub-command selector for this command); P2 still carries the\n * chunk-continuation flag handled by {@link ./../services/sendFramedContactsPayload}.\n */\nexport const RENAME_CONTACT_APDU_CLA = 0xe0;\nexport const RENAME_CONTACT_APDU_INS = 0x2e;\nexport const RENAME_CONTACT_P1 = 0x00;\n\n/** Sizes (bytes) of the fields in the REGISTER IDENTITY final-chunk response. */\nexport const GROUP_HANDLE_BYTES = 64;\nexport const HMAC_PROOF_BYTES = 32;\nexport const HMAC_REST_BYTES = 32;\n\n/**\n * Size (bytes) of the rotated `hmac_name` returned on the EDIT CONTACT NAME\n * final-chunk response \u2014 the replacement group-level name proof.\n */\nexport const HMAC_NAME_BYTES = 32;\n\n/**\n * Blockchain-family byte encoded in the `BLOCKCHAIN_FAMILY` TLV, keyed by a\n * lowercase family name. v1 ships Ethereum only; the remaining families are\n * listed for completeness and will be enabled as their chains are supported.\n */\nexport const BLOCKCHAIN_FAMILY_BY_NAME: Readonly<Record<string, number>> = {\n bitcoin: 0x00,\n ethereum: 0x01,\n solana: 0x02,\n polkadot: 0x03,\n cosmos: 0x04,\n cardano: 0x05,\n};\n"],
5
- "mappings": "AAUO,MAAMA,EAAoB,IACpBC,EAAoB,GAGpBC,EAA4B,EAG5BC,EAA0B,GAM1BC,EAA0B,EAO1BC,EAAqB,EASrBC,EAA0B,IAC1BC,EAA0B,GAC1BC,EAAoB,EAGpBC,EAAqB,GACrBC,EAAmB,GACnBC,EAAkB,GAMlBC,EAAkB,GAOlBC,EAA8D,CACzE,QAAS,EACT,SAAU,EACV,OAAQ,EACR,SAAU,EACV,OAAQ,EACR,QAAS,CACX",
4
+ "sourcesContent": ["/**\n * Protocol constants shared by the Contacts (Address Book) operations.\n *\n * Wire format and values follow the BOLOS SDK Address Book specification\n * (ledger-secure-sdk/app_features/address_book). Op-specific sub-command bytes\n * and response field sizes live here; TLV tags and struct-type bytes live in\n * {@link ./../services/contactsTlvSerializer}.\n */\n\n/** APDU class/instruction shared by every Address Book sub-command. */\nexport const CONTACTS_APDU_CLA = 0xb0;\nexport const CONTACTS_APDU_INS = 0x10;\n\n/** P1 sub-command selector for REGISTER IDENTITY (register external address). */\nexport const SUB_CMD_REGISTER_IDENTITY = 0x01;\n\n/** P1 sub-command selector for PROVIDE CONTACT (pre-signing decoration). */\nexport const SUB_CMD_PROVIDE_CONTACT = 0x20;\n\n/**\n * P1 sub-command selector for EDIT IDENTIFIER \u2014 an address-book app sub-command\n * (CLA 0xB0 / INS 0x10) served by the coin app, never OS-dispatched.\n */\nexport const SUB_CMD_EDIT_IDENTIFIER = 0x03;\n\n/**\n * P1 sub-command selector for EDIT SCOPE \u2014 an address-book app sub-command\n * (CLA 0xB0 / INS 0x10) served by the coin app, never OS-dispatched. Changes an\n * entry's scope while keeping its contact name and identifier.\n */\nexport const SUB_CMD_EDIT_SCOPE = 0x04;\n\n/**\n * EDIT CONTACT NAME (rename) is a blockchain-agnostic OS/dashboard command with\n * its own CLA/INS \u2014 NOT a sub-command of the address-book app APDU (0xB0/0x10).\n * The OS serves it directly, so it must run on the dashboard. P1 is a fixed\n * 0x00 (there is no sub-command selector for this command); P2 still carries the\n * chunk-continuation flag handled by {@link ./../services/sendFramedContactsPayload}.\n */\nexport const RENAME_CONTACT_APDU_CLA = 0xe0;\nexport const RENAME_CONTACT_APDU_INS = 0x2e;\nexport const RENAME_CONTACT_P1 = 0x00;\n\n/** Sizes (bytes) of the fields in the REGISTER IDENTITY final-chunk response. */\nexport const GROUP_HANDLE_BYTES = 64;\nexport const HMAC_PROOF_BYTES = 32;\nexport const HMAC_REST_BYTES = 32;\n\n/**\n * Size (bytes) of the rotated `hmac_name` returned on the EDIT CONTACT NAME\n * final-chunk response \u2014 the replacement group-level name proof.\n */\nexport const HMAC_NAME_BYTES = 32;\n\n/**\n * Blockchain-family byte encoded in the `BLOCKCHAIN_FAMILY` TLV, keyed by a\n * lowercase family name. Values follow the BOLOS Address Book family enum\n * (`BlockchainFamily` in ragger / ledger-secure-sdk).\n */\nexport const BLOCKCHAIN_FAMILY_BY_NAME: Readonly<Record<string, number>> = {\n bitcoin: 0x00,\n ethereum: 0x01,\n solana: 0x02,\n polkadot: 0x03,\n cosmos: 0x04,\n cardano: 0x05,\n tron: 0x06,\n};\n"],
5
+ "mappings": "AAUO,MAAMA,EAAoB,IACpBC,EAAoB,GAGpBC,EAA4B,EAG5BC,EAA0B,GAM1BC,EAA0B,EAO1BC,EAAqB,EASrBC,EAA0B,IAC1BC,EAA0B,GAC1BC,EAAoB,EAGpBC,EAAqB,GACrBC,EAAmB,GACnBC,EAAkB,GAMlBC,EAAkB,GAOlBC,EAA8D,CACzE,QAAS,EACT,SAAU,EACV,OAAQ,EACR,SAAU,EACV,OAAQ,EACR,QAAS,EACT,KAAM,CACR",
6
6
  "names": ["CONTACTS_APDU_CLA", "CONTACTS_APDU_INS", "SUB_CMD_REGISTER_IDENTITY", "SUB_CMD_PROVIDE_CONTACT", "SUB_CMD_EDIT_IDENTIFIER", "SUB_CMD_EDIT_SCOPE", "RENAME_CONTACT_APDU_CLA", "RENAME_CONTACT_APDU_INS", "RENAME_CONTACT_P1", "GROUP_HANDLE_BYTES", "HMAC_PROOF_BYTES", "HMAC_REST_BYTES", "HMAC_NAME_BYTES", "BLOCKCHAIN_FAMILY_BY_NAME"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{bufferToHexaString as c,CommandResultFactory as i,CommandResultStatus as s}from"@ledgerhq/device-management-kit";import{ProvideContactCommand as p}from"../../app-binder/command/ProvideContactCommand";import{makeDeviceActionInternalApiMock as r}from"../../app-binder/device-action/__test-utils__/makeInternalApi";import{ContactsCommandError as f}from"../../app-binder/model/contactsErrors";import{buildProvideContactPayload as t,sendProvideContactPayload as d}from"./provideContact";const h=new Uint8Array(20).fill(17),C=new Uint8Array(64).fill(34),u=new Uint8Array(32).fill(51),y=new Uint8Array(32).fill(68),o={contactName:"Alice",scope:"Ethereum",identifier:h,groupHandle:C,hmacProof:u,hmacRest:y,blockchainFamily:"ethereum",chainId:1n},T="010133",x="020101",E="81f005416c696365",P="81f108457468657265756d",_="81f214"+"11".repeat(20),l="81f640"+"22".repeat(64),I="230101",g="510101",A="2920"+"33".repeat(32),b="81f720"+"44".repeat(32);describe("buildProvideContactPayload",()=>{it("encodes every tag in the order the spec lists",()=>{const e=t(o);expect(c(e,!1)).toBe(T+x+E+P+_+l+I+g+A+b)}),it("fits an Ethereum contact in a single 255-byte chunk",()=>{expect(t(o).length).toBeLessThanOrEqual(253)}),it("omits CHAIN_ID for a family that does not carry one",()=>{const e=t({...o,blockchainFamily:"bitcoin",chainId:void 0});expect(c(e,!1)).toContain(l+"510100")}),it("encodes a multi-byte chain id big-endian with no leading zeroes",()=>{const e=t({...o,chainId:8453n});expect(c(e,!1)).toContain("23022105")}),it("accepts the family name case-insensitively",()=>{expect(t({...o,blockchainFamily:"Ethereum"})).toStrictEqual(t(o))}),it("throws on an unknown blockchain family",()=>{expect(()=>t({...o,blockchainFamily:"dogecoin"})).toThrow("Unsupported blockchain family: dogecoin")})});describe("sendProvideContactPayload",()=>{it("sends one chunk under P2=0x00, prefixed with the 2-byte BE total length",async()=>{const e=r();e.sendCommand.mockResolvedValue(i({data:void 0}));const n=t(o),m=await d(e,{payload:n});expect(e.sendCommand).toHaveBeenCalledTimes(1);const a=e.sendCommand.mock.calls[0][0];expect(a).toBeInstanceOf(p),expect(a.args.p2).toBe(0),expect(a.args.data.slice(0,2)).toStrictEqual(Uint8Array.from([n.length>>8&255,n.length&255])),expect(a.args.data.slice(2)).toStrictEqual(n),expect(m.status).toBe(s.Success)}),it("propagates a device rejection instead of throwing",async()=>{const e=r();e.sendCommand.mockResolvedValue(i({error:new f({errorCode:"6982",message:"wrong seed"})}));const n=await d(e,{payload:t(o)});expect(n.status).toBe(s.Error)})});
1
+ import{bufferToHexaString as c,CommandResultFactory as i,CommandResultStatus as s}from"@ledgerhq/device-management-kit";import{ProvideContactCommand as p}from"../../app-binder/command/ProvideContactCommand";import{makeDeviceActionInternalApiMock as r}from"../../app-binder/device-action/__test-utils__/makeInternalApi";import{ContactsCommandError as f}from"../../app-binder/model/contactsErrors";import{buildProvideContactPayload as t,sendProvideContactPayload as d}from"./provideContact";const h=new Uint8Array(20).fill(17),C=new Uint8Array(64).fill(34),u=new Uint8Array(32).fill(51),y=new Uint8Array(32).fill(68),o={contactName:"Alice",scope:"Ethereum",identifier:h,groupHandle:C,hmacProof:u,hmacRest:y,blockchainFamily:"ethereum",chainId:1n},T="010133",x="020101",E="81f005416c696365",P="81f108457468657265756d",_="81f214"+"11".repeat(20),l="81f640"+"22".repeat(64),I="230101",g="510101",A="2920"+"33".repeat(32),R="81f720"+"44".repeat(32);describe("buildProvideContactPayload",()=>{it("encodes every tag in the order the spec lists",()=>{const e=t(o);expect(c(e,!1)).toBe(T+x+E+P+_+l+I+g+A+R)}),it("fits an Ethereum contact in a single 255-byte chunk",()=>{expect(t(o).length).toBeLessThanOrEqual(253)}),it("omits CHAIN_ID for a family that does not carry one",()=>{const e=t({...o,blockchainFamily:"tron",chainId:void 0});expect(c(e,!1)).toContain(l+"510106")}),it("encodes a multi-byte chain id big-endian with no leading zeroes",()=>{const e=t({...o,chainId:8453n});expect(c(e,!1)).toContain("23022105")}),it("accepts the family name case-insensitively",()=>{expect(t({...o,blockchainFamily:"Ethereum"})).toStrictEqual(t(o))}),it("throws on an unknown blockchain family",()=>{expect(()=>t({...o,blockchainFamily:"dogecoin"})).toThrow("Unsupported blockchain family: dogecoin")})});describe("sendProvideContactPayload",()=>{it("sends one chunk under P2=0x00, prefixed with the 2-byte BE total length",async()=>{const e=r();e.sendCommand.mockResolvedValue(i({data:void 0}));const n=t(o),m=await d(e,{payload:n});expect(e.sendCommand).toHaveBeenCalledTimes(1);const a=e.sendCommand.mock.calls[0][0];expect(a).toBeInstanceOf(p),expect(a.args.p2).toBe(0),expect(a.args.data.slice(0,2)).toStrictEqual(Uint8Array.from([n.length>>8&255,n.length&255])),expect(a.args.data.slice(2)).toStrictEqual(n),expect(m.status).toBe(s.Success)}),it("propagates a device rejection instead of throwing",async()=>{const e=r();e.sendCommand.mockResolvedValue(i({error:new f({errorCode:"6982",message:"wrong seed"})}));const n=await d(e,{payload:t(o)});expect(n.status).toBe(s.Error)})});
2
2
  //# sourceMappingURL=provideContact.test.js.map