-
Notifications
You must be signed in to change notification settings - Fork 2
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
Kels7 wip make it work in the browser #2
Kels7 wip make it work in the browser #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good, your formatter interfered with having a clean diff though. Can you undo those changes and re-request ?
dist/index.d.mts
Outdated
sk: string; | ||
vk: string; | ||
sk: any; | ||
vk: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why any ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird. I only formatted src/lib/wallet.ts
with prettier v3.2.5
and built it. I did not even touch any of your tsup configs
src/lib/wallet.ts
Outdated
}; | ||
}; | ||
|
||
return wallet(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like your autoformatter created diffs where there shouldn't be.
src/lib/wallet.ts
Outdated
return { | ||
sk: new Uint8Array(kp["secretKey"].slice(0, 32)), | ||
vk: new Uint8Array(kp["secretKey"].slice(32, 64)), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto formatter again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Kels, thanks for making a PR ! Looks great except for the diffs created from what I assume is your formatter and also the any
typings.
const uint8Array: Uint8Array = new Uint8Array(buffer); | ||
const hexArray: string[] = Array.prototype.map.call(uint8Array, (x: number) => ("00" + x.toString(16)).slice(-2)); | ||
const hexString: string = hexArray.join(""); | ||
return hexString | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue for the any
types was due to buf2hex
not written properly in typescript. In the near future all functions in helper.ts
should be rewritten in proper typescript
const publicKey = bip32.getPublicKey(key, false).toString("hex"); | ||
hdkey = hdkey.derive(derivationPath); | ||
const privateKey = helpers.buf2hex(hdkey.privateKey); | ||
const publicKey = helpers.buf2hex(hdkey.publicKey).slice(2); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buf2hex
was used for getting the privateKey
and publicKey
in hex strings . But because buf2hex
was not properly typed, it returned any
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noice
Pull Request Submission: Update ed25519-hd-key to ed25519-keygen
Issue Description
The npm package
ed25519-hd-key
currently cannot be run in the browser due to its dependency oncreate-hmac
. This issue has been acknowledged and can be found in the ed25519-hd-key GitHub repository [1]. To address this limitation, the decision was made to replaceed25519-hd-key
with the packageed25519-keygen
[2].Changes Made
To resolve the issue, the logic for
ed25519-hd-key
in thesrc/lib/wallet.ts
file has been replaced with the logic fored25519-keygen
. This replacement ensures that the code can be executed in the browser without any dependency conflicts [2]. The changes can be found in the branchkels7-wip-make-it-work-in-the-browser)
Benefits of Using ed25519-keygen
By switching to
ed25519-keygen
, the following benefits are achieved:Pull Request Details
The pull request includes the following changes:
ed25519-hd-key
withed25519-keygen
in thesrc/lib/wallet.ts
file.create-hmac
.