mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-20 04:21:20 +02:00
chore: code format
This commit is contained in:
@@ -30,17 +30,17 @@ import hashlib
|
|||||||
from secp256k1 import PrivateKey, PublicKey
|
from secp256k1 import PrivateKey, PublicKey
|
||||||
|
|
||||||
|
|
||||||
def hash_to_curve(message: bytes):
|
def hash_to_curve(message: bytes):
|
||||||
"""Generates a point from the message hash and checks if the point lies on the curve.
|
"""Generates a point from the message hash and checks if the point lies on the curve.
|
||||||
If it does not, it tries computing again a new x coordinate from the hash of the coordinate."""
|
If it does not, it tries computing again a new x coordinate from the hash of the coordinate."""
|
||||||
point = None
|
point = None
|
||||||
msg_to_hash = message
|
msg_to_hash = message
|
||||||
while point is None:
|
while point is None:
|
||||||
try:
|
try:
|
||||||
_hash = hashlib.sha256(msg_to_hash).digest()
|
_hash = hashlib.sha256(msg_to_hash).digest()
|
||||||
point = PublicKey(b"\x02" + _hash, raw=True)
|
point = PublicKey(b"\x02" + _hash, raw=True)
|
||||||
except:
|
except:
|
||||||
msg_to_hash = _hash
|
msg_to_hash = _hash
|
||||||
return point
|
return point
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import hashlib
|
|
||||||
import base64
|
import base64
|
||||||
|
import hashlib
|
||||||
from typing import List, Set
|
from typing import List, Set
|
||||||
|
|
||||||
from .core.b_dhke import verify
|
from .core.b_dhke import verify
|
||||||
@@ -41,13 +41,11 @@ async def verify_proof(master_prvkey: str, proofs_used: Set[str], proof: Proof):
|
|||||||
] # Get the correct key to check against
|
] # Get the correct key to check against
|
||||||
C = PublicKey(bytes.fromhex(proof.C), raw=True)
|
C = PublicKey(bytes.fromhex(proof.C), raw=True)
|
||||||
secret = base64.standard_b64decode(proof.secret)
|
secret = base64.standard_b64decode(proof.secret)
|
||||||
print('### secret', secret)
|
print("### secret", secret)
|
||||||
validMintSig = verify(secret_key, C, secret)
|
validMintSig = verify(secret_key, C, secret)
|
||||||
if validMintSig != True:
|
if validMintSig != True:
|
||||||
raise Exception(f"tokens not valid. Secret: {proof.secret}")
|
raise Exception(f"tokens not valid. Secret: {proof.secret}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def verify_split_amount(amount: int):
|
def verify_split_amount(amount: int):
|
||||||
"""Split amount like output amount can't be negative or too big."""
|
"""Split amount like output amount can't be negative or too big."""
|
||||||
|
@@ -1089,7 +1089,7 @@ page_container %}
|
|||||||
payload
|
payload
|
||||||
)
|
)
|
||||||
|
|
||||||
newTokens.promises = data.snd;
|
newTokens.promises = data.snd
|
||||||
// console.log('split data', JSON.stringify(data.snd))
|
// console.log('split data', JSON.stringify(data.snd))
|
||||||
// for (let i =0 ;i < newTokens.length; i++) {
|
// for (let i =0 ;i < newTokens.length; i++) {
|
||||||
// Object.assign(newTokens[i], promises)
|
// Object.assign(newTokens[i], promises)
|
||||||
|
Reference in New Issue
Block a user