@neuraiproject/neurai-sign-esp32 0.5.5 → 0.5.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/README.md CHANGED
@@ -494,7 +494,8 @@ Main class for device interaction.
494
494
  |---|---|
495
495
  | `connect()` | Open USB Serial connection (browser dialog) |
496
496
  | `disconnect()` | Close connection |
497
- | `getInfo()` | Get device info incl. `key_type` (no confirmation) |
497
+ | `ping()` | Detect/handshake the device (no confirmation, no wallet-identifying data) — use this to enumerate devices |
498
+ | `getInfo()` | Get device info incl. `key_type` (**requires confirmation** on consent-model firmware) |
498
499
  | `getAddress()` | Get address + pubkey (requires confirmation); derives the address from the pubkey + mode (legacy or PQ) |
499
500
  | `getBip32Pubkey()` | Get account xpub (requires confirmation) |
500
501
  | `signPsbt(base64)` | Sign a PSBT (requires confirmation) |
@@ -12934,8 +12934,30 @@ var NeuraiSignESP32Bundle = (function () {
12934
12934
  this.deviceInfo = null;
12935
12935
  await this.serial.close();
12936
12936
  }
12937
+ /**
12938
+ * Detect the device without prompting the owner. `ping` (alias `device_info`)
12939
+ * answers immediately, requires NO on-device confirmation and returns nothing
12940
+ * that identifies the wallet (no fingerprint, address, pubkey or network) — so
12941
+ * it is safe to poll. Use this to enumerate/handshake a NeuraiHW device; use
12942
+ * {@link getInfo} (behind on-device approval) for the actual wallet data.
12943
+ *
12944
+ * Throws on firmware too old to know `ping` (it replies `Unknown action`);
12945
+ * callers that must support such firmware can catch and fall back to `getInfo`.
12946
+ */
12947
+ async ping() {
12948
+ // `ping` replies instantly (no user approval), so a short timeout is enough.
12949
+ const response = await this.serial.sendCommand({ action: "ping" }, 5000);
12950
+ this.assertSuccess(response);
12951
+ return response;
12952
+ }
12953
+ /**
12954
+ * Read the device's wallet info (network, key_type, master fingerprint, address,
12955
+ * pubkey). As of the consent-model firmware this REQUIRES on-device approval and
12956
+ * the device waits up to 30 s for it, so the timeout must accommodate that wait —
12957
+ * do not use `getInfo` merely to detect the device; use {@link ping} for that.
12958
+ */
12937
12959
  async getInfo() {
12938
- const response = await this.serial.sendCommand({ action: "info" }, 5000);
12960
+ const response = await this.serial.sendCommand({ action: "info" }, 35000);
12939
12961
  this.assertSuccess(response);
12940
12962
  this.deviceInfo = response;
12941
12963
  return this.deviceInfo;
package/dist/browser.js CHANGED
@@ -12931,8 +12931,30 @@ class NeuraiESP32 {
12931
12931
  this.deviceInfo = null;
12932
12932
  await this.serial.close();
12933
12933
  }
12934
+ /**
12935
+ * Detect the device without prompting the owner. `ping` (alias `device_info`)
12936
+ * answers immediately, requires NO on-device confirmation and returns nothing
12937
+ * that identifies the wallet (no fingerprint, address, pubkey or network) — so
12938
+ * it is safe to poll. Use this to enumerate/handshake a NeuraiHW device; use
12939
+ * {@link getInfo} (behind on-device approval) for the actual wallet data.
12940
+ *
12941
+ * Throws on firmware too old to know `ping` (it replies `Unknown action`);
12942
+ * callers that must support such firmware can catch and fall back to `getInfo`.
12943
+ */
12944
+ async ping() {
12945
+ // `ping` replies instantly (no user approval), so a short timeout is enough.
12946
+ const response = await this.serial.sendCommand({ action: "ping" }, 5000);
12947
+ this.assertSuccess(response);
12948
+ return response;
12949
+ }
12950
+ /**
12951
+ * Read the device's wallet info (network, key_type, master fingerprint, address,
12952
+ * pubkey). As of the consent-model firmware this REQUIRES on-device approval and
12953
+ * the device waits up to 30 s for it, so the timeout must accommodate that wait —
12954
+ * do not use `getInfo` merely to detect the device; use {@link ping} for that.
12955
+ */
12934
12956
  async getInfo() {
12935
- const response = await this.serial.sendCommand({ action: "info" }, 5000);
12957
+ const response = await this.serial.sendCommand({ action: "info" }, 35000);
12936
12958
  this.assertSuccess(response);
12937
12959
  this.deviceInfo = response;
12938
12960
  return this.deviceInfo;
package/dist/index.cjs CHANGED
@@ -12933,8 +12933,30 @@ class NeuraiESP32 {
12933
12933
  this.deviceInfo = null;
12934
12934
  await this.serial.close();
12935
12935
  }
12936
+ /**
12937
+ * Detect the device without prompting the owner. `ping` (alias `device_info`)
12938
+ * answers immediately, requires NO on-device confirmation and returns nothing
12939
+ * that identifies the wallet (no fingerprint, address, pubkey or network) — so
12940
+ * it is safe to poll. Use this to enumerate/handshake a NeuraiHW device; use
12941
+ * {@link getInfo} (behind on-device approval) for the actual wallet data.
12942
+ *
12943
+ * Throws on firmware too old to know `ping` (it replies `Unknown action`);
12944
+ * callers that must support such firmware can catch and fall back to `getInfo`.
12945
+ */
12946
+ async ping() {
12947
+ // `ping` replies instantly (no user approval), so a short timeout is enough.
12948
+ const response = await this.serial.sendCommand({ action: "ping" }, 5000);
12949
+ this.assertSuccess(response);
12950
+ return response;
12951
+ }
12952
+ /**
12953
+ * Read the device's wallet info (network, key_type, master fingerprint, address,
12954
+ * pubkey). As of the consent-model firmware this REQUIRES on-device approval and
12955
+ * the device waits up to 30 s for it, so the timeout must accommodate that wait —
12956
+ * do not use `getInfo` merely to detect the device; use {@link ping} for that.
12957
+ */
12936
12958
  async getInfo() {
12937
- const response = await this.serial.sendCommand({ action: "info" }, 5000);
12959
+ const response = await this.serial.sendCommand({ action: "info" }, 35000);
12938
12960
  this.assertSuccess(response);
12939
12961
  this.deviceInfo = response;
12940
12962
  return this.deviceInfo;
package/dist/index.d.ts CHANGED
@@ -81,6 +81,22 @@ interface IBuildAssetTransferDisplayMetadataOptions {
81
81
  feeAmount?: number | string;
82
82
  baseCurrency?: string;
83
83
  }
84
+ /**
85
+ * Lightweight device handshake returned by `ping` / `device_info`. Safe to poll:
86
+ * it requires NO on-device confirmation and returns nothing that identifies the
87
+ * wallet (no fingerprint, address, pubkey or network). Use it to detect/enumerate
88
+ * a NeuraiHW device; use {@link IDeviceInfo} (via `getInfo`, behind on-device
89
+ * approval) for the actual wallet data.
90
+ */
91
+ interface IPingResponse {
92
+ status: string;
93
+ device: string;
94
+ /** Protocol/app version (matches `info`'s `version`). */
95
+ version: string;
96
+ /** Firmware version (ping-only; not returned by `info`). */
97
+ firmware_version: string;
98
+ chip: string;
99
+ }
84
100
  interface IDeviceInfo {
85
101
  status: string;
86
102
  device: string;
@@ -162,7 +178,7 @@ interface IProcessingResponse {
162
178
  status: "processing";
163
179
  stage: string;
164
180
  }
165
- type DeviceResponse = IDeviceInfo | IAddressResponse | IBip32PubkeyResponse | ISignPsbtResponse | ISignTxResponse | ISignMessageResponse | IErrorResponse | IProcessingResponse;
181
+ type DeviceResponse = IPingResponse | IDeviceInfo | IAddressResponse | IBip32PubkeyResponse | ISignPsbtResponse | ISignTxResponse | ISignMessageResponse | IErrorResponse | IProcessingResponse;
166
182
  /**
167
183
  * Message-level transport consumed by {@link NeuraiESP32}. This is the only
168
184
  * surface the device class depends on, so any platform (Web Serial, React
@@ -299,6 +315,23 @@ declare class NeuraiESP32 {
299
315
  get info(): IDeviceInfo | null;
300
316
  connect(): Promise<void>;
301
317
  disconnect(): Promise<void>;
318
+ /**
319
+ * Detect the device without prompting the owner. `ping` (alias `device_info`)
320
+ * answers immediately, requires NO on-device confirmation and returns nothing
321
+ * that identifies the wallet (no fingerprint, address, pubkey or network) — so
322
+ * it is safe to poll. Use this to enumerate/handshake a NeuraiHW device; use
323
+ * {@link getInfo} (behind on-device approval) for the actual wallet data.
324
+ *
325
+ * Throws on firmware too old to know `ping` (it replies `Unknown action`);
326
+ * callers that must support such firmware can catch and fall back to `getInfo`.
327
+ */
328
+ ping(): Promise<IPingResponse>;
329
+ /**
330
+ * Read the device's wallet info (network, key_type, master fingerprint, address,
331
+ * pubkey). As of the consent-model firmware this REQUIRES on-device approval and
332
+ * the device waits up to 30 s for it, so the timeout must accommodate that wait —
333
+ * do not use `getInfo` merely to detect the device; use {@link ping} for that.
334
+ */
302
335
  getInfo(): Promise<IDeviceInfo>;
303
336
  /**
304
337
  * Retrieve the device's address (requires physical confirmation).
@@ -686,4 +719,4 @@ interface IPQSighashOptions {
686
719
  declare function pqAuthScriptSighash(options: IPQSighashOptions): Buffer;
687
720
 
688
721
  export { DEFAULT_WITNESS_SCRIPT_HEX, MAX_OUTPUTS, MAX_PQ_INPUTS, NeuraiESP32, PQ_AUTH_TYPE, SIGHASH_ALL, SerialConnection, SerialProtocol, WebSerialByteChannel, buildAssetTransferDisplayMetadata, buildPSBT, buildPSBTFromRawTransaction, buildUnsignedPQTransaction, decodeAddress, encodeDestinationScript, extractPQWitness, finalizePSBT, finalizeSignedPSBT, getNetwork, getPQNetworkParams, isPQAddress, neuraiLegacyMainnet, neuraiLegacyTestnet, neuraiMainnet, neuraiPQMainnet, neuraiPQTestnet, neuraiTestnet, parseSignedPQTransaction, pqAddressFromPublicKey, pqAuthDescriptor, pqAuthScriptSighash, pqCommitment, publicKeyToAddress, resolveNetwork, validatePSBT };
689
- export type { DecodedAddress, IAddressResponse, IAssetTransferDisplayMetadata, IBip32PubkeyResponse, IBuildAssetTransferDisplayMetadataOptions, IBuildPSBTFromRawOptions, IBuildPSBTOptions, IBuildUnsignedPQTxOptions, IByteChannel, IDeviceInfo, IErrorResponse, INeuraiTransport, IPQSighashOptions, IPQSignInput, IPQUTXO, IPQWitness, IPSBTInputMetadata, ISerialOptions, ISignMessageResponse, ISignPsbtResponse, ISignResult, ISignTxResponse, ISigningDisplayMetadata, ITxOutput, IUTXO, IUnsignedPQTx, KeyType, Network, NetworkType, PQNetworkParams };
722
+ export type { DecodedAddress, IAddressResponse, IAssetTransferDisplayMetadata, IBip32PubkeyResponse, IBuildAssetTransferDisplayMetadataOptions, IBuildPSBTFromRawOptions, IBuildPSBTOptions, IBuildUnsignedPQTxOptions, IByteChannel, IDeviceInfo, IErrorResponse, INeuraiTransport, IPQSighashOptions, IPQSignInput, IPQUTXO, IPQWitness, IPSBTInputMetadata, IPingResponse, ISerialOptions, ISignMessageResponse, ISignPsbtResponse, ISignResult, ISignTxResponse, ISigningDisplayMetadata, ITxOutput, IUTXO, IUnsignedPQTx, KeyType, Network, NetworkType, PQNetworkParams };
package/dist/index.js CHANGED
@@ -12931,8 +12931,30 @@ class NeuraiESP32 {
12931
12931
  this.deviceInfo = null;
12932
12932
  await this.serial.close();
12933
12933
  }
12934
+ /**
12935
+ * Detect the device without prompting the owner. `ping` (alias `device_info`)
12936
+ * answers immediately, requires NO on-device confirmation and returns nothing
12937
+ * that identifies the wallet (no fingerprint, address, pubkey or network) — so
12938
+ * it is safe to poll. Use this to enumerate/handshake a NeuraiHW device; use
12939
+ * {@link getInfo} (behind on-device approval) for the actual wallet data.
12940
+ *
12941
+ * Throws on firmware too old to know `ping` (it replies `Unknown action`);
12942
+ * callers that must support such firmware can catch and fall back to `getInfo`.
12943
+ */
12944
+ async ping() {
12945
+ // `ping` replies instantly (no user approval), so a short timeout is enough.
12946
+ const response = await this.serial.sendCommand({ action: "ping" }, 5000);
12947
+ this.assertSuccess(response);
12948
+ return response;
12949
+ }
12950
+ /**
12951
+ * Read the device's wallet info (network, key_type, master fingerprint, address,
12952
+ * pubkey). As of the consent-model firmware this REQUIRES on-device approval and
12953
+ * the device waits up to 30 s for it, so the timeout must accommodate that wait —
12954
+ * do not use `getInfo` merely to detect the device; use {@link ping} for that.
12955
+ */
12934
12956
  async getInfo() {
12935
- const response = await this.serial.sendCommand({ action: "info" }, 5000);
12957
+ const response = await this.serial.sendCommand({ action: "info" }, 35000);
12936
12958
  this.assertSuccess(response);
12937
12959
  this.deviceInfo = response;
12938
12960
  return this.deviceInfo;
@@ -81,6 +81,22 @@ interface IBuildAssetTransferDisplayMetadataOptions {
81
81
  feeAmount?: number | string;
82
82
  baseCurrency?: string;
83
83
  }
84
+ /**
85
+ * Lightweight device handshake returned by `ping` / `device_info`. Safe to poll:
86
+ * it requires NO on-device confirmation and returns nothing that identifies the
87
+ * wallet (no fingerprint, address, pubkey or network). Use it to detect/enumerate
88
+ * a NeuraiHW device; use {@link IDeviceInfo} (via `getInfo`, behind on-device
89
+ * approval) for the actual wallet data.
90
+ */
91
+ interface IPingResponse {
92
+ status: string;
93
+ device: string;
94
+ /** Protocol/app version (matches `info`'s `version`). */
95
+ version: string;
96
+ /** Firmware version (ping-only; not returned by `info`). */
97
+ firmware_version: string;
98
+ chip: string;
99
+ }
84
100
  interface IDeviceInfo {
85
101
  status: string;
86
102
  device: string;
@@ -162,7 +178,7 @@ interface IProcessingResponse {
162
178
  status: "processing";
163
179
  stage: string;
164
180
  }
165
- type DeviceResponse = IDeviceInfo | IAddressResponse | IBip32PubkeyResponse | ISignPsbtResponse | ISignTxResponse | ISignMessageResponse | IErrorResponse | IProcessingResponse;
181
+ type DeviceResponse = IPingResponse | IDeviceInfo | IAddressResponse | IBip32PubkeyResponse | ISignPsbtResponse | ISignTxResponse | ISignMessageResponse | IErrorResponse | IProcessingResponse;
166
182
  /**
167
183
  * Message-level transport consumed by {@link NeuraiESP32}. This is the only
168
184
  * surface the device class depends on, so any platform (Web Serial, React
@@ -299,6 +315,23 @@ declare class NeuraiESP32 {
299
315
  get info(): IDeviceInfo | null;
300
316
  connect(): Promise<void>;
301
317
  disconnect(): Promise<void>;
318
+ /**
319
+ * Detect the device without prompting the owner. `ping` (alias `device_info`)
320
+ * answers immediately, requires NO on-device confirmation and returns nothing
321
+ * that identifies the wallet (no fingerprint, address, pubkey or network) — so
322
+ * it is safe to poll. Use this to enumerate/handshake a NeuraiHW device; use
323
+ * {@link getInfo} (behind on-device approval) for the actual wallet data.
324
+ *
325
+ * Throws on firmware too old to know `ping` (it replies `Unknown action`);
326
+ * callers that must support such firmware can catch and fall back to `getInfo`.
327
+ */
328
+ ping(): Promise<IPingResponse>;
329
+ /**
330
+ * Read the device's wallet info (network, key_type, master fingerprint, address,
331
+ * pubkey). As of the consent-model firmware this REQUIRES on-device approval and
332
+ * the device waits up to 30 s for it, so the timeout must accommodate that wait —
333
+ * do not use `getInfo` merely to detect the device; use {@link ping} for that.
334
+ */
302
335
  getInfo(): Promise<IDeviceInfo>;
303
336
  /**
304
337
  * Retrieve the device's address (requires physical confirmation).
@@ -784,4 +817,4 @@ declare function createNeuraiESP32OverUsb(driver: IUsbSerialDriver, options?: {
784
817
  }): NeuraiESP32;
785
818
 
786
819
  export { DEFAULT_WITNESS_SCRIPT_HEX, MAX_OUTPUTS, MAX_PQ_INPUTS, NativeUsbByteChannel, NeuraiESP32, PQ_AUTH_TYPE, SIGHASH_ALL, SerialConnection, SerialProtocol, WebSerialByteChannel, base64ToBytes, buildAssetTransferDisplayMetadata, buildPSBT, buildPSBTFromRawTransaction, buildUnsignedPQTransaction, bytesToBase64, createNeuraiESP32OverUsb, decodeAddress, encodeDestinationScript, extractPQWitness, finalizePSBT, finalizeSignedPSBT, getNetwork, getPQNetworkParams, isPQAddress, neuraiLegacyMainnet, neuraiLegacyTestnet, neuraiMainnet, neuraiPQMainnet, neuraiPQTestnet, neuraiTestnet, parseSignedPQTransaction, pqAddressFromPublicKey, pqAuthDescriptor, pqAuthScriptSighash, pqCommitment, publicKeyToAddress, resolveNetwork, validatePSBT };
787
- export type { DecodedAddress, IAddressResponse, IAssetTransferDisplayMetadata, IBip32PubkeyResponse, IBuildAssetTransferDisplayMetadataOptions, IBuildPSBTFromRawOptions, IBuildPSBTOptions, IBuildUnsignedPQTxOptions, IByteChannel, IDeviceInfo, IErrorResponse, INeuraiTransport, IPQSighashOptions, IPQSignInput, IPQUTXO, IPQWitness, IPSBTInputMetadata, ISerialOptions, ISignMessageResponse, ISignPsbtResponse, ISignResult, ISignTxResponse, ISigningDisplayMetadata, ITxOutput, IUTXO, IUnsignedPQTx, IUsbSerialDriver, IUsbSerialPort, IUsbSubscription, KeyType, Network, NetworkType, PQNetworkParams };
820
+ export type { DecodedAddress, IAddressResponse, IAssetTransferDisplayMetadata, IBip32PubkeyResponse, IBuildAssetTransferDisplayMetadataOptions, IBuildPSBTFromRawOptions, IBuildPSBTOptions, IBuildUnsignedPQTxOptions, IByteChannel, IDeviceInfo, IErrorResponse, INeuraiTransport, IPQSighashOptions, IPQSignInput, IPQUTXO, IPQWitness, IPSBTInputMetadata, IPingResponse, ISerialOptions, ISignMessageResponse, ISignPsbtResponse, ISignResult, ISignTxResponse, ISigningDisplayMetadata, ITxOutput, IUTXO, IUnsignedPQTx, IUsbSerialDriver, IUsbSerialPort, IUsbSubscription, KeyType, Network, NetworkType, PQNetworkParams };
@@ -12931,8 +12931,30 @@ class NeuraiESP32 {
12931
12931
  this.deviceInfo = null;
12932
12932
  await this.serial.close();
12933
12933
  }
12934
+ /**
12935
+ * Detect the device without prompting the owner. `ping` (alias `device_info`)
12936
+ * answers immediately, requires NO on-device confirmation and returns nothing
12937
+ * that identifies the wallet (no fingerprint, address, pubkey or network) — so
12938
+ * it is safe to poll. Use this to enumerate/handshake a NeuraiHW device; use
12939
+ * {@link getInfo} (behind on-device approval) for the actual wallet data.
12940
+ *
12941
+ * Throws on firmware too old to know `ping` (it replies `Unknown action`);
12942
+ * callers that must support such firmware can catch and fall back to `getInfo`.
12943
+ */
12944
+ async ping() {
12945
+ // `ping` replies instantly (no user approval), so a short timeout is enough.
12946
+ const response = await this.serial.sendCommand({ action: "ping" }, 5000);
12947
+ this.assertSuccess(response);
12948
+ return response;
12949
+ }
12950
+ /**
12951
+ * Read the device's wallet info (network, key_type, master fingerprint, address,
12952
+ * pubkey). As of the consent-model firmware this REQUIRES on-device approval and
12953
+ * the device waits up to 30 s for it, so the timeout must accommodate that wait —
12954
+ * do not use `getInfo` merely to detect the device; use {@link ping} for that.
12955
+ */
12934
12956
  async getInfo() {
12935
- const response = await this.serial.sendCommand({ action: "info" }, 5000);
12957
+ const response = await this.serial.sendCommand({ action: "info" }, 35000);
12936
12958
  this.assertSuccess(response);
12937
12959
  this.deviceInfo = response;
12938
12960
  return this.deviceInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuraiproject/neurai-sign-esp32",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Create and sign PSBTs for Neurai via ESP32 hardware wallet",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",