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

Swap out Buffer with browser-compatible Uint8Array #83

Merged
merged 3 commits into from
Oct 24, 2022

Conversation

Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Oct 12, 2022

Buffer is a Node.js API and does not work in browsers without polyfills. This swaps out all usage of Buffer with Uint8Array, to make this library fully browser compatible without the need for polyfills.

@Mrtenz Mrtenz requested a review from a team as a code owner October 12, 2022 09:07
src/SLIP10Node.ts Show resolved Hide resolved
src/curves/curve.ts Show resolved Hide resolved
src/derivers/bip32.ts Outdated Show resolved Hide resolved
src/derivers/bip32.ts Outdated Show resolved Hide resolved
src/utils.test.ts Show resolved Hide resolved
Comment on lines +254 to +258
public readonly chainCodeBuffer: Uint8Array;

public readonly privateKeyBuffer?: Buffer;
public readonly privateKeyBuffer?: Uint8Array;

public readonly publicKeyBuffer: Buffer;
public readonly publicKeyBuffer: Uint8Array;
Copy link
Member

@rekmarks rekmarks Oct 18, 2022

Choose a reason for hiding this comment

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

This change will be breaking. Should we rename these properties to *Bytes instead of *Buffer instead?

Copy link
Member

Choose a reason for hiding this comment

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

We're gonna do this in a follow-up.

src/utils.ts Show resolved Hide resolved
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

In addition to my inline comment(s), there are some questions by @FrederikBolding that should be resolved before we merge this.

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

@Mrtenz Mrtenz merged commit 3da3c2b into main Oct 24, 2022
@Mrtenz Mrtenz deleted the mrtenz/remove-buffer branch October 24, 2022 07:26
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.

3 participants