dig-session
The DIG session / keystore layer: a small, custody-safe facade that turns stored, encrypted key material into a live signer and injects a bare signing primitive into downstream consumers.
It composes two lower-level crates and adds no cryptography of its own:
dig-keystore— encrypted, per-scheme secret-key storage (Keystore::<K>::load -> unlock -> SignerHandle).dig-identity— the canonical DIG BLS identity derivation (m/12381'/8444'/9'/0').
Install
[]
= "0.1"
Use
use Arc;
use ;
#
Accounts: one root, a portable recovery phrase
An account's root is 32 bytes of BIP-39 entropy. Every derivation — identity,
per-profile DEK, wallet — reads the seed EXPANDED from it
(entropy -> 24 words -> to_seed("")), which is the standard Chia derivation, so
a DIG recovery phrase restores the same addresses in Sage and any other
conforming wallet.
use Arc;
use ;
#
Legacy accounts: fail-closed, and your job to remediate
A blob written before the versioned seed envelope held a raw seed rather than entropy. Because the
two are byte-indistinguishable, unlock_master_seed fails closed with
SessionError::LegacySeedFormat instead of reinterpreting them — silently deriving a plausible wrong
wallet would be far worse than an error.
Those blobs exist in the field: the published 0.4 line auto-enrolled an account at first boot with
no user action. A legacy account is wedged — unlock refuses, and re-enrolling at the same key
returns AlreadyExists because enrolment never overwrites a custody root. So adopting 0.5 requires
a legacy-detection-and-re-enrolment path in your app: detect the variant specifically, preserve
(never delete) the old sealed blob — it may hold value and its password may live in an OS credential
store — tell the user in the UI, then re-enrol and show the new phrase. Merely logging the error
leaves the account permanently and silently without a signer. See the LegacySeedFormat rustdoc.
Design notes
- No seal / decap. Recipient message encryption belongs to
dig-message, not here. - Identity keys are stored with
L1WalletBls, notBlsSigning. The identity key is already derived by dig-identity; storage must round-trip it viafrom_bytes.BlsSigningwould re-derive viafrom_seedand yield a different key (the dig_ecosystem #64/#57 pitfall). - Custody-safe.
UnlockedIdentityzeroizes its secret on drop, neverDebug-prints key material, and must never cross an IPC boundary.
See SPEC.md for the normative contract.
License
GPL-2.0-only.