@adonis-agora/authkit-server 0.82.1 → 0.82.2

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,4 +1,3 @@
1
- import { generateAuthenticationOptions, generateRegistrationOptions, verifyAuthenticationResponse, verifyRegistrationResponse, } from '@simplewebauthn/server';
2
1
  import { PasswordManager } from '../password/password_manager.js';
3
2
  import { buildCore } from './lucid_store/core.js';
4
3
  import { buildLoginMethods, supportsLoginMethodsColumn } from './lucid_store/login_methods.js';
@@ -7,7 +6,7 @@ import { defaultOrganizationModels } from './lucid_store/organization_models.js'
7
6
  import { buildOrganizations } from './lucid_store/organizations.js';
8
7
  import { buildPasswordExpiration, buildPasswordHistory } from './lucid_store/password_hygiene.js';
9
8
  import { buildProviderIdentity } from './lucid_store/provider_identity.js';
10
- import { hasTable, } from './lucid_store/shared.js';
9
+ import { defaultWebauthnCeremonies, hasTable, } from './lucid_store/shared.js';
11
10
  import { buildDeletion, buildEmailVerificationStatus, buildProfile, buildStatus, hasColumn, } from './lucid_store/status_profile.js';
12
11
  import { buildWebauthn } from './lucid_store/webauthn.js';
13
12
  export function resolveEmailTokens(input) {
@@ -147,10 +146,7 @@ export function lucidAccountStore(Model, options = {}) {
147
146
  };
148
147
  // Cerimônias WebAuthn: reais por default, injetáveis para testes.
149
148
  const ceremonies = {
150
- generateRegistrationOptions,
151
- verifyRegistrationResponse,
152
- generateAuthenticationOptions,
153
- verifyAuthenticationResponse,
149
+ ...defaultWebauthnCeremonies,
154
150
  ...options.webauthnCeremonies,
155
151
  };
156
152
  const passwords = new PasswordManager(options.password, {
@@ -1,4 +1,4 @@
1
- import { generateAuthenticationOptions, generateRegistrationOptions, verifyAuthenticationResponse, verifyRegistrationResponse } from '@simplewebauthn/server';
1
+ import type { generateAuthenticationOptions, generateRegistrationOptions, verifyAuthenticationResponse, verifyRegistrationResponse } from '@simplewebauthn/server';
2
2
  import type { AuditSink } from '../../audit/audit_sink.js';
3
3
  import type { PasswordManager } from '../../password/password_manager.js';
4
4
  import type { AuthAccount } from '../account_store.js';
@@ -23,6 +23,12 @@ export interface WebauthnCeremonies {
23
23
  generateAuthenticationOptions: typeof generateAuthenticationOptions;
24
24
  verifyAuthenticationResponse: typeof verifyAuthenticationResponse;
25
25
  }
26
+ /**
27
+ * As cerimônias reais (default de {@link WebauthnCeremonies}). Todas já são
28
+ * assíncronas no `@simplewebauthn/server`; cada uma só espera o import lazy antes
29
+ * de delegar.
30
+ */
31
+ export declare const defaultWebauthnCeremonies: WebauthnCeremonies;
26
32
  /** RP (Relying Party) do WebAuthn usado nas cerimônias. */
27
33
  export interface ResolvedRp {
28
34
  rpName: string;
@@ -1,4 +1,28 @@
1
1
  import { createHash, randomBytes, timingSafeEqual } from 'node:crypto';
2
+ /**
3
+ * `@simplewebauthn/server` carregado na primeira cerimônia, não no boot: a maioria
4
+ * dos processos (workers, ace, apps sem passkeys) nunca faz uma. Um import por
5
+ * processo; uma falha não fica em cache (a próxima cerimônia tenta de novo).
6
+ */
7
+ let simpleWebauthn;
8
+ function loadSimpleWebauthn() {
9
+ simpleWebauthn ??= import('@simplewebauthn/server').catch((error) => {
10
+ simpleWebauthn = undefined;
11
+ throw error;
12
+ });
13
+ return simpleWebauthn;
14
+ }
15
+ /**
16
+ * As cerimônias reais (default de {@link WebauthnCeremonies}). Todas já são
17
+ * assíncronas no `@simplewebauthn/server`; cada uma só espera o import lazy antes
18
+ * de delegar.
19
+ */
20
+ export const defaultWebauthnCeremonies = {
21
+ generateRegistrationOptions: async (options) => (await loadSimpleWebauthn()).generateRegistrationOptions(options),
22
+ verifyRegistrationResponse: async (options) => (await loadSimpleWebauthn()).verifyRegistrationResponse(options),
23
+ generateAuthenticationOptions: async (options) => (await loadSimpleWebauthn()).generateAuthenticationOptions(options),
24
+ verifyAuthenticationResponse: async (options) => (await loadSimpleWebauthn()).verifyAuthenticationResponse(options),
25
+ };
2
26
  export const sha256 = (value) => createHash('sha256').update(value).digest('hex');
3
27
  /** Recovery code legível: 10 chars hex em duas metades (ex.: a1b2c-3d4e5). */
4
28
  export function generateRecoveryCode() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/authkit-server",
3
- "version": "0.82.1",
3
+ "version": "0.82.2",
4
4
  "description": "AdonisJS OIDC/OAuth2 provider (Identity Provider) toolkit: ejectable auth server with sessions, rate-limiting, MFA/TOTP, audit log, federated logout and OpenTelemetry metrics.",
5
5
  "license": "MIT",
6
6
  "author": "dudousxd",