jmcore.wallet_metadata
jmcore.wallet_metadata
Private mnemonic sidecars and public wallet identity selection.
A legacy fingerprint is a hint written by earlier releases. It is adopted only when an unlocked wallet derives the same fingerprint. Registration never implies recovery is needed, and never replaces an existing selection.
Attributes
IDENTITY_VERSION = 1
module-attribute
UPGRADE_GUIDANCE = 'Wallet identity is unconfirmed: this wallet does not match the fingerprint recorded for its mnemonic file, or none was recorded. If it is the intended wallet, run `jm-wallet identity register` (add --prompt-bip39-passphrase for a passphrase wallet).'
module-attribute
Classes
WalletIdentity
Bases: BaseModel
A remembered derivation, not a stored credential or authentication proof.
Source code in jmcore/src/jmcore/wallet_metadata.py
32 33 34 35 36 37 38 39 40 41 42 43 44 | |
Attributes
bip39: Literal['none', 'required', 'unknown']
instance-attribute
fingerprint: str
instance-attribute
Methods:
validate_fingerprint(value: str) -> str
classmethod
Source code in jmcore/src/jmcore/wallet_metadata.py
38 39 40 41 42 43 44 | |
Functions:
adopt_legacy_identity(mnemonic_file: Path, identity: WalletIdentity) -> bool
Register and select an unlocked wallet matching the legacy fingerprint.
Earlier releases recorded the fingerprint of the wallet they derived. A matching derivation is affirmative evidence of the intended wallet, so the upgrade needs no manual steps. Missing or different hints adopt nothing.
Source code in jmcore/src/jmcore/wallet_metadata.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
load_mnemonic_meta(mnemonic_file: Path, *, strict: bool = False) -> dict[str, Any]
Keep legacy best-effort reads, but never repair corruption during a write.
Source code in jmcore/src/jmcore/wallet_metadata.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
meta_path(mnemonic_file: Path) -> Path
Source code in jmcore/src/jmcore/wallet_metadata.py
47 48 | |
metadata_lock(mnemonic_file: Path, *, nonblocking: bool = False) -> Iterator[None]
Source code in jmcore/src/jmcore/wallet_metadata.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
register_identity(mnemonic_file: Path, identity: WalletIdentity) -> bool
Register, selecting only when nothing is selected yet.
Preserves an existing selection, unknown fields, and recovery state. Returns whether the identity became the selection.
Source code in jmcore/src/jmcore/wallet_metadata.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
registered_identities(mnemonic_file: Path) -> dict[str, WalletIdentity]
Source code in jmcore/src/jmcore/wallet_metadata.py
117 118 119 | |
select_identity(mnemonic_file: Path, fingerprint: str) -> None
Source code in jmcore/src/jmcore/wallet_metadata.py
219 220 221 222 223 224 225 226 | |
selected_identity(mnemonic_file: Path) -> WalletIdentity | None
Source code in jmcore/src/jmcore/wallet_metadata.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
write_mnemonic_meta(mnemonic_file: Path, meta: dict[str, Any]) -> None
Source code in jmcore/src/jmcore/wallet_metadata.py
112 113 114 | |