lnurl-auth from lnbits wallets to services.

This commit is contained in:
fiatjaf
2020-11-10 11:36:10 -03:00
parent 8f1ae1646e
commit eaec3480e6
6 changed files with 156 additions and 38 deletions
+10
View File
@@ -1,4 +1,6 @@
import json
import hashlib
from ecdsa import SECP256k1, SigningKey # type: ignore
from typing import List, NamedTuple, Optional, Dict
from sqlite3 import Row
@@ -33,6 +35,14 @@ class Wallet(NamedTuple):
def balance(self) -> int:
return self.balance_msat // 1000
@property
def lnurlauth_key(self) -> SigningKey:
return SigningKey.from_string(
hashlib.sha256(self.id.encode("utf-8")).digest(),
curve=SECP256k1,
hashfunc=hashlib.sha256,
)
def get_payment(self, payment_hash: str) -> Optional["Payment"]:
from .crud import get_wallet_payment