stricahq / bip32ed25519 Goto Github PK
View Code? Open in Web Editor NEWPure javascript implementation of Bip32Ed25519, used for Cardano blockchain key pair.
License: Apache License 2.0
Pure javascript implementation of Bip32Ed25519, used for Cardano blockchain key pair.
License: Apache License 2.0
Here
bip32ed25519/src/Bip32PrivateKey.ts
Line 28 in 5e2788b
If you compare it with classical implementation it should be 0x7f (=127) as per Berstein ref or 0x3f (=63) as per ref10.
for instance, NACL is using 0x7f:
https://github.com/dchest/tweetnacl-js/blob/f1ec050ceae0861f34280e62498b1d3ed9c350c6/nacl.js#L712
I think this error might make the implementation unsecure, as signatures can be malleable. Or do you have any reference justifying such implementation?
chai
module must be in dev deps
Hello, I've faced with the error in version 1.0.4:
import { Bip32PublicKey } from '@stricahq/bip32ed25519';
^^^^^^^^^^^^^^
SyntaxError: Named export 'Bip32PublicKey' not found. The requested module '@stricahq/bip32ed25519' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
Library version 1.0.3 works as expected with named imports.
Workaround:
import bip32ed25519 from '@stricahq/bip32ed25519';
const { Bip32PublicKey } = bip32ed25519;
But it would be helpful to support named imports in module only environment.
when i used bip32 from 24 word seed phrase , the same path address is mot match typhonjs wallet address.
```
const words = 'my 24 words';
const rootKey = await Bip32PrivateKey.fromEntropy(words);
// hardened derivation from typhonjs wallet
// m/1852'/1815'/0'/0/0 Payment Key Path 0f9cacda3bc7a196a91c03782c7d2efbd2262f8a5cf2f42146567dd5
// m/1852'/1815'/0'/2/0 Stake Key Path 098d18ebe3d4a859757e86a1ce2c46514c35d4d859a805a109038cb3
const accountKey = rootKey
.derive(2147483648 + 1852) // purpose
.derive(2147483648 + 1815) // coin type
.derive(2147483648 + 0) // account index
.derive(0) // chain
.derive(0) // payment key index
.toPrivateKey();
const stakeKey = rootKey
.derive(2147483648 + 1852) // purpose
.derive(2147483648 + 1815) // coin type
.derive(2147483648 + 0) // account index
.derive(2) // chain
.derive(0) // payment key index
.toPrivateKey();
console.log(accountKey.toPublicKey().hash().toString("hex"));
console.log(stakeKey.toPublicKey().hash().toString("hex"));
// 61cab1cea50fa5b4d7b40269d78e8c0a86485a3ed5484fce7201e8ea
// 2b2c7e8fbc8beac8c620298d3e92e6b195b2cdb77f384498e17ab4b3
const paymentCred0 = {
hash: accountKey.toPublicKey().hash().toString("hex"),
type: typhonJs.types.HashType.ADDRESS,
};
const paymentCred1 = {
hash: stakeKey.toPublicKey().hash().toString("hex"),
type: typhonJs.types.HashType.ADDRESS,
};
const address1 = new typhonJs.address.BaseAddress(
typhonJs.types.NetworkId.MAINNET,
paymentCred0,
paymentCred1
);
console.log(address1);
// address1 : addr1q9su4vww5586tdxhkspxn4uw3s9gvjz68m25sn7wwgq7363t93lgl0ytatyvvgpf35lf9e43jkevmdml8pzf3ct6kjesj4al6c
// typhonjs wallet address : addr1qy8eetx680r6r94frsphstra9maayf303fw09appget8m4gf35vwhc754pvh2l5x588zc3j3fs6afkze4qz6zzgr3jesr4gp3k
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.