Git Product home page Git Product logo

Comments (14)

iinuwa avatar iinuwa commented on June 4, 2024 1

changed the title on this to be specific to the crate now that it's been moved to the monorepo.

from ruma.

jplatte avatar jplatte commented on June 4, 2024 1

The ed25519-dalek crate uses rand's traits in its interface so we should use that for keypair generation (probably fine to use thread_rng, we could then later possibly allow a custom RNG).

from ruma.

stoically avatar stoically commented on June 4, 2024

Workaround: https://github.com/stoically/ruma-signatures/commit/c9823b2f4e4fafc6cebfd3fc62d9d794d093b236

from ruma.

jplatte avatar jplatte commented on June 4, 2024

If ed25519-dalek can fully replace ring for our uses, I think I'd be in favor of switching and AFAIK it's also written by trustworthy people.

I don't really know what our current uses of ring even are though and I don't have much time to understand this crate in more detail. We really need an owner for this crate who is not me...

from ruma.

stoically avatar stoically commented on June 4, 2024

Looks like it could fully replace ring, would need some adjustments in the tests. ed25519-dalek seems to be geared for this specific use case, which is nice I think, but ring might be the better candidate if one day different algorithms might be needed. I'll look into putting it behind a feature.

from ruma.

jplatte avatar jplatte commented on June 4, 2024

While we could support both behind feature flags, I'm not sure what that achieves. Are you interested in maintaining ruma-signatures? If not, maybe the best path forward for now is to have your own fork using ed25519-dalek and rely on that. There's no dependencies on ruma-signatures in any of the other ruma crates, so no compatibility concerns.

from ruma.

jplatte avatar jplatte commented on June 4, 2024

ed25519-dalek 1.0 is out, I'll look into switching away from ring

I'd welcome a PR switching from ring to ed25519-dalek.

from ruma.

ShadowJonathan avatar ShadowJonathan commented on June 4, 2024

/command @iinuwa assign to @ShadowJonathan

from ruma.

ShadowJonathan avatar ShadowJonathan commented on June 4, 2024

ruma-signatures has two spots which uses ring for other uses;

use ring::digest::{digest, SHA256};

let document = RingEd25519KeyPair::generate_pkcs8(&ring::rand::SystemRandom::new())

These would also need replacement candidates.

from ruma.

ShadowJonathan avatar ShadowJonathan commented on June 4, 2024

Suggestions from @poljar are;

  • Use rand with getrandom (which "works everywhere")

  • Use sha2 crate, which is pure rust.

from ruma.

ShadowJonathan avatar ShadowJonathan commented on June 4, 2024

I opened this issue because it doesn't seem ed25519-dalek supports PKCS8 to support generating/creating Ed25519KeyPair from them.

from ruma.

ShadowJonathan avatar ShadowJonathan commented on June 4, 2024

Going deeper down the rabbit hole, I discovered that the pkcs8 crate doesn't support PKCS8 v2 documents (as described here), ring::signature::Ed25519KeyPair::as_ref() produces PKCS8 v2 documents, so I made some noise to have it be supported (possibly): RustCrypto/utils#419

from ruma.

ShadowJonathan avatar ShadowJonathan commented on June 4, 2024

@stoically now that #589 has merged into next, could you verify that compiling to WASM works?

from ruma.

jplatte avatar jplatte commented on June 4, 2024

Closing under the assumption that this now works, if it doesn't please open an issue with details on how it fails.

from ruma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.