Merge pull request #3352 from jt000/aspnet-identity-pw

Adding aspnet-identity-pw.d.ts
This commit is contained in:
Masahiro Wakame
2014-12-20 13:56:08 +09:00
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
/// <reference path="aspnet-identity-pw.d.ts" />
import passwordHasher = require('aspnet-identity-pw');
function usageSync() {
var hashedPassword: string = passwordHasher.hashPassword('SomePassword');
var isValid: boolean = passwordHasher.validatePassword('SomePassword', hashedPassword);
}
function usageAsync() {
var hashedPassword: string = null;
var isValid: boolean = null;
passwordHasher.hashPassword('SomePassword', function(err, result) {
hashedPassword = result;
});
passwordHasher.validatePassword('SomePassword', hashedPassword, function(err, result) {
isValid = result;
});
}

View File

@@ -0,0 +1,13 @@
// Type definitions for aspnet-identity-pw 1.0.0
// Project: https://github.com/Syncbak-Git/aspnet-identity-pw
// Definitions by: jt000 <https://github.com/jt000>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "aspnet-identity-pw" {
export function hashPassword(password: string): string;
export function hashPassword(password: string, callback: (err: any, result: string)=>void): void;
export function validatePassword(password: string, hashedPass: string): boolean;
export function validatePassword(password: string, hashedPass: string, callback: (err: any, result: boolean) => void): void;
}