-
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.
Change to better distinguish signature schemes
It is currently possible to call the `APK::verify` or `PublicKey::verify` on the same signature type, leading to situations where even if a user is technically *allowed* to call the function, verification is in principle impossible, since the signature schemes used to produce a signature are different. Furthermore, the `sign_vulnerable` function is arguably misnamed, since it is only actually vulnerable to a rogue key attack *when used in a multi-signature context*. In the interest of fixing this, this commit introduces a couple of changes to the API of the crate, designed to better distinguish and clarify the usage of the two different signature schemes it provides. First and foremost, a new signature type - `MultisigSignature` is added, representing a signature produced using the multi-signature scheme. Conversely, the already existing `Signature` type is taken to mean the a signature produced using the single-key scheme. The functions under `SecretKey`, `sign_vulnerable` and `sign`, are respectivelly renamed into `sign` and `sign_multisig`, and the latter is changed to return the new `MultisigSignature` type. The "aggregated public key" type is renamed from `APK` into `MultisigPublicKey`, to better denote its use and to be in line with the kind signature it can now verify using the `verify` function - which is changed to take a `MultisigSignature`. On a more subtle note, the `From<&PublicKey>` and `From<&SecretKey>` implementations for `MultisigPublicKey`, formerly `APK` are removed and the API of `MultisigPublicKey::aggregate` is changed to *not* take `&self`, and only take a slice of `PublicKey`. This is designed to promote the intended usage of the struct - aggregating a collection of public keys, as opposed to just "aggregating" one. Resolves: #18
- Loading branch information
Eduardo Leegwater Simões
committed
Jul 31, 2024
1 parent
fcecfad
commit 25a680e
Showing
11 changed files
with
293 additions
and
275 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,5 @@ | |
// | ||
// Copyright (c) DUSK NETWORK. All rights reserved. | ||
|
||
pub mod apk; | ||
pub mod public; | ||
pub mod secret; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.