mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
parent
377936895e
commit
accdb12060
13
types/node-phpass/index.d.ts
vendored
Normal file
13
types/node-phpass/index.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// Type definitions for node-phpass 1.0
|
||||
// Project: https://github.com/glauberportella/password-hash
|
||||
// Definitions by: Glenn Reyes <https://github.com/DefinitelyTyped>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export const CRYPT_BLOWFISH = 1;
|
||||
export const CRYPT_EXT_DES = 2;
|
||||
|
||||
export class PasswordHash {
|
||||
constructor(length?: number, portable?: boolean, phpVersion?: number);
|
||||
CheckPassword(password: string, hash: string): boolean;
|
||||
HashPassword(password: string, method?: typeof CRYPT_BLOWFISH | typeof CRYPT_EXT_DES): Promise<string>;
|
||||
}
|
||||
11
types/node-phpass/node-phpass-tests.ts
Normal file
11
types/node-phpass/node-phpass-tests.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { CRYPT_BLOWFISH, CRYPT_EXT_DES, PasswordHash } from 'node-phpass';
|
||||
|
||||
const hasher: PasswordHash = new PasswordHash();
|
||||
const hash: Promise<string> = hasher.HashPassword('foo').then(hash => {
|
||||
hasher.CheckPassword('foo', hash);
|
||||
|
||||
return hash;
|
||||
});
|
||||
|
||||
const blowfishHasher: PasswordHash = new PasswordHash(8, true, CRYPT_BLOWFISH);
|
||||
const extDesHasher: PasswordHash = new PasswordHash(8, false, CRYPT_EXT_DES);
|
||||
23
types/node-phpass/tsconfig.json
Normal file
23
types/node-phpass/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-phpass-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/node-phpass/tslint.json
Normal file
1
types/node-phpass/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user