@wildo-ai/saas-backend-lib 1.1.8 → 1.1.9
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.
- package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts +8 -0
- package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts.map +1 -1
- package/dist/esm/data-seeding/models/data-seed.shared.schemas.js +17 -0
- package/dist/esm/data-seeding/models/data-seed.shared.schemas.js.map +1 -1
- package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.d.ts.map +1 -1
- package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.js +9 -1
- package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.js.map +1 -1
- package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.d.ts +23 -0
- package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.d.ts.map +1 -0
- package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.js +25 -0
- package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.js.map +1 -0
- package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts +6 -0
- package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts.map +1 -1
- package/dist/esm/databases/services/postgresql-migration-runner.backend.js +8 -1
- package/dist/esm/databases/services/postgresql-migration-runner.backend.js.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +0 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +4 -39
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts +15 -4
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.js +21 -11
- package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +47 -2
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +56 -8
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.js +21 -8
- package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
- package/dist/esm/queue/job-status-tracking.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-status-tracking.backend.service.js +4 -1
- package/dist/esm/queue/job-status-tracking.backend.service.js.map +1 -1
- package/dist/esm/queue/queue.backend.service.d.ts +14 -0
- package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue.backend.service.js +68 -12
- package/dist/esm/queue/queue.backend.service.js.map +1 -1
- package/dist/esm/queue/scheduled-evidence-coverage.backend.d.ts +8 -0
- package/dist/esm/queue/scheduled-evidence-coverage.backend.d.ts.map +1 -1
- package/dist/esm/queue/scheduled-evidence-coverage.backend.js +20 -2
- package/dist/esm/queue/scheduled-evidence-coverage.backend.js.map +1 -1
- package/dist/esm/queue/scheduled-execution.backend.service.d.ts +44 -1
- package/dist/esm/queue/scheduled-execution.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/scheduled-execution.backend.service.js +180 -10
- package/dist/esm/queue/scheduled-execution.backend.service.js.map +1 -1
- package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts +73 -21
- package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/scheduled-message-verifier.backend.service.js +162 -88
- package/dist/esm/queue/scheduled-message-verifier.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.js +16 -1
- package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
- package/package.json +10 -10
- package/dist/esm/__tests__/fixture-deep-partial.d.ts +0 -18
- package/dist/esm/__tests__/fixture-deep-partial.d.ts.map +0 -1
- package/dist/esm/__tests__/fixture-deep-partial.js +0 -1
- package/dist/esm/__tests__/fixture-deep-partial.js.map +0 -1
- package/dist/esm/__tests__/integration/redis-integration-gate.d.ts +0 -26
- package/dist/esm/__tests__/integration/redis-integration-gate.d.ts.map +0 -1
- package/dist/esm/__tests__/integration/redis-integration-gate.js +0 -105
- package/dist/esm/__tests__/integration/redis-integration-gate.js.map +0 -1
- package/dist/esm/__tests__/setup.d.ts +0 -7
- package/dist/esm/__tests__/setup.d.ts.map +0 -1
- package/dist/esm/__tests__/setup.js +0 -14
- package/dist/esm/__tests__/setup.js.map +0 -1
- package/dist/esm/__tests__/test-container.d.ts +0 -41
- package/dist/esm/__tests__/test-container.d.ts.map +0 -1
- package/dist/esm/__tests__/test-container.js +0 -98
- package/dist/esm/__tests__/test-container.js.map +0 -1
- package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts +0 -47
- package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts.map +0 -1
- package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.js +0 -82
- package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.js.map +0 -1
- package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts +0 -57
- package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts.map +0 -1
- package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.js +0 -172
- package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.js.map +0 -1
- package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.d.ts +0 -41
- package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.d.ts.map +0 -1
- package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.js +0 -54
- package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.js.map +0 -1
- package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.d.ts +0 -20
- package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.d.ts.map +0 -1
- package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.js +0 -33
- package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.js.map +0 -1
- package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.d.ts +0 -22
- package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.d.ts.map +0 -1
- package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.js +0 -92
- package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.js.map +0 -1
- package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.d.ts +0 -15
- package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.d.ts.map +0 -1
- package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.js +0 -61
- package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.js.map +0 -1
- package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.d.ts +0 -21
- package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.d.ts.map +0 -1
- package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.js +0 -32
- package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.js.map +0 -1
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +0 -52
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +0 -1
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +0 -74
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +0 -1
- package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts +0 -60
- package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts.map +0 -1
- package/dist/esm/config/services/__tests__/mock-app-configuration.service.js +0 -156
- package/dist/esm/config/services/__tests__/mock-app-configuration.service.js.map +0 -1
- package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.d.ts +0 -31
- package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.d.ts.map +0 -1
- package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.js +0 -47
- package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.js.map +0 -1
- package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts +0 -20
- package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts.map +0 -1
- package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.js +0 -424
- package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.js.map +0 -1
- package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts +0 -19
- package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts.map +0 -1
- package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.js +0 -49
- package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.js.map +0 -1
- package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.d.ts +0 -43
- package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.d.ts.map +0 -1
- package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.js +0 -61
- package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.js.map +0 -1
- package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.d.ts +0 -25
- package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.d.ts.map +0 -1
- package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.js +0 -92
- package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.js.map +0 -1
- package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts +0 -7
- package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts.map +0 -1
- package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.js +0 -194
- package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.js.map +0 -1
- package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts +0 -34
- package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts.map +0 -1
- package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.js +0 -59
- package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.js.map +0 -1
- package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts +0 -48
- package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts.map +0 -1
- package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.js +0 -53
- package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.js.map +0 -1
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.d.ts +0 -3
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.d.ts.map +0 -1
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.js +0 -19
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.js.map +0 -1
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.d.ts +0 -51
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.d.ts.map +0 -1
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.js +0 -24
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.js.map +0 -1
- package/dist/esm/notifications/services/__tests__/recipient-language.test-double.d.ts +0 -8
- package/dist/esm/notifications/services/__tests__/recipient-language.test-double.d.ts.map +0 -1
- package/dist/esm/notifications/services/__tests__/recipient-language.test-double.js +0 -9
- package/dist/esm/notifications/services/__tests__/recipient-language.test-double.js.map +0 -1
- package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts +0 -10
- package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts.map +0 -1
- package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.js +0 -18
- package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.js.map +0 -1
- package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.d.ts +0 -11
- package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.d.ts.map +0 -1
- package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.js +0 -34
- package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.js.map +0 -1
- package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.d.ts +0 -105
- package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.d.ts.map +0 -1
- package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.js +0 -140
- package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.js.map +0 -1
- package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts +0 -35
- package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts.map +0 -1
- package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.js +0 -46
- package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.js.map +0 -1
- package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.d.ts +0 -2
- package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.d.ts.map +0 -1
- package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.js +0 -18
- package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.js.map +0 -1
- package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.d.ts +0 -20
- package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.d.ts.map +0 -1
- package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.js +0 -56
- package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
import { AuthMethod, ErrorType } from '@wildo-ai/saas-models';
|
|
3
|
-
import { AuthenticationOrchestratorBackendService } from '../../../security/authentications/services/authentication-orchestrator.backend.service.js';
|
|
4
|
-
/**
|
|
5
|
-
* A REAL `AuthenticationOrchestratorBackendService` for the registration → onboarding journey (#1011,
|
|
6
|
-
* #1008), with only its collaborators replaced.
|
|
7
|
-
*
|
|
8
|
-
* The pins that use it exist because the defect lived INSIDE the orchestrator's own session handling —
|
|
9
|
-
* `processEmailVerification` created a fresh session that no pending organization type reached, and
|
|
10
|
-
* `completeOrgOnboarding` wrote `COMPLETED` for any number of concurrent callers. A unit double of the
|
|
11
|
-
* orchestrator answers whatever the test tells it to, so it can only ever reproduce the drop that the
|
|
12
|
-
* test author already knows about. So the orchestrator's real `createSession` / `getSession` /
|
|
13
|
-
* `updateSession` / `consumeSession`, its real registration pipeline, its real enrollment settlement and
|
|
14
|
-
* its real `completeOrgOnboarding` (including the real durable-onboarding ledger code) run here against:
|
|
15
|
-
*
|
|
16
|
-
* - an in-memory session store with the production store's contracts: `atomicUpdate` lands only on the
|
|
17
|
-
* version the caller read, and `consume` reports `true` to exactly the caller whose delete removed the
|
|
18
|
-
* key (Redis `DEL`'s count) — the same double `login-completion-single-mint.test.ts` uses;
|
|
19
|
-
* - an in-memory `organizationOnboardingOperations` ledger behind the three repository doors the
|
|
20
|
-
* production ledger uses (#1131): a filtered read, an insert whose `_id` is unique (a second insert is
|
|
21
|
-
* refused with the classified CONFLICT both adapters raise), and a compare-and-set update.
|
|
22
|
-
*
|
|
23
|
-
* What is stubbed is policy RESOLUTION (which MFA posture a user type has) and credential storage —
|
|
24
|
-
* inputs to the journey, not the journey.
|
|
25
|
-
*/
|
|
26
|
-
/** The onboarding ledger's repository doors, in memory, with the store contracts the ledger relies on (#1131). */
|
|
27
|
-
export function createInMemoryOnboardingLedger() {
|
|
28
|
-
const rows = new Map();
|
|
29
|
-
const matches = (row, filter) => Object.entries(filter).every(([key, value]) => row[key] === value);
|
|
30
|
-
const repositoriesRegistry = {
|
|
31
|
-
readUnscopedByKey: vi.fn(async (_resourceType, filter) => {
|
|
32
|
-
const row = rows.get(filter._id);
|
|
33
|
-
return row && matches(row, filter) ? { ...row } : null;
|
|
34
|
-
}),
|
|
35
|
-
insertDocumentForInfrastructure: vi.fn(async (_resourceType, doc) => {
|
|
36
|
-
if (rows.has(doc._id)) {
|
|
37
|
-
// The classified refusal `insertRawDocument` raises on either adapter for a duplicate primary key.
|
|
38
|
-
throw { type: ErrorType.CONFLICT, customMessageReference: 'conflict', context: { duplicateKey: doc._id } };
|
|
39
|
-
}
|
|
40
|
-
rows.set(doc._id, { ...doc });
|
|
41
|
-
return { ...doc };
|
|
42
|
-
}),
|
|
43
|
-
atomicGuardedMutation: vi.fn(async (_resourceType, filter, mutation) => {
|
|
44
|
-
const row = rows.get(filter._id);
|
|
45
|
-
if (!row || !matches(row, filter))
|
|
46
|
-
return null;
|
|
47
|
-
Object.assign(row, mutation.set);
|
|
48
|
-
return { ...row };
|
|
49
|
-
}),
|
|
50
|
-
};
|
|
51
|
-
return { rows, repositoriesRegistry };
|
|
52
|
-
}
|
|
53
|
-
/** The production session store's contracts, in memory. Session ids are `S-1`, `S-2`, … in creation order. */
|
|
54
|
-
export function createInMemoryAuthSessionStore() {
|
|
55
|
-
const sessions = new Map();
|
|
56
|
-
let sequence = 0;
|
|
57
|
-
const store = {
|
|
58
|
-
generateSessionId: vi.fn(() => `S-${++sequence}`),
|
|
59
|
-
set: vi.fn(async (id, session) => { sessions.set(id, { ...session }); }),
|
|
60
|
-
get: vi.fn(async (id) => {
|
|
61
|
-
const session = sessions.get(id);
|
|
62
|
-
return session ? { ...session } : null;
|
|
63
|
-
}),
|
|
64
|
-
atomicUpdate: vi.fn(async (id, updated, expectedVersion) => {
|
|
65
|
-
const current = sessions.get(id);
|
|
66
|
-
if (!current || (current.version ?? 0) !== expectedVersion)
|
|
67
|
-
return null;
|
|
68
|
-
sessions.set(id, { ...updated });
|
|
69
|
-
return { ...updated };
|
|
70
|
-
}),
|
|
71
|
-
delete: vi.fn(async (id) => { sessions.delete(id); }),
|
|
72
|
-
consume: vi.fn(async (id) => sessions.delete(id)),
|
|
73
|
-
};
|
|
74
|
-
return { sessions, store };
|
|
75
|
-
}
|
|
76
|
-
export function buildRealRegistrationOrchestrator(deps) {
|
|
77
|
-
const service = Object.create(AuthenticationOrchestratorBackendService.prototype);
|
|
78
|
-
const { sessions, store } = createInMemoryAuthSessionStore();
|
|
79
|
-
const ledger = createInMemoryOnboardingLedger();
|
|
80
|
-
const posture = {};
|
|
81
|
-
service.sessionStore = store;
|
|
82
|
-
service.logDebug = vi.fn();
|
|
83
|
-
service.logger = { warn: vi.fn(), error: vi.fn(), debug: vi.fn(), info: vi.fn() };
|
|
84
|
-
service.errorBuilder = deps.errorBuilder;
|
|
85
|
-
service.appConfigService = deps.appConfigService;
|
|
86
|
-
service.servicesRegistryHandler = deps.servicesRegistryHandler;
|
|
87
|
-
service.systemAccessService = deps.systemAccessService;
|
|
88
|
-
service.resourcePersistenceUnitOfWork = deps.resourcePersistenceUnitOfWork;
|
|
89
|
-
service.repositoriesRegistry = ledger.repositoriesRegistry;
|
|
90
|
-
const policy = () => ({
|
|
91
|
-
authMethodsEnabled: { [AuthMethod.PASSWORD]: true, [AuthMethod.TOTP]: true },
|
|
92
|
-
mfaPolicy: { requireMFA: posture.requireMFA ?? false, enrollmentGracePeriodDays: posture.enrollmentGracePeriodDays ?? 0 },
|
|
93
|
-
lockoutPolicy: { maxLoginAttempts: 5, progressiveLockout: false },
|
|
94
|
-
sessionDurationMinutes: 30,
|
|
95
|
-
});
|
|
96
|
-
service._resolveAuthPolicy = vi.fn(() => policy());
|
|
97
|
-
service._resolveAuthPolicyWithOrgOverrides = vi.fn(async () => policy());
|
|
98
|
-
service._shouldRequireMFA = vi.fn(async () => ({ required: posture.requireMFA ?? false, enrolledMethods: [], presentableMethods: [] }));
|
|
99
|
-
service.credentialOps = {
|
|
100
|
-
readByUserId: vi.fn(async () => ({ _id: 'cred-1', mfaEnrollmentState: undefined })),
|
|
101
|
-
updateById: vi.fn(async () => undefined),
|
|
102
|
-
};
|
|
103
|
-
// The factor the registrant just enrolled is enrolled and accepted: the enrollment ceremony is not the subject.
|
|
104
|
-
service._resolveEnrolledAcceptedSecondFactors = vi.fn(async () => ({ policy: policy(), cred: null, enrolledAndAccepted: [AuthMethod.TOTP] }));
|
|
105
|
-
service.userLookup = {
|
|
106
|
-
findUserById: vi.fn(async (_ec, userId) => deps.findUserById?.(userId) ?? null),
|
|
107
|
-
/*
|
|
108
|
-
* Read by `completeOrgOnboarding` since #1215: the method that proved a PARKED federated sign-in
|
|
109
|
-
* must still be enabled when the tokens are finally minted, which happens here rather than at the
|
|
110
|
-
* callback. A resolved policy always carries `authMethodsEnabled` in production — the schema
|
|
111
|
-
* defaults it — so the double supplies it too.
|
|
112
|
-
*/
|
|
113
|
-
resolveEffectiveAuthPolicy: vi.fn(async () => ({
|
|
114
|
-
authMethodsEnabled: {
|
|
115
|
-
[AuthMethod.PASSWORD]: true,
|
|
116
|
-
[AuthMethod.MAGIC_LINK]: true,
|
|
117
|
-
[AuthMethod.PASSKEY]: true,
|
|
118
|
-
[AuthMethod.EXTERNAL_OAUTH2]: true,
|
|
119
|
-
[AuthMethod.ORG_OPENID_CONNECT]: true,
|
|
120
|
-
[AuthMethod.ORG_SAML]: true,
|
|
121
|
-
},
|
|
122
|
-
})),
|
|
123
|
-
};
|
|
124
|
-
service.tokenIssuer = { issueTokens: vi.fn(async () => ({ accessToken: 'enrollment-access', refreshToken: 'enrollment-refresh', expiresIn: 900 })) };
|
|
125
|
-
service.auditLogsService = { logUserLogin: vi.fn(async () => undefined) };
|
|
126
|
-
return {
|
|
127
|
-
/*
|
|
128
|
-
* Typed as a plain record, not `AuthenticationOrchestratorBackendService & Record<…>`: the class has
|
|
129
|
-
* `private` members, TypeScript matches those by declaration site, and the intersection refuses every
|
|
130
|
-
* read of one — which the pins need (`createSession`, `tokenIssuer`, `auditLogsService`).
|
|
131
|
-
*/
|
|
132
|
-
orchestrator: service,
|
|
133
|
-
sessions,
|
|
134
|
-
store,
|
|
135
|
-
ledger,
|
|
136
|
-
/** Set the user type's MFA posture before driving the pipeline. */
|
|
137
|
-
setPosture: (next) => Object.assign(posture, next),
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=registration-onboarding.harness.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registration-onboarding.harness.js","sourceRoot":"","sources":["../../../../../../src/security/authentications/__tests__/registration-onboarding.harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,wCAAwC,EAAE,MAAM,kGAAkG,CAAC;AAE5J;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,kHAAkH;AAClH,MAAM,UAAU,8BAA8B;IAC5C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAmC,CAAC;IACxD,MAAM,OAAO,GAAG,CAAC,GAA4B,EAAE,MAA+B,EAAE,EAAE,CAChF,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC;IAErE,MAAM,oBAAoB,GAAG;QAC3B,iBAAiB,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,aAAsB,EAAE,MAA+B,EAAE,EAAE;YACzF,MAAM,GAAG,GAAG,IAAI,CAAC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AC,EAAE,CAAC,KAAK,EAAE,GAAY,EAAE,MAAc,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;QAChG;;;;;WAKG;QACH,0BAA0B,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YAC7C,kBAAkB,EAAE;gBAClB,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,IAAI;gBAC3B,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,IAAI;gBAC7B,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI;gBAC1B,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,IAAI;gBAClC,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,IAAI;gBACrC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,IAAI;aAC5B;SACF,CAAC,CAAC;KACJ,CAAC;IACF,OAAO,CAAC,WAAW,GAAG,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACrJ,OAAO,CAAC,gBAAgB,GAAG,EAAE,YAAY,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;IAE1E,OAAO;QACL;;;;WAIG;QACH,YAAY,EAAE,OAA8B;QAC5C,QAAQ;QACR,KAAK;QACL,MAAM;QACN,mEAAmE;QACnE,UAAU,EAAE,CAAC,IAA+B,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC;KAC9E,CAAC;AACJ,CAAC","sourcesContent":["import { vi } from 'vitest';\nimport { AuthMethod, ErrorType } from '@wildo-ai/saas-models';\n\nimport { AuthenticationOrchestratorBackendService } from '~wildo-backend-lib/security/authentications/services/authentication-orchestrator.backend.service';\n\n/**\n * A REAL `AuthenticationOrchestratorBackendService` for the registration → onboarding journey (#1011,\n * #1008), with only its collaborators replaced.\n *\n * The pins that use it exist because the defect lived INSIDE the orchestrator's own session handling —\n * `processEmailVerification` created a fresh session that no pending organization type reached, and\n * `completeOrgOnboarding` wrote `COMPLETED` for any number of concurrent callers. A unit double of the\n * orchestrator answers whatever the test tells it to, so it can only ever reproduce the drop that the\n * test author already knows about. So the orchestrator's real `createSession` / `getSession` /\n * `updateSession` / `consumeSession`, its real registration pipeline, its real enrollment settlement and\n * its real `completeOrgOnboarding` (including the real durable-onboarding ledger code) run here against:\n *\n * - an in-memory session store with the production store's contracts: `atomicUpdate` lands only on the\n * version the caller read, and `consume` reports `true` to exactly the caller whose delete removed the\n * key (Redis `DEL`'s count) — the same double `login-completion-single-mint.test.ts` uses;\n * - an in-memory `organizationOnboardingOperations` ledger behind the three repository doors the\n * production ledger uses (#1131): a filtered read, an insert whose `_id` is unique (a second insert is\n * refused with the classified CONFLICT both adapters raise), and a compare-and-set update.\n *\n * What is stubbed is policy RESOLUTION (which MFA posture a user type has) and credential storage —\n * inputs to the journey, not the journey.\n */\n\n/** The onboarding ledger's repository doors, in memory, with the store contracts the ledger relies on (#1131). */\nexport function createInMemoryOnboardingLedger() {\n const rows = new Map<string, Record<string, unknown>>();\n const matches = (row: Record<string, unknown>, filter: Record<string, unknown>) =>\n Object.entries(filter).every(([key, value]) => row[key] === value);\n\n const repositoriesRegistry = {\n readUnscopedByKey: vi.fn(async (_resourceType: unknown, filter: Record<string, unknown>) => {\n const row = rows.get(filter._id as string);\n return row && matches(row, filter) ? { ...row } : null;\n }),\n insertDocumentForInfrastructure: vi.fn(async (_resourceType: unknown, doc: Record<string, unknown>) => {\n if (rows.has(doc._id as string)) {\n // The classified refusal `insertRawDocument` raises on either adapter for a duplicate primary key.\n throw { type: ErrorType.CONFLICT, customMessageReference: 'conflict', context: { duplicateKey: doc._id } };\n }\n rows.set(doc._id as string, { ...doc });\n return { ...doc };\n }),\n atomicGuardedMutation: vi.fn(async (_resourceType: unknown, filter: Record<string, unknown>, mutation: { set?: Record<string, unknown> }) => {\n const row = rows.get(filter._id as string);\n if (!row || !matches(row, filter)) return null;\n Object.assign(row, mutation.set);\n return { ...row };\n }),\n };\n\n return { rows, repositoriesRegistry };\n}\n\n/** The production session store's contracts, in memory. Session ids are `S-1`, `S-2`, … in creation order. */\nexport function createInMemoryAuthSessionStore() {\n const sessions = new Map<string, Record<string, unknown>>();\n let sequence = 0;\n const store = {\n generateSessionId: vi.fn(() => `S-${++sequence}`),\n set: vi.fn(async (id: string, session: Record<string, unknown>) => { sessions.set(id, { ...session }); }),\n get: vi.fn(async (id: string) => {\n const session = sessions.get(id);\n return session ? { ...session } : null;\n }),\n atomicUpdate: vi.fn(async (id: string, updated: Record<string, unknown>, expectedVersion: number) => {\n const current = sessions.get(id);\n if (!current || (current.version ?? 0) !== expectedVersion) return null;\n sessions.set(id, { ...updated });\n return { ...updated };\n }),\n delete: vi.fn(async (id: string) => { sessions.delete(id); }),\n consume: vi.fn(async (id: string) => sessions.delete(id)),\n };\n return { sessions, store };\n}\n\nexport interface RegistrationOrchestratorHarnessDependencies {\n appConfigService: unknown;\n servicesRegistryHandler: unknown;\n systemAccessService: unknown;\n resourcePersistenceUnitOfWork: unknown;\n errorBuilder: unknown;\n /** The account the enrollment settlement re-checks before completing a registration. */\n findUserById?: (userId: string) => Promise<unknown>;\n}\n\nexport interface RegistrationPolicyPosture {\n /** The user type requires a second factor. */\n requireMFA?: boolean;\n /** Days a registrant may defer the enrollment `requireMFA` demands. */\n enrollmentGracePeriodDays?: number;\n}\n\nexport function buildRealRegistrationOrchestrator(deps: RegistrationOrchestratorHarnessDependencies) {\n const service = Object.create(AuthenticationOrchestratorBackendService.prototype) as any;\n const { sessions, store } = createInMemoryAuthSessionStore();\n const ledger = createInMemoryOnboardingLedger();\n const posture: RegistrationPolicyPosture = {};\n\n service.sessionStore = store;\n service.logDebug = vi.fn();\n service.logger = { warn: vi.fn(), error: vi.fn(), debug: vi.fn(), info: vi.fn() };\n service.errorBuilder = deps.errorBuilder;\n service.appConfigService = deps.appConfigService;\n service.servicesRegistryHandler = deps.servicesRegistryHandler;\n service.systemAccessService = deps.systemAccessService;\n service.resourcePersistenceUnitOfWork = deps.resourcePersistenceUnitOfWork;\n service.repositoriesRegistry = ledger.repositoriesRegistry;\n\n const policy = () => ({\n authMethodsEnabled: { [AuthMethod.PASSWORD]: true, [AuthMethod.TOTP]: true },\n mfaPolicy: { requireMFA: posture.requireMFA ?? false, enrollmentGracePeriodDays: posture.enrollmentGracePeriodDays ?? 0 },\n lockoutPolicy: { maxLoginAttempts: 5, progressiveLockout: false },\n sessionDurationMinutes: 30,\n });\n service._resolveAuthPolicy = vi.fn(() => policy());\n service._resolveAuthPolicyWithOrgOverrides = vi.fn(async () => policy());\n service._shouldRequireMFA = vi.fn(async () => ({ required: posture.requireMFA ?? false, enrolledMethods: [], presentableMethods: [] }));\n service.credentialOps = {\n readByUserId: vi.fn(async () => ({ _id: 'cred-1', mfaEnrollmentState: undefined })),\n updateById: vi.fn(async () => undefined),\n };\n // The factor the registrant just enrolled is enrolled and accepted: the enrollment ceremony is not the subject.\n service._resolveEnrolledAcceptedSecondFactors = vi.fn(async () => ({ policy: policy(), cred: null, enrolledAndAccepted: [AuthMethod.TOTP] }));\n service.userLookup = {\n findUserById: vi.fn(async (_ec: unknown, userId: string) => deps.findUserById?.(userId) ?? null),\n /*\n * Read by `completeOrgOnboarding` since #1215: the method that proved a PARKED federated sign-in\n * must still be enabled when the tokens are finally minted, which happens here rather than at the\n * callback. A resolved policy always carries `authMethodsEnabled` in production — the schema\n * defaults it — so the double supplies it too.\n */\n resolveEffectiveAuthPolicy: vi.fn(async () => ({\n authMethodsEnabled: {\n [AuthMethod.PASSWORD]: true,\n [AuthMethod.MAGIC_LINK]: true,\n [AuthMethod.PASSKEY]: true,\n [AuthMethod.EXTERNAL_OAUTH2]: true,\n [AuthMethod.ORG_OPENID_CONNECT]: true,\n [AuthMethod.ORG_SAML]: true,\n },\n })),\n };\n service.tokenIssuer = { issueTokens: vi.fn(async () => ({ accessToken: 'enrollment-access', refreshToken: 'enrollment-refresh', expiresIn: 900 })) };\n service.auditLogsService = { logUserLogin: vi.fn(async () => undefined) };\n\n return {\n /*\n * Typed as a plain record, not `AuthenticationOrchestratorBackendService & Record<…>`: the class has\n * `private` members, TypeScript matches those by declaration site, and the intersection refuses every\n * read of one — which the pins need (`createSession`, `tokenIssuer`, `auditLogsService`).\n */\n orchestrator: service as Record<string, any>,\n sessions,\n store,\n ledger,\n /** Set the user type's MFA posture before driving the pipeline. */\n setPosture: (next: RegistrationPolicyPosture) => Object.assign(posture, next),\n };\n}\n"]}
|
package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A COMPLETE `AuditLogsBackendService` test double for the OAuth2/OIDC-provider suites — every audit
|
|
3
|
-
* method the provider flows emit, as a stable `vi.fn()` spy. Two reasons this exists as ONE shared
|
|
4
|
-
* factory rather than an inline literal per test:
|
|
5
|
-
*
|
|
6
|
-
* 1. **Assertability** — a test can assert an emit fired (e.g. `spies.logOAuthConsentGranted` was called
|
|
7
|
-
* with the right event args). Callers must reuse ONE instance per service/container so `.mock.calls`
|
|
8
|
-
* stays stable across `container.get(AuditLogsService)`.
|
|
9
|
-
* 2. **Future-proofing** — a NEW audit method added to the provider flow will not re-break every OAuth
|
|
10
|
-
* suite with `<method> is not a function`; it is added HERE, once. (This is exactly the breakage the
|
|
11
|
-
* 2026-07-31 audit-tier work hit when the mocks only stubbed `logMachineAuth*`.)
|
|
12
|
-
*
|
|
13
|
-
* Every spy resolves (`async () => {}`) to mirror the fire-and-forget `void log*(…).catch(warn)` shape at
|
|
14
|
-
* the emit sites. `clear()` resets call history between tests.
|
|
15
|
-
*/
|
|
16
|
-
export declare function createOAuthProviderAuditLogsSpies(): {
|
|
17
|
-
/** Reset all spy call history (use in `beforeEach`). */
|
|
18
|
-
clear(): void;
|
|
19
|
-
logMachineAuthSuccess: import("vitest").Mock<[], Promise<void>>;
|
|
20
|
-
logMachineAuthFailed: import("vitest").Mock<[], Promise<void>>;
|
|
21
|
-
logOAuthDelegatedTokenIssued: import("vitest").Mock<[], Promise<void>>;
|
|
22
|
-
logOAuthConsentGranted: import("vitest").Mock<[], Promise<void>>;
|
|
23
|
-
logOAuthConsentDenied: import("vitest").Mock<[], Promise<void>>;
|
|
24
|
-
logOAuthConsentGrantPersisted: import("vitest").Mock<[], Promise<void>>;
|
|
25
|
-
logOAuthTokenRefreshed: import("vitest").Mock<[], Promise<void>>;
|
|
26
|
-
logOAuthTokenRevoked: import("vitest").Mock<[], Promise<void>>;
|
|
27
|
-
logOAuthRpInitiatedLogout: import("vitest").Mock<[], Promise<void>>;
|
|
28
|
-
logOAuthCodeExchangeFailed: import("vitest").Mock<[], Promise<void>>;
|
|
29
|
-
logOAuthConsentBindingViolation: import("vitest").Mock<[], Promise<void>>;
|
|
30
|
-
logUserRefreshTokenReuseDetected: import("vitest").Mock<[], Promise<void>>;
|
|
31
|
-
logCimdClientRefused: import("vitest").Mock<[], Promise<void>>;
|
|
32
|
-
logDynamicClientRegistered: import("vitest").Mock<[], Promise<void>>;
|
|
33
|
-
};
|
|
34
|
-
export type OAuthProviderAuditLogsSpies = ReturnType<typeof createOAuthProviderAuditLogsSpies>;
|
|
35
|
-
//# sourceMappingURL=oauth-provider-audit-spies.mock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-provider-audit-spies.mock.d.ts","sourceRoot":"","sources":["../../../../../../../src/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iCAAiC;IAsB7C,wDAAwD;;;;;;;;;;;;;;;;EAK3D;AAED,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAAC"}
|
package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
/**
|
|
3
|
-
* A COMPLETE `AuditLogsBackendService` test double for the OAuth2/OIDC-provider suites — every audit
|
|
4
|
-
* method the provider flows emit, as a stable `vi.fn()` spy. Two reasons this exists as ONE shared
|
|
5
|
-
* factory rather than an inline literal per test:
|
|
6
|
-
*
|
|
7
|
-
* 1. **Assertability** — a test can assert an emit fired (e.g. `spies.logOAuthConsentGranted` was called
|
|
8
|
-
* with the right event args). Callers must reuse ONE instance per service/container so `.mock.calls`
|
|
9
|
-
* stays stable across `container.get(AuditLogsService)`.
|
|
10
|
-
* 2. **Future-proofing** — a NEW audit method added to the provider flow will not re-break every OAuth
|
|
11
|
-
* suite with `<method> is not a function`; it is added HERE, once. (This is exactly the breakage the
|
|
12
|
-
* 2026-07-31 audit-tier work hit when the mocks only stubbed `logMachineAuth*`.)
|
|
13
|
-
*
|
|
14
|
-
* Every spy resolves (`async () => {}`) to mirror the fire-and-forget `void log*(…).catch(warn)` shape at
|
|
15
|
-
* the emit sites. `clear()` resets call history between tests.
|
|
16
|
-
*/
|
|
17
|
-
export function createOAuthProviderAuditLogsSpies() {
|
|
18
|
-
const spies = {
|
|
19
|
-
// Pre-existing machine-auth events (client_credentials front + the A-7 code-flow twins).
|
|
20
|
-
logMachineAuthSuccess: vi.fn(async () => { }),
|
|
21
|
-
logMachineAuthFailed: vi.fn(async () => { }),
|
|
22
|
-
// OAuth2/OIDC provider events (audit-tier A-1..A-9).
|
|
23
|
-
logOAuthDelegatedTokenIssued: vi.fn(async () => { }),
|
|
24
|
-
logOAuthConsentGranted: vi.fn(async () => { }),
|
|
25
|
-
logOAuthConsentDenied: vi.fn(async () => { }),
|
|
26
|
-
logOAuthConsentGrantPersisted: vi.fn(async () => { }),
|
|
27
|
-
logOAuthTokenRefreshed: vi.fn(async () => { }),
|
|
28
|
-
logOAuthTokenRevoked: vi.fn(async () => { }),
|
|
29
|
-
logOAuthRpInitiatedLogout: vi.fn(async () => { }),
|
|
30
|
-
logOAuthCodeExchangeFailed: vi.fn(async () => { }),
|
|
31
|
-
logOAuthConsentBindingViolation: vi.fn(async () => { }),
|
|
32
|
-
logUserRefreshTokenReuseDetected: vi.fn(async () => { }),
|
|
33
|
-
// Client-identity events: a refused CIMD assertion, and an anonymous RFC 7591 registration.
|
|
34
|
-
logCimdClientRefused: vi.fn(async () => { }),
|
|
35
|
-
logDynamicClientRegistered: vi.fn(async () => { }),
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
...spies,
|
|
39
|
-
/** Reset all spy call history (use in `beforeEach`). */
|
|
40
|
-
clear() {
|
|
41
|
-
for (const fn of Object.values(spies))
|
|
42
|
-
fn.mockClear();
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=oauth-provider-audit-spies.mock.js.map
|
package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-provider-audit-spies.mock.js","sourceRoot":"","sources":["../../../../../../../src/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iCAAiC;IAC/C,MAAM,KAAK,GAAG;QACZ,yFAAyF;QACzF,qBAAqB,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC;QAC5C,oBAAoB,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC;QAC3C,qDAAqD;QACrD,4BAA4B,EAAE,EAAE,CAAC,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C-provider suites — every audit\n * method the provider flows emit, as a stable `vi.fn()` spy. Two reasons this exists as ONE shared\n * factory rather than an inline literal per test:\n *\n * 1. **Assertability** — a test can assert an emit fired (e.g. `spies.logOAuthConsentGranted` was called\n * with the right event args). Callers must reuse ONE instance per service/container so `.mock.calls`\n * stays stable across `container.get(AuditLogsService)`.\n * 2. **Future-proofing** — a NEW audit method added to the provider flow will not re-break every OAuth\n * suite with `<method> is not a function`; it is added HERE, once. (This is exactly the breakage the\n * 2026-07-31 audit-tier work hit when the mocks only stubbed `logMachineAuth*`.)\n *\n * Every spy resolves (`async () => {}`) to mirror the fire-and-forget `void log*(…).catch(warn)` shape at\n * the emit sites. `clear()` resets call history between tests.\n */\nexport function createOAuthProviderAuditLogsSpies() {\n const spies = {\n // Pre-existing machine-auth events (client_credentials front + the A-7 code-flow twins).\n logMachineAuthSuccess: vi.fn(async () => {}),\n logMachineAuthFailed: vi.fn(async () => {}),\n // OAuth2/OIDC provider events (audit-tier A-1..A-9).\n logOAuthDelegatedTokenIssued: vi.fn(async () => {}),\n logOAuthConsentGranted: vi.fn(async () => {}),\n logOAuthConsentDenied: vi.fn(async () => {}),\n logOAuthConsentGrantPersisted: vi.fn(async () => {}),\n logOAuthTokenRefreshed: vi.fn(async () => {}),\n logOAuthTokenRevoked: vi.fn(async () => {}),\n logOAuthRpInitiatedLogout: vi.fn(async () => {}),\n logOAuthCodeExchangeFailed: vi.fn(async () => {}),\n logOAuthConsentBindingViolation: vi.fn(async () => {}),\n logUserRefreshTokenReuseDetected: vi.fn(async () => {}),\n // Client-identity events: a refused CIMD assertion, and an anonymous RFC 7591 registration.\n logCimdClientRefused: vi.fn(async () => {}),\n logDynamicClientRegistered: vi.fn(async () => {}),\n };\n return {\n ...spies,\n /** Reset all spy call history (use in `beforeEach`). */\n clear() {\n for (const fn of Object.values(spies)) fn.mockClear();\n },\n };\n}\n\nexport type OAuthProviderAuditLogsSpies = ReturnType<typeof createOAuthProviderAuditLogsSpies>;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-connection-client-methods.d.ts","sourceRoot":"","sources":["../../../../../../../src/security/connected-accounts/__tests__/support/real-connection-client-methods.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,8BAA8B,EAK3B,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ExternalProvidersRegistryBackendService } from '../../../../external-providers/services/external-providers-registry.backend.service.js';
|
|
2
|
-
/**
|
|
3
|
-
* The REAL registry methods that choose a connection's OAuth client (#1725), to spread into a registry double.
|
|
4
|
-
*
|
|
5
|
-
* A double that supplied its own `getConnectionOAuth2Client` would pin that the caller ASKS for a client and never
|
|
6
|
-
* which client it gets — a pin satisfied by the fixture (`invariant-call-site-enumeration.md`). These are the
|
|
7
|
-
* shipped bodies; called on the double they read the double's own `getProviderRuntimeContract` and
|
|
8
|
-
* `getProviderSecret`, and a double with no `configService` declares no shared connection, so every ref is its own
|
|
9
|
-
* connection exactly as an undeclared application's is.
|
|
10
|
-
*/
|
|
11
|
-
const prototype = ExternalProvidersRegistryBackendService.prototype;
|
|
12
|
-
export const REAL_CONNECTION_CLIENT_METHODS = {
|
|
13
|
-
getProviderSharedConnection: prototype.getProviderSharedConnection,
|
|
14
|
-
declaredSharedConnections: prototype.declaredSharedConnections,
|
|
15
|
-
getConnectionOAuth2Client: prototype.getConnectionOAuth2Client,
|
|
16
|
-
resolveConnectionOAuth2ClientCredentials: prototype.resolveConnectionOAuth2ClientCredentials,
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=real-connection-client-methods.js.map
|
package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-connection-client-methods.js","sourceRoot":"","sources":["../../../../../../../src/security/connected-accounts/__tests__/support/real-connection-client-methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,4FAA4F,CAAC;AAErJ;;;;;;;;GAQG;AACH,MAAM,SAAS,GAAG,uCAAuC,CAAC,SAA+C,CAAC;AAE1G,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,2BAA2B,EAAE,SAAS,CAAC,2BAA2B;IAClE,yBAAyB,EAAE,SAAS,CAAC,yBAAyB;IAC9D,yBAAyB,EAAE,SAAS,CAAC,yBAAyB;IAC9D,wCAAwC,EAAE,SAAS,CAAC,wCAAwC;CACzD,CAAC","sourcesContent":["import { ExternalProvidersRegistryBackendService } from '~wildo-backend-lib/external-providers/services/external-providers-registry.backend.service';\n\n/**\n * The REAL registry methods that choose a connection's OAuth client (#1725), to spread into a registry double.\n *\n * A double that supplied its own `getConnectionOAuth2Client` would pin that the caller ASKS for a client and never\n * which client it gets — a pin satisfied by the fixture (`invariant-call-site-enumeration.md`). These are the\n * shipped bodies; called on the double they read the double's own `getProviderRuntimeContract` and\n * `getProviderSecret`, and a double with no `configService` declares no shared connection, so every ref is its own\n * connection exactly as an undeclared application's is.\n */\nconst prototype = ExternalProvidersRegistryBackendService.prototype as unknown as Record<string, unknown>;\n\nexport const REAL_CONNECTION_CLIENT_METHODS = {\n getProviderSharedConnection: prototype.getProviderSharedConnection,\n declaredSharedConnections: prototype.declaredSharedConnections,\n getConnectionOAuth2Client: prototype.getConnectionOAuth2Client,\n resolveConnectionOAuth2ClientCredentials: prototype.resolveConnectionOAuth2ClientCredentials,\n} as unknown as Record<string, never>;\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fixed X.509 fixtures for the credential pins (#1056).
|
|
3
|
-
*
|
|
4
|
-
* Self-signed, generated once, and checked in rather than minted per run: Node cannot mint a
|
|
5
|
-
* certificate, and a fixture produced by shelling out to `openssl` would make these tests depend on a
|
|
6
|
-
* binary the repository does not otherwise require.
|
|
7
|
-
*
|
|
8
|
-
* Both are PUBLIC material — a certificate is the half you publish — so nothing here is a secret. The
|
|
9
|
-
* private keys they were generated with were discarded to `/dev/null` and no signature is ever made
|
|
10
|
-
* with them: the valid one is used for its BYTES (the `x5t` thumbprint) and its validity window, the
|
|
11
|
-
* expired one for its window alone.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* `notAfter` in 2126. Long-lived deliberately: a fixture that expires turns a passing suite red on a
|
|
15
|
-
* date nobody chose, which is the failure mode this file's own subject is about.
|
|
16
|
-
*/
|
|
17
|
-
export declare const VALID_CERTIFICATE_PEM = "-----BEGIN CERTIFICATE-----\nMIIDFTCCAf2gAwIBAgIUGJ5PE1NHgDMro6tyd/sxqF/L9lgwDQYJKoZIhvcNAQEL\nBQAwGTEXMBUGA1UEAwwOd2lsZG8tc29yLXRlc3QwIBcNMjYwOTE3MTkyNDUwWhgP\nMjEyNjA4MjQxOTI0NTBaMBkxFzAVBgNVBAMMDndpbGRvLXNvci10ZXN0MIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAocaBdD7ZeyY/JNsjBs6Lq1do7BYN\ngfH1HtQh6MBsN3vVdrqg8XgF65kYyXbQx+qCPOoxKazw9iQ9ko26vqDJwBk/TBT8\nAP6NwGIvbWGutQb6PXveeo6uvuD8rL4Mm044UH9Rj3lFmIXfcVFrXEx2TXt2Q+s9\n4xFvaRyjVSXioaHOpLOujN2vIvTAijXwPpbrN/LFGdukyLMkSRX7Ttf56Km4uwta\nINQyJt9qWO7NcmjjgogK2PrPmc4PuqFRimyEQBzi3QiNW01uAniR4DUEmcFJuPO6\nZ/ykWTmSP6yrMgurnCkB0eLub1fD59D4FgsGTJl+kbxVoFzrVTusqg7EgQIDAQAB\no1MwUTAdBgNVHQ4EFgQUCH+FpIKDm+79TGPw+JdQOrXiZOswHwYDVR0jBBgwFoAU\nCH+FpIKDm+79TGPw+JdQOrXiZOswDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B\nAQsFAAOCAQEALX1Ev86gubCsesJLBDf/1yDnqBOx+uOWm7JJAJBxya8I3Gr3O+9c\nSpIuuBZK8OTHU19pmTRbAttFxA58VOl4nN7jTLsGVp1iAGuTjAgM+Rm9M+ilhm16\nV9Tu1Rv0r3q1SbwcFs5Ov9tCQhcOU0b6P1zRGsFaomuBJzESpmHnLEV2f2xZpi9t\nbcQoUtdzig9W2OnBj5HJKKYVdwMmoCssP6xRzmkRjkN/KIfdMPcLtdLnAqRAhC5B\ncdaaYq7fYgy3/MUmk0p9HF03Qk2//aMWPmFesEwgpaU+WUl0Hc8Y2RpkyS3SRjQz\nlwP83tAU/6GI4J8cFi+Pp0HfIPS/3PowLg==\n-----END CERTIFICATE-----";
|
|
18
|
-
/** `notAfter` 2020-02-01 — already in the past, and permanently so. The E7 fixture. */
|
|
19
|
-
export declare const EXPIRED_CERTIFICATE_PEM = "-----BEGIN CERTIFICATE-----\nMIIDGTCCAgGgAwIBAgIUbiRDk/GIFk+ZblQI5xF5KVsplAEwDQYJKoZIhvcNAQEL\nBQAwHDEaMBgGA1UEAwwRd2lsZG8tc29yLWV4cGlyZWQwHhcNMjAwMTAxMDAwMDAw\nWhcNMjAwMjAxMDAwMDAwWjAcMRowGAYDVQQDDBF3aWxkby1zb3ItZXhwaXJlZDCC\nASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMP3wfQXT4DNyYVPaOmNtHkQ\nXgGXC31rCoUnk7Q6ZL7wuXpg/eoHQEDpNuZ955aPxjg0Q8lsydohmxbi9SwrR88f\nE25HIIKNxoxoNi67nlrAe0YV0ngNKEDPWORlwvOE+Aw52F4JOgJn35E2SkjAZcqM\nX3WoIK/K3YdfaMrgR3yMzE9t/G10Kxy1SIG6Kn1MhPJNyxslVkAIyZhnqWUxBdjG\nKQTwjZfE30UJwh4zK3mRY+22l2/O7WLAdD0LawmvmDQXxuc/Jc3bzF2Ipm5REAnT\nAcic8uwcAuHfVqe1E9OUnURRSQdTNoP20nfO0rLrFYTjWpXmZOOQGNJkzDheV2EC\nAwEAAaNTMFEwHQYDVR0OBBYEFI1Zu+OGcOq8kGX7/2qn0jQT5CvhMB8GA1UdIwQY\nMBaAFI1Zu+OGcOq8kGX7/2qn0jQT5CvhMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI\nhvcNAQELBQADggEBAJhjUFH17YnhMilq5oKeXp/87U85M8YvzmoV5pJ1Qs+Co+oO\ntCqR790W0j7HccS8YM927omZ4Gggt1VnsGK9N6NdSGNNAu1WQS6AD4d7wQ8UDhon\nTlcstIdzxjJZE59a08saaH84ymKtc2didVeHEwvtYtWbpmVy3FWP4YGHqIiXASIR\nJs5PifpiMqHVPfNT2/Wc16J1hIa1Cd6XqJdnoyhKV067So2uqQmJ/4Ea5di+/PxM\n0pB1AaNX0tvEWvlw5FBXucSw4sJ/J4QExSn4BFCMYqsJktoiPd4ehepcvFBW0e1r\nF1ZmEj1+AMgAIfpenIKizDbWMXJkkukfeDr32hA=\n-----END CERTIFICATE-----";
|
|
20
|
-
//# sourceMappingURL=certificate-fixtures.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"certificate-fixtures.d.ts","sourceRoot":"","sources":["../../../../../../src/systems-of-record/credentials/__tests__/certificate-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,ioCAkBR,CAAC;AAE3B,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,qoCAkBV,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fixed X.509 fixtures for the credential pins (#1056).
|
|
3
|
-
*
|
|
4
|
-
* Self-signed, generated once, and checked in rather than minted per run: Node cannot mint a
|
|
5
|
-
* certificate, and a fixture produced by shelling out to `openssl` would make these tests depend on a
|
|
6
|
-
* binary the repository does not otherwise require.
|
|
7
|
-
*
|
|
8
|
-
* Both are PUBLIC material — a certificate is the half you publish — so nothing here is a secret. The
|
|
9
|
-
* private keys they were generated with were discarded to `/dev/null` and no signature is ever made
|
|
10
|
-
* with them: the valid one is used for its BYTES (the `x5t` thumbprint) and its validity window, the
|
|
11
|
-
* expired one for its window alone.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* `notAfter` in 2126. Long-lived deliberately: a fixture that expires turns a passing suite red on a
|
|
15
|
-
* date nobody chose, which is the failure mode this file's own subject is about.
|
|
16
|
-
*/
|
|
17
|
-
export const VALID_CERTIFICATE_PEM = `-----BEGIN CERTIFICATE-----
|
|
18
|
-
MIIDFTCCAf2gAwIBAgIUGJ5PE1NHgDMro6tyd/sxqF/L9lgwDQYJKoZIhvcNAQEL
|
|
19
|
-
BQAwGTEXMBUGA1UEAwwOd2lsZG8tc29yLXRlc3QwIBcNMjYwOTE3MTkyNDUwWhgP
|
|
20
|
-
MjEyNjA4MjQxOTI0NTBaMBkxFzAVBgNVBAMMDndpbGRvLXNvci10ZXN0MIIBIjAN
|
|
21
|
-
BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAocaBdD7ZeyY/JNsjBs6Lq1do7BYN
|
|
22
|
-
gfH1HtQh6MBsN3vVdrqg8XgF65kYyXbQx+qCPOoxKazw9iQ9ko26vqDJwBk/TBT8
|
|
23
|
-
AP6NwGIvbWGutQb6PXveeo6uvuD8rL4Mm044UH9Rj3lFmIXfcVFrXEx2TXt2Q+s9
|
|
24
|
-
4xFvaRyjVSXioaHOpLOujN2vIvTAijXwPpbrN/LFGdukyLMkSRX7Ttf56Km4uwta
|
|
25
|
-
INQyJt9qWO7NcmjjgogK2PrPmc4PuqFRimyEQBzi3QiNW01uAniR4DUEmcFJuPO6
|
|
26
|
-
Z/ykWTmSP6yrMgurnCkB0eLub1fD59D4FgsGTJl+kbxVoFzrVTusqg7EgQIDAQAB
|
|
27
|
-
o1MwUTAdBgNVHQ4EFgQUCH+FpIKDm+79TGPw+JdQOrXiZOswHwYDVR0jBBgwFoAU
|
|
28
|
-
CH+FpIKDm+79TGPw+JdQOrXiZOswDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B
|
|
29
|
-
AQsFAAOCAQEALX1Ev86gubCsesJLBDf/1yDnqBOx+uOWm7JJAJBxya8I3Gr3O+9c
|
|
30
|
-
SpIuuBZK8OTHU19pmTRbAttFxA58VOl4nN7jTLsGVp1iAGuTjAgM+Rm9M+ilhm16
|
|
31
|
-
V9Tu1Rv0r3q1SbwcFs5Ov9tCQhcOU0b6P1zRGsFaomuBJzESpmHnLEV2f2xZpi9t
|
|
32
|
-
bcQoUtdzig9W2OnBj5HJKKYVdwMmoCssP6xRzmkRjkN/KIfdMPcLtdLnAqRAhC5B
|
|
33
|
-
cdaaYq7fYgy3/MUmk0p9HF03Qk2//aMWPmFesEwgpaU+WUl0Hc8Y2RpkyS3SRjQz
|
|
34
|
-
lwP83tAU/6GI4J8cFi+Pp0HfIPS/3PowLg==
|
|
35
|
-
-----END CERTIFICATE-----`;
|
|
36
|
-
/** `notAfter` 2020-02-01 — already in the past, and permanently so. The E7 fixture. */
|
|
37
|
-
export const EXPIRED_CERTIFICATE_PEM = `-----BEGIN CERTIFICATE-----
|
|
38
|
-
MIIDGTCCAgGgAwIBAgIUbiRDk/GIFk+ZblQI5xF5KVsplAEwDQYJKoZIhvcNAQEL
|
|
39
|
-
BQAwHDEaMBgGA1UEAwwRd2lsZG8tc29yLWV4cGlyZWQwHhcNMjAwMTAxMDAwMDAw
|
|
40
|
-
WhcNMjAwMjAxMDAwMDAwWjAcMRowGAYDVQQDDBF3aWxkby1zb3ItZXhwaXJlZDCC
|
|
41
|
-
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMP3wfQXT4DNyYVPaOmNtHkQ
|
|
42
|
-
XgGXC31rCoUnk7Q6ZL7wuXpg/eoHQEDpNuZ955aPxjg0Q8lsydohmxbi9SwrR88f
|
|
43
|
-
E25HIIKNxoxoNi67nlrAe0YV0ngNKEDPWORlwvOE+Aw52F4JOgJn35E2SkjAZcqM
|
|
44
|
-
X3WoIK/K3YdfaMrgR3yMzE9t/G10Kxy1SIG6Kn1MhPJNyxslVkAIyZhnqWUxBdjG
|
|
45
|
-
KQTwjZfE30UJwh4zK3mRY+22l2/O7WLAdD0LawmvmDQXxuc/Jc3bzF2Ipm5REAnT
|
|
46
|
-
Acic8uwcAuHfVqe1E9OUnURRSQdTNoP20nfO0rLrFYTjWpXmZOOQGNJkzDheV2EC
|
|
47
|
-
AwEAAaNTMFEwHQYDVR0OBBYEFI1Zu+OGcOq8kGX7/2qn0jQT5CvhMB8GA1UdIwQY
|
|
48
|
-
MBaAFI1Zu+OGcOq8kGX7/2qn0jQT5CvhMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI
|
|
49
|
-
hvcNAQELBQADggEBAJhjUFH17YnhMilq5oKeXp/87U85M8YvzmoV5pJ1Qs+Co+oO
|
|
50
|
-
tCqR790W0j7HccS8YM927omZ4Gggt1VnsGK9N6NdSGNNAu1WQS6AD4d7wQ8UDhon
|
|
51
|
-
TlcstIdzxjJZE59a08saaH84ymKtc2didVeHEwvtYtWbpmVy3FWP4YGHqIiXASIR
|
|
52
|
-
Js5PifpiMqHVPfNT2/Wc16J1hIa1Cd6XqJdnoyhKV067So2uqQmJ/4Ea5di+/PxM
|
|
53
|
-
0pB1AaNX0tvEWvlw5FBXucSw4sJ/J4QExSn4BFCMYqsJktoiPd4ehepcvFBW0e1r
|
|
54
|
-
F1ZmEj1+AMgAIfpenIKizDbWMXJkkukfeDr32hA=
|
|
55
|
-
-----END CERTIFICATE-----`;
|
|
56
|
-
//# sourceMappingURL=certificate-fixtures.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"certificate-fixtures.js","sourceRoot":"","sources":["../../../../../../src/systems-of-record/credentials/__tests__/certificate-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;0BAkBX,CAAC;AAE3B,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;0BAkBb,CAAC","sourcesContent":["/**\n * Fixed X.509 fixtures for the credential pins (#1056).\n *\n * Self-signed, generated once, and checked in rather than minted per run: Node cannot mint a\n * certificate, and a fixture produced by shelling out to `openssl` would make these tests depend on a\n * binary the repository does not otherwise require.\n *\n * Both are PUBLIC material — a certificate is the half you publish — so nothing here is a secret. The\n * private keys they were generated with were discarded to `/dev/null` and no signature is ever made\n * with them: the valid one is used for its BYTES (the `x5t` thumbprint) and its validity window, the\n * expired one for its window alone.\n */\n\n/**\n * `notAfter` in 2126. Long-lived deliberately: a fixture that expires turns a passing suite red on a\n * date nobody chose, which is the failure mode this file's own subject is about.\n */\nexport const VALID_CERTIFICATE_PEM = `-----BEGIN CERTIFICATE-----\nMIIDFTCCAf2gAwIBAgIUGJ5PE1NHgDMro6tyd/sxqF/L9lgwDQYJKoZIhvcNAQEL\nBQAwGTEXMBUGA1UEAwwOd2lsZG8tc29yLXRlc3QwIBcNMjYwOTE3MTkyNDUwWhgP\nMjEyNjA4MjQxOTI0NTBaMBkxFzAVBgNVBAMMDndpbGRvLXNvci10ZXN0MIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAocaBdD7ZeyY/JNsjBs6Lq1do7BYN\ngfH1HtQh6MBsN3vVdrqg8XgF65kYyXbQx+qCPOoxKazw9iQ9ko26vqDJwBk/TBT8\nAP6NwGIvbWGutQb6PXveeo6uvuD8rL4Mm044UH9Rj3lFmIXfcVFrXEx2TXt2Q+s9\n4xFvaRyjVSXioaHOpLOujN2vIvTAijXwPpbrN/LFGdukyLMkSRX7Ttf56Km4uwta\nINQyJt9qWO7NcmjjgogK2PrPmc4PuqFRimyEQBzi3QiNW01uAniR4DUEmcFJuPO6\nZ/ykWTmSP6yrMgurnCkB0eLub1fD59D4FgsGTJl+kbxVoFzrVTusqg7EgQIDAQAB\no1MwUTAdBgNVHQ4EFgQUCH+FpIKDm+79TGPw+JdQOrXiZOswHwYDVR0jBBgwFoAU\nCH+FpIKDm+79TGPw+JdQOrXiZOswDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B\nAQsFAAOCAQEALX1Ev86gubCsesJLBDf/1yDnqBOx+uOWm7JJAJBxya8I3Gr3O+9c\nSpIuuBZK8OTHU19pmTRbAttFxA58VOl4nN7jTLsGVp1iAGuTjAgM+Rm9M+ilhm16\nV9Tu1Rv0r3q1SbwcFs5Ov9tCQhcOU0b6P1zRGsFaomuBJzESpmHnLEV2f2xZpi9t\nbcQoUtdzig9W2OnBj5HJKKYVdwMmoCssP6xRzmkRjkN/KIfdMPcLtdLnAqRAhC5B\ncdaaYq7fYgy3/MUmk0p9HF03Qk2//aMWPmFesEwgpaU+WUl0Hc8Y2RpkyS3SRjQz\nlwP83tAU/6GI4J8cFi+Pp0HfIPS/3PowLg==\n-----END CERTIFICATE-----`;\n\n/** `notAfter` 2020-02-01 — already in the past, and permanently so. The E7 fixture. */\nexport const EXPIRED_CERTIFICATE_PEM = `-----BEGIN CERTIFICATE-----\nMIIDGTCCAgGgAwIBAgIUbiRDk/GIFk+ZblQI5xF5KVsplAEwDQYJKoZIhvcNAQEL\nBQAwHDEaMBgGA1UEAwwRd2lsZG8tc29yLWV4cGlyZWQwHhcNMjAwMTAxMDAwMDAw\nWhcNMjAwMjAxMDAwMDAwWjAcMRowGAYDVQQDDBF3aWxkby1zb3ItZXhwaXJlZDCC\nASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMP3wfQXT4DNyYVPaOmNtHkQ\nXgGXC31rCoUnk7Q6ZL7wuXpg/eoHQEDpNuZ955aPxjg0Q8lsydohmxbi9SwrR88f\nE25HIIKNxoxoNi67nlrAe0YV0ngNKEDPWORlwvOE+Aw52F4JOgJn35E2SkjAZcqM\nX3WoIK/K3YdfaMrgR3yMzE9t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