Crate ledger_mob_core

source ·
Expand description

MobileCoin hardware wallet core

This provides a common Engine supporting transaction signing and verification for execution on hardware wallets.

Interactions with the Engine are performed via Events and Outputs, see ledger_mob_apdu for APDU objects and wire encodings.

Operations

Prior to interacting with a hardware wallet the client should issue an AppInfoReq to fetch an AppInfoResp containing application information including the applet version, protocol version, and flags for available features.

Requesting wallet / subaddress keys

Wallet keys can be requested via WalletKeyReq APDU, returning a WalletKeyResp containing the root spend public key and view private key for a given account index.

SubAddress keys can be requested via WalletKeyReq APDU, returning a WalletKeyResp containing the subaddress spend public key and view private key for a given account index.

Key Image Scanning

Key images can be recovered via KeyImageReq request, returning a KeyImageResp APDU containing the computed key image.

Executing a transaction

Transactions consist of a series of operations to first configure the transaction, sign memos for the transaction, then to sign the set of rings included in the transaction.

See lib/src/handle.rs for a complete / reference implementation.

Unless otherwise documented each transaction operation returns a TxInfo response containing the current transaction state as well as a TxDigest computed from the inputs to the transaction. This digest ensures the executed transaction matches the callers expectations, and MUST be cached on TxInit and updated and compared for each operation during a transaction, with the transaction discarded if a mismatch is detected.

  1. Issue TxInit with transaction options to start a transaction operation
  2. Generate and sign memos
    1. Issue TxMemoSign to fetch a TxMemoSig APDU containing a signature for the provided memo
  3. Build transaction summary to generate message for signing (see: MCIP#52)
    1. Issue TxSummaryInit to start summary generation
    2. Add N outputs and unblinding information using TxSummaryAddTxOut followed by TxSummaryAddTxOutUnblinding
    3. Add M inputs via TxSummaryAddTxIn
    4. Issue TxSummaryBuild to build summary message
  4. Sign N rings
    1. Issue TxRingInit to start a ring signing operation
    2. Issue TxSetBlinding to set the blinding values for the ring
    3. Issue TxAddTxOut for each ring entry (in order of real_index to (real_index - 1) % ring_size)
    4. Issue TxRingSign to complete signing
    5. Issue TxGetKeyImage to fetch a TxKeyImage APDU containing the key image and zeroth challenge for the signed ring
    6. Issue TxGetResponse to fetch TxResponse APDU containing the response scalar for each ring entry
  5. Issue TxComplete to complete transaction

Re-exports

Modules

Structs

  • Token Id, used to identify different assets on on the blockchain.