mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-28 09:40:59 +02:00
mypy fakewallet, macaroon, bolt11 invoice
This commit is contained in:
parent
8901ff8084
commit
91c5a68ccc
@ -23,6 +23,7 @@ class Route(NamedTuple):
|
|||||||
|
|
||||||
class Invoice(object):
|
class Invoice(object):
|
||||||
payment_hash: str
|
payment_hash: str
|
||||||
|
checking_id: Optional[str] = None
|
||||||
amount_msat: int = 0
|
amount_msat: int = 0
|
||||||
description: Optional[str] = None
|
description: Optional[str] = None
|
||||||
description_hash: Optional[str] = None
|
description_hash: Optional[str] = None
|
||||||
|
@ -28,7 +28,7 @@ class FakeWallet(Wallet):
|
|||||||
logger.info(
|
logger.info(
|
||||||
"FakeWallet funding source is for using LNbits as a centralised, stand-alone payment system with brrrrrr."
|
"FakeWallet funding source is for using LNbits as a centralised, stand-alone payment system with brrrrrr."
|
||||||
)
|
)
|
||||||
return StatusResponse(None, float("inf"))
|
return StatusResponse(None, 1000000000)
|
||||||
|
|
||||||
async def create_invoice(
|
async def create_invoice(
|
||||||
self,
|
self,
|
||||||
@ -80,8 +80,12 @@ class FakeWallet(Wallet):
|
|||||||
|
|
||||||
async def pay_invoice(self, bolt11: str, fee_limit_msat: int) -> PaymentResponse:
|
async def pay_invoice(self, bolt11: str, fee_limit_msat: int) -> PaymentResponse:
|
||||||
invoice = decode(bolt11)
|
invoice = decode(bolt11)
|
||||||
|
# TODO: no data here?
|
||||||
|
data: Dict = {
|
||||||
|
"privkey": "missing"
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
hasattr(invoice, "checking_id")
|
invoice.checking_id is not None
|
||||||
and invoice.checking_id[6:] == data["privkey"][:6]
|
and invoice.checking_id[6:] == data["privkey"][:6]
|
||||||
):
|
):
|
||||||
return PaymentResponse(True, invoice.payment_hash, 0)
|
return PaymentResponse(True, invoice.payment_hash, 0)
|
||||||
@ -97,7 +101,7 @@ class FakeWallet(Wallet):
|
|||||||
return PaymentStatus(None)
|
return PaymentStatus(None)
|
||||||
|
|
||||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||||
self.queue = asyncio.Queue(0)
|
self.queue: asyncio.Queue = asyncio.Queue(0)
|
||||||
while True:
|
while True:
|
||||||
value = await self.queue.get()
|
value = await self.queue.get()
|
||||||
yield value
|
yield value
|
||||||
|
@ -73,7 +73,7 @@ class AESCipher(object):
|
|||||||
final_key += key
|
final_key += key
|
||||||
return final_key[:output]
|
return final_key[:output]
|
||||||
|
|
||||||
def decrypt(self, encrypted: str) -> str:
|
def decrypt(self, encrypted) -> str:
|
||||||
"""Decrypts a string using AES-256-CBC."""
|
"""Decrypts a string using AES-256-CBC."""
|
||||||
passphrase = self.passphrase
|
passphrase = self.passphrase
|
||||||
encrypted = base64.b64decode(encrypted)
|
encrypted = base64.b64decode(encrypted)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user