@furystack/security
Advanced tools
Comparing version 6.0.1 to 6.0.2
@@ -9,5 +9,7 @@ import { SecurityPolicy } from './security-policy.js'; | ||
const plainPolicy = new SecurityPolicy(); | ||
policy && Object.assign(plainPolicy, policy); | ||
if (policy) { | ||
Object.assign(plainPolicy, policy); | ||
} | ||
injector.setExplicitInstance(plainPolicy, SecurityPolicy); | ||
}; | ||
//# sourceMappingURL=helpers.js.map |
@@ -1,4 +0,4 @@ | ||
import { SecurityPolicyManager } from './security-policy-manager.js'; | ||
import type { PasswordCheckResult } from './models/index.js'; | ||
import type { PasswordHasher } from './password-hasher.js'; | ||
import { SecurityPolicyManager } from './security-policy-manager.js'; | ||
export declare class PasswordAuthenticator { | ||
@@ -5,0 +5,0 @@ private readonly passwordStore; |
@@ -12,6 +12,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
import { Injectable, Injected } from '@furystack/inject'; | ||
import { SecurityPolicyManager } from './security-policy-manager.js'; | ||
import { UnauthenticatedError } from './errors/index.js'; | ||
import { PasswordComplexityError } from './errors/password-complexity-error.js'; | ||
import { PasswordCredential, PasswordResetToken } from './models/index.js'; | ||
import { PasswordComplexityError } from './errors/password-complexity-error.js'; | ||
import { SecurityPolicyManager } from './security-policy-manager.js'; | ||
let PasswordAuthenticator = class PasswordAuthenticator { | ||
@@ -58,3 +58,5 @@ /** | ||
const existing = await this.passwordStore.get(userName); | ||
existing && (await this.passwordStore.remove(existing.userName)); | ||
if (existing) { | ||
await this.passwordStore.remove(existing.userName); | ||
} | ||
await this.passwordStore.add(newCredential); | ||
@@ -82,3 +84,5 @@ } | ||
const existing = await this.passwordStore.get(token.userName); | ||
existing && (await this.passwordStore.remove(existing.userName)); | ||
if (existing) { | ||
await this.passwordStore.remove(existing.userName); | ||
} | ||
await this.passwordStore.add(newCredential); | ||
@@ -85,0 +89,0 @@ } |
{ | ||
"name": "@furystack/security", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "Security, password management and authorization related stuff for FuryStack", | ||
@@ -38,12 +38,12 @@ "type": "module", | ||
"dependencies": { | ||
"@furystack/core": "^15.0.1", | ||
"@furystack/inject": "^12.0.1" | ||
"@furystack/core": "^15.0.2", | ||
"@furystack/inject": "^12.0.2" | ||
}, | ||
"homepage": "https://github.com/furystack/furystack", | ||
"devDependencies": { | ||
"@furystack/utils": "^8.0.1", | ||
"@types/node": "^20.14.11", | ||
"typescript": "^5.5.3", | ||
"vitest": "^2.0.3" | ||
"@furystack/utils": "^8.0.2", | ||
"@types/node": "^22.2.0", | ||
"typescript": "^5.5.4", | ||
"vitest": "^2.0.5" | ||
} | ||
} |
@@ -11,4 +11,8 @@ import type { Injector } from '@furystack/inject' | ||
const plainPolicy = new SecurityPolicy() | ||
policy && Object.assign(plainPolicy, policy) | ||
if (policy) { | ||
Object.assign(plainPolicy, policy) | ||
} | ||
injector.setExplicitInstance(plainPolicy, SecurityPolicy) | ||
} |
import type { PhysicalStore } from '@furystack/core' | ||
import { StoreManager } from '@furystack/core' | ||
import { Injectable, Injected } from '@furystack/inject' | ||
import { SecurityPolicyManager } from './security-policy-manager.js' | ||
import { UnauthenticatedError } from './errors/index.js' | ||
import { PasswordComplexityError } from './errors/password-complexity-error.js' | ||
import type { PasswordCheckResult } from './models/index.js' | ||
import { PasswordCredential, PasswordResetToken } from './models/index.js' | ||
import { PasswordComplexityError } from './errors/password-complexity-error.js' | ||
import type { PasswordHasher } from './password-hasher.js' | ||
import { SecurityPolicyManager } from './security-policy-manager.js' | ||
@@ -17,3 +17,3 @@ @Injectable({ lifetime: 'singleton' }) | ||
@Injected((injector) => injector.getInstance(StoreManager).getStoreFor(PasswordResetToken, 'token')) | ||
private declare readonly tokenStore | ||
private declare readonly tokenStore: PhysicalStore<PasswordResetToken, 'token'> | ||
@@ -67,3 +67,5 @@ @Injected(function (this: PasswordAuthenticator, injector) { | ||
const existing = await this.passwordStore.get(userName) | ||
existing && (await this.passwordStore.remove(existing.userName)) | ||
if (existing) { | ||
await this.passwordStore.remove(existing.userName) | ||
} | ||
await this.passwordStore.add(newCredential) | ||
@@ -96,3 +98,5 @@ } | ||
const existing = await this.passwordStore.get(token.userName) | ||
existing && (await this.passwordStore.remove(existing.userName)) | ||
if (existing) { | ||
await this.passwordStore.remove(existing.userName) | ||
} | ||
await this.passwordStore.add(newCredential) | ||
@@ -99,0 +103,0 @@ } |
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
Sorry, the diff of this file is not supported yet
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
153033
1838
Updated@furystack/core@^15.0.2
Updated@furystack/inject@^12.0.2