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(types): introduce type files for projects using TS #71

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

IanKrieger
Copy link
Contributor

Adds typings into the base directory, so that a TS project can understand what it is importing

Generates index.d.ts:

export const DEFAULT_SEED_SIZE: number;
export function hmac(message: Uint8Array, key: Uint8Array): Uint8Array;
export function getHKDF(ikm: Uint8Array, info: Uint8Array, extractLen: number, salt?: Uint8Array | undefined): Uint8Array;
export function getSeed(size?: number | undefined): Uint8Array;
export function deriveSigningKeysFromSeed(seed: Uint8Array, salt?: Uint8Array | undefined): {
    secretKey: Uint8Array;
    publicKey: Uint8Array;
};
export function uint8ToHex(arr: Uint8Array | Buffer): string;
export function hexToUint8(hex?: string | undefined): Uint8Array;
export namespace passphrase {
    function fromBytesOrHex(bytes: Uint8Array | Buffer | string, useNiceware?: boolean | undefined): string;
    function toBytes32(passphrase: string): Uint8Array;
    function toHex32(passphrase: string): string;
    let NICEWARE_32_BYTE_WORD_COUNT: number;
    let BIP39_32_BYTE_WORD_COUNT: number;
}
export namespace random {
    function uniform(n: number): number;
    function uniform_01(): number;
}

@diracdeltas diracdeltas self-requested a review June 25, 2024 17:25
Copy link
Member

@diracdeltas diracdeltas left a comment

Choose a reason for hiding this comment

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

let me know if you want me to do an npm release for this

@diracdeltas diracdeltas merged commit eda8a12 into brave:master Jun 25, 2024
7 checks passed
@IanKrieger
Copy link
Contributor Author

@diracdeltas that would be great! I have one more contribution I want to make here, so I think I'll have a 0.4.1 follow after this. It can hold off if need be, but if it's easy then please do!

@diracdeltas
Copy link
Member

ok i'll wait til the next version then

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.

2 participants