paulmillr / ed25519-keygen Goto Github PK
View Code? Open in Web Editor NEWProduces secure keys and passwords. Supports SSH, PGP, BLS, OTP and many other formats
Home Page: https://paulmillr.com
License: MIT License
Produces secure keys and passwords. Supports SSH, PGP, BLS, OTP and many other formats
Home Page: https://paulmillr.com
License: MIT License
https://gist.github.com/jcolson/5bfa8650482cc0e31788b1d42b20fb0b
I'm attempting to use your library to load a gpg key created with gnupg (I noticed in one of your test cases you where doing something similar, but it was with a key that was generated deterministically with your tool, I assume.) Is there something that could be changed in order to successfully load a gpg key not created using ed25519-keygen/pgp ?
The library https://github.com/paulmillr/scure-bip32/blob/main/index.ts implements extended keys where you can do hdkey.fromExtendedKey(master.publicExtendedKey).deriveChild(x)
I'm looking for this feature using ed25519
and found this nice hdkeys implementation: https://github.com/paulmillr/ed25519-keygen/blob/main/src/hdkey.ts it looks very similar to scure-bip32
, I've tried porting over the code from scure-bip32
to use ed25519 but not to much success, so I figured I should just ask. Is this possible at all?
import ssh from 'ed25519-keygen/ssh';
...
I used the example, to generate a ssh private & public, for macos there will be an error
-> % ssh-add id_ed25519
Error loading key "id_ed25519": invalid format
imports in a couple places reference keys instead of keygen
import ssh from 'ed25519-keys/ssh';
import pgp from 'ed25519-keys/pgp';
import tor from 'ed25519-keys/tor';
import { randomBytes } from 'ed25519-keys/utils';
I am looking in generated keys from a parent hd key both from its private key and public key, so that the resulting keys matches
The api seems to only work on keys where the private key is known. any pointer to get non-hardened keys ?
I want something like the function deriveFromPublicKey
in the following
derive(parent private key).publickey = deriveFromPublicKey(public key)
Are there any plans to add support for commonJs?
Hello,
I've faced with the fact that clean installation of ed25519-keygen
module installs two versions of @noble/hashes
.
npm install ed25519-keygen
npm list @noble/hashes
[email protected] test-ed25519-keygen
└─┬ [email protected]
├─┬ @noble/[email protected]
│ └── @noble/[email protected]
└── @noble/[email protected]
It is not a big problem for a single usage but produces a lot of duplicates when using many @noble/*
and @scure/*
libraries.
is there a way that one could convert pgp ed25519 key to ssh ed25519 key format with this library? is there any interoperability between the ssh and pgp exports?
Hey Paul,
Unless I’m mistaken, 0.5 → 0.6, while appearing as a minor release, contains breaking changes (removal of await from the public API).
May I please request that the project adhere to semantic versioning to avoid breakage during maintenance updates?
Thanks + thanks again for making and sharing this :)
Could you please publish latest version to npm.
0.4.1 version is last in npm https://www.npmjs.com/package/ed25519-keygen?activeTab=versions
To my understanding (here's a RFC link to what I think is the relevant bit), the messages that can be signed by a Ed25519 can be of arbitrary size.
But the sign
function enforces a 32-byte message:
throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
^
TypeError: Expected Uint8Array of length 32, not of length=91
Why does the library do this?
🙏 it'd be nice to have ed25519 IPNS (libp2p-key) keygen support.
This is our experimental app-specific deterministic keygen format using deterministic ETH signatures for ENS contenthash.
let caip10 = `eip155:1:${App.user.address}`
let domain = "domain.eth"
let info = `${caip10}:${domain}`
let password = "pass12#$" // optional salt/pin
let extradata = await sha256(`${info}:${password ? password : ''}`) //still testing
let msg = `Requesting Signature To Generate IPNS Keys For ${domain}\n\nWARNING:Do Not Sign This Request From Untrusted Clients\nExtradata: ${extradata}\nSigned By: ${caip10}`;
let sig = await App.user.signMessage(msg);
let inputKey = sha256(
hexToBytes(
sig.toLowerCase().startsWith('0x') ? sig.slice(2) : sig
)
)
let salt = await sha256(`${info}:${password ? password : ''}:${sig.slice(-64)}`)
let hashKey = await hkdf(sha256, inputKey, salt, info, 42)
let privateKey = hashToPrivateScalar(hashKey, ed25519.CURVE.n, true).toString(16).padStart(64, "0")
let publicKey = bytesToHex(await ed25519.getPublicKey(privateKey))
let key = `08011240${privateKey}${publicKey}`
let w3Name = await Name.from(hexToBytes(key))
// let contenthash = `0xe5010172002408011220{$publicKey}`
error importing utils:
node:internal/errors:484
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/jcolson/src/personal/gpgssh/node_modules/ed25519-keygen/utils.js'
ls output of node_modules:
ll node_modules/ed25519-keygen/
.rw-r--r-- 46 jcolson staff 30 Aug 21:28 index.d.ts
.rw-r--r-- 101 jcolson staff 30 Aug 21:28 index.d.ts.map
.rw-r--r-- 87 jcolson staff 30 Aug 21:28 index.js
.rw-r--r-- 1.8k jcolson staff 30 Aug 21:28 package.json
.rw-r--r-- 2.3k jcolson staff 30 Aug 21:28 pgp.d.ts
.rw-r--r-- 1.0k jcolson staff 30 Aug 21:28 pgp.d.ts.map
.rw-r--r-- 20k jcolson staff 30 Aug 21:28 pgp.js
.rw-r--r-- 5.8k jcolson staff 30 Aug 21:28 README.md
drwxr-xr-x - jcolson staff 30 Aug 21:28 src
.rw-r--r-- 1.5k jcolson staff 30 Aug 21:28 ssh.d.ts
.rw-r--r-- 741 jcolson staff 30 Aug 21:28 ssh.d.ts.map
.rw-r--r-- 2.5k jcolson staff 30 Aug 21:28 ssh.js
.rw-r--r-- 339 jcolson staff 30 Aug 21:28 tor.d.ts
.rw-r--r-- 258 jcolson staff 30 Aug 21:28 tor.d.ts.map
.rw-r--r-- 1.3k jcolson staff 30 Aug 21:28 tor.js
Thanks for this library!
Would it be possible to support encoding the ssh key with a passphrase?
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.