mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add definitions for triplesec
This commit is contained in:
parent
8c2749435d
commit
f6962ca7ea
31
types/triplesec/index.d.ts
vendored
Normal file
31
types/triplesec/index.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Type definitions for triplesec 3.0
|
||||
// Project: https://github.com/keybase/triplesec
|
||||
// Definitions by: Ben Speakman <https://github.com/threesquared>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export interface WordArray {
|
||||
sigBytes: number;
|
||||
words: number[];
|
||||
to_hex: () => string;
|
||||
}
|
||||
|
||||
export interface Arguments {
|
||||
data: Buffer,
|
||||
key: Buffer,
|
||||
progress_hook?: (progress: Progress) => void;
|
||||
}
|
||||
|
||||
export interface Progress {
|
||||
what: string;
|
||||
i: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function encrypt(arg: Arguments, cb: (err: Error | null, buff: Buffer | null) => void): void;
|
||||
export function decrypt(arg: Arguments, cb: (err: Error | null, buff: Buffer | null) => void): void;
|
||||
|
||||
export namespace prng {
|
||||
export function generate(n: number, cb: (words: WordArray) => void): void;
|
||||
}
|
||||
27
types/triplesec/triplesec-tests.ts
Normal file
27
types/triplesec/triplesec-tests.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import * as triplesec from 'triplesec';
|
||||
|
||||
triplesec.encrypt({
|
||||
data: new Buffer('data'),
|
||||
key: new Buffer('key')
|
||||
}, (err, buff) => {
|
||||
if (err === null) {
|
||||
console.log(buff);
|
||||
} else {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
triplesec.decrypt({
|
||||
data: new Buffer('data'),
|
||||
key: new Buffer('key')
|
||||
}, (err, buff) => {
|
||||
if (err === null) {
|
||||
console.log(buff);
|
||||
} else {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
triplesec.prng.generate(24, words => {
|
||||
console.log(words.to_hex()); // $ExpectType string
|
||||
});
|
||||
22
types/triplesec/tsconfig.json
Normal file
22
types/triplesec/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"triplesec-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/triplesec/tslint.json
Normal file
1
types/triplesec/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user