-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: validate events async, transform messages in async way
- Loading branch information
Showing
4 changed files
with
59 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
import 'package:nostr_dart/src/crypto/utils.dart'; | ||
|
||
mixin SignatureVerifier { | ||
|
||
bool verify({ | ||
Future<bool> verify({ | ||
required String signature, | ||
required String message, | ||
required String publicKey, | ||
}); | ||
|
||
} | ||
|
||
class SchnorrSignatureVerifier with SignatureVerifier { | ||
|
||
SchnorrSignatureVerifier(); | ||
|
||
/// Verifies a schnorr signature using the BIP-340 scheme. | ||
/// | ||
/// It returns true if the signature is valid, false otherwise. | ||
@override | ||
bool verify({ | ||
Future<bool> verify({ | ||
required String signature, | ||
required String message, | ||
required String publicKey, | ||
}) { | ||
}) async { | ||
return verifyBip340Signature( | ||
signature: signature, | ||
publicKey: publicKey, | ||
message: message, | ||
); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters