@wise-community/angular-password-strength-meter
Version:
[](https://github.com/antoantonyk/password-strength-meter/actions/workflows/ci-workflow.yml) [
{"version":3,"file":"wise-community-angular-password-strength-meter-zxcvbn.mjs","sources":["../../../projects/password-strength-meter/zxcvbn/src/password-strength-meter.types.ts","../../../projects/password-strength-meter/zxcvbn/src/password-strength-meter-zxcvbn.service.ts","../../../projects/password-strength-meter/zxcvbn/src/default-provider.ts","../../../projects/password-strength-meter/zxcvbn/public-api.ts","../../../projects/password-strength-meter/zxcvbn/wise-community-angular-password-strength-meter-zxcvbn.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { OptionsType } from '@zxcvbn-ts/core/dist/types';\n\nexport type ZxvbnConfigType = OptionsType;\nexport const ZXCVBN_CONFIG = new InjectionToken<ZxvbnConfigType>(\n 'ZXCVBN_CONFIG'\n);\n","import { Inject, Injectable, Optional } from '@angular/core';\nimport { zxcvbn, zxcvbnAsync, zxcvbnOptions } from '@zxcvbn-ts/core';\nimport { translations } from '@zxcvbn-ts/language-en';\nimport {\n FeedbackResult,\n IPasswordStrengthMeterService,\n} from '@wise-community/angular-password-strength-meter';\nimport {\n ZXCVBN_CONFIG,\n ZxvbnConfigType,\n} from './password-strength-meter.types';\n\nexport const DEFAULT_CONFIG: ZxvbnConfigType = {\n translations: translations,\n};\n\n@Injectable()\nexport class PasswordStrengthMeterZXCVBNService extends IPasswordStrengthMeterService {\n constructor(\n @Optional()\n @Inject(ZXCVBN_CONFIG)\n options: ZxvbnConfigType\n ) {\n super();\n\n if (options) {\n zxcvbnOptions.setOptions(options);\n } else {\n zxcvbnOptions.setOptions(DEFAULT_CONFIG);\n }\n }\n\n /**\n * this will return the password strength score in number\n * 0 - too guessable\n * 1 - very guessable\n * 2 - somewhat guessable\n * 3 - safely unguessable\n * 4 - very unguessable\n *\n * @param password - Password\n */\n score(password: string): number {\n const result = zxcvbn(password);\n return result.score;\n }\n\n /**\n * this will return the password strength score with feedback messages\n * return type FeedbackResult\n *\n * @param password - Password\n */\n scoreWithFeedback(password: string): FeedbackResult {\n const result = zxcvbn(password);\n return { score: result.score, feedback: result.feedback };\n }\n\n async scoreAsync(password: string): Promise<number> {\n const result = await zxcvbnAsync(password);\n return result.score;\n }\n\n async scoreWithFeedbackAsync(password: string): Promise<FeedbackResult> {\n const result = await zxcvbnAsync(password);\n return { score: result.score, feedback: result.feedback };\n }\n}\n","import {\n EnvironmentProviders,\n Provider,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport {\n ZXCVBN_CONFIG,\n ZxvbnConfigType,\n} from './password-strength-meter.types';\nimport { IPasswordStrengthMeterService } from '@wise-community/angular-password-strength-meter';\nimport { PasswordStrengthMeterZXCVBNService } from './password-strength-meter-zxcvbn.service';\n\nexport function provideZxvbnServiceForPSM(\n config?: ZxvbnConfigType\n): EnvironmentProviders {\n let providers: (EnvironmentProviders | Provider)[] = [\n {\n provide: IPasswordStrengthMeterService,\n useClass: PasswordStrengthMeterZXCVBNService,\n },\n ];\n\n if (config) {\n providers = [\n {\n provide: ZXCVBN_CONFIG,\n useValue: config,\n },\n ...providers,\n ];\n }\n\n return makeEnvironmentProviders(providers);\n}\n","/* Public API Surface of password-strength-meter default zxcvbn service\n */\n\nexport * from './src/default-provider';\nexport * from './src/password-strength-meter.types';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAIa,aAAa,GAAG,IAAI,cAAc,CAC7C,eAAe;;ACOV,MAAM,cAAc,GAAoB;AAC7C,IAAA,YAAY,EAAE,YAAY;CAC3B;AAGK,MAAO,kCAAmC,SAAQ,6BAA6B,CAAA;AACnF,IAAA,WAAA,CAGE,OAAwB,EAAA;AAExB,QAAA,KAAK,EAAE;QAEP,IAAI,OAAO,EAAE;AACX,YAAA,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;QACnC;aAAO;AACL,YAAA,aAAa,CAAC,UAAU,CAAC,cAAc,CAAC;QAC1C;IACF;AAEA;;;;;;;;;AASG;AAC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