Browse Source

feat(core): Export PasswordCipher helper

Michael Bromley 4 years ago
parent
commit
221051f32f

+ 3 - 3
packages/core/src/config/auth/native-authentication-strategy.ts

@@ -7,7 +7,7 @@ import { UnauthorizedError } from '../../common/error/errors';
 import { Injector } from '../../common/injector';
 import { NativeAuthenticationMethod } from '../../entity/authentication-method/native-authentication-method.entity';
 import { User } from '../../entity/user/user.entity';
-import { PasswordCiper } from '../../service/helpers/password-cipher/password-ciper';
+import { PasswordCipher } from '../../service/helpers/password-cipher/password-cipher';
 import { TransactionalConnection } from '../../service/transaction/transactional-connection';
 
 import { AuthenticationStrategy } from './authentication-strategy';
@@ -31,11 +31,11 @@ export class NativeAuthenticationStrategy implements AuthenticationStrategy<Nati
     readonly name = NATIVE_AUTH_STRATEGY_NAME;
 
     private connection: TransactionalConnection;
-    private passwordCipher: PasswordCiper;
+    private passwordCipher: PasswordCipher;
 
     init(injector: Injector) {
         this.connection = injector.get(TransactionalConnection);
-        this.passwordCipher = injector.get(PasswordCiper);
+        this.passwordCipher = injector.get(PasswordCipher);
     }
 
     defineInputType(): DocumentNode {

+ 1 - 1
packages/core/src/service/helpers/password-cipher/password-ciper.ts → packages/core/src/service/helpers/password-cipher/password-cipher.ts

@@ -7,7 +7,7 @@ const SALT_ROUNDS = 12;
  * A cipher which uses bcrypt (https://en.wikipedia.org/wiki/Bcrypt) to hash plaintext password strings.
  */
 @Injectable()
-export class PasswordCiper {
+export class PasswordCipher {
     hash(plaintext: string): Promise<string> {
         return bcrypt.hash(plaintext, SALT_ROUNDS);
     }

+ 1 - 0
packages/core/src/service/index.ts

@@ -8,6 +8,7 @@ export * from './helpers/order-calculator/order-calculator';
 export * from './helpers/order-merger/order-merger';
 export * from './helpers/order-modifier/order-modifier';
 export * from './helpers/order-state-machine/order-state';
+export * from './helpers/password-cipher/password-cipher';
 export * from './helpers/fulfillment-state-machine/fulfillment-state';
 export * from './helpers/payment-state-machine/payment-state';
 export * from './services/administrator.service';

+ 2 - 2
packages/core/src/service/service.module.ts

@@ -20,7 +20,7 @@ import { OrderCalculator } from './helpers/order-calculator/order-calculator';
 import { OrderMerger } from './helpers/order-merger/order-merger';
 import { OrderModifier } from './helpers/order-modifier/order-modifier';
 import { OrderStateMachine } from './helpers/order-state-machine/order-state-machine';
-import { PasswordCiper } from './helpers/password-cipher/password-ciper';
+import { PasswordCipher } from './helpers/password-cipher/password-cipher';
 import { PaymentStateMachine } from './helpers/payment-state-machine/payment-state-machine';
 import { RefundStateMachine } from './helpers/refund-state-machine/refund-state-machine';
 import { ShippingCalculator } from './helpers/shipping-calculator/shipping-calculator';
@@ -99,7 +99,7 @@ const services = [
 
 const helpers = [
     TranslatableSaver,
-    PasswordCiper,
+    PasswordCipher,
     OrderCalculator,
     OrderStateMachine,
     FulfillmentStateMachine,

+ 2 - 2
packages/core/src/service/services/administrator.service.ts

@@ -15,7 +15,7 @@ import { NativeAuthenticationMethod } from '../../entity/authentication-method/n
 import { User } from '../../entity/user/user.entity';
 import { CustomFieldRelationService } from '../helpers/custom-field-relation/custom-field-relation.service';
 import { ListQueryBuilder } from '../helpers/list-query-builder/list-query-builder';
-import { PasswordCiper } from '../helpers/password-cipher/password-ciper';
+import { PasswordCipher } from '../helpers/password-cipher/password-cipher';
 import { patchEntity } from '../helpers/utils/patch-entity';
 import { TransactionalConnection } from '../transaction/transactional-connection';
 
@@ -28,7 +28,7 @@ export class AdministratorService {
         private connection: TransactionalConnection,
         private configService: ConfigService,
         private listQueryBuilder: ListQueryBuilder,
-        private passwordCipher: PasswordCiper,
+        private passwordCipher: PasswordCipher,
         private userService: UserService,
         private roleService: RoleService,
         private customFieldRelationService: CustomFieldRelationService,

+ 2 - 2
packages/core/src/service/services/user.service.ts

@@ -19,7 +19,7 @@ import {
 import { ConfigService } from '../../config/config.service';
 import { NativeAuthenticationMethod } from '../../entity/authentication-method/native-authentication-method.entity';
 import { User } from '../../entity/user/user.entity';
-import { PasswordCiper } from '../helpers/password-cipher/password-ciper';
+import { PasswordCipher } from '../helpers/password-cipher/password-cipher';
 import { VerificationTokenGenerator } from '../helpers/verification-token-generator/verification-token-generator';
 import { TransactionalConnection } from '../transaction/transactional-connection';
 
@@ -31,7 +31,7 @@ export class UserService {
         private connection: TransactionalConnection,
         private configService: ConfigService,
         private roleService: RoleService,
-        private passwordCipher: PasswordCiper,
+        private passwordCipher: PasswordCipher,
         private verificationTokenGenerator: VerificationTokenGenerator,
     ) {}