@adonisjs/hash
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -68,2 +68,5 @@ declare module '@ioc:Adonis/Core/Hash' { | ||
* to setup the `HashersList`. | ||
* | ||
* We will remove this later. Make sure all stubs are not using this | ||
* type. | ||
*/ | ||
@@ -98,9 +101,5 @@ export type HashDrivers = { | ||
/** | ||
* Piggy back on the driver method when driver exists, otherwise fallback to `never` | ||
*/ | ||
export type DriverMethod<T, K extends keyof HashDriverContract> = T extends HashDriverContract ? HashDriverContract[K] : never; | ||
/** | ||
* Hash mananger interface | ||
*/ | ||
export interface HashContract<DefaultDriver = HashersList[HashConfig['default']]['implementation']> extends ManagerContract<HashDriverContract, HashDriverContract, { | ||
export interface HashContract extends ManagerContract<HashDriverContract, HashDriverContract, { | ||
[P in keyof HashersList]: HashersList[P]['implementation']; | ||
@@ -111,3 +110,3 @@ }> { | ||
*/ | ||
hash(value: string): ReturnType<DriverMethod<DefaultDriver, 'hash'>>; | ||
hash(value: string): ReturnType<HashDriverContract['hash']>; | ||
/** | ||
@@ -117,3 +116,3 @@ * Verify plain value against the hashed value to find if it's | ||
*/ | ||
verify(hashedValue: string, plainValue: string): ReturnType<DriverMethod<DefaultDriver, 'verify'>>; | ||
verify(hashedValue: string, plainValue: string): ReturnType<HashDriverContract['verify']>; | ||
/** | ||
@@ -123,3 +122,3 @@ * Check the hash against the current config to find it needs | ||
*/ | ||
needsReHash(hashedValue: string): ReturnType<DriverMethod<DefaultDriver, 'needsReHash'>>; | ||
needsReHash(hashedValue: string): ReturnType<HashDriverContract['needsReHash']>; | ||
} | ||
@@ -126,0 +125,0 @@ const Hash: HashContract; |
@@ -10,5 +10,9 @@ /// <reference path="../adonis-typings/hash.d.ts" /> | ||
[P in keyof HashersList]: HashersList[P]['implementation']; | ||
}> implements HashContract<HashDriverContract> { | ||
}> implements HashContract { | ||
config: Config; | ||
constructor(container: any, config: Config); | ||
/** | ||
* Validate config | ||
*/ | ||
private validateConfig; | ||
protected $cacheMappings: boolean; | ||
@@ -15,0 +19,0 @@ /** |
@@ -13,2 +13,3 @@ "use strict"; | ||
const manager_1 = require("@poppinss/manager"); | ||
const utils_1 = require("@poppinss/utils"); | ||
/** | ||
@@ -23,4 +24,13 @@ * The Hash module exposes the API to hash values using an underlying | ||
this.$cacheMappings = true; | ||
this.validateConfig(); | ||
} | ||
/** | ||
* Validate config | ||
*/ | ||
validateConfig() { | ||
const validator = new utils_1.ManagerConfigValidator(this.config, 'hash', 'config/hash'); | ||
validator.validateDefault('default'); | ||
validator.validateList('list', 'default'); | ||
} | ||
/** | ||
* Pulling the default driver name from the user config. | ||
@@ -27,0 +37,0 @@ */ |
{ | ||
"name": "@adonisjs/hash", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Multi driver hash module with support for PHC string formats", | ||
@@ -45,3 +45,3 @@ "main": "build/providers/HashProvider", | ||
"@phc/bcrypt": "^1.0.2", | ||
"@types/node": "^13.11.1", | ||
"@types/node": "^13.13.1", | ||
"argon2": "^0.26.2", | ||
@@ -87,3 +87,4 @@ "bcrypt": "^4.0.1", | ||
"@phc/format": "^0.5.0", | ||
"@poppinss/manager": "^2.1.6" | ||
"@poppinss/manager": "^2.1.6", | ||
"@poppinss/utils": "^2.2.6" | ||
}, | ||
@@ -90,0 +91,0 @@ "optionalDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22486
536
5
+ Added@poppinss/utils@^2.2.6
+ Added@poppinss/utils@2.5.10(transitive)
+ Addedbuffer-alloc@1.2.0(transitive)
+ Addedbuffer-alloc-unsafe@1.1.0(transitive)
+ Addedbuffer-fill@1.0.0(transitive)
+ Addedfast-safe-stringify@2.1.1(transitive)
+ Addedfs-readdir-recursive@1.1.0(transitive)
+ Addedklona@2.0.6(transitive)
+ Addedrequire-all@3.0.0(transitive)
+ Addedresolve-from@5.0.0(transitive)