@neuraiproject/neurai-sign-esp32 0.5.8 → 0.5.10

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
@@ -579,8 +579,10 @@ using JSON messages. Supported commands:
579
579
  | `sign_message` | Physical button | 30s |
580
580
  | `depin_session_begin` | Physical button (channel token on screen) | 30s |
581
581
  | `get_depin_identity` | None (session-gated) | 10s |
582
+ | `depin_sign_digest` | Physical button | 30s |
582
583
  | `depin_sign` | None (session-gated, rate-limited) | 30s |
583
584
  | `depin_decrypt` | None (session-gated, rate-limited) | 30s |
585
+ | `depin_decrypt_payload` | None (session-gated, rate-limited) | 30s |
584
586
  | `depin_session_end` | None | 10s |
585
587
 
586
588
  `info` reports `key_type` (`"legacy"` | `"pq"`). In PQ mode, `get_address`
@@ -616,6 +618,8 @@ Main class for device interaction.
616
618
  | `getDepinIdentity()` | Read the DePIN chat identity (address + pubkey + path); session-gated, no per-call prompt |
617
619
  | `depinSign(params)` | Sign a DePIN message on-device (DER over the canonical CDepinMessage); session-gated, rate-limited |
618
620
  | `depinDecrypt(depinMessageHex)` | Decrypt a CDepinMessage addressed to this identity → `plaintext_b64`; session-gated |
621
+ | `depinDecryptPayload(encryptedPayloadHex)` | Decrypt a bare ECIES `encrypted_payload_hex` (decomposed server item) → `plaintext_b64`; session-gated |
622
+ | `depinSignDigest(digestHex)` | Sign a tx sighash with the DePIN key (account 100') → `{ signature, pubkey }`; physical confirmation, for the pubkey-reveal burn |
619
623
  | `depinSessionEnd()` | End the DePIN session (also revoked on lock / disconnect / timeout) |
620
624
  | `signTransaction(opts)` | Build + sign + finalize in one call; auto-routes legacy (PSBT) vs PQ (`sign_tx`) by device mode |
621
625
  | `signPqTransaction(opts)` | Spend from a PQ address: build raw tx + sign via `sign_tx` (used internally by `signTransaction` in PQ mode) |
@@ -13164,6 +13164,37 @@ var NeuraiSignESP32Bundle = (function () {
13164
13164
  this.assertSuccess(response);
13165
13165
  return response;
13166
13166
  }
13167
+ /**
13168
+ * Decrypt a BARE ECIES payload — the `encrypted_payload_hex` a DePIN server
13169
+ * returns per message (and the format of privacy-wrapped `{ encrypted }`
13170
+ * server responses) — without the surrounding CDepinMessage framing. Use this
13171
+ * when you have the decomposed server item rather than a full serialized
13172
+ * message (the common case for a chat client). Returns the plaintext
13173
+ * base64-encoded, or a `not_for_us` device error if not a recipient.
13174
+ * Requires an active session and the `depin_message` capability.
13175
+ */
13176
+ async depinDecryptPayload(encryptedPayloadHex) {
13177
+ const response = await this.serial.sendCommand({ action: "depin_decrypt_payload", encrypted_payload: encryptedPayloadHex }, 35000);
13178
+ this.assertSuccess(response);
13179
+ return response;
13180
+ }
13181
+ /**
13182
+ * Sign a 32-byte digest with the DePIN key (account 100'). The device ALWAYS
13183
+ * asks for an explicit physical confirmation — this signature can move the
13184
+ * DePIN address's XNA. Used to spend from the DePIN address, notably the
13185
+ * pubkey-reveal burn that publishes the account-100 pubkey on-chain (so other
13186
+ * chat members can encrypt group messages to this identity). The host builds
13187
+ * the transaction, computes each input's legacy sighash, calls this per input,
13188
+ * and assembles the P2PKH scriptSig from `signature` (append the sighash-type
13189
+ * byte) + `pubkey`. Requires the device unlocked; not session-gated.
13190
+ *
13191
+ * @param digestHex 32-byte digest (the tx sighash), hex.
13192
+ */
13193
+ async depinSignDigest(digestHex) {
13194
+ const response = await this.serial.sendCommand({ action: "depin_sign_digest", digest: digestHex }, 35000);
13195
+ this.assertSuccess(response);
13196
+ return response;
13197
+ }
13167
13198
  /**
13168
13199
  * End the current DePIN session: auto-sign/decrypt stops and the identity is
13169
13200
  * no longer revealed until a new {@link depinSessionBegin} approval. Safe to
package/dist/browser.js CHANGED
@@ -13161,6 +13161,37 @@ class NeuraiESP32 {
13161
13161
  this.assertSuccess(response);
13162
13162
  return response;
13163
13163
  }
13164
+ /**
13165
+ * Decrypt a BARE ECIES payload — the `encrypted_payload_hex` a DePIN server
13166
+ * returns per message (and the format of privacy-wrapped `{ encrypted }`
13167
+ * server responses) — without the surrounding CDepinMessage framing. Use this
13168
+ * when you have the decomposed server item rather than a full serialized
13169
+ * message (the common case for a chat client). Returns the plaintext
13170
+ * base64-encoded, or a `not_for_us` device error if not a recipient.
13171
+ * Requires an active session and the `depin_message` capability.
13172
+ */
13173
+ async depinDecryptPayload(encryptedPayloadHex) {
13174
+ const response = await this.serial.sendCommand({ action: "depin_decrypt_payload", encrypted_payload: encryptedPayloadHex }, 35000);
13175
+ this.assertSuccess(response);
13176
+ return response;
13177
+ }
13178
+ /**
13179
+ * Sign a 32-byte digest with the DePIN key (account 100'). The device ALWAYS
13180
+ * asks for an explicit physical confirmation — this signature can move the
13181
+ * DePIN address's XNA. Used to spend from the DePIN address, notably the
13182
+ * pubkey-reveal burn that publishes the account-100 pubkey on-chain (so other
13183
+ * chat members can encrypt group messages to this identity). The host builds
13184
+ * the transaction, computes each input's legacy sighash, calls this per input,
13185
+ * and assembles the P2PKH scriptSig from `signature` (append the sighash-type
13186
+ * byte) + `pubkey`. Requires the device unlocked; not session-gated.
13187
+ *
13188
+ * @param digestHex 32-byte digest (the tx sighash), hex.
13189
+ */
13190
+ async depinSignDigest(digestHex) {
13191
+ const response = await this.serial.sendCommand({ action: "depin_sign_digest", digest: digestHex }, 35000);
13192
+ this.assertSuccess(response);
13193
+ return response;
13194
+ }
13164
13195
  /**
13165
13196
  * End the current DePIN session: auto-sign/decrypt stops and the identity is
13166
13197
  * no longer revealed until a new {@link depinSessionBegin} approval. Safe to
package/dist/index.cjs CHANGED
@@ -13163,6 +13163,37 @@ class NeuraiESP32 {
13163
13163
  this.assertSuccess(response);
13164
13164
  return response;
13165
13165
  }
13166
+ /**
13167
+ * Decrypt a BARE ECIES payload — the `encrypted_payload_hex` a DePIN server
13168
+ * returns per message (and the format of privacy-wrapped `{ encrypted }`
13169
+ * server responses) — without the surrounding CDepinMessage framing. Use this
13170
+ * when you have the decomposed server item rather than a full serialized
13171
+ * message (the common case for a chat client). Returns the plaintext
13172
+ * base64-encoded, or a `not_for_us` device error if not a recipient.
13173
+ * Requires an active session and the `depin_message` capability.
13174
+ */
13175
+ async depinDecryptPayload(encryptedPayloadHex) {
13176
+ const response = await this.serial.sendCommand({ action: "depin_decrypt_payload", encrypted_payload: encryptedPayloadHex }, 35000);
13177
+ this.assertSuccess(response);
13178
+ return response;
13179
+ }
13180
+ /**
13181
+ * Sign a 32-byte digest with the DePIN key (account 100'). The device ALWAYS
13182
+ * asks for an explicit physical confirmation — this signature can move the
13183
+ * DePIN address's XNA. Used to spend from the DePIN address, notably the
13184
+ * pubkey-reveal burn that publishes the account-100 pubkey on-chain (so other
13185
+ * chat members can encrypt group messages to this identity). The host builds
13186
+ * the transaction, computes each input's legacy sighash, calls this per input,
13187
+ * and assembles the P2PKH scriptSig from `signature` (append the sighash-type
13188
+ * byte) + `pubkey`. Requires the device unlocked; not session-gated.
13189
+ *
13190
+ * @param digestHex 32-byte digest (the tx sighash), hex.
13191
+ */
13192
+ async depinSignDigest(digestHex) {
13193
+ const response = await this.serial.sendCommand({ action: "depin_sign_digest", digest: digestHex }, 35000);
13194
+ this.assertSuccess(response);
13195
+ return response;
13196
+ }
13166
13197
  /**
13167
13198
  * End the current DePIN session: auto-sign/decrypt stops and the identity is
13168
13199
  * no longer revealed until a new {@link depinSessionBegin} approval. Safe to
package/dist/index.d.ts CHANGED
@@ -255,6 +255,13 @@ interface IDepinDecryptResponse {
255
255
  plaintext_b64: string;
256
256
  op_count: number;
257
257
  }
258
+ interface IDepinSignDigestResponse {
259
+ status: string;
260
+ /** DER signature over the digest (no sighash-type byte; append it host-side). */
261
+ signature: string;
262
+ /** Compressed secp256k1 DePIN public key (33 bytes), hex — for the scriptSig. */
263
+ pubkey: string;
264
+ }
258
265
  interface IErrorResponse {
259
266
  status: "error";
260
267
  message: string;
@@ -263,7 +270,7 @@ interface IProcessingResponse {
263
270
  status: "processing";
264
271
  stage: string;
265
272
  }
266
- type DeviceResponse = IPingResponse | IDeviceInfo | IAddressResponse | IBip32PubkeyResponse | ISignPsbtResponse | ISignTxResponse | ISignMessageResponse | ISetupSeedResponse | IDepinSessionResponse | IDepinIdentityResponse | IDepinSignResponse | IDepinDecryptResponse | IErrorResponse | IProcessingResponse;
273
+ type DeviceResponse = IPingResponse | IDeviceInfo | IAddressResponse | IBip32PubkeyResponse | ISignPsbtResponse | ISignTxResponse | ISignMessageResponse | ISetupSeedResponse | IDepinSessionResponse | IDepinIdentityResponse | IDepinSignResponse | IDepinDecryptResponse | IDepinSignDigestResponse | IErrorResponse | IProcessingResponse;
267
274
  /**
268
275
  * Message-level transport consumed by {@link NeuraiESP32}. This is the only
269
276
  * surface the device class depends on, so any platform (Web Serial, React
@@ -520,6 +527,29 @@ declare class NeuraiESP32 {
520
527
  * @param depinMessageHex Hex of the complete serialized CDepinMessage.
521
528
  */
522
529
  depinDecrypt(depinMessageHex: string): Promise<IDepinDecryptResponse>;
530
+ /**
531
+ * Decrypt a BARE ECIES payload — the `encrypted_payload_hex` a DePIN server
532
+ * returns per message (and the format of privacy-wrapped `{ encrypted }`
533
+ * server responses) — without the surrounding CDepinMessage framing. Use this
534
+ * when you have the decomposed server item rather than a full serialized
535
+ * message (the common case for a chat client). Returns the plaintext
536
+ * base64-encoded, or a `not_for_us` device error if not a recipient.
537
+ * Requires an active session and the `depin_message` capability.
538
+ */
539
+ depinDecryptPayload(encryptedPayloadHex: string): Promise<IDepinDecryptResponse>;
540
+ /**
541
+ * Sign a 32-byte digest with the DePIN key (account 100'). The device ALWAYS
542
+ * asks for an explicit physical confirmation — this signature can move the
543
+ * DePIN address's XNA. Used to spend from the DePIN address, notably the
544
+ * pubkey-reveal burn that publishes the account-100 pubkey on-chain (so other
545
+ * chat members can encrypt group messages to this identity). The host builds
546
+ * the transaction, computes each input's legacy sighash, calls this per input,
547
+ * and assembles the P2PKH scriptSig from `signature` (append the sighash-type
548
+ * byte) + `pubkey`. Requires the device unlocked; not session-gated.
549
+ *
550
+ * @param digestHex 32-byte digest (the tx sighash), hex.
551
+ */
552
+ depinSignDigest(digestHex: string): Promise<IDepinSignDigestResponse>;
523
553
  /**
524
554
  * End the current DePIN session: auto-sign/decrypt stops and the identity is
525
555
  * no longer revealed until a new {@link depinSessionBegin} approval. Safe to
package/dist/index.js CHANGED
@@ -13161,6 +13161,37 @@ class NeuraiESP32 {
13161
13161
  this.assertSuccess(response);
13162
13162
  return response;
13163
13163
  }
13164
+ /**
13165
+ * Decrypt a BARE ECIES payload — the `encrypted_payload_hex` a DePIN server
13166
+ * returns per message (and the format of privacy-wrapped `{ encrypted }`
13167
+ * server responses) — without the surrounding CDepinMessage framing. Use this
13168
+ * when you have the decomposed server item rather than a full serialized
13169
+ * message (the common case for a chat client). Returns the plaintext
13170
+ * base64-encoded, or a `not_for_us` device error if not a recipient.
13171
+ * Requires an active session and the `depin_message` capability.
13172
+ */
13173
+ async depinDecryptPayload(encryptedPayloadHex) {
13174
+ const response = await this.serial.sendCommand({ action: "depin_decrypt_payload", encrypted_payload: encryptedPayloadHex }, 35000);
13175
+ this.assertSuccess(response);
13176
+ return response;
13177
+ }
13178
+ /**
13179
+ * Sign a 32-byte digest with the DePIN key (account 100'). The device ALWAYS
13180
+ * asks for an explicit physical confirmation — this signature can move the
13181
+ * DePIN address's XNA. Used to spend from the DePIN address, notably the
13182
+ * pubkey-reveal burn that publishes the account-100 pubkey on-chain (so other
13183
+ * chat members can encrypt group messages to this identity). The host builds
13184
+ * the transaction, computes each input's legacy sighash, calls this per input,
13185
+ * and assembles the P2PKH scriptSig from `signature` (append the sighash-type
13186
+ * byte) + `pubkey`. Requires the device unlocked; not session-gated.
13187
+ *
13188
+ * @param digestHex 32-byte digest (the tx sighash), hex.
13189
+ */
13190
+ async depinSignDigest(digestHex) {
13191
+ const response = await this.serial.sendCommand({ action: "depin_sign_digest", digest: digestHex }, 35000);
13192
+ this.assertSuccess(response);
13193
+ return response;
13194
+ }
13164
13195
  /**
13165
13196
  * End the current DePIN session: auto-sign/decrypt stops and the identity is
13166
13197
  * no longer revealed until a new {@link depinSessionBegin} approval. Safe to
@@ -255,6 +255,13 @@ interface IDepinDecryptResponse {
255
255
  plaintext_b64: string;
256
256
  op_count: number;
257
257
  }
258
+ interface IDepinSignDigestResponse {
259
+ status: string;
260
+ /** DER signature over the digest (no sighash-type byte; append it host-side). */
261
+ signature: string;
262
+ /** Compressed secp256k1 DePIN public key (33 bytes), hex — for the scriptSig. */
263
+ pubkey: string;
264
+ }
258
265
  interface IErrorResponse {
259
266
  status: "error";
260
267
  message: string;
@@ -263,7 +270,7 @@ interface IProcessingResponse {
263
270
  status: "processing";
264
271
  stage: string;
265
272
  }
266
- type DeviceResponse = IPingResponse | IDeviceInfo | IAddressResponse | IBip32PubkeyResponse | ISignPsbtResponse | ISignTxResponse | ISignMessageResponse | ISetupSeedResponse | IDepinSessionResponse | IDepinIdentityResponse | IDepinSignResponse | IDepinDecryptResponse | IErrorResponse | IProcessingResponse;
273
+ type DeviceResponse = IPingResponse | IDeviceInfo | IAddressResponse | IBip32PubkeyResponse | ISignPsbtResponse | ISignTxResponse | ISignMessageResponse | ISetupSeedResponse | IDepinSessionResponse | IDepinIdentityResponse | IDepinSignResponse | IDepinDecryptResponse | IDepinSignDigestResponse | IErrorResponse | IProcessingResponse;
267
274
  /**
268
275
  * Message-level transport consumed by {@link NeuraiESP32}. This is the only
269
276
  * surface the device class depends on, so any platform (Web Serial, React
@@ -520,6 +527,29 @@ declare class NeuraiESP32 {
520
527
  * @param depinMessageHex Hex of the complete serialized CDepinMessage.
521
528
  */
522
529
  depinDecrypt(depinMessageHex: string): Promise<IDepinDecryptResponse>;
530
+ /**
531
+ * Decrypt a BARE ECIES payload — the `encrypted_payload_hex` a DePIN server
532
+ * returns per message (and the format of privacy-wrapped `{ encrypted }`
533
+ * server responses) — without the surrounding CDepinMessage framing. Use this
534
+ * when you have the decomposed server item rather than a full serialized
535
+ * message (the common case for a chat client). Returns the plaintext
536
+ * base64-encoded, or a `not_for_us` device error if not a recipient.
537
+ * Requires an active session and the `depin_message` capability.
538
+ */
539
+ depinDecryptPayload(encryptedPayloadHex: string): Promise<IDepinDecryptResponse>;
540
+ /**
541
+ * Sign a 32-byte digest with the DePIN key (account 100'). The device ALWAYS
542
+ * asks for an explicit physical confirmation — this signature can move the
543
+ * DePIN address's XNA. Used to spend from the DePIN address, notably the
544
+ * pubkey-reveal burn that publishes the account-100 pubkey on-chain (so other
545
+ * chat members can encrypt group messages to this identity). The host builds
546
+ * the transaction, computes each input's legacy sighash, calls this per input,
547
+ * and assembles the P2PKH scriptSig from `signature` (append the sighash-type
548
+ * byte) + `pubkey`. Requires the device unlocked; not session-gated.
549
+ *
550
+ * @param digestHex 32-byte digest (the tx sighash), hex.
551
+ */
552
+ depinSignDigest(digestHex: string): Promise<IDepinSignDigestResponse>;
523
553
  /**
524
554
  * End the current DePIN session: auto-sign/decrypt stops and the identity is
525
555
  * no longer revealed until a new {@link depinSessionBegin} approval. Safe to
@@ -13161,6 +13161,37 @@ class NeuraiESP32 {
13161
13161
  this.assertSuccess(response);
13162
13162
  return response;
13163
13163
  }
13164
+ /**
13165
+ * Decrypt a BARE ECIES payload — the `encrypted_payload_hex` a DePIN server
13166
+ * returns per message (and the format of privacy-wrapped `{ encrypted }`
13167
+ * server responses) — without the surrounding CDepinMessage framing. Use this
13168
+ * when you have the decomposed server item rather than a full serialized
13169
+ * message (the common case for a chat client). Returns the plaintext
13170
+ * base64-encoded, or a `not_for_us` device error if not a recipient.
13171
+ * Requires an active session and the `depin_message` capability.
13172
+ */
13173
+ async depinDecryptPayload(encryptedPayloadHex) {
13174
+ const response = await this.serial.sendCommand({ action: "depin_decrypt_payload", encrypted_payload: encryptedPayloadHex }, 35000);
13175
+ this.assertSuccess(response);
13176
+ return response;
13177
+ }
13178
+ /**
13179
+ * Sign a 32-byte digest with the DePIN key (account 100'). The device ALWAYS
13180
+ * asks for an explicit physical confirmation — this signature can move the
13181
+ * DePIN address's XNA. Used to spend from the DePIN address, notably the
13182
+ * pubkey-reveal burn that publishes the account-100 pubkey on-chain (so other
13183
+ * chat members can encrypt group messages to this identity). The host builds
13184
+ * the transaction, computes each input's legacy sighash, calls this per input,
13185
+ * and assembles the P2PKH scriptSig from `signature` (append the sighash-type
13186
+ * byte) + `pubkey`. Requires the device unlocked; not session-gated.
13187
+ *
13188
+ * @param digestHex 32-byte digest (the tx sighash), hex.
13189
+ */
13190
+ async depinSignDigest(digestHex) {
13191
+ const response = await this.serial.sendCommand({ action: "depin_sign_digest", digest: digestHex }, 35000);
13192
+ this.assertSuccess(response);
13193
+ return response;
13194
+ }
13164
13195
  /**
13165
13196
  * End the current DePIN session: auto-sign/decrypt stops and the identity is
13166
13197
  * no longer revealed until a new {@link depinSessionBegin} approval. Safe to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuraiproject/neurai-sign-esp32",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "Create and sign PSBTs for Neurai via ESP32 hardware wallet",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",