Commit Graph

10 Commits

Author SHA1 Message Date
Tobin C. Harding 6d7c653b64
Use hashes instead of bitcoin_hashes
Use the more terse `hashes` by way of the `package` field in the
manifest.

Allows us to remove the ugly feature alias "bitcoin-hashes" ->
"bitcoin_hashes" and removes all the bother with the underscore.

Why did we not think of this 2 years ago?
2023-08-15 14:54:55 +10:00
Tobin C. Harding cd40ae7f19
Improve Message constructors
Observe:

- The word "hash" can be a verb or a noun, its usage in function names
  is therefore at times ambiguous.
- The function name `from_slice` gives no indication as to what the
  slice input is.

Improve Message constructors by doing:

- Add a constructor `Message::from_digest` that takes a 32 byte array as
  input.
- Rename `Message::from_slice` to `Message::from_digest_slice`
  (deprecate `from_slice` and add `from_digest_slice`)
- Improve the docs while we are at it.
2023-08-10 08:20:46 +10:00
Tobin C. Harding 8e772493dc
Depend on bitcoin_hashes v0.12
Upgrade to use the newly released `bitcoin_hashes`.
2023-03-15 14:56:28 +11:00
Tobin C. Harding 9c748550b4 Fix feature gating
Currently we have a few problems with our feature gating, attempt to
audit all feature gating and fix it by doing:

1. Do not enable features on optional dependencies (`rand` and
   `bitcoin-hashes`) in dev-dependencies, doing so hides broken feature
   gating in unit tests.
2. Do not use unnecessary feature combinations when one feature enables
   another e.g. `any(feature = "std", feature = "alloc")`.
3. Enable "std" from "rand-std" and "bitcoin-std" (and fix features
   gating as for point 2).
4. Clean up code around `rand::thread_rng`, this is part of this patch
   because `thread_rng` requires the "rand-std" feature.
5. Clean up CI test script to test each feature individually now that
   "rand-std" and "bitcoin-hashes-std" enable "std".
2022-11-18 10:14:41 +11:00
Tobin C. Harding e0e575dde7 Run cargo fmt
Run the command `cargo +nightly fmt` to fix formatting issues.

The formatter got confused in one place, adding an incorrect
indentation, this was manually fixed.
2022-11-16 11:06:12 +11:00
Elichai Turkel ebe46a4d4e
Update rand to 0.8 and replace CounterRng with mock::StepRng 2022-06-07 23:59:40 +03:00
Thomas Eizinger c47ead9967
Move `Signature` and `SerializedSignature` to new `ecdsa` module
With the introduction of Schnorr signatures, exporting a `Signature`
type without any further qualification is ambiguous. To minimize the
ambiguity, the `ecdsa` module is public which should encourage users
to refer to its types as `ecdsa::Signature` and `ecdsa::SerializedSignature`.

To reduce ambiguity in the APIs on `Secp256k1`, we deprecate several
fucntions and introduce new variants that explicitly mention the use of
the ECDSA signature algorithm.

Due to the move of `Signature` and `SerializedSignature` to a new module,
this patch is a breaking change. The impact is minimal though and fixing the
compile errors encourages a qualified naming of the type.
2021-11-11 13:43:48 +11:00
Elichai Turkel 7e5916b61f
Aded an example for recoverable signatures and recovering the pubkey 2019-10-28 22:23:56 +02:00
Elichai Turkel e28f756788
Added an example for signing and verification 2019-10-28 22:09:59 +02:00
Elichai Turkel 5ee0afbde4
Added an example for generating keys using OsRng 2019-10-28 22:09:18 +02:00