nostr-gem/sig/nostr/crypto.rbs
Wilson Silva 01010c763f
Allow the verification of signatures and events
Added the methods:
- Event#verify_signature
- Crypto#check_sig!
- Crypto#valid_sig?
- Crypto#sign_message

Fixed a primitive obsession by introducing a Signature class to ensure that signatures are valid Nostr signatures.
2024-03-15 19:13:33 +00:00

20 lines
586 B
Plaintext

module Nostr
class Crypto
BN_BASE: 0 | 2 | 10 | 16
CIPHER_CURVE: String
CIPHER_ALGORITHM: String
def encrypt_text: (PrivateKey, PublicKey, String) -> String
def decrypt_text: (PrivateKey, PublicKey, String) -> String
def sign_event: (Event, PrivateKey) -> Event
def sign_message: (String, PrivateKey) -> Signature
def valid_sig?: (String, PublicKey, Signature) -> bool
def check_sig!: (String, PublicKey, Signature) -> bool
private
def compute_shared_key: (PrivateKey, PublicKey) -> String
def hash_event:(Event) -> String
end
end