@onekeyfe/hd-core 1.0.3 → 1.0.4-alpha.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.
@@ -1,3 +1,7 @@
1
1
  export declare const getSDKVersion: () => any;
2
2
  export declare const DEFAULT_DOMAIN: string;
3
+ export declare const whitelist: {
4
+ origin: string;
5
+ }[];
6
+ export declare const whitelistExtension: string[];
3
7
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/data/config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,WAAoB,CAAC;AAC/C,eAAO,MAAM,cAAc,QAAgD,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/data/config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,WAAoB,CAAC;AAC/C,eAAO,MAAM,cAAc,QAAgD,CAAC;AAE5E,eAAO,MAAM,SAAS;;GAOrB,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAG9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"connectSettings.d.ts","sourceRoot":"","sources":["../../src/data-manager/connectSettings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAkB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/D,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAGlC,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,kBAAkB,EAAE,MAAM,CAAC;CAChC;AAkBD,eAAO,MAAM,MAAM,4DAqBlB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,MAAM,uBAKzC,CAAC;AAEF,eAAO,MAAM,oBAAoB,WAAW,QAAQ,eAAe,CAAC,oBAyDnE,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"connectSettings.d.ts","sourceRoot":"","sources":["../../src/data-manager/connectSettings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAkB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/D,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAGlC,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,kBAAkB,EAAE,MAAM,CAAC;CAChC;AAmBD,eAAO,MAAM,MAAM,4DAqBlB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,MAAM,uBAKzC,CAAC;AAEF,eAAO,MAAM,oBAAoB,WAAW,QAAQ,eAAe,CAAC,oBA2DnE,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -172,6 +172,7 @@ type ConnectSettings = {
172
172
  isFrame?: boolean;
173
173
  preRelease?: boolean;
174
174
  fetchConfig?: boolean;
175
+ extension?: string;
175
176
  };
176
177
  type IVersionArray = [number, number, number];
177
178
  type ILocale = 'zh-CN' | 'en-US';
@@ -2564,6 +2565,10 @@ declare const isBleConnect: (env: string) => boolean;
2564
2565
  declare const wait: (ms: number) => Promise<unknown>;
2565
2566
 
2566
2567
  declare const getSDKVersion: () => any;
2568
+ declare const whitelist: {
2569
+ origin: string;
2570
+ }[];
2571
+ declare const whitelistExtension: string[];
2567
2572
 
2568
2573
  declare const DEFAULT_PRIORITY = 2;
2569
2574
  declare global {
@@ -2577,4 +2582,4 @@ declare const HardwareSdk: ({ init, call, dispose, eventEmitter, uiResponse, can
2577
2582
  declare const HardwareSDKLowLevel: ({ init, call, dispose, eventEmitter, addHardwareGlobalEventListener, uiResponse, cancel, updateSettings, }: LowLevelInjectApi) => LowLevelCoreApi;
2578
2583
  declare const HardwareTopLevelSdk: () => CoreApi;
2579
2584
 
2580
- export { AccountAddress, AccountAddresses, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesPayload, DeviceFirmwareRange, DeviceFlagsParams, DeviceModelToTypes, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendSupportFeatures, DeviceSettingsParams, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceTypeToModels, DeviceUploadResourceParams, DeviceVerifyParams, DeviceVerifySignature, DnxAddress, DnxGetAddressParams, DnxSignTransactionParams, DnxSignature, DnxTxKey, EOneKeyDeviceMode, EVMAccessList, EVMAddress, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProgress, FirmwareRange, FirmwareRelease$1 as FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, HardwareSDKLowLevel, HardwareTopLevelSdk, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, IVersionRange, KaspaAddress, KaspaGetAddressParams, KaspaSignInputParams, KaspaSignOutputParams, KaspaSignTransactionParams, KaspaSignature, KnownDevice, LOG, LOG_EVENT, LogBlockEvent, LogEvent, LogEventMessage, LogOutput, LoggerNames, LowLevelCoreApi, LowLevelInjectApi, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, NervosAddress, NervosGetAddressParams, NervosSignTransactionParams, NervosSignedTx, NexaAddress, NexaGetAddressParams, NexaSignInputParams, NexaSignOutputParams, NexaSignTransactionParams, NexaSignature, OnekeyFeatures, Params, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, Response, SearchDevice, SignedTransaction, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignMessageParams, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TopLevelInjectApi, TransactionOptions, TransportReleaseStatus, TronAddress, TronDelegateResourceContract, TronFreezeBalanceV2Contract, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceV2Contract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBootForClassicAndMini, checkNeedUpdateBootForTouch, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createResponseMessage, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, getDeviceBLEFirmwareVersion, getDeviceBleName, getDeviceBoardloaderVersion, getDeviceBootloaderVersion, getDeviceFirmwareVersion, getDeviceLabel, getDeviceType, getDeviceTypeByBleName, getDeviceUUID, getEnv, getFirmwareUpdateField, getHDPath, getHomeScreenHex, getLog, getLogger, getMethodVersionRange, getOutputScriptType, getSDKVersion, getScriptType, getTimeStamp, httpRequest, init as initCore, isBleConnect, isValidVersionArray, isValidVersionString, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, versionCompare, versionSplit, wait };
2585
+ export { AccountAddress, AccountAddresses, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesPayload, DeviceFirmwareRange, DeviceFlagsParams, DeviceModelToTypes, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendSupportFeatures, DeviceSettingsParams, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceTypeToModels, DeviceUploadResourceParams, DeviceVerifyParams, DeviceVerifySignature, DnxAddress, DnxGetAddressParams, DnxSignTransactionParams, DnxSignature, DnxTxKey, EOneKeyDeviceMode, EVMAccessList, EVMAddress, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProgress, FirmwareRange, FirmwareRelease$1 as FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, HardwareSDKLowLevel, HardwareTopLevelSdk, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, IVersionRange, KaspaAddress, KaspaGetAddressParams, KaspaSignInputParams, KaspaSignOutputParams, KaspaSignTransactionParams, KaspaSignature, KnownDevice, LOG, LOG_EVENT, LogBlockEvent, LogEvent, LogEventMessage, LogOutput, LoggerNames, LowLevelCoreApi, LowLevelInjectApi, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, NervosAddress, NervosGetAddressParams, NervosSignTransactionParams, NervosSignedTx, NexaAddress, NexaGetAddressParams, NexaSignInputParams, NexaSignOutputParams, NexaSignTransactionParams, NexaSignature, OnekeyFeatures, Params, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, Response, SearchDevice, SignedTransaction, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignMessageParams, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TopLevelInjectApi, TransactionOptions, TransportReleaseStatus, TronAddress, TronDelegateResourceContract, TronFreezeBalanceV2Contract, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceV2Contract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBootForClassicAndMini, checkNeedUpdateBootForTouch, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createResponseMessage, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, getDeviceBLEFirmwareVersion, getDeviceBleName, getDeviceBoardloaderVersion, getDeviceBootloaderVersion, getDeviceFirmwareVersion, getDeviceLabel, getDeviceType, getDeviceTypeByBleName, getDeviceUUID, getEnv, getFirmwareUpdateField, getHDPath, getHomeScreenHex, getLog, getLogger, getMethodVersionRange, getOutputScriptType, getSDKVersion, getScriptType, getTimeStamp, httpRequest, init as initCore, isBleConnect, isValidVersionArray, isValidVersionString, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, versionCompare, versionSplit, wait, whitelist, whitelistExtension };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAkB,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE3D,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AAExB,QAAA,MAAM,WAAW,+EAQd,SAAS,KAAG,OASX,CAAC;AAEL,QAAA,MAAM,mBAAmB,+GAStB,iBAAiB,KAAG,eAUnB,CAAC;AAEL,QAAA,MAAM,mBAAmB,QAAO,OAA2B,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;AAEpD,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAkB,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE3D,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE9D,QAAA,MAAM,WAAW,+EAQd,SAAS,KAAG,OASX,CAAC;AAEL,QAAA,MAAM,mBAAmB,+GAStB,iBAAiB,KAAG,eAUnB,CAAC;AAEL,QAAA,MAAM,mBAAmB,QAAO,OAA2B,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;AAEpD,eAAe,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -23239,7 +23239,7 @@ const findLatestRelease = (releases) => {
23239
23239
  return leastRelease;
23240
23240
  };
23241
23241
 
23242
- var _a;
23242
+ var _a$1;
23243
23243
  class DataManager {
23244
23244
  static load(settings) {
23245
23245
  return __awaiter(this, void 0, void 0, function* () {
@@ -23290,7 +23290,7 @@ class DataManager {
23290
23290
  return this.settings;
23291
23291
  }
23292
23292
  }
23293
- _a = DataManager;
23293
+ _a$1 = DataManager;
23294
23294
  DataManager.deviceMap = {
23295
23295
  classic: {
23296
23296
  firmware: [],
@@ -23332,7 +23332,7 @@ DataManager.getFirmwareStatus = (features) => {
23332
23332
  return 'unknown';
23333
23333
  }
23334
23334
  const firmwareUpdateField = getFirmwareUpdateField({ features, updateType: 'firmware' });
23335
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23335
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23336
23336
  const currentVersion = deviceFirmwareVersion.join('.');
23337
23337
  return getReleaseStatus(targetDeviceConfigList, currentVersion);
23338
23338
  };
@@ -23346,7 +23346,7 @@ DataManager.getSysResourcesLatestRelease = (features, forcedUpdateRes) => {
23346
23346
  features,
23347
23347
  updateType: 'firmware',
23348
23348
  });
23349
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23349
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23350
23350
  const currentVersion = deviceFirmwareVersion.join('.');
23351
23351
  const targetDeviceConfig = targetDeviceConfigList.filter(item => forcedUpdateRes
23352
23352
  ? !!item.resource
@@ -23364,7 +23364,7 @@ DataManager.getSysFullResource = (features) => {
23364
23364
  features,
23365
23365
  updateType: 'firmware',
23366
23366
  });
23367
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23367
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23368
23368
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.fullResource);
23369
23369
  return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.fullResource;
23370
23370
  };
@@ -23379,7 +23379,7 @@ DataManager.getBootloaderResource = (features) => {
23379
23379
  features,
23380
23380
  updateType: 'firmware',
23381
23381
  });
23382
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23382
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23383
23383
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
23384
23384
  return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.bootloaderResource;
23385
23385
  };
@@ -23392,7 +23392,7 @@ DataManager.getBootloaderTargetVersion = (features) => {
23392
23392
  features,
23393
23393
  updateType: 'firmware',
23394
23394
  });
23395
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23395
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23396
23396
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
23397
23397
  return (_e = (_d = targetDeviceConfig === null || targetDeviceConfig === void 0 ? void 0 : targetDeviceConfig[0]) === null || _d === void 0 ? void 0 : _d.bootloaderVersion) !== null && _e !== void 0 ? _e : undefined;
23398
23398
  };
@@ -23407,7 +23407,7 @@ DataManager.getBootloaderRelatedFirmwareVersion = (features) => {
23407
23407
  features,
23408
23408
  updateType: 'firmware',
23409
23409
  });
23410
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23410
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23411
23411
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderRelatedFirmwareVersion);
23412
23412
  return (_e = (_d = targetDeviceConfig === null || targetDeviceConfig === void 0 ? void 0 : targetDeviceConfig[0]) === null || _d === void 0 ? void 0 : _d.bootloaderRelatedFirmwareVersion) !== null && _e !== void 0 ? _e : undefined;
23413
23413
  };
@@ -23421,7 +23421,7 @@ DataManager.getFirmwareChangelog = (features) => {
23421
23421
  features,
23422
23422
  updateType: 'firmware',
23423
23423
  });
23424
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23424
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23425
23425
  if (features.firmware_present === false ||
23426
23426
  (DeviceModelToTypes.model_classic.includes(deviceType) && features.bootloader_mode)) {
23427
23427
  return getReleaseChangelog(targetDeviceConfigList, '0.0.0');
@@ -23438,12 +23438,12 @@ DataManager.getFirmwareLatestRelease = (features) => {
23438
23438
  features,
23439
23439
  updateType: 'firmware',
23440
23440
  });
23441
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23441
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
23442
23442
  const target = findLatestRelease(targetDeviceConfigList);
23443
23443
  if (!target)
23444
23444
  return target;
23445
23445
  if (!target.resource) {
23446
- const resource = _a.getSysResourcesLatestRelease(features);
23446
+ const resource = _a$1.getSysResourcesLatestRelease(features);
23447
23447
  return Object.assign(Object.assign({}, target), { resource });
23448
23448
  }
23449
23449
  return target;
@@ -23457,7 +23457,7 @@ DataManager.getBLEFirmwareStatus = (features) => {
23457
23457
  if (!deviceBLEFirmwareVersion) {
23458
23458
  return 'none';
23459
23459
  }
23460
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
23460
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
23461
23461
  const currentVersion = deviceBLEFirmwareVersion.join('.');
23462
23462
  return getReleaseStatus(targetDeviceConfigList, currentVersion);
23463
23463
  };
@@ -23470,7 +23470,7 @@ DataManager.getBleFirmwareChangelog = (features) => {
23470
23470
  if (!deviceBLEFirmwareVersion) {
23471
23471
  return [];
23472
23472
  }
23473
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
23473
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
23474
23474
  const currentVersion = deviceBLEFirmwareVersion.join('.');
23475
23475
  return getReleaseChangelog(targetDeviceConfigList, currentVersion);
23476
23476
  };
@@ -23479,12 +23479,12 @@ DataManager.getBleFirmwareLatestRelease = (features) => {
23479
23479
  const deviceType = getDeviceType(features);
23480
23480
  if (deviceType === 'unknown')
23481
23481
  return undefined;
23482
- const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
23482
+ const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
23483
23483
  return findLatestRelease(targetDeviceConfigList);
23484
23484
  };
23485
23485
  DataManager.getTransportStatus = (localVersion) => {
23486
23486
  var _b, _c;
23487
- const latestTransportVersion = (_c = (_b = _a.assets) === null || _b === void 0 ? void 0 : _b.bridge) === null || _c === void 0 ? void 0 : _c.version;
23487
+ const latestTransportVersion = (_c = (_b = _a$1.assets) === null || _b === void 0 ? void 0 : _b.bridge) === null || _c === void 0 ? void 0 : _c.version;
23488
23488
  if (!latestTransportVersion)
23489
23489
  return 'valid';
23490
23490
  const isLatest = semver__default["default"].gte(localVersion, latestTransportVersion.join('.'));
@@ -23644,7 +23644,17 @@ const fixFeaturesFirmwareVersion = (features) => {
23644
23644
  const pkg = require('../package.json');
23645
23645
  const getSDKVersion = () => pkg.version;
23646
23646
  const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${getSDKVersion()}/`;
23647
+ const whitelist = [
23648
+ { origin: 'file://' },
23649
+ { origin: '1key.so' },
23650
+ { origin: 'onekey.so' },
23651
+ { origin: 'onekeycn.com' },
23652
+ ];
23653
+ const whitelistExtension = [
23654
+ 'fgddkaglmpbfaaeoldjafejilhdijpmi',
23655
+ ];
23647
23656
 
23657
+ var _a;
23648
23658
  const DEFAULT_PRIORITY = 2;
23649
23659
  const initialSettings = {
23650
23660
  configSrc: './data/config.json',
@@ -23655,6 +23665,7 @@ const initialSettings = {
23655
23665
  connectSrc: DEFAULT_DOMAIN,
23656
23666
  iframeSrc: `${DEFAULT_DOMAIN}iframe.html`,
23657
23667
  parentOrigin: typeof window !== 'undefined' && window.location ? window.location.origin : '',
23668
+ extension: ((_a = chrome === null || chrome === void 0 ? void 0 : chrome.runtime) === null || _a === void 0 ? void 0 : _a.id) || '',
23658
23669
  supportedBrowser: typeof navigator !== 'undefined' ? !/Trident|MSIE|Edge/.test(navigator.userAgent) : true,
23659
23670
  env: 'web',
23660
23671
  lazyLoad: false,
@@ -23688,6 +23699,7 @@ const corsValidator = (url) => {
23688
23699
  return url;
23689
23700
  };
23690
23701
  const parseConnectSettings = (input = {}) => {
23702
+ console.log('=====>>>>> parseConnectSettings: ', input);
23691
23703
  const settings = Object.assign({}, initialSettings);
23692
23704
  if (Object.prototype.hasOwnProperty.call(input, 'debug')) {
23693
23705
  settings.debug = input.debug;
@@ -34105,3 +34117,5 @@ exports.supportInputPinOnSoftware = supportInputPinOnSoftware;
34105
34117
  exports.versionCompare = versionCompare;
34106
34118
  exports.versionSplit = versionSplit;
34107
34119
  exports.wait = wait;
34120
+ exports.whitelist = whitelist;
34121
+ exports.whitelistExtension = whitelistExtension;
@@ -17,6 +17,7 @@ export type ConnectSettings = {
17
17
  isFrame?: boolean;
18
18
  preRelease?: boolean;
19
19
  fetchConfig?: boolean;
20
+ extension?: string;
20
21
  };
21
22
  export type IVersionArray = [number, number, number];
22
23
  export type ILocale = 'zh-CN' | 'en-US';
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/types/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,cAAc,GAAG,UAAU,GAAG,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAC;IAC3F,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EA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,MAAM,aAAa,GAAG;KACzB,CAAC,IAAI,YAAY,GAAG;QACnB,QAAQ,EAAE,oBAAoB,EAAE,CAAC;QACjC,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;QACvC,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;QACvC,GAAG,EAAE,uBAAuB,EAAE,CAAC;KAChC;CACF,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE;QACN,OAAO,EAAE,aAAa,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE;aACR,CAAC,IAAI,OAAO,GAAG,MAAM;SACvB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC7B,GAAG,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.0.3",
3
+ "version": "1.0.4-alpha.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "^1.0.3",
29
- "@onekeyfe/hd-transport": "^1.0.3",
28
+ "@onekeyfe/hd-shared": "^1.0.4-alpha.0",
29
+ "@onekeyfe/hd-transport": "^1.0.4-alpha.0",
30
30
  "axios": "^0.27.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "bytebuffer": "^5.0.1",
@@ -44,5 +44,5 @@
44
44
  "@types/semver": "^7.3.9",
45
45
  "ripple-keypairs": "^1.1.4"
46
46
  },
47
- "gitHead": "4eadcfe0493b10d37b6e46e59fc41a24409a6d70"
47
+ "gitHead": "4b7f6956bcb5c2570c62ae796e314f1335404786"
48
48
  }
@@ -3,3 +3,17 @@ const pkg = require('../package.json');
3
3
 
4
4
  export const getSDKVersion = () => pkg.version;
5
5
  export const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${getSDKVersion()}/`;
6
+
7
+ export const whitelist = [
8
+ // Electron local file
9
+ { origin: 'file://' },
10
+ // OneKey App
11
+ { origin: '1key.so' },
12
+ { origin: 'onekey.so' },
13
+ { origin: 'onekeycn.com' },
14
+ ];
15
+
16
+ export const whitelistExtension = [
17
+ // OneKey
18
+ 'fgddkaglmpbfaaeoldjafejilhdijpmi',
19
+ ];
@@ -20,6 +20,7 @@ const initialSettings: ConnectSettings = {
20
20
  connectSrc: DEFAULT_DOMAIN,
21
21
  iframeSrc: `${DEFAULT_DOMAIN}iframe.html`,
22
22
  parentOrigin: typeof window !== 'undefined' && window.location ? window.location.origin : '',
23
+ extension: chrome?.runtime?.id || '',
23
24
  supportedBrowser:
24
25
  typeof navigator !== 'undefined' ? !/Trident|MSIE|Edge/.test(navigator.userAgent) : true,
25
26
  env: 'web',
@@ -58,6 +59,8 @@ export const corsValidator = (url?: string) => {
58
59
  };
59
60
 
60
61
  export const parseConnectSettings = (input: Partial<ConnectSettings> = {}) => {
62
+ console.log('=====>>>>> parseConnectSettings: ', input);
63
+
61
64
  const settings: ConnectSettings = { ...initialSettings };
62
65
 
63
66
  if (Object.prototype.hasOwnProperty.call(input, 'debug')) {
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export * from './utils';
13
13
  export * from './data-manager';
14
14
  export * from './events';
15
15
  export * from './types';
16
+ export { whitelist, whitelistExtension } from './data/config';
16
17
 
17
18
  const HardwareSdk = ({
18
19
  init,
@@ -19,6 +19,7 @@ export type ConnectSettings = {
19
19
  isFrame?: boolean;
20
20
  preRelease?: boolean;
21
21
  fetchConfig?: boolean;
22
+ extension?: string;
22
23
  };
23
24
 
24
25
  export type IVersionArray = [number, number, number];