Add blakejs

This commit is contained in:
Jaco Greeff 2018-06-21 10:31:25 +02:00
parent 5d9c93e8ce
commit 26cc286262
6 changed files with 60 additions and 0 deletions

9
.editorconfig Normal file
View File

@ -0,0 +1,9 @@
root = true
[*]
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
[{*.json,*.yml}]
indent_style = space

View File

@ -8,4 +8,5 @@ In general, updates here should have corrsponding PRs on the DefinitelyTyped rep
This following libraries are currently included. Where possible add the relevant DT PRs as there are included - may not be applicable initially if definitions are not expansive enough or fully tested internally. This following libraries are currently included. Where possible add the relevant DT PRs as there are included - may not be applicable initially if definitions are not expansive enough or fully tested internally.
- [blakejs](https://github.com/dcposch/blakejs)
- [bn.js](https://github.com/indutny/bn.js/) [@types PR #26717](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/26717) - [bn.js](https://github.com/indutny/bn.js/) [@types PR #26717](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/26717)

4
blakejs/blakejs-tests.ts Normal file
View File

@ -0,0 +1,4 @@
import blake = require('blakejs');
blake.blake2bHex(new Uint8Array([1, 2, 3, 4, 5]));
blake.blake2sHex(Buffer.from([1, 2, 3, 4, 5]));

29
blakejs/index.d.ts vendored Normal file
View File

@ -0,0 +1,29 @@
// Type definitions for blakejs 1.1.0
// Project: https://github.com/dcposch/blakejs
// Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
type BlakeJsContext = {
b: Uint8Array,
h: Uint32Array,
t: number,
c: number,
outlen: number
};
type blakejs = {
blake2b: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => Uint8Array,
blake2bFinal: (context: BlakeJsContext) => Uint8Array,
blake2bHex: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => string,
blake2bInit: (outlen?: number, key?: Uint8Array) => BlakeJsContext,
blake2bUpdate: (context: BlakeJsContext, data: Buffer | Uint8Array | string) => void,
blake2s: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => Uint8Array,
blake2sFinal: (context: BlakeJsContext) => Uint8Array,
blake2sHex: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => string,
blake2sInit: (outlen?: number, key?: Uint8Array) => BlakeJsContext,
blake2sUpdate: (context: BlakeJsContext, data: Buffer | Uint8Array | string) => void
};
export = blakejs;

16
blakejs/tsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "bn.js-tests.ts"]
}

1
blakejs/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }