Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credible bug: [BUG] Unable to build DIDKit due to multiple definitions of sha256 and generate_ed25519 #64

Closed
Mikerah opened this issue Feb 9, 2021 · 3 comments
Assignees

Comments

@Mikerah
Copy link

Mikerah commented Feb 9, 2021

Describe the bug
When building DIDKit according to the instructions found here, I encountered to errors relating to duplication of definitions of sha256 and generate_ed25519. These definitions are actually found in the ssi crate and is causing the building process to fail.

These are the outputs:

error[E0428]: the name `sha256` is defined multiple times
  --> /home/mikerah/Documents/Projects/ssi/src/hash.rs:13:1
   |
4  | pub fn sha256(data: &[u8]) -> Result<[u8; 32], Error> {
   | ----------------------------------------------------- previous definition of the value `sha256` here
...
13 | pub fn sha256(data: &[u8]) -> Result<[u8; 32], Error> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` redefined here
   |
   = note: `sha256` must be defined only once in the value namespace of this module
error[E0201]: duplicate definitions with name `generate_ed25519`:
   --> /home/mikerah/Documents/Projects/ssi/src/jwk.rs:206:5
    |
179 | /     pub fn generate_ed25519() -> Result<JWK, Error> {
180 | |         use ring::signature::KeyPair;
181 | |         let rng = ring::rand::SystemRandom::new();
182 | |         let doc = ring::signature::Ed25519KeyPair::generate_pkcs8(&rng)?;
...   |
202 | |         })
203 | |     }
    | |_____- previous definition of `generate_ed25519` here
...
206 | /     pub fn generate_ed25519() -> Result<JWK, Error> {
207 | |         let mut csprng = rand::rngs::OsRng {};
208 | |         let keypair = ed25519_dalek::Keypair::generate(&mut csprng);
209 | |         let sk_bytes = keypair.secret.to_bytes();
...   |
225 | |         })
226 | |     }
    | |_____^ duplicate definition

To Reproduce
Steps from DIDKit docs

  1. git clone https://github.com/spruceid/ssi
  2. git clone https://github.com/spruceid/didkit
  3. cd didkit/
  4. cargo build

Expected behavior
Expected cargo build to complete without any errors.

Desktop (please complete the following information):

  • OS: Fedora 32, 64-bit
  • Browser: Firefox
@wyc
Copy link
Contributor

wyc commented Feb 9, 2021

Thanks for opening an issue @Mikerah, please try the instructions here to exclude the WASM package for now: https://github.com/spruceid/didkit#manual

Specifically, with our introduction of WASM, there were competing features for ssi. We believe that packaging for crates.io and adding some more sophistication in our build process will resolve this.

We have tracked this issue more broadly here to ensure it doesn't re-occur: #63

@wyc
Copy link
Contributor

wyc commented Feb 9, 2021

Hi @Mikerah, with #65 I believe this should be resolved. Could you please confirm? Thanks.

@Mikerah
Copy link
Author

Mikerah commented Feb 9, 2021

I can confirm that with #65, I was able to build didkit.
Closing...

@Mikerah Mikerah closed this as completed Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants