@ledgerhq/live-common 21.32.3 → 21.32.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/families/bitcoin/wallet-btc/wallet.integration.test.js +1 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/wallet.integration.test.js.map +1 -1
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.js +26 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.js.map +1 -1
- package/lib/apps/hw.d.ts.map +1 -1
- package/lib/apps/hw.js +4 -3
- package/lib/apps/hw.js.map +1 -1
- package/lib/env.d.ts +10 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +5 -0
- package/lib/env.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/errors.d.ts +3 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +3 -2
- package/lib/errors.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bip32.js +2 -2
- package/lib/families/bitcoin/wallet-btc/crypto/bip32.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts +2 -2
- package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zec.js +37 -16
- package/lib/families/bitcoin/wallet-btc/crypto/zec.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts +0 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zen.js +46 -24
- package/lib/families/bitcoin/wallet-btc/crypto/zen.js.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.js +4 -0
- package/lib/families/ethereum/speculos-deviceActions.js.map +1 -1
- package/lib/families/solana/test-dataset.d.ts.map +1 -1
- package/lib/families/solana/test-dataset.js +1 -2
- package/lib/families/solana/test-dataset.js.map +1 -1
- package/lib/families/tezos/synchronisation.d.ts.map +1 -1
- package/lib/families/tezos/synchronisation.js +2 -0
- package/lib/families/tezos/synchronisation.js.map +1 -1
- package/lib/featureFlags/FeatureToggle.js +2 -2
- package/lib/featureFlags/FeatureToggle.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -1
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/types.d.ts +1 -1
- package/lib/featureFlags/types.d.ts.map +1 -1
- package/lib/hw/connectManager.d.ts.map +1 -1
- package/lib/hw/connectManager.js +5 -0
- package/lib/hw/connectManager.js.map +1 -1
- package/lib/hw/getDeviceInfo.d.ts.map +1 -1
- package/lib/hw/getDeviceInfo.js +17 -3
- package/lib/hw/getDeviceInfo.js.map +1 -1
- package/lib/platform/PlatformAppProvider/helpers.d.ts +1 -0
- package/lib/platform/PlatformAppProvider/helpers.d.ts.map +1 -1
- package/lib/platform/PlatformAppProvider/helpers.js +23 -1
- package/lib/platform/PlatformAppProvider/helpers.js.map +1 -1
- package/lib/platform/PlatformAppProvider/index.d.ts.map +1 -1
- package/lib/platform/PlatformAppProvider/index.js +2 -1
- package/lib/platform/PlatformAppProvider/index.js.map +1 -1
- package/lib/types/manager.d.ts +5 -3
- package/lib/types/manager.d.ts.map +1 -1
- package/lib/types/manager.js +4 -3
- package/lib/types/manager.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +109 -0
- package/src/__tests__/families/bitcoin/wallet-btc/wallet.integration.test.ts +2 -0
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.ts +31 -0
- package/src/apps/hw.ts +4 -3
- package/src/env.ts +5 -0
- package/src/errors.ts +1 -0
- package/src/families/bitcoin/wallet-btc/crypto/bip32.ts +2 -2
- package/src/families/bitcoin/wallet-btc/crypto/zec.ts +19 -19
- package/src/families/bitcoin/wallet-btc/crypto/zen.ts +26 -27
- package/src/families/ethereum/speculos-deviceActions.ts +4 -0
- package/src/families/solana/test-dataset.ts +3 -4
- package/src/families/tezos/synchronisation.ts +2 -0
- package/src/featureFlags/FeatureToggle.tsx +2 -2
- package/src/featureFlags/defaultFeatures.ts +1 -1
- package/src/featureFlags/types.ts +1 -1
- package/src/hw/connectManager.ts +6 -0
- package/src/hw/getDeviceInfo.ts +18 -1
- package/src/platform/PlatformAppProvider/helpers.ts +29 -0
- package/src/platform/PlatformAppProvider/index.tsx +3 -2
- package/src/types/manager.ts +5 -3
- package/src/.DS_Store +0 -0
- package/src/__tests__/.DS_Store +0 -0
package/src/hw/connectManager.ts
CHANGED
|
@@ -12,6 +12,7 @@ import getDeviceInfo from "./getDeviceInfo";
|
|
|
12
12
|
import getAppAndVersion from "./getAppAndVersion";
|
|
13
13
|
import appSupportsQuitApp from "../appSupportsQuitApp";
|
|
14
14
|
import { isDashboardName } from "./isDashboardName";
|
|
15
|
+
import { DeviceNotOnboarded } from "../errors";
|
|
15
16
|
import type { AppAndVersion } from "./connectApp";
|
|
16
17
|
import quitApp from "./quitApp";
|
|
17
18
|
export type Input = {
|
|
@@ -77,6 +78,11 @@ const cmd = ({
|
|
|
77
78
|
concatMap((deviceInfo) => {
|
|
78
79
|
timeoutSub.unsubscribe();
|
|
79
80
|
|
|
81
|
+
// FIXME Until we have proper flagging of the onboarded status.
|
|
82
|
+
if (!deviceInfo.onboarded) {
|
|
83
|
+
throw new DeviceNotOnboarded();
|
|
84
|
+
}
|
|
85
|
+
|
|
80
86
|
if (deviceInfo.isBootloader) {
|
|
81
87
|
return of({
|
|
82
88
|
type: "bootloader",
|
package/src/hw/getDeviceInfo.ts
CHANGED
|
@@ -10,6 +10,7 @@ import getAppAndVersion from "./getAppAndVersion";
|
|
|
10
10
|
import type { DeviceInfo } from "../types/manager";
|
|
11
11
|
import { PROVIDERS } from "../manager/provider";
|
|
12
12
|
import { isDashboardName } from "./isDashboardName";
|
|
13
|
+
import { DeviceNotOnboarded } from "../errors";
|
|
13
14
|
const ManagerAllowedFlag = 0x08;
|
|
14
15
|
const PinValidatedFlag = 0x80;
|
|
15
16
|
export default async function getDeviceInfo(
|
|
@@ -37,7 +38,16 @@ export default async function getDeviceInfo(
|
|
|
37
38
|
throw new DeviceOnDashboardExpected();
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
const res = await getVersion(transport)
|
|
41
|
+
const res = await getVersion(transport).catch((e) => {
|
|
42
|
+
if (e instanceof TransportStatusError) {
|
|
43
|
+
// @ts-expect-error typescript not checking agains the instanceof
|
|
44
|
+
if (e.statusCode === 0x6d06) {
|
|
45
|
+
throw new DeviceNotOnboarded();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
throw e;
|
|
49
|
+
});
|
|
50
|
+
|
|
41
51
|
const {
|
|
42
52
|
isBootloader,
|
|
43
53
|
rawVersion,
|
|
@@ -57,6 +67,12 @@ export default async function getDeviceInfo(
|
|
|
57
67
|
const flag = flags.length > 0 ? flags[0] : 0;
|
|
58
68
|
const managerAllowed = !!(flag & ManagerAllowedFlag);
|
|
59
69
|
const pinValidated = !!(flag & PinValidatedFlag);
|
|
70
|
+
|
|
71
|
+
// FIXME Until we have proper flagging of the onboarded status.
|
|
72
|
+
let onboarded = true;
|
|
73
|
+
if (flags.length === 4) {
|
|
74
|
+
onboarded = !!(flags[0] & 0x04);
|
|
75
|
+
}
|
|
60
76
|
log(
|
|
61
77
|
"hw",
|
|
62
78
|
"deviceInfo: se@" +
|
|
@@ -79,5 +95,6 @@ export default async function getDeviceInfo(
|
|
|
79
95
|
isBootloader,
|
|
80
96
|
managerAllowed,
|
|
81
97
|
pinValidated,
|
|
98
|
+
onboarded,
|
|
82
99
|
};
|
|
83
100
|
}
|
|
@@ -6,6 +6,7 @@ export type FilterParams = {
|
|
|
6
6
|
private?: boolean;
|
|
7
7
|
version?: string;
|
|
8
8
|
};
|
|
9
|
+
import { getEnv } from "../../env";
|
|
9
10
|
|
|
10
11
|
function matchVersion(filterParams: FilterParams, manifest: AppManifest) {
|
|
11
12
|
return (
|
|
@@ -52,3 +53,31 @@ export function mergeManifestLists(
|
|
|
52
53
|
const newIds = new Set(list2.map((elem) => elem.id));
|
|
53
54
|
return [...list1.filter((elem) => !newIds.has(elem.id)), ...list2];
|
|
54
55
|
}
|
|
56
|
+
|
|
57
|
+
export const initializeLocalManifest = (): Map<string, AppManifest> => {
|
|
58
|
+
const localManifestJsonRaw: string | null | undefined = getEnv(
|
|
59
|
+
"PLATFORM_LOCAL_MANIFEST_JSON"
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (!localManifestJsonRaw) {
|
|
63
|
+
return new Map();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
const manifest: AppManifest | [AppManifest] =
|
|
68
|
+
JSON.parse(localManifestJsonRaw);
|
|
69
|
+
|
|
70
|
+
const manifestArray = Array.isArray(manifest) ? manifest : [manifest];
|
|
71
|
+
|
|
72
|
+
const map = new Map(manifestArray.map((m) => [m.id, m]));
|
|
73
|
+
|
|
74
|
+
return map;
|
|
75
|
+
} catch (error) {
|
|
76
|
+
/**
|
|
77
|
+
* Probable error during `JSON.parse` call, log error and return empty map
|
|
78
|
+
* as if env variable was not defined
|
|
79
|
+
*/
|
|
80
|
+
console.error(error);
|
|
81
|
+
return new Map();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
@@ -9,11 +9,12 @@ import React, {
|
|
|
9
9
|
import type { PlatformAppContextType, Props, State } from "./types";
|
|
10
10
|
import api from "./api";
|
|
11
11
|
import type { AppManifest } from "../types";
|
|
12
|
+
import { initializeLocalManifest } from "./helpers";
|
|
12
13
|
|
|
13
14
|
// @ts-expect-error empty object creates an error
|
|
14
15
|
const PlatformAppContext = createContext<PlatformAppContextType>({});
|
|
15
16
|
const initialState: State = {
|
|
16
|
-
localManifests:
|
|
17
|
+
localManifests: initializeLocalManifest(),
|
|
17
18
|
remoteManifests: new Map(),
|
|
18
19
|
isLoading: false,
|
|
19
20
|
lastUpdateTime: undefined,
|
|
@@ -28,7 +29,7 @@ export function PlatformAppProvider({
|
|
|
28
29
|
autoUpdateDelay,
|
|
29
30
|
platformAppsServerURL,
|
|
30
31
|
children,
|
|
31
|
-
}: Props) {
|
|
32
|
+
}: Props): JSX.Element {
|
|
32
33
|
const [state, setState] = useState<State>(initialState);
|
|
33
34
|
|
|
34
35
|
const addLocalManifest = useCallback((manifest: AppManifest) => {
|
package/src/types/manager.ts
CHANGED
|
@@ -30,6 +30,7 @@ export type DeviceInfo = {
|
|
|
30
30
|
mcuBlVersion?: string;
|
|
31
31
|
mcuTargetId?: number;
|
|
32
32
|
seTargetId?: number;
|
|
33
|
+
onboarded?: boolean;
|
|
33
34
|
};
|
|
34
35
|
export type DeviceModelInfo = {
|
|
35
36
|
modelId: DeviceModelId;
|
|
@@ -155,9 +156,10 @@ export type Application = {
|
|
|
155
156
|
compatibleWalletsJSON: string | null | undefined;
|
|
156
157
|
};
|
|
157
158
|
export enum AppType {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
app = "app",
|
|
160
|
+
plugin = "plugin",
|
|
161
|
+
tool = "tool",
|
|
162
|
+
swap = "swap",
|
|
161
163
|
}
|
|
162
164
|
// App is higher level on top of Application and ApplicationVersion
|
|
163
165
|
// with all fields Live needs and in normalized form (but still serializable)
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/__tests__/.DS_Store
DELETED
|
Binary file
|