decentralized-identity / decentralized-identity/web5-rs

Add singular cryptography interfaces for generating, signing and verifying

Open
#205 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
19
Forks
15
PR merge metrics
No merged PRs in 30d

Description

In a ton of places throughout the codebase, wherever we make a call to on of the `crypto` crates' `generate()`/`sign()`/`verify()` functions we always have to have a `match` statement. For example,

```rust
let private_key = Arc::new(match curve {
Curve::Ed25519 => Ed25519::generate(),
Curve::Secp256k1 => Secp256k1::generate(),
}?);
```

This is an obvious place where DRY and the convenience would save us a lot of lines of code (and overhead). We should create singular interfaces for this set of functionality, within the `crypto` crate, perhaps multiple different functions depending on what the required set of parameters are (rust doesn't support function overloading, so prefer to use required parameters with named functions; for example `sign_crv(curve: Curve)` and `sign_crv_str(curve: &str)`).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.