npub13z…l2rce on Nostr: "sig": <64-bytes lowercase hex of the signature of the sha256 hash of the serialized ...
"sig": <64-bytes lowercase hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field>
}
how to sign event correctly, always get response from relay: false,"invalid: bad signature"?
getting this error at least mean event id is correct, otherwise it will show bad event id.
def compute_event_id(json_string):
return hashlib.sha256(json_string.encode('utf-8')).digest()
def sign_event(private_key, event_id):
sk = ecdsa.SigningKey.from_string(bytes.fromhex(private_key), curve=ecdsa.SECP256k1)
signature = sk.sign(event_id)
return signature.hex()
#asknostr
}
how to sign event correctly, always get response from relay: false,"invalid: bad signature"?
getting this error at least mean event id is correct, otherwise it will show bad event id.
def compute_event_id(json_string):
return hashlib.sha256(json_string.encode('utf-8')).digest()
def sign_event(private_key, event_id):
sk = ecdsa.SigningKey.from_string(bytes.fromhex(private_key), curve=ecdsa.SECP256k1)
signature = sk.sign(event_id)
return signature.hex()
#asknostr