Create credential-tests.ts

This commit is contained in:
Phú
2015-11-08 10:38:06 +07:00
parent a2bba58e82
commit 462461d1fb
+16
View File
@@ -0,0 +1,16 @@
/// <reference path="credential.d.ts">
import * as credential from 'credential';
credential.hash('password', function(err: Error, hash: string) {
if (err) console.error(err);
else console.log(hash);
});
const hash = '{}';
const password = 'test';
credential.verify(hash, password, function(err: Error, isValid: boolean) {
if (err) console.error(err);
else console.log(isValid ? 'Password match' : 'Incorrect password');
});