Comments (14)
This maps to what is done in substrate/polkadot, i.e. https://github.com/paritytech/substrate/blob/master/core/primitives/src/ed25519.rs#L334-L340
At launch, the default pairs will be sr25519 (for general accounts, i.e. https://github.com/w3f/schnorrkel) and TBD for sessions (currently the only place ed25519 generally should be used atm since sr25519 is not supported there yet)
from common.
@hskang9 I would suggest contacting the W3F for a couple of reasons -
- they did the w3f/schnorrkel and worst-case can get you in touch with the guy behind that
- they may very well be open for the suggestion of a port + bounty on the port
from common.
The C wrapper is fine, but doesn’t really help in a RN or browser environment, only in a Node.js env.
And yes, Jeff is the right person from a technical POV. (Obviously:))
from common.
Really looking forward to playing with whatever you come up with. (Like I mentioned earlier, not something I would attempt myself since I'm no immersed enough in the crypto world, and well, idiots shouldn't do crypto, but would love a JS impl)
from common.
The C wrapper is fine, but doesn’t really help in a RN or browser environment, only in a Node.js env.
And yes, Jeff is the right person from a technical POV. (Obviously:))
The Hardware wallet need C or C++ sr25519 lib. Such as: Arduino Nano
from common.
@hskang9
C language implementation.
https://github.com/Warchant/sr25519-crust
https://travis-ci.org/Warchant/sr25519-crust
from common.
@jacogr don't just discourage yourself, there must be something that we can do together. I will post the repo for that here. @jiangfuyao Thank you for introducing wrapper interface, I should look into that and use it to build js wrapper, but I think I will first make ristretto point layer to feed as a seed in x25519 algorithm. After I tweaked around the code, it looks like sr25519 consists of
seed -> ristretto point serialized as 32 bytes for key property in x25519 extended key -> sr keypair
I am excited as well to build this layer for sr25519.
from common.
Will sr25519 lib be used asynchronously due to the fact that wasm has to be compiled asynchronously or will it be synchronous by porting sr25519 in javascript or update when wasm can be compiled synchronously?
from common.
Currently the WASM is instantiated in an async manner. (Not pretty since it "hacks around" the Rust wasm-pack somewhat - https://github.com/polkadot-js/wasm/blob/master/scripts/build-package.sh#L76. Build process used wasm-pack to build and then adjusts the outputs for async and some other polyfills).
In a Node.js env sync works really well, however in browser webpack environments the sync init does not work as well, or rather results in something that doesn't work and throws warnings.
For all the functions exposed in that repo, there are JS fallbacks, e.g. ed25519 or blake2, etc. (when the WASM is not instantiated yet), however there is nothing like that for sr25519. Atm there are no plans to port this to JS - would love a JS implementation, however prefer not doing crypto code myself and leave it yo people who work with thius stuff the whole day.
(As an aside there has been some playing with an asm.js fallback version, however it just bloats the packages completely to >13MB, so effectively if you don't have a WASM-capable env. at present, there is no sr25519 support at all)
from common.
I agree that wasm for now is really tricky, and I heard that they are working on synchronous compilation this year. Okay working on js implementation starting now. I hope if there is a bounty on this.
from common.
@jacogr Thank you! I have already sent burdges in w3f for my plan to work on this, but here are two plans to share the suggestion that I have thought.
-
w3f/schnorrkel is based on
curve25519-dalek
from Ristretto Group, and I found a C implementation. I am thinking to make Js wrapper of that C library and build schnorrkel great again with js. -
Configure some constants in existing ed25519 js lib. After I investigated and asked Mr.Burdges, I found out that the curve is same between ed25519 and sr25519 hopefully, so I think this is probably the easiest one if I can just apply the corresponding configuration there(e.g. ristretto points).
from common.
I think I would have to add ristretto group layer to use it with ed25519's key in Extended key type to make sr25519.
I will get confirm from him in a day or tmrw.
from common.
Closing this one. Happy as it stands with the WASM bridge.
from common.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.
from common.
Related Issues (20)
- Re-enable encrypt/decrypt on keypair HOT 2
- Add support for bip39 with other wordlists HOT 1
- Bug: the function 'deriveAddress' from a public key with ecdsa HOT 6
- Verify a signed transaction payload offline for ecdsa HOT 7
- Attempted import error: 'TextDecoder' is not exported from '@polkadot/x-textdecoder'
- Keypair functions taking too much time HOT 2
- `base58Validate` returns true for invalid base58 string HOT 1
- Ledger Identity Verification ("raw") signing HOT 10
- Hash of https://esm.sh/@noble/[email protected]/ed25519.js often change HOT 6
- pair.encodePkcs8() not interoperable HOT 3
- Question for how to get publickey and privatekey & how to verify those key?
- Expose `Keypair` from util-crypto/src/types.ts in util-crypto/bundle.ts HOT 3
- Change RISC-V magic HOT 1
- Signing and verifying a message using ECDSA sometimes fails
- Can the seed be recovered from the secret key? HOT 3
- keyring->pair->vrfVerify: possibly the wrong public key is used if the pair type is sr25519 HOT 1
- Please provide documentation for the pkcs8 related constants in keyring HOT 2
- toBin conversion
- Mythos Parachain's prefix `29972`not supported
- create a wallet like trustwallet HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from common.