@estifanos-sh/convex-auth 0.0.1-preview.0
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/README.md +52 -0
- package/dist/_generated/component.d.ts +2981 -0
- package/dist/bin.js +7194 -0
- package/dist/browser/index.d.ts +22 -0
- package/dist/browser/index.js +61 -0
- package/dist/browser/locks.js +20 -0
- package/dist/browser/navigation.js +14 -0
- package/dist/browser/runtime.js +90 -0
- package/dist/browser/webauthn.js +99 -0
- package/dist/client/core/types.d.ts +615 -0
- package/dist/client/core/types.js +23 -0
- package/dist/client/errors.js +30 -0
- package/dist/client/factors/device.js +100 -0
- package/dist/client/factors/totp.js +111 -0
- package/dist/client/factors/webauthn.js +69 -0
- package/dist/client/index.d.ts +60 -0
- package/dist/client/index.js +976 -0
- package/dist/client/runtime/invite.js +50 -0
- package/dist/client/runtime/mutex.js +25 -0
- package/dist/client/runtime/proxy.js +75 -0
- package/dist/client/runtime/storage.js +65 -0
- package/dist/component/_generated/api.js +26 -0
- package/dist/component/_generated/component.d.ts +2981 -0
- package/dist/component/_generated/component.js +1 -0
- package/dist/component/_generated/dataModel.js +1 -0
- package/dist/component/_generated/server.js +74 -0
- package/dist/component/account.js +197 -0
- package/dist/component/connection/audit.js +152 -0
- package/dist/component/connection/cache.js +205 -0
- package/dist/component/connection/domain/verification.js +63 -0
- package/dist/component/connection/domain.js +108 -0
- package/dist/component/connection/saml/assertion.js +41 -0
- package/dist/component/connection/saml/request.js +61 -0
- package/dist/component/connection/scim/config.js +55 -0
- package/dist/component/connection/scim/identity.js +162 -0
- package/dist/component/connection/secret.js +65 -0
- package/dist/component/connection/webhook/delivery.js +396 -0
- package/dist/component/connection/webhook/endpoint.js +77 -0
- package/dist/component/connection.js +204 -0
- package/dist/component/convex.config.d.ts +7 -0
- package/dist/component/convex.config.js +15 -0
- package/dist/component/crons.js +27 -0
- package/dist/component/event.js +341 -0
- package/dist/component/factor/device.js +141 -0
- package/dist/component/factor/passkey.js +385 -0
- package/dist/component/factor/totp.js +253 -0
- package/dist/component/functions.js +3 -0
- package/dist/component/group/active.js +63 -0
- package/dist/component/group/invite.js +300 -0
- package/dist/component/group/member.js +188 -0
- package/dist/component/group.js +431 -0
- package/dist/component/http.js +9 -0
- package/dist/component/index.d.ts +5 -0
- package/dist/component/index.js +3 -0
- package/dist/component/limits.js +103 -0
- package/dist/component/maintenance.js +205 -0
- package/dist/component/migrations.js +277 -0
- package/dist/component/model.d.ts +384 -0
- package/dist/component/model.js +709 -0
- package/dist/component/modules.js +53 -0
- package/dist/component/oauth/client.js +196 -0
- package/dist/component/oauth/code.js +97 -0
- package/dist/component/oauth/refresh.js +230 -0
- package/dist/component/schema.d.ts +1530 -0
- package/dist/component/schema.js +401 -0
- package/dist/component/session.js +134 -0
- package/dist/component/token/pkce.js +121 -0
- package/dist/component/token/refresh.js +189 -0
- package/dist/component/token/verification.js +155 -0
- package/dist/component/user/email.js +147 -0
- package/dist/component/user/key.js +273 -0
- package/dist/component/user.js +173 -0
- package/dist/core/index.d.ts +531 -0
- package/dist/core/index.js +81 -0
- package/dist/expo/index.d.ts +43 -0
- package/dist/expo/index.js +131 -0
- package/dist/expo/webauthn.js +88 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/NoopLogger.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/api/logs.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/index.d.ts +7 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/AnyValue.d.ts +21 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/LogRecord.d.ts +36 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/Logger.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/LoggerOptions.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/LoggerProvider.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/baggage/utils.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/attributes.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/global-error-handler.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/logging-error-handler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/time.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/types.d.ts +16 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/index.d.ts +13 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/propagation/composite.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/TraceState.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/W3CTraceContextPropagator.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/rpc-metadata.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/suppress-tracing.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/utils/configuration.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/LogRecordProcessor.d.ts +24 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/LoggerProvider.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/config/LoggerConfigurators.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/BatchLogRecordProcessorBase.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/ConsoleLogRecordExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/InMemoryLogRecordExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/LogRecordExporter.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/ReadableLogRecord.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/SdkLogRecord.d.ts +71 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/SimpleLogRecordProcessor.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/index.d.ts +11 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/platform/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/platform/node/export/BatchLogRecordProcessor.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/platform/node/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/types.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/InstrumentDescriptor.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/MeterProvider.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Drop.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/index.d.ts +6 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/types.d.ts +53 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationSelector.d.ts +16 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationTemporality.d.ts +11 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/CardinalitySelector.d.ts +10 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/ConsoleMetricExporter.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/InMemoryMetricExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricData.d.ts +148 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricProducer.d.ts +27 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.d.ts +138 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/index.d.ts +15 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/types.d.ts +10 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/utils.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/AggregationOption.d.ts +41 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/AttributesProcessor.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/InstrumentSelector.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/View.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/BasicTracerProvider.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/IdGenerator.d.ts +11 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/Sampler.d.ts +74 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/Span.d.ts +17 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/SpanProcessor.d.ts +43 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/TimedEvent.d.ts +19 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/BatchSpanProcessorBase.d.ts +6 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/ConsoleSpanExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/InMemorySpanExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/NoopSpanProcessor.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/ReadableSpan.d.ts +29 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/SimpleSpanProcessor.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/SpanExporter.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/index.d.ts +18 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/platform/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/platform/node/export/BatchSpanProcessor.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/platform/node/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/AlwaysOffSampler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/AlwaysOnSampler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/ParentBasedSampler.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/TraceIdRatioBasedSampler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/types.d.ts +66 -0
- package/dist/otel.d.ts +73 -0
- package/dist/otel.js +82 -0
- package/dist/permissions/index.d.ts +81 -0
- package/dist/permissions/index.js +18 -0
- package/dist/providers/anonymous.d.ts +35 -0
- package/dist/providers/anonymous.js +40 -0
- package/dist/providers/apple.d.ts +61 -0
- package/dist/providers/apple.js +57 -0
- package/dist/providers/connection.d.ts +30 -0
- package/dist/providers/connection.js +33 -0
- package/dist/providers/credentials.d.ts +78 -0
- package/dist/providers/credentials.js +31 -0
- package/dist/providers/custom.d.ts +96 -0
- package/dist/providers/custom.js +108 -0
- package/dist/providers/device.d.ts +33 -0
- package/dist/providers/device.js +30 -0
- package/dist/providers/email.d.ts +45 -0
- package/dist/providers/email.js +52 -0
- package/dist/providers/github.d.ts +56 -0
- package/dist/providers/github.js +79 -0
- package/dist/providers/google.d.ts +56 -0
- package/dist/providers/google.js +59 -0
- package/dist/providers/index.d.ts +16 -0
- package/dist/providers/index.js +16 -0
- package/dist/providers/microsoft.d.ts +59 -0
- package/dist/providers/microsoft.js +98 -0
- package/dist/providers/password.d.ts +68 -0
- package/dist/providers/password.js +348 -0
- package/dist/providers/phone.d.ts +33 -0
- package/dist/providers/phone.js +35 -0
- package/dist/providers/redirect.d.ts +1 -0
- package/dist/providers/redirect.js +11 -0
- package/dist/providers/totp.d.ts +29 -0
- package/dist/providers/totp.js +29 -0
- package/dist/providers/webauthn/attestation.d.ts +42 -0
- package/dist/providers/webauthn/attestation.js +167 -0
- package/dist/providers/webauthn.d.ts +83 -0
- package/dist/providers/webauthn.js +57 -0
- package/dist/react/index.d.ts +55 -0
- package/dist/react/index.js +80 -0
- package/dist/server/auth.d.ts +443 -0
- package/dist/server/auth.js +178 -0
- package/dist/server/cache/context.js +94 -0
- package/dist/server/component/api.d.ts +14 -0
- package/dist/server/component/api.js +13 -0
- package/dist/server/component/context.d.ts +16 -0
- package/dist/server/component/context.js +1 -0
- package/dist/server/component/factor/db.js +71 -0
- package/dist/server/config.d.ts +3 -0
- package/dist/server/config.js +78 -0
- package/dist/server/connection/config.js +101 -0
- package/dist/server/connection/domain.d.ts +878 -0
- package/dist/server/connection/domain.js +1122 -0
- package/dist/server/connection/group/service.d.ts +25 -0
- package/dist/server/connection/group/service.js +250 -0
- package/dist/server/connection/http.js +1485 -0
- package/dist/server/connection/oidc.js +366 -0
- package/dist/server/connection/policy/domain.js +59 -0
- package/dist/server/connection/policy.d.ts +1 -0
- package/dist/server/connection/policy.js +163 -0
- package/dist/server/connection/profile.js +22 -0
- package/dist/server/connection/provision.js +182 -0
- package/dist/server/connection/saml/api.js +70 -0
- package/dist/server/connection/saml/binding/post.js +140 -0
- package/dist/server/connection/saml/binding/redirect.js +139 -0
- package/dist/server/connection/saml/binding/shared.js +18 -0
- package/dist/server/connection/saml/c14n.js +224 -0
- package/dist/server/connection/saml/constants.js +100 -0
- package/dist/server/connection/saml/crypto.js +170 -0
- package/dist/server/connection/saml/dom/select.js +299 -0
- package/dist/server/connection/saml/encoding.js +93 -0
- package/dist/server/connection/saml/encryption.js +34 -0
- package/dist/server/connection/saml/entity.js +24 -0
- package/dist/server/connection/saml/extractor.js +408 -0
- package/dist/server/connection/saml/flow.js +150 -0
- package/dist/server/connection/saml/identity/provider.js +66 -0
- package/dist/server/connection/saml/index.js +5 -0
- package/dist/server/connection/saml/metadata.js +294 -0
- package/dist/server/connection/saml/service/provider.js +117 -0
- package/dist/server/connection/saml/signature.js +214 -0
- package/dist/server/connection/saml/template.js +68 -0
- package/dist/server/connection/saml/types.js +1 -0
- package/dist/server/connection/saml/validator.js +32 -0
- package/dist/server/connection/saml/xml/builder.js +68 -0
- package/dist/server/connection/saml/xmldsig.js +598 -0
- package/dist/server/connection/saml/xmlenc.js +162 -0
- package/dist/server/connection/saml.d.ts +56 -0
- package/dist/server/connection/saml.js +762 -0
- package/dist/server/connection/scim.js +115 -0
- package/dist/server/connection/shared.js +74 -0
- package/dist/server/connection/webhook.js +163 -0
- package/dist/server/context.d.ts +137 -0
- package/dist/server/context.js +108 -0
- package/dist/server/contract.d.ts +48 -0
- package/dist/server/contract.js +107 -0
- package/dist/server/cookies.js +90 -0
- package/dist/server/core.js +163 -0
- package/dist/server/cors.d.ts +22 -0
- package/dist/server/cors.js +93 -0
- package/dist/server/crypto.js +43 -0
- package/dist/server/db.js +88 -0
- package/dist/server/device.js +140 -0
- package/dist/server/domains/access.js +29 -0
- package/dist/server/domains/account.d.ts +16 -0
- package/dist/server/domains/account.js +92 -0
- package/dist/server/domains/factor.d.ts +28 -0
- package/dist/server/domains/factor.js +115 -0
- package/dist/server/domains/group.js +87 -0
- package/dist/server/domains/invite.js +76 -0
- package/dist/server/domains/key.js +253 -0
- package/dist/server/domains/member.js +149 -0
- package/dist/server/domains/session.js +29 -0
- package/dist/server/domains/user.js +119 -0
- package/dist/server/env.d.ts +46 -0
- package/dist/server/env.js +96 -0
- package/dist/server/errors.js +38 -0
- package/dist/server/events.d.ts +880 -0
- package/dist/server/events.js +406 -0
- package/dist/server/facade.d.ts +83 -0
- package/dist/server/facade.js +124 -0
- package/dist/server/http.d.ts +125 -0
- package/dist/server/http.js +566 -0
- package/dist/server/identity/claims.js +58 -0
- package/dist/server/identity/convex.d.ts +15 -0
- package/dist/server/identity/convex.js +1 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.js +11 -0
- package/dist/server/keys.js +60 -0
- package/dist/server/limits.js +41 -0
- package/dist/server/log.js +28 -0
- package/dist/server/mcp.d.ts +19 -0
- package/dist/server/mcp.js +250 -0
- package/dist/server/mutations/account.js +47 -0
- package/dist/server/mutations/calls.js +16 -0
- package/dist/server/mutations/code.js +91 -0
- package/dist/server/mutations/credentials/signin.js +210 -0
- package/dist/server/mutations/invalidate.js +60 -0
- package/dist/server/mutations/oauth.js +251 -0
- package/dist/server/mutations/refresh.js +152 -0
- package/dist/server/mutations/register.js +93 -0
- package/dist/server/mutations/retrieve.js +66 -0
- package/dist/server/mutations/signature.js +36 -0
- package/dist/server/mutations/signin.js +81 -0
- package/dist/server/mutations/signout.js +61 -0
- package/dist/server/mutations/store/refs.js +15 -0
- package/dist/server/mutations/store.js +82 -0
- package/dist/server/mutations/verifier.js +25 -0
- package/dist/server/mutations/verify.js +199 -0
- package/dist/server/oauth/authorize.js +98 -0
- package/dist/server/oauth/client.d.ts +93 -0
- package/dist/server/oauth/client.js +115 -0
- package/dist/server/oauth/code.d.ts +63 -0
- package/dist/server/oauth/code.js +124 -0
- package/dist/server/oauth/domain.d.ts +23 -0
- package/dist/server/oauth/domain.js +1 -0
- package/dist/server/oauth/factory.js +46 -0
- package/dist/server/oauth/grant.js +46 -0
- package/dist/server/oauth/handlers.js +108 -0
- package/dist/server/oauth/manage.js +121 -0
- package/dist/server/oauth/normalize.js +27 -0
- package/dist/server/oauth/refresh.d.ts +71 -0
- package/dist/server/oauth/refresh.js +132 -0
- package/dist/server/oauth/register.js +147 -0
- package/dist/server/oauth/runtime.js +280 -0
- package/dist/server/oauth/token.js +355 -0
- package/dist/server/payloads.d.ts +16 -0
- package/dist/server/payloads.js +30 -0
- package/dist/server/preload.d.ts +249 -0
- package/dist/server/preload.js +673 -0
- package/dist/server/random.js +25 -0
- package/dist/server/redirects.js +85 -0
- package/dist/server/runtime.d.ts +845 -0
- package/dist/server/runtime.js +387 -0
- package/dist/server/secret.js +46 -0
- package/dist/server/services/factors.js +117 -0
- package/dist/server/services/providers.js +23 -0
- package/dist/server/services/resolve.js +17 -0
- package/dist/server/session/lifecycle.d.ts +23 -0
- package/dist/server/session/lifecycle.js +139 -0
- package/dist/server/signin/flow.js +359 -0
- package/dist/server/telemetry.js +68 -0
- package/dist/server/templates.js +91 -0
- package/dist/server/token/refresh.js +35 -0
- package/dist/server/tokens.js +164 -0
- package/dist/server/totp.js +282 -0
- package/dist/server/types.d.ts +1154 -0
- package/dist/server/types.js +1 -0
- package/dist/server/url.js +43 -0
- package/dist/server/user/account.js +325 -0
- package/dist/server/utils/bearer.js +24 -0
- package/dist/server/utils/cache.js +51 -0
- package/dist/server/utils/retry.js +3 -0
- package/dist/server/utils/span.js +59 -0
- package/dist/server/validators.d.ts +2061 -0
- package/dist/server/validators.js +320 -0
- package/dist/server/webauthn.js +699 -0
- package/dist/server/wellknown.d.ts +74 -0
- package/dist/server/wellknown.js +195 -0
- package/dist/shared/brand.d.ts +28 -0
- package/dist/shared/brand.js +13 -0
- package/dist/shared/codes.d.ts +99 -0
- package/dist/shared/codes.js +98 -0
- package/dist/shared/compare.js +23 -0
- package/dist/shared/errors.js +24 -0
- package/dist/shared/event/kinds.d.ts +188 -0
- package/dist/shared/event/kinds.js +103 -0
- package/dist/shared/fetch/guard.js +189 -0
- package/dist/shared/log.js +62 -0
- package/dist/shared/results.d.ts +58 -0
- package/dist/shared/retry.js +27 -0
- package/dist/shared/webauthn.js +9 -0
- package/dist/svelte/AuthLoading.svelte +13 -0
- package/dist/svelte/AuthLoading.svelte.d.ts +8 -0
- package/dist/svelte/SignedIn.svelte +14 -0
- package/dist/svelte/SignedIn.svelte.d.ts +8 -0
- package/dist/svelte/SignedOut.svelte +13 -0
- package/dist/svelte/SignedOut.svelte.d.ts +8 -0
- package/dist/svelte/context.svelte.d.ts +26 -0
- package/dist/svelte/context.svelte.js +61 -0
- package/dist/svelte/index.d.ts +5 -0
- package/dist/svelte/index.js +4 -0
- package/dist/test.d.ts +48 -0
- package/dist/test.js +54 -0
- package/package.json +247 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { vGroupConnectionDomainVerificationDoc } from "../../model.js";
|
|
2
|
+
import { mutation, query } from "../../_generated/server.js";
|
|
3
|
+
import { v } from "convex/values";
|
|
4
|
+
|
|
5
|
+
//#region src/component/connection/domain/verification.ts
|
|
6
|
+
/**
|
|
7
|
+
* `component.connection.domain.verification.*` — domain
|
|
8
|
+
* ownership-proof records (sub-resource of connection.domain).
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** Read a domain's verification record by `domainId`, or `null` if none. */
|
|
13
|
+
const get = query({
|
|
14
|
+
args: { domainId: v.id("GroupConnectionDomain") },
|
|
15
|
+
returns: v.union(vGroupConnectionDomainVerificationDoc, v.null()),
|
|
16
|
+
handler: async (ctx, { domainId }) => {
|
|
17
|
+
return await ctx.db.query("GroupConnectionDomainVerification").withIndex("domain_id", (idx) => idx.eq("domainId", domainId)).first();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
/** Insert a verification record, or patch it when one already exists for the domain (keyed by `domainId`). */
|
|
21
|
+
const upsert = mutation({
|
|
22
|
+
args: {
|
|
23
|
+
connectionId: v.id("GroupConnection"),
|
|
24
|
+
groupId: v.id("Group"),
|
|
25
|
+
domainId: v.id("GroupConnectionDomain"),
|
|
26
|
+
domain: v.string(),
|
|
27
|
+
recordName: v.string(),
|
|
28
|
+
token: v.string(),
|
|
29
|
+
tokenHash: v.string(),
|
|
30
|
+
requestedAt: v.number(),
|
|
31
|
+
expiresAt: v.number()
|
|
32
|
+
},
|
|
33
|
+
returns: v.id("GroupConnectionDomainVerification"),
|
|
34
|
+
handler: async (ctx, args) => {
|
|
35
|
+
const { connectionId, ...rest } = args;
|
|
36
|
+
const existing = await ctx.db.query("GroupConnectionDomainVerification").withIndex("domain_id", (idx) => idx.eq("domainId", args.domainId)).first();
|
|
37
|
+
if (existing) {
|
|
38
|
+
await ctx.db.patch("GroupConnectionDomainVerification", existing._id, {
|
|
39
|
+
connectionId,
|
|
40
|
+
...rest
|
|
41
|
+
});
|
|
42
|
+
return existing._id;
|
|
43
|
+
}
|
|
44
|
+
return await ctx.db.insert("GroupConnectionDomainVerification", {
|
|
45
|
+
connectionId,
|
|
46
|
+
...rest
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
/** Delete a domain's verification record, if any. */
|
|
51
|
+
const remove = mutation({
|
|
52
|
+
args: { domainId: v.id("GroupConnectionDomain") },
|
|
53
|
+
returns: v.null(),
|
|
54
|
+
handler: async (ctx, { domainId }) => {
|
|
55
|
+
const existing = await ctx.db.query("GroupConnectionDomainVerification").withIndex("domain_id", (idx) => idx.eq("domainId", domainId)).first();
|
|
56
|
+
if (existing) await ctx.db.delete("GroupConnectionDomainVerification", existing._id);
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { get, remove, upsert };
|
|
63
|
+
//# sourceMappingURL=verification.js.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ErrorCode } from "../../shared/codes.js";
|
|
2
|
+
import { vGroupConnectionDomainDoc } from "../model.js";
|
|
3
|
+
import { mutation, query } from "../_generated/server.js";
|
|
4
|
+
import { ConvexError, v } from "convex/values";
|
|
5
|
+
|
|
6
|
+
//#region src/component/connection/domain.ts
|
|
7
|
+
/**
|
|
8
|
+
* `component.connection.domain.*` — domains linked to an Connection
|
|
9
|
+
* connection (sub-resource of connection).
|
|
10
|
+
*
|
|
11
|
+
* `verify` is a kept domain verb (ownership-proof
|
|
12
|
+
* workflow); ownership-record CRUD nests under `domain.verification`.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
const CONNECTION_DOMAIN_BATCH = 500;
|
|
17
|
+
/** List the domains attached to a connection (`limit` clamped to 1..500, default 100). */
|
|
18
|
+
const list = query({
|
|
19
|
+
args: {
|
|
20
|
+
connectionId: v.id("GroupConnection"),
|
|
21
|
+
limit: v.optional(v.number())
|
|
22
|
+
},
|
|
23
|
+
returns: v.array(vGroupConnectionDomainDoc),
|
|
24
|
+
handler: async (ctx, { connectionId, limit }) => {
|
|
25
|
+
const bounded = Math.min(Math.max(limit ?? 100, 1), 500);
|
|
26
|
+
return await ctx.db.query("GroupConnectionDomain").withIndex("connection_id", (idx) => idx.eq("connectionId", connectionId)).take(bounded);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Attach a domain to a connection. Idempotent on `(connectionId, domain)`:
|
|
31
|
+
* re-attaching patches the existing row instead of inserting. Throws if the
|
|
32
|
+
* domain already belongs to a different connection. Setting `isPrimary` demotes
|
|
33
|
+
* any current primary; the first domain on a connection becomes primary by default.
|
|
34
|
+
*/
|
|
35
|
+
const create = mutation({
|
|
36
|
+
args: {
|
|
37
|
+
connectionId: v.id("GroupConnection"),
|
|
38
|
+
groupId: v.id("Group"),
|
|
39
|
+
domain: v.string(),
|
|
40
|
+
isPrimary: v.optional(v.boolean())
|
|
41
|
+
},
|
|
42
|
+
returns: v.id("GroupConnectionDomain"),
|
|
43
|
+
handler: async (ctx, args) => {
|
|
44
|
+
const { connectionId, ...rest } = args;
|
|
45
|
+
const existingByDomain = await ctx.db.query("GroupConnectionDomain").withIndex("domain", (idx) => idx.eq("domain", args.domain)).first();
|
|
46
|
+
if (existingByDomain && existingByDomain.connectionId !== connectionId) throw new ConvexError({
|
|
47
|
+
code: ErrorCode.GROUP_CONNECTION_DOMAIN_TAKEN,
|
|
48
|
+
message: "That domain is already attached to another connection."
|
|
49
|
+
});
|
|
50
|
+
const existingForConnection = await ctx.db.query("GroupConnectionDomain").withIndex("connection_id", (q) => q.eq("connectionId", connectionId)).take(CONNECTION_DOMAIN_BATCH + 1);
|
|
51
|
+
if (existingForConnection.length > CONNECTION_DOMAIN_BATCH) throw new ConvexError({
|
|
52
|
+
code: ErrorCode.CASCADE_TOO_LARGE,
|
|
53
|
+
message: `Connection has more than ${CONNECTION_DOMAIN_BATCH} domains; update is not safe in one mutation.`
|
|
54
|
+
});
|
|
55
|
+
for (const row of existingForConnection) if (row.domain === args.domain) {
|
|
56
|
+
if (args.isPrimary === true) {
|
|
57
|
+
for (const other of existingForConnection) if (other._id !== row._id && other.isPrimary) await ctx.db.patch("GroupConnectionDomain", other._id, { isPrimary: false });
|
|
58
|
+
}
|
|
59
|
+
await ctx.db.patch("GroupConnectionDomain", row._id, { isPrimary: args.isPrimary ?? row.isPrimary });
|
|
60
|
+
return row._id;
|
|
61
|
+
}
|
|
62
|
+
if (args.isPrimary === true) {
|
|
63
|
+
for (const row of existingForConnection) if (row.isPrimary) await ctx.db.patch("GroupConnectionDomain", row._id, { isPrimary: false });
|
|
64
|
+
}
|
|
65
|
+
return await ctx.db.insert("GroupConnectionDomain", {
|
|
66
|
+
connectionId,
|
|
67
|
+
...rest,
|
|
68
|
+
isPrimary: args.isPrimary ?? existingForConnection.length === 0
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
/** Delete a domain and its dependent verification record, if any. */
|
|
73
|
+
const remove = mutation({
|
|
74
|
+
args: { id: v.id("GroupConnectionDomain") },
|
|
75
|
+
returns: v.null(),
|
|
76
|
+
handler: async (ctx, { id: domainId }) => {
|
|
77
|
+
const verification = await ctx.db.query("GroupConnectionDomainVerification").withIndex("domain_id", (idx) => idx.eq("domainId", domainId)).first();
|
|
78
|
+
if (verification) await ctx.db.delete("GroupConnectionDomainVerification", verification._id);
|
|
79
|
+
await ctx.db.delete("GroupConnectionDomain", domainId);
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Mark a domain verified at `verifiedAt` and clear its pending verification
|
|
85
|
+
* record. Returns the updated domain doc.
|
|
86
|
+
*/
|
|
87
|
+
const verify = mutation({
|
|
88
|
+
args: {
|
|
89
|
+
id: v.id("GroupConnectionDomain"),
|
|
90
|
+
verifiedAt: v.number()
|
|
91
|
+
},
|
|
92
|
+
returns: vGroupConnectionDomainDoc,
|
|
93
|
+
handler: async (ctx, { id: domainId, verifiedAt }) => {
|
|
94
|
+
await ctx.db.patch("GroupConnectionDomain", domainId, { verifiedAt });
|
|
95
|
+
const domain = await ctx.db.get("GroupConnectionDomain", domainId);
|
|
96
|
+
if (!domain) throw new ConvexError({
|
|
97
|
+
code: ErrorCode.INVALID_PARAMETERS,
|
|
98
|
+
message: "Group Connection domain not found."
|
|
99
|
+
});
|
|
100
|
+
const verification = await ctx.db.query("GroupConnectionDomainVerification").withIndex("domain_id", (idx) => idx.eq("domainId", domainId)).first();
|
|
101
|
+
if (verification) await ctx.db.delete("GroupConnectionDomainVerification", verification._id);
|
|
102
|
+
return domain;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
export { create, list, remove, verify };
|
|
108
|
+
//# sourceMappingURL=domain.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { mutation } from "../../_generated/server.js";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
|
|
4
|
+
//#region src/component/connection/saml/assertion.ts
|
|
5
|
+
/**
|
|
6
|
+
* `component.connection.saml.assertion.*` — bounded replay cache of SAML
|
|
7
|
+
* assertion IDs already accepted (sub-resource of connection).
|
|
8
|
+
*
|
|
9
|
+
* `accept` is an atomic insert-or-reject gate: it catches IdP-initiated
|
|
10
|
+
* responses that carry no `InResponseTo` by rejecting an assertion ID that was
|
|
11
|
+
* already seen for the connection. Rows are bounded by the assertion's
|
|
12
|
+
* `NotOnOrAfter` and pruned by `expiresAt`.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Atomically accept a SAML assertion ID for a connection. Returns `true` on
|
|
18
|
+
* first sighting (the row is inserted); returns `false` if the assertion ID was
|
|
19
|
+
* already recorded, signalling a replay the caller must reject.
|
|
20
|
+
*/
|
|
21
|
+
const accept = mutation({
|
|
22
|
+
args: {
|
|
23
|
+
connectionId: v.id("GroupConnection"),
|
|
24
|
+
assertionId: v.string(),
|
|
25
|
+
expiresAt: v.number()
|
|
26
|
+
},
|
|
27
|
+
returns: v.boolean(),
|
|
28
|
+
handler: async (ctx, { connectionId, assertionId, expiresAt }) => {
|
|
29
|
+
if (await ctx.db.query("SamlSeenAssertion").withIndex("connection_id_assertion_id", (idx) => idx.eq("connectionId", connectionId).eq("assertionId", assertionId)).first() !== null) return false;
|
|
30
|
+
await ctx.db.insert("SamlSeenAssertion", {
|
|
31
|
+
connectionId,
|
|
32
|
+
assertionId,
|
|
33
|
+
expiresAt
|
|
34
|
+
});
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { accept };
|
|
41
|
+
//# sourceMappingURL=assertion.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { mutation } from "../../_generated/server.js";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
|
|
4
|
+
//#region src/component/connection/saml/request.ts
|
|
5
|
+
/**
|
|
6
|
+
* `component.connection.saml.request.*` — pending SAML AuthnRequest IDs
|
|
7
|
+
* (sub-resource of connection) enabling server-side replay prevention.
|
|
8
|
+
*
|
|
9
|
+
* A row is persisted when the SP generates a sign-in request and accepted
|
|
10
|
+
* single-use at the ACS handler. Because `accept` is one atomic
|
|
11
|
+
* read-check-write mutation, a captured SAMLResponse/RelayState pair cannot be
|
|
12
|
+
* replayed - the second accept fails.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
/** Persist a pending SAML AuthnRequest ID so the ACS handler can accept it once. */
|
|
17
|
+
const create = mutation({
|
|
18
|
+
args: {
|
|
19
|
+
connectionId: v.id("GroupConnection"),
|
|
20
|
+
requestId: v.string(),
|
|
21
|
+
createdAt: v.number(),
|
|
22
|
+
expiresAt: v.number()
|
|
23
|
+
},
|
|
24
|
+
returns: v.id("SamlLoginRequest"),
|
|
25
|
+
handler: async (ctx, args) => {
|
|
26
|
+
return await ctx.db.insert("SamlLoginRequest", args);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Atomically accept a pending SAML AuthnRequest by its `requestId`. Returns
|
|
31
|
+
* `true` only when a matching, unaccepted, unexpired row existed and was
|
|
32
|
+
* stamped `acceptedAt`; a replayed, expired, or unknown request returns
|
|
33
|
+
* `false`.
|
|
34
|
+
*
|
|
35
|
+
* When `connectionId` is supplied, the pending request must also belong to that
|
|
36
|
+
* connection. This is defense-in-depth for multi-tenant setups: a `SAMLResponse`
|
|
37
|
+
* captured under one connection carries an `InResponseTo` that must not be
|
|
38
|
+
* consumable while processing a *different* connection's ACS callback. A
|
|
39
|
+
* mismatch returns `false` *without* consuming the row, so the owning
|
|
40
|
+
* connection can still accept it (a wrong-connection probe cannot burn a
|
|
41
|
+
* legitimate pending request).
|
|
42
|
+
*/
|
|
43
|
+
const accept = mutation({
|
|
44
|
+
args: {
|
|
45
|
+
requestId: v.string(),
|
|
46
|
+
now: v.number(),
|
|
47
|
+
connectionId: v.optional(v.id("GroupConnection"))
|
|
48
|
+
},
|
|
49
|
+
returns: v.boolean(),
|
|
50
|
+
handler: async (ctx, { requestId, now, connectionId }) => {
|
|
51
|
+
const row = await ctx.db.query("SamlLoginRequest").withIndex("request_id", (idx) => idx.eq("requestId", requestId)).first();
|
|
52
|
+
if (row === null || row.acceptedAt !== void 0 || row.expiresAt <= now) return false;
|
|
53
|
+
if (connectionId !== void 0 && row.connectionId !== connectionId) return false;
|
|
54
|
+
await ctx.db.patch("SamlLoginRequest", row._id, { acceptedAt: now });
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { accept, create };
|
|
61
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { vGroupConnectionScimConfigDoc, vScimStatus } from "../../model.js";
|
|
2
|
+
import { mutation, query } from "../../_generated/server.js";
|
|
3
|
+
import { v } from "convex/values";
|
|
4
|
+
|
|
5
|
+
//#region src/component/connection/scim/config.ts
|
|
6
|
+
/**
|
|
7
|
+
* `component.connection.scim.config.*` — SCIM provisioning config
|
|
8
|
+
* for an Connection connection (sub-resource of connection).
|
|
9
|
+
*
|
|
10
|
+
* Reads collapse into one overloaded `get`
|
|
11
|
+
* (`{ connectionId }` or `{ tokenHash }`).
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Read a SCIM config. Overloaded: lookup by `{ tokenHash }` (bearer-token
|
|
17
|
+
* resolution) or by `{ connectionId }`. Returns `null` when nothing matches.
|
|
18
|
+
*/
|
|
19
|
+
const get = query({
|
|
20
|
+
args: {
|
|
21
|
+
connectionId: v.optional(v.id("GroupConnection")),
|
|
22
|
+
tokenHash: v.optional(v.string())
|
|
23
|
+
},
|
|
24
|
+
returns: v.union(vGroupConnectionScimConfigDoc, v.null()),
|
|
25
|
+
handler: async (ctx, args) => {
|
|
26
|
+
if (args.tokenHash !== void 0) return await ctx.db.query("GroupConnectionScimConfig").withIndex("token_hash", (idx) => idx.eq("tokenHash", args.tokenHash)).first();
|
|
27
|
+
if (args.connectionId === void 0) return null;
|
|
28
|
+
return await ctx.db.query("GroupConnectionScimConfig").withIndex("group_connection_id", (idx) => idx.eq("connectionId", args.connectionId)).first();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
/** Insert a SCIM config, or patch it when one already exists for the connection (keyed by `connectionId`). */
|
|
32
|
+
const upsert = mutation({
|
|
33
|
+
args: {
|
|
34
|
+
connectionId: v.id("GroupConnection"),
|
|
35
|
+
groupId: v.id("Group"),
|
|
36
|
+
status: vScimStatus,
|
|
37
|
+
basePath: v.string(),
|
|
38
|
+
tokenHash: v.string(),
|
|
39
|
+
lastRotatedAt: v.optional(v.number()),
|
|
40
|
+
extend: v.optional(v.any())
|
|
41
|
+
},
|
|
42
|
+
returns: v.id("GroupConnectionScimConfig"),
|
|
43
|
+
handler: async (ctx, args) => {
|
|
44
|
+
const existing = await ctx.db.query("GroupConnectionScimConfig").withIndex("group_connection_id", (idx) => idx.eq("connectionId", args.connectionId)).first();
|
|
45
|
+
if (existing) {
|
|
46
|
+
await ctx.db.patch("GroupConnectionScimConfig", existing._id, args);
|
|
47
|
+
return existing._id;
|
|
48
|
+
}
|
|
49
|
+
return await ctx.db.insert("GroupConnectionScimConfig", args);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { get, upsert };
|
|
55
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { ErrorCode } from "../../../shared/codes.js";
|
|
2
|
+
import { vGroupConnectionScimIdentityDoc, vPaginated, vScimResourceType } from "../../model.js";
|
|
3
|
+
import schema_default from "../../schema.js";
|
|
4
|
+
import { mutation, query } from "../../_generated/server.js";
|
|
5
|
+
import { ConvexError, v } from "convex/values";
|
|
6
|
+
import { paginationOptsValidator } from "convex/server";
|
|
7
|
+
import { paginator } from "convex-helpers/server/pagination";
|
|
8
|
+
|
|
9
|
+
//#region src/component/connection/scim/identity.ts
|
|
10
|
+
/**
|
|
11
|
+
* `component.connection.scim.identity.*` — SCIM-provisioned
|
|
12
|
+
* identities for an Connection connection (sub-resource of connection).
|
|
13
|
+
*
|
|
14
|
+
* `get` is overloaded — single lookup or, with `{ connectionId,
|
|
15
|
+
* userIds }`, a batched resolve aligned to input order.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
const vScimUserData = v.object(schema_default.tables.User.validator.fields);
|
|
20
|
+
/**
|
|
21
|
+
* Read SCIM identities, overloaded by the args supplied. With
|
|
22
|
+
* `{ connectionId, userIds }` it batch-resolves and returns an array aligned to
|
|
23
|
+
* the input order (`null` per missing user). Otherwise it resolves a single
|
|
24
|
+
* identity by `(connectionId, resourceType, externalId)`, `(connectionId,
|
|
25
|
+
* userId)`, `userId`, or `mappedGroupId`. Returns `null` when nothing matches.
|
|
26
|
+
*/
|
|
27
|
+
const get = query({
|
|
28
|
+
args: {
|
|
29
|
+
connectionId: v.optional(v.id("GroupConnection")),
|
|
30
|
+
resourceType: v.optional(vScimResourceType),
|
|
31
|
+
externalId: v.optional(v.string()),
|
|
32
|
+
userId: v.optional(v.id("User")),
|
|
33
|
+
userIds: v.optional(v.array(v.id("User"))),
|
|
34
|
+
mappedGroupId: v.optional(v.id("Group"))
|
|
35
|
+
},
|
|
36
|
+
returns: v.union(vGroupConnectionScimIdentityDoc, v.null(), v.array(v.union(vGroupConnectionScimIdentityDoc, v.null()))),
|
|
37
|
+
handler: async (ctx, args) => {
|
|
38
|
+
if (args.connectionId !== void 0 && args.userIds !== void 0) {
|
|
39
|
+
const userIds = args.userIds;
|
|
40
|
+
if (userIds.length === 0) return [];
|
|
41
|
+
const unique = Array.from(new Set(userIds));
|
|
42
|
+
const docs = await Promise.all(unique.map((userId) => ctx.db.query("GroupConnectionScimIdentity").withIndex("group_connection_id_user_id", (idx) => idx.eq("connectionId", args.connectionId).eq("userId", userId)).first()));
|
|
43
|
+
const byUserId = new Map(unique.map((id, i) => [id, docs[i] ?? null]));
|
|
44
|
+
return userIds.map((userId) => byUserId.get(userId) ?? null);
|
|
45
|
+
}
|
|
46
|
+
if (args.connectionId !== void 0 && args.resourceType !== void 0 && args.externalId !== void 0) return await ctx.db.query("GroupConnectionScimIdentity").withIndex("group_connection_id_resource_type_external_id", (idx) => idx.eq("connectionId", args.connectionId).eq("resourceType", args.resourceType).eq("externalId", args.externalId)).first();
|
|
47
|
+
if (args.connectionId !== void 0 && args.userId !== void 0) return await ctx.db.query("GroupConnectionScimIdentity").withIndex("group_connection_id_user_id", (idx) => idx.eq("connectionId", args.connectionId).eq("userId", args.userId)).first();
|
|
48
|
+
if (args.userId !== void 0) return await ctx.db.query("GroupConnectionScimIdentity").withIndex("user_id", (idx) => idx.eq("userId", args.userId)).first();
|
|
49
|
+
if (args.mappedGroupId !== void 0) return await ctx.db.query("GroupConnectionScimIdentity").withIndex("mapped_group_id", (idx) => idx.eq("mappedGroupId", args.mappedGroupId)).first();
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
/** List a connection's SCIM identities, paginated. */
|
|
54
|
+
const list = query({
|
|
55
|
+
args: {
|
|
56
|
+
connectionId: v.id("GroupConnection"),
|
|
57
|
+
paginationOpts: paginationOptsValidator
|
|
58
|
+
},
|
|
59
|
+
returns: vPaginated(vGroupConnectionScimIdentityDoc),
|
|
60
|
+
handler: async (ctx, { connectionId, paginationOpts }) => {
|
|
61
|
+
return await paginator(ctx.db, schema_default).query("GroupConnectionScimIdentity").withIndex("group_connection_id", (idx) => idx.eq("connectionId", connectionId)).paginate(paginationOpts);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
/** Insert a SCIM identity, or patch it when it already exists (keyed by `(connectionId, resourceType, externalId)`). */
|
|
65
|
+
const upsert = mutation({
|
|
66
|
+
args: {
|
|
67
|
+
connectionId: v.id("GroupConnection"),
|
|
68
|
+
groupId: v.id("Group"),
|
|
69
|
+
resourceType: vScimResourceType,
|
|
70
|
+
externalId: v.string(),
|
|
71
|
+
userId: v.optional(v.id("User")),
|
|
72
|
+
mappedGroupId: v.optional(v.id("Group")),
|
|
73
|
+
lastProvisionedAt: v.optional(v.number()),
|
|
74
|
+
active: v.optional(v.boolean()),
|
|
75
|
+
raw: v.optional(v.any())
|
|
76
|
+
},
|
|
77
|
+
returns: v.id("GroupConnectionScimIdentity"),
|
|
78
|
+
handler: async (ctx, args) => {
|
|
79
|
+
const existing = await ctx.db.query("GroupConnectionScimIdentity").withIndex("group_connection_id_resource_type_external_id", (idx) => idx.eq("connectionId", args.connectionId).eq("resourceType", args.resourceType).eq("externalId", args.externalId)).first();
|
|
80
|
+
if (existing) {
|
|
81
|
+
await ctx.db.patch("GroupConnectionScimIdentity", existing._id, args);
|
|
82
|
+
return existing._id;
|
|
83
|
+
}
|
|
84
|
+
return await ctx.db.insert("GroupConnectionScimIdentity", args);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* Atomically provision or resolve a SCIM user by both of its durable natural
|
|
89
|
+
* keys: the connection-scoped SCIM external id and the provider Account id.
|
|
90
|
+
* A concurrent retry cannot commit a losing User because the identity and
|
|
91
|
+
* Account index reads participate in the same OCC transaction as the inserts.
|
|
92
|
+
* Existing ownership is preserved; conflicting owners are rejected.
|
|
93
|
+
*/
|
|
94
|
+
const provision = mutation({
|
|
95
|
+
args: {
|
|
96
|
+
connectionId: v.id("GroupConnection"),
|
|
97
|
+
groupId: v.id("Group"),
|
|
98
|
+
externalId: v.string(),
|
|
99
|
+
provider: v.string(),
|
|
100
|
+
userData: vScimUserData,
|
|
101
|
+
lastProvisionedAt: v.optional(v.number()),
|
|
102
|
+
active: v.optional(v.boolean()),
|
|
103
|
+
raw: v.optional(v.any())
|
|
104
|
+
},
|
|
105
|
+
returns: v.object({
|
|
106
|
+
userId: v.id("User"),
|
|
107
|
+
created: v.boolean()
|
|
108
|
+
}),
|
|
109
|
+
handler: async (ctx, args) => {
|
|
110
|
+
const identity = await ctx.db.query("GroupConnectionScimIdentity").withIndex("group_connection_id_resource_type_external_id", (idx) => idx.eq("connectionId", args.connectionId).eq("resourceType", "user").eq("externalId", args.externalId)).unique();
|
|
111
|
+
const account = await ctx.db.query("Account").withIndex("provider_account_id", (idx) => idx.eq("provider", args.provider).eq("providerAccountId", args.externalId)).unique();
|
|
112
|
+
if (identity?.userId !== void 0 && account !== null && identity.userId !== account.userId) throw new ConvexError({
|
|
113
|
+
code: ErrorCode.ACCOUNT_ALREADY_LINKED,
|
|
114
|
+
message: "The SCIM identity and provider account belong to different users."
|
|
115
|
+
});
|
|
116
|
+
let userId = identity?.userId ?? account?.userId;
|
|
117
|
+
let created = false;
|
|
118
|
+
if (userId !== void 0) {
|
|
119
|
+
if (await ctx.db.get("User", userId) === null) throw new ConvexError({
|
|
120
|
+
code: ErrorCode.ACCOUNT_NOT_FOUND,
|
|
121
|
+
message: "The SCIM identity references a user that no longer exists."
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
userId = await ctx.db.insert("User", args.userData);
|
|
125
|
+
created = true;
|
|
126
|
+
}
|
|
127
|
+
if (account === null) await ctx.db.insert("Account", {
|
|
128
|
+
userId,
|
|
129
|
+
provider: args.provider,
|
|
130
|
+
providerAccountId: args.externalId
|
|
131
|
+
});
|
|
132
|
+
const identityData = {
|
|
133
|
+
connectionId: args.connectionId,
|
|
134
|
+
groupId: args.groupId,
|
|
135
|
+
resourceType: "user",
|
|
136
|
+
externalId: args.externalId,
|
|
137
|
+
userId,
|
|
138
|
+
...args.lastProvisionedAt !== void 0 ? { lastProvisionedAt: args.lastProvisionedAt } : {},
|
|
139
|
+
...args.active !== void 0 ? { active: args.active } : {},
|
|
140
|
+
...args.raw !== void 0 ? { raw: args.raw } : {}
|
|
141
|
+
};
|
|
142
|
+
if (identity === null) await ctx.db.insert("GroupConnectionScimIdentity", identityData);
|
|
143
|
+
else await ctx.db.patch("GroupConnectionScimIdentity", identity._id, identityData);
|
|
144
|
+
return {
|
|
145
|
+
userId,
|
|
146
|
+
created
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
/** Delete a SCIM identity by id. */
|
|
151
|
+
const remove = mutation({
|
|
152
|
+
args: { id: v.id("GroupConnectionScimIdentity") },
|
|
153
|
+
returns: v.null(),
|
|
154
|
+
handler: async (ctx, { id: identityId }) => {
|
|
155
|
+
await ctx.db.delete("GroupConnectionScimIdentity", identityId);
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
//#endregion
|
|
161
|
+
export { get, list, provision, remove, upsert };
|
|
162
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { vGroupConnectionSecretDoc, vGroupConnectionSecretKind } from "../model.js";
|
|
2
|
+
import { mutation, query } from "../_generated/server.js";
|
|
3
|
+
import { v } from "convex/values";
|
|
4
|
+
|
|
5
|
+
//#region src/component/connection/secret.ts
|
|
6
|
+
/**
|
|
7
|
+
* `component.connection.secret.*` — encrypted IdP secrets for an
|
|
8
|
+
* Connection connection (sub-resource of connection).
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** Read a connection's secret by `(connectionId, kind)`, or `null` if none. */
|
|
13
|
+
const get = query({
|
|
14
|
+
args: {
|
|
15
|
+
connectionId: v.id("GroupConnection"),
|
|
16
|
+
kind: vGroupConnectionSecretKind
|
|
17
|
+
},
|
|
18
|
+
returns: v.union(vGroupConnectionSecretDoc, v.null()),
|
|
19
|
+
handler: async (ctx, { connectionId, kind }) => {
|
|
20
|
+
return await ctx.db.query("GroupConnectionSecret").withIndex("connection_id_kind", (idx) => idx.eq("connectionId", connectionId).eq("kind", kind)).first();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
/** Insert a connection secret, or patch it when it already exists (keyed by `(connectionId, kind)`). */
|
|
24
|
+
const upsert = mutation({
|
|
25
|
+
args: {
|
|
26
|
+
connectionId: v.id("GroupConnection"),
|
|
27
|
+
groupId: v.id("Group"),
|
|
28
|
+
kind: vGroupConnectionSecretKind,
|
|
29
|
+
ciphertext: v.string(),
|
|
30
|
+
updatedAt: v.number()
|
|
31
|
+
},
|
|
32
|
+
returns: v.id("GroupConnectionSecret"),
|
|
33
|
+
handler: async (ctx, args) => {
|
|
34
|
+
const { connectionId, ...rest } = args;
|
|
35
|
+
const existing = await ctx.db.query("GroupConnectionSecret").withIndex("connection_id_kind", (idx) => idx.eq("connectionId", connectionId).eq("kind", args.kind)).first();
|
|
36
|
+
if (existing) {
|
|
37
|
+
await ctx.db.patch("GroupConnectionSecret", existing._id, {
|
|
38
|
+
connectionId,
|
|
39
|
+
...rest
|
|
40
|
+
});
|
|
41
|
+
return existing._id;
|
|
42
|
+
}
|
|
43
|
+
return await ctx.db.insert("GroupConnectionSecret", {
|
|
44
|
+
connectionId,
|
|
45
|
+
...rest
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
/** Delete a connection's secret identified by `(connectionId, kind)`, if any. */
|
|
50
|
+
const remove = mutation({
|
|
51
|
+
args: {
|
|
52
|
+
connectionId: v.id("GroupConnection"),
|
|
53
|
+
kind: vGroupConnectionSecretKind
|
|
54
|
+
},
|
|
55
|
+
returns: v.null(),
|
|
56
|
+
handler: async (ctx, { connectionId, kind }) => {
|
|
57
|
+
const existing = await ctx.db.query("GroupConnectionSecret").withIndex("connection_id_kind", (idx) => idx.eq("connectionId", connectionId).eq("kind", kind)).first();
|
|
58
|
+
if (existing) await ctx.db.delete("GroupConnectionSecret", existing._id);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { get, remove, upsert };
|
|
65
|
+
//# sourceMappingURL=secret.js.map
|