Compare commits
2
Commits
dev
...
boltz_seed_fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3372f7463a | ||
|
|
3f4fd93858 |
+19
-1
@@ -6,6 +6,7 @@ import inspect
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import secrets
|
||||
from datetime import datetime, timezone
|
||||
from enum import Enum
|
||||
from os import path
|
||||
@@ -18,6 +19,21 @@ from loguru import logger
|
||||
from pydantic import BaseModel, BaseSettings, Extra, Field, validator
|
||||
|
||||
|
||||
def generate_default_boltz_mnemonic() -> str | None:
|
||||
"""
|
||||
Generate a BIP39 mnemonic using the bundled embit dependency.
|
||||
If embit is unavailable at runtime, return None to avoid blocking startup.
|
||||
"""
|
||||
try:
|
||||
from embit import bip39
|
||||
except Exception as exc: # pragma: no cover - dependency missing at runtime
|
||||
logger.warning(f"Unable to generate Boltz mnemonic (embit missing): {exc}")
|
||||
return None
|
||||
|
||||
entropy = secrets.token_bytes(16) # 128 bits -> 12-word mnemonic
|
||||
return bip39.mnemonic_from_bytes(entropy)
|
||||
|
||||
|
||||
def list_parse_fallback(v: str):
|
||||
v = v.replace(" ", "")
|
||||
if len(v) > 0:
|
||||
@@ -604,7 +620,9 @@ class BoltzFundingSource(LNbitsSettings):
|
||||
boltz_client_wallet: str | None = Field(default="lnbits")
|
||||
boltz_client_password: str = Field(default="")
|
||||
boltz_client_cert: str | None = Field(default=None)
|
||||
boltz_mnemonic: str | None = Field(default=None)
|
||||
boltz_mnemonic: str | None = Field(
|
||||
default_factory=generate_default_boltz_mnemonic
|
||||
)
|
||||
|
||||
|
||||
class StrikeFundingSource(LNbitsSettings):
|
||||
|
||||
@@ -161,15 +161,21 @@ window.app.component('lnbits-admin-funding-sources', {
|
||||
'Boltz',
|
||||
{
|
||||
boltz_client_endpoint: 'Endpoint',
|
||||
boltz_client_macaroon: 'Admin Macaroon path or hex',
|
||||
boltz_client_cert: 'Certificate path or hex',
|
||||
boltz_client_macaroon: {
|
||||
label: 'Admin Macaroon path or hex',
|
||||
default: '/home/ubuntu/.boltz/macaroons/admin.macaroon'
|
||||
},
|
||||
boltz_client_cert: {
|
||||
label: 'Certificate path or hex',
|
||||
default: '/home/ben/.boltz/tls.cert'
|
||||
},
|
||||
boltz_client_wallet: 'Wallet Name',
|
||||
boltz_client_password: 'Wallet Password (can be empty)',
|
||||
boltz_mnemonic: {
|
||||
label: 'Liquid mnemonic (copy into greenwallet)',
|
||||
readonly: true,
|
||||
copy: true,
|
||||
qrcode: true
|
||||
qrcode: true,
|
||||
hint: 'Paste or type your liquid mnemonic'
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user