mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Merge pull request #30843 from BendingBender/create-hmac
Add types for create-hmac
This commit is contained in:
commit
24077f2cd0
9
types/create-hmac/create-hmac-tests.ts
Normal file
9
types/create-hmac/create-hmac-tests.ts
Normal 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
26
types/create-hmac/index.d.ts
vendored
Normal 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';
|
||||
}
|
||||
23
types/create-hmac/tsconfig.json
Normal file
23
types/create-hmac/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/create-hmac/tslint.json
Normal file
1
types/create-hmac/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user