Skip to content
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

feat(hd-wallet): add package #1151

Merged
merged 22 commits into from
Nov 17, 2023
Merged

feat(hd-wallet): add package #1151

merged 22 commits into from
Nov 17, 2023

Conversation

javadkh2
Copy link
Collaborator

This is the first PR related to hd-wallet
check readme and ADRs for more information

Copy link

changeset-bot bot commented Oct 31, 2023

🦋 Changeset detected

Latest commit: e041095

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
alpha-docs ⬜️ Ignored (Inspect) Visit Preview Nov 17, 2023 0:49am
docs-storybook ⬜️ Ignored (Inspect) Visit Preview Nov 17, 2023 0:49am
react-ui ⬜️ Ignored (Inspect) Visit Preview Nov 17, 2023 0:49am
tools ⬜️ Ignored (Inspect) Visit Preview Nov 17, 2023 0:49am

@@ -0,0 +1,53 @@
# Use BIP44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe somewhere in this decision record, you could also mention something about not supporting extended-public-keys

@@ -8360,8 +8362,8 @@ if (debugUtil && debugUtil.debuglog) {
}
/*</replacement>*/

var BufferList = require('./internal/streams/BufferList.js');
var destroyImpl = require('./internal/streams/destroy.js');
var BufferList = require('./internal/streams/BufferList');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if it matters, but potentially the removal of .js makes this extraction esm incompatible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bundle is created with browserify, I have copied it from the old lib.
it only work if I remove .js actually I didnt add them manually my VSCode did it when I move the file to the different path.
I will check esm compatibility

@javadkh2 javadkh2 marked this pull request as ready for review November 7, 2023 12:17
.gitignore Outdated
Comment on lines 99 to 105
packages/tools/lint-package/src/helpers.js
packages/tools/lint-package/src/index.js
packages/tools/lint-package/src/logger.js
packages/tools/lint-package/src/rules/api-extractor/types.js
packages/tools/lint-package/src/rules/eslint/config.js
packages/tools/lint-package/src/rules/package-json/scripts.js
packages/tools/lint-package/src/rules/typescript/extends.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to make a separate PR for this?

Is this happening when running tsc in that package? It should, based on tsconfig, create a lib for files like this.

Do we maybe need a more generic one? Something like

packages/*/*/src/**/*.js

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how they came up here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this file?

"lib"
],
"scripts": {
"build": "tsc && cpy ./src/chainweaver/vendor/**/* ./lib/chainweaver/vendor/",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add api-extractor to this package?

"name": "@kadena/hd-wallet",
"version": "0.0.1",
"private": true,
"description": "HD Wallet; key derivation",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "HD Wallet; key derivation",
"description": "A common approach to work with mnemonic keys and key derivation for Kadena based on BIP39 BIP44",

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this generic for the other non-legacy/chainweaver implementation as well?

"extends": "./node_modules/@kadena-dev/shared-config/tsconfig-base.json",
"compilerOptions": {
"allowJs": false,
"lib": ["es2019", "DOM"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to not rely on DOM? Do you think that using DOM here will make this package potentially not work in non-DOM, nodejs, environment?

Comment on lines 24 to 28
export declare const kadenaSign: (
password: string,
message: string,
privateKey: string,
) => Uint8Array;
Copy link
Member

@alber70g alber70g Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to use the rootKey and
do we want to be signing multiple hashes at once to improve performance?

Suggested change
export declare const kadenaSign: (
password: string,
message: string,
privateKey: string,
) => Uint8Array;
export declare const kadenaSign: (
password: string,
rootKey: string | Uint8Array,
index: number,
...message: string[]
) => Uint8Array;


export declare const kadenaGenMnemonic: () => string;

export declare const kadenaGetPublic: (secretKey: Uint8Array) => Uint8Array;
Copy link
Member

@alber70g alber70g Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should probably accept the rootKey: string | Uint8Array, password: string, ...index: number[]

@javadkh2 javadkh2 merged commit 03b249a into main Nov 17, 2023
10 checks passed
@javadkh2 javadkh2 deleted the feat/hd-wallet branch November 17, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants