-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Kasper Isager Dalsgarð <[email protected]>
- Loading branch information
1 parent
63cfc33
commit 7d9631a
Showing
10 changed files
with
222 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"prettier-config-standard" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { Transform, TransformOptions } from 'bare-stream' | ||
import Buffer, { BufferEncoding } from 'bare-buffer' | ||
|
||
type Algorithm = 'MD5' | 'SHA1' | 'SHA256' | 'SHA512' | 'BLAKE2B256' | ||
|
||
export const constants: { hash: Record<Algorithm, number> } | ||
|
||
declare class CryptoError extends Error { | ||
static UNSUPPORTED_DIGEST_METHOD(msg: string): CryptoError | ||
} | ||
|
||
export class Hash extends Transform { | ||
constructor( | ||
algorithm: Algorithm | Lowercase<Algorithm> | number, | ||
opts?: TransformOptions<Hash> | ||
) | ||
|
||
update(data: string, encoding?: BufferEncoding): this | ||
update(data: Buffer): this | ||
|
||
digest(encoding: BufferEncoding): string | ||
digest(): Buffer | ||
} | ||
|
||
export function createHash( | ||
algorithm: Algorithm | Lowercase<Algorithm> | number, | ||
opts?: TransformOptions<Hash> | ||
): Hash | ||
|
||
export function randomBytes(size: number): Buffer | ||
|
||
export function randomBytes( | ||
size: number, | ||
callback: (err: Error | null, buffer: Buffer) => void | ||
): void | ||
|
||
export function randomFill<B extends ArrayBuffer | ArrayBufferView>( | ||
buffer: B, | ||
offset?: number, | ||
size?: number | ||
): B | ||
|
||
export function randomFill<B extends ArrayBuffer | ArrayBufferView>( | ||
buffer: B, | ||
callback: (err: Error | null, buffer: B) => void | ||
): void | ||
|
||
export function randomFill<B extends ArrayBuffer | ArrayBufferView>( | ||
buffer: B, | ||
offset: number, | ||
callback: (err: Error | null, buffer: B) => void | ||
): void | ||
|
||
export function randomFill<B extends ArrayBuffer | ArrayBufferView>( | ||
buffer: B, | ||
offset: number, | ||
size: number, | ||
callback: (err: Error | null, buffer: B) => void | ||
): void | ||
|
||
export function randomFillSync<B extends ArrayBuffer | ArrayBufferView>( | ||
buffer: B, | ||
offset?: number, | ||
size?: number | ||
): B | ||
|
||
export { CryptoError as errors } |
Oops, something went wrong.