@onekeyfe/onekey-btc-provider 2.2.68-alpha.0 → 2.2.69

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.
@@ -56,6 +56,13 @@ declare class ProviderBtc extends ProviderBtcBase implements IProviderBtc {
56
56
  }): Promise<string[]>;
57
57
  pushPsbt(psbtHex: string): Promise<string>;
58
58
  inscribeTransfer(ticker: string, amount: string): Promise<string>;
59
+ /**
60
+ * @experimental May change in future versions.
61
+ * Derive a deterministic 32-byte value from the wallet's key material via
62
+ * HKDF-SHA-256. The wallet backend handles validation, user approval, and
63
+ * the actual derivation.
64
+ */
65
+ deriveContextHash(appName: string, context: string): Promise<string>;
59
66
  getVersion(): Promise<string>;
60
67
  on<E extends ProviderEvents>(event: E, listener: ProviderEventsMap[E]): this;
61
68
  off<E extends ProviderEvents>(event: E, listener: ProviderEventsMap[E]): this;
@@ -319,6 +319,23 @@ class ProviderBtc extends ProviderBtcBase {
319
319
  });
320
320
  });
321
321
  }
322
+ /**
323
+ * @experimental May change in future versions.
324
+ * Derive a deterministic 32-byte value from the wallet's key material via
325
+ * HKDF-SHA-256. The wallet backend handles validation, user approval, and
326
+ * the actual derivation.
327
+ */
328
+ deriveContextHash(appName, context) {
329
+ return __awaiter(this, void 0, void 0, function* () {
330
+ return this._request({
331
+ method: ProviderMethods.DERIVE_CONTEXT_HASH,
332
+ params: {
333
+ appName,
334
+ context,
335
+ },
336
+ });
337
+ });
338
+ }
322
339
  getVersion() {
323
340
  return __awaiter(this, void 0, void 0, function* () {
324
341
  return Promise.resolve('1.4.10');
@@ -324,6 +324,23 @@ class ProviderBtc extends ProviderBtcBase_1.ProviderBtcBase {
324
324
  });
325
325
  });
326
326
  }
327
+ /**
328
+ * @experimental May change in future versions.
329
+ * Derive a deterministic 32-byte value from the wallet's key material via
330
+ * HKDF-SHA-256. The wallet backend handles validation, user approval, and
331
+ * the actual derivation.
332
+ */
333
+ deriveContextHash(appName, context) {
334
+ return __awaiter(this, void 0, void 0, function* () {
335
+ return this._request({
336
+ method: types_1.ProviderMethods.DERIVE_CONTEXT_HASH,
337
+ params: {
338
+ appName,
339
+ context,
340
+ },
341
+ });
342
+ });
343
+ }
327
344
  getVersion() {
328
345
  return __awaiter(this, void 0, void 0, function* () {
329
346
  return Promise.resolve('1.4.10');
package/dist/cjs/types.js CHANGED
@@ -40,4 +40,10 @@ var ProviderMethods;
40
40
  ProviderMethods["GET_NETWORK_FEES"] = "getNetworkFees";
41
41
  ProviderMethods["GET_UTXOS"] = "getUtxos";
42
42
  ProviderMethods["GET_BTC_TIP_HEIGHT"] = "getBTCTipHeight";
43
+ /**
44
+ * @experimental Derive a deterministic 32-byte value from the wallet's key
45
+ * material via HKDF-SHA-256. The wallet backend handles validation, user
46
+ * approval, and the actual derivation.
47
+ */
48
+ ProviderMethods["DERIVE_CONTEXT_HASH"] = "deriveContextHash";
43
49
  })(ProviderMethods || (exports.ProviderMethods = ProviderMethods = {}));
package/dist/types.d.ts CHANGED
@@ -76,7 +76,13 @@ export declare enum ProviderMethods {
76
76
  */
77
77
  GET_NETWORK_FEES = "getNetworkFees",
78
78
  GET_UTXOS = "getUtxos",
79
- GET_BTC_TIP_HEIGHT = "getBTCTipHeight"
79
+ GET_BTC_TIP_HEIGHT = "getBTCTipHeight",
80
+ /**
81
+ * @experimental Derive a deterministic 32-byte value from the wallet's key
82
+ * material via HKDF-SHA-256. The wallet backend handles validation, user
83
+ * approval, and the actual derivation.
84
+ */
85
+ DERIVE_CONTEXT_HASH = "deriveContextHash"
80
86
  }
81
87
  export type OneKeyBtcProviderProps = IInpageProviderConfig & {
82
88
  timeout?: number;
@@ -148,6 +154,24 @@ export interface IProviderBtc extends ProviderBtcBase {
148
154
  }): Promise<string[]>;
149
155
  pushPsbt(psbt: string): Promise<string>;
150
156
  inscribeTransfer(ticker: string, amount: string): Promise<string>;
157
+ /**
158
+ * @experimental Deterministic 32-byte value derived from the connected
159
+ * address's key material via HKDF-SHA-256. Output is per-public-key:
160
+ * the same connected address always produces the same value; different
161
+ * connected addresses (different public keys) produce different values.
162
+ * Cross-wallet portable — any conforming wallet produces the same value
163
+ * for the same connected public key + appName + context.
164
+ *
165
+ * Supported on HD (mnemonic / xpriv) software accounts. Hardware, QR,
166
+ * watching-only, and external accounts are not yet supported (need
167
+ * firmware-side derivation). Requires user approval — the wallet shows
168
+ * the application name, context bytes, and bound address before deriving.
169
+ *
170
+ * @param appName - 1-64 bytes, `[a-z0-9-]` only.
171
+ * @param context - lowercase hex, even-length, no `0x` prefix, ≤ 2048 chars.
172
+ * @returns 64-char lowercase hex string.
173
+ */
174
+ deriveContextHash(appName: string, context: string): Promise<string>;
151
175
  }
152
176
  /**
153
177
  * Add support for the Babylon BTC wallet provider.
package/dist/types.js CHANGED
@@ -37,4 +37,10 @@ export var ProviderMethods;
37
37
  ProviderMethods["GET_NETWORK_FEES"] = "getNetworkFees";
38
38
  ProviderMethods["GET_UTXOS"] = "getUtxos";
39
39
  ProviderMethods["GET_BTC_TIP_HEIGHT"] = "getBTCTipHeight";
40
+ /**
41
+ * @experimental Derive a deterministic 32-byte value from the wallet's key
42
+ * material via HKDF-SHA-256. The wallet backend handles validation, user
43
+ * approval, and the actual derivation.
44
+ */
45
+ ProviderMethods["DERIVE_CONTEXT_HASH"] = "deriveContextHash";
40
46
  })(ProviderMethods || (ProviderMethods = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/onekey-btc-provider",
3
- "version": "2.2.68-alpha.0",
3
+ "version": "2.2.69",
4
4
  "keywords": [
5
5
  "cross-inpage-provider"
6
6
  ],
@@ -27,10 +27,10 @@
27
27
  "start": "tsc --watch"
28
28
  },
29
29
  "dependencies": {
30
- "@onekeyfe/cross-inpage-provider-core": "2.2.68-alpha.0",
31
- "@onekeyfe/cross-inpage-provider-errors": "2.2.68-alpha.0",
32
- "@onekeyfe/cross-inpage-provider-types": "2.2.68-alpha.0",
33
- "@onekeyfe/extension-bridge-injected": "2.2.68-alpha.0"
30
+ "@onekeyfe/cross-inpage-provider-core": "2.2.69",
31
+ "@onekeyfe/cross-inpage-provider-errors": "2.2.69",
32
+ "@onekeyfe/cross-inpage-provider-types": "2.2.69",
33
+ "@onekeyfe/extension-bridge-injected": "2.2.69"
34
34
  },
35
- "gitHead": "7788c790f4d387ff754ba35114eaeaa7486211c3"
35
+ "gitHead": "7485565ca9007ea5f82518980d86e89178e4429c"
36
36
  }