Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Create a subproject for core components #153

Open
mikelodder7 opened this issue Oct 5, 2020 · 0 comments
Open

Create a subproject for core components #153

mikelodder7 opened this issue Oct 5, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@mikelodder7
Copy link
Contributor

Ursa will have many traits and structures that will be common across subprojects. The idea is that if at least two subprojects have a common item, this can live in the core subproject.

Here is a list of the currently known components that can live here

As part of this the Keys struct should be changed to be a placeholder trait such that each consuming subproject can expand it in their own way without having to extend an enum.

For example, all the keys are just generic wrappers around byte arrays like PrivateKey. While it works, Rust can provide stronger typing that wrapping a generic Vec.

If PrivateKey were changed to

pub trait PrivateKey: Zeroize {
  fn to_bytes(&self, compressed: bool) -> Vec<u8>;
  fn from_bytes(data: &[u8], compressed: bool) -> UrsaResult<Self>;
}

The BLS, Ed25519, ECDSA could provide an implemented version that is the specific to them that is stronger typed

pub struct BLSPrivateKey([u8; 32]);

impl Zeroize for BLSPrivateKey {...}

impl PrivateKey for BLSPrivateKey {...}

We can similarly apply the same idea to the current enum KeyGenOption.

In the end, key generation should be flexible enough to be usable by any crypto primitive like signatures, short group signatures, post quantum methods, and others.

This also facilitates the FFI and WASM wrappers to just return the generic PrivateKey trait as part of their interfaces without having to worry about the specific implementations.

@mikelodder7 mikelodder7 added the enhancement New feature or request label Oct 5, 2020
@mikelodder7 mikelodder7 mentioned this issue Oct 5, 2020
15 tasks
@mac-arrap mac-arrap self-assigned this Jul 1, 2021
@brentzundel brentzundel added this to the v1.0 milestone Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants