barsa-auth 2.3.165 → 2.3.167

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { EventEmitter, WritableSignal, TemplateRef, QueryList, ElementRef, NgZone, OnInit } from '@angular/core';
3
- import * as i9 from 'barsa-novin-ray-core';
3
+ import * as i10 from 'barsa-novin-ray-core';
4
4
  import { BaseController, IViewBase, FilePictureInfoModel, PortalService, ApplicationCtrlrService, ViewBase, BaseComponent, BaseModule } from 'barsa-novin-ray-core';
5
- import * as i8 from '@angular/forms';
5
+ import * as i9 from '@angular/forms';
6
6
  import { FormGroup } from '@angular/forms';
7
7
  import { HttpClient } from '@angular/common/http';
8
- import * as i7 from '@angular/common';
8
+ import * as i8 from '@angular/common';
9
9
 
10
10
  declare class LoginMobileController extends BaseController<ILoginMobileView> {
11
11
  private _httpClient;
@@ -57,6 +57,8 @@ interface ILoginVerificationView extends IViewBase {
57
57
  }
58
58
 
59
59
  type LoginState = 'user-pass' | 'enter-mobile' | 'verification';
60
+ type AuthViewState = LoginState | 'passkey' | 'passkey-enrollment';
61
+ type PasskeyMode = 'login' | 'enrollment';
60
62
  interface LoginSettings {
61
63
  Title: string;
62
64
  Subtitle: string;
@@ -83,21 +85,110 @@ interface LoginSettings {
83
85
  WidthOfBackground?: number;
84
86
  WidthOfLogo?: number;
85
87
  Theme$Caption?: string;
88
+ PasskeyEnable?: boolean;
89
+ PasskeyPromptOnFirstLogin?: boolean;
90
+ }
91
+ type PasskeyTransport = 'ble' | 'cable' | 'hybrid' | 'internal' | 'nfc' | 'smart-card' | 'usb';
92
+ interface PasskeyCredentialDescriptorJson {
93
+ id: string;
94
+ type: 'public-key';
95
+ transports?: PasskeyTransport[];
96
+ }
97
+ interface PasskeyRegistrationOptionsJson {
98
+ challenge: string;
99
+ rp: {
100
+ id?: string;
101
+ name: string;
102
+ };
103
+ user: {
104
+ id: string;
105
+ name: string;
106
+ displayName: string;
107
+ };
108
+ pubKeyCredParams: Array<{
109
+ type: 'public-key';
110
+ alg: number;
111
+ }>;
112
+ timeout?: number;
113
+ excludeCredentials?: PasskeyCredentialDescriptorJson[];
114
+ authenticatorSelection?: AuthenticatorSelectionCriteria;
115
+ attestation?: AttestationConveyancePreference;
116
+ hints?: string[];
117
+ }
118
+ interface PasskeyAuthenticationOptionsJson {
119
+ challenge: string;
120
+ timeout?: number;
121
+ rpId?: string;
122
+ allowCredentials?: PasskeyCredentialDescriptorJson[];
123
+ userVerification?: UserVerificationRequirement;
124
+ hints?: string[];
125
+ }
126
+ interface PasskeyCeremonyOptions<TOptions> {
127
+ ceremonyId: string;
128
+ publicKey: TOptions;
129
+ }
130
+ interface PasskeyEnrollmentStatus {
131
+ hasCredential: boolean;
132
+ hasAnyCredential?: boolean;
133
+ activeCredentialCount?: number;
134
+ canCreatePasskey?: boolean;
135
+ shouldOfferEnrollment: boolean;
136
+ }
137
+ interface PasskeyRegistrationCredentialJson {
138
+ id: string;
139
+ rawId: string;
140
+ type: 'public-key';
141
+ authenticatorAttachment: string | null;
142
+ clientExtensionResults: AuthenticationExtensionsClientOutputs;
143
+ response: {
144
+ clientDataJSON: string;
145
+ attestationObject: string;
146
+ transports: string[];
147
+ };
148
+ }
149
+ interface PasskeyAuthenticationCredentialJson {
150
+ id: string;
151
+ rawId: string;
152
+ type: 'public-key';
153
+ authenticatorAttachment: string | null;
154
+ clientExtensionResults: AuthenticationExtensionsClientOutputs;
155
+ response: {
156
+ clientDataJSON: string;
157
+ authenticatorData: string;
158
+ signature: string;
159
+ userHandle: string | null;
160
+ };
161
+ }
162
+ interface PasskeyRegistrationVerifyResponse {
163
+ verified: boolean;
164
+ credentialId: string;
165
+ }
166
+ interface PasskeyAuthenticationVerifyResponse {
167
+ verified: boolean;
168
+ userId?: string | number;
169
+ token2: string;
86
170
  }
87
171
 
88
172
  declare class BarsaAuthComponent {
89
- verified: EventEmitter<any>;
173
+ verified: EventEmitter<string | undefined>;
90
174
  appSettings: _angular_core.InputSignal<LoginSettings>;
91
- state: WritableSignal<LoginState>;
175
+ state: WritableSignal<AuthViewState>;
92
176
  mobile: WritableSignal<string>;
93
177
  loading: WritableSignal<boolean>;
178
+ passkeyAvailable: WritableSignal<boolean>;
94
179
  _portalService: PortalService;
95
180
  _applicationCtrlrService: ApplicationCtrlrService;
181
+ private readonly passkeyService;
96
182
  ngOnInit(): void;
97
- onChangeState(state: LoginState): void;
183
+ onChangeState(state: AuthViewState): void;
98
184
  onChangeMobile(): void;
99
185
  onOtpSent(mobile: string): void;
100
186
  onLoggedIn(): void;
187
+ onPasskeyLoggedIn(token2: string): void;
188
+ onEnrollmentFinished(): void;
189
+ private updatePasskeyAvailability;
190
+ private completeExistingLogin;
191
+ private finishLogin;
101
192
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BarsaAuthComponent, never>;
102
193
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<BarsaAuthComponent, "ba-auth", never, { "appSettings": { "alias": "appSettings"; "required": true; "isSignal": true; }; }, { "verified": "verified"; }, never, never, false, never>;
103
194
  }
@@ -220,7 +311,7 @@ declare class LoginComponent implements OnInit {
220
311
  private _activatedRoute;
221
312
  private _portalService;
222
313
  ngOnInit(): void;
223
- onVerified(): void;
314
+ onVerified(token2?: string): void;
224
315
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<LoginComponent, never>;
225
316
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<LoginComponent, "ba-login", never, {}, {}, never, never, false, never>;
226
317
  }
@@ -228,14 +319,56 @@ interface Settings {
228
319
  LoginSettingsValue: LoginSettings;
229
320
  }
230
321
 
322
+ declare class PasskeyComponent implements OnInit {
323
+ mode: PasskeyMode;
324
+ autoStart: boolean;
325
+ loggedIn: EventEmitter<string>;
326
+ registered: EventEmitter<void>;
327
+ skipped: EventEmitter<void>;
328
+ cancelled: EventEmitter<void>;
329
+ checkingSupport: _angular_core.WritableSignal<boolean>;
330
+ supported: _angular_core.WritableSignal<boolean>;
331
+ loading: _angular_core.WritableSignal<boolean>;
332
+ errorMessage: _angular_core.WritableSignal<string>;
333
+ private readonly passkeyService;
334
+ ngOnInit(): void;
335
+ onPrimaryAction(): Promise<void>;
336
+ onSkip(): void;
337
+ private checkSupport;
338
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PasskeyComponent, never>;
339
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PasskeyComponent, "ba-passkey", never, { "mode": { "alias": "mode"; "required": false; }; "autoStart": { "alias": "autoStart"; "required": false; }; }, { "loggedIn": "loggedIn"; "registered": "registered"; "skipped": "skipped"; "cancelled": "cancelled"; }, never, never, false, never>;
340
+ }
341
+
342
+ declare class PasskeyService {
343
+ private readonly httpClient;
344
+ private platformAvailability?;
345
+ isPlatformAuthenticatorAvailable(): Promise<boolean>;
346
+ getEnrollmentStatus(): Promise<PasskeyEnrollmentStatus>;
347
+ canOfferEnrollment(status: PasskeyEnrollmentStatus): boolean;
348
+ isCredentialAlreadyRegistered(error: unknown): boolean;
349
+ register(): Promise<PasskeyRegistrationVerifyResponse>;
350
+ authenticate(): Promise<string>;
351
+ getErrorMessage(error: unknown): string;
352
+ private detectPlatformAuthenticator;
353
+ private parseJsonResponse;
354
+ private toCreationOptions;
355
+ private toRequestOptions;
356
+ private toCredentialDescriptors;
357
+ private serializeRegistrationCredential;
358
+ private serializeAuthenticationCredential;
359
+ private getAuthenticatorAttachment;
360
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PasskeyService, never>;
361
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<PasskeyService>;
362
+ }
363
+
231
364
  declare class BarsaAuthModule extends BaseModule {
232
- protected dynamicComponents: (typeof BarsaAuthComponent | typeof EnterMobileComponent | typeof UserPassComponent | typeof TimerCountDownComponent | typeof VerificationComponent | typeof LoginComponent)[];
365
+ protected dynamicComponents: (typeof BarsaAuthComponent | typeof EnterMobileComponent | typeof VerificationComponent | typeof TimerCountDownComponent | typeof UserPassComponent | typeof LoginComponent | typeof PasskeyComponent)[];
233
366
  /** Inserted by Angular inject() migration for backwards compatibility */
234
367
  constructor();
235
368
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BarsaAuthModule, never>;
236
- static ɵmod: _angular_core.ɵɵNgModuleDeclaration<BarsaAuthModule, [typeof BarsaAuthComponent, typeof EnterMobileComponent, typeof VerificationComponent, typeof TimerCountDownComponent, typeof UserPassComponent, typeof LoginComponent], [typeof i7.CommonModule, typeof i8.FormsModule, typeof i8.ReactiveFormsModule, typeof i9.BarsaNovinRayCoreModule], [typeof BarsaAuthComponent, typeof EnterMobileComponent, typeof VerificationComponent, typeof TimerCountDownComponent, typeof UserPassComponent, typeof LoginComponent]>;
369
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<BarsaAuthModule, [typeof BarsaAuthComponent, typeof EnterMobileComponent, typeof VerificationComponent, typeof TimerCountDownComponent, typeof UserPassComponent, typeof LoginComponent, typeof PasskeyComponent], [typeof i8.CommonModule, typeof i9.FormsModule, typeof i9.ReactiveFormsModule, typeof i10.BarsaNovinRayCoreModule], [typeof BarsaAuthComponent, typeof EnterMobileComponent, typeof VerificationComponent, typeof TimerCountDownComponent, typeof UserPassComponent, typeof LoginComponent, typeof PasskeyComponent]>;
237
370
  static ɵinj: _angular_core.ɵɵInjectorDeclaration<BarsaAuthModule>;
238
371
  }
239
372
 
240
- export { BarsaAuthComponent, BarsaAuthModule, EnterMobileComponent, LoginComponent, LoginMobileController, LoginUserPassController, LoginVerificationController, TimerCountDownComponent, UserPassComponent, VerificationComponent };
241
- export type { ILoginMobileView, ILoginUserPassView, ILoginVerificationView, LoginSettings, LoginState };
373
+ export { BarsaAuthComponent, BarsaAuthModule, EnterMobileComponent, LoginComponent, LoginMobileController, LoginUserPassController, LoginVerificationController, PasskeyComponent, PasskeyService, TimerCountDownComponent, UserPassComponent, VerificationComponent };
374
+ export type { AuthViewState, ILoginMobileView, ILoginUserPassView, ILoginVerificationView, LoginSettings, LoginState, PasskeyAuthenticationCredentialJson, PasskeyAuthenticationOptionsJson, PasskeyAuthenticationVerifyResponse, PasskeyCeremonyOptions, PasskeyCredentialDescriptorJson, PasskeyEnrollmentStatus, PasskeyMode, PasskeyRegistrationCredentialJson, PasskeyRegistrationOptionsJson, PasskeyRegistrationVerifyResponse, PasskeyTransport };