Merge pull request #30843 from BendingBender/create-hmac

Add types for create-hmac
This commit is contained in:
Andrew Casey 2018-12-03 18:22:12 -08:00 committed by GitHub
commit 24077f2cd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import createHmac = require('create-hmac');
const hmac = createHmac('sha224', Buffer.from('secret key'));
hmac.update('synchronous write');
hmac.digest();
hmac.write('write to it as a stream');
hmac.end();
hmac.read();

26
types/create-hmac/index.d.ts vendored Normal file
View File

@ -0,0 +1,26 @@
// Type definitions for create-hmac 1.1
// Project: https://github.com/crypto-browserify/createHmac
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import { Hmac } from 'crypto';
export = createHmac;
declare function createHmac(algo: createHmac.Algorithm, key: string | Buffer): Hmac;
declare namespace createHmac {
type Algorithm =
| 'rmd160'
| 'ripemd160'
| 'md5'
| 'sha'
| 'sha1'
| 'sha224'
| 'sha256'
| 'sha384'
| 'sha512';
}

View File

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

View File

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