dowpro-replay-watcher-dal
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -7,8 +7,6 @@ "use strict"; | ||
exports.Manipulation = Manipulation; | ||
const Util = require("./exports/util.export"); | ||
const Util = require("./exports/util.exports"); | ||
exports.Util = Util; | ||
const Types = require("./exports/types.export"); | ||
exports.Types = Types; | ||
const CryptoUtil = require("./util/crypto.util"); | ||
exports.CryptoUtil = CryptoUtil; | ||
//# sourceMappingURL=index.js.map |
@@ -13,3 +13,3 @@ "use strict"; | ||
const dal_generic_store_1 = require("./../dal.generic.store"); | ||
const cryptoUtil = require("./../../../../util/crypto.util"); | ||
const crypto_util_1 = require("./../../../../util/crypto.util"); | ||
class AuthorizedUsersStore { | ||
@@ -19,3 +19,3 @@ static create(guildId) { | ||
let password = [...Array(8)].map(i => (~~(Math.random() * 36)).toString(36)).join(''); | ||
let hash = yield cryptoUtil.hash(password); | ||
let hash = yield crypto_util_1.Crypto.hash(password); | ||
yield dal_generic_store_1.GenericStore.createOrUpdate(this.storeName, { login: guildId }, { login: guildId, password: hash, dateGenerated: moment().toString() }); | ||
@@ -22,0 +22,0 @@ return password; |
@@ -12,17 +12,18 @@ "use strict"; | ||
const bcrypt = require("bcrypt"); | ||
function hash(data) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let salt = yield bcrypt.genSalt(12); | ||
let hash = yield bcrypt.hash(data, salt); | ||
return hash; | ||
}); | ||
class Crypto { | ||
static hash(data) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let salt = yield bcrypt.genSalt(12); | ||
let hash = yield bcrypt.hash(data, salt); | ||
return hash; | ||
}); | ||
} | ||
static verify(data, hash) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let result = yield bcrypt.compare(data, hash); | ||
return result; | ||
}); | ||
} | ||
} | ||
exports.hash = hash; | ||
function verify(data, hash) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let result = yield bcrypt.compare(data, hash); | ||
return result; | ||
}); | ||
} | ||
exports.verify = verify; | ||
exports.Crypto = Crypto; | ||
//# sourceMappingURL=crypto.util.js.map |
{ | ||
"name": "dowpro-replay-watcher-dal", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Data access layer for dowpro ladder", | ||
@@ -5,0 +5,0 @@ "main": "js/index.js", |
@@ -31,2 +31,3 @@ Data access layer for dowpro ladder | ||
* 0.1.6: Adding a filesystem manipulation subset. | ||
* 0.1.7: Oh no! Forgot to export file util. | ||
* 0.1.7: Oh no! Forgot to export file util. | ||
* 0.1.8: Rationalizing exports. |
import { DalConfiguration as Configuration } from './configuration/dal.configuration'; | ||
import * as Manipulation from './exports/manipulation.export'; | ||
import * as Util from './exports/util.export'; | ||
import * as Util from './exports/util.exports'; | ||
import * as Types from './exports/types.export'; | ||
import * as CryptoUtil from './util/crypto.util'; | ||
export { Configuration, Manipulation, Util, Types, CryptoUtil }; | ||
export { Configuration, Manipulation, Util, Types }; |
@@ -1,2 +0,4 @@ | ||
export declare function hash(data: string): Promise<string>; | ||
export declare function verify(data: string, hash: string): Promise<boolean>; | ||
export declare abstract class Crypto { | ||
static hash(data: string): Promise<string>; | ||
static verify(data: string, hash: string): Promise<boolean>; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
36675
544
32