@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,615 @@
|
|
|
1
|
+
import { ErrorCode } from "../../shared/codes.js";
|
|
2
|
+
import { Value } from "convex/values";
|
|
3
|
+
import { FunctionReference } from "convex/server";
|
|
4
|
+
|
|
5
|
+
//#region src/client/core/types.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Structural interface for any Convex client.
|
|
8
|
+
* Satisfied by `ConvexClient` (`convex/browser`),
|
|
9
|
+
* `ConvexReactClient` (`convex/react`), and similar transports.
|
|
10
|
+
*
|
|
11
|
+
* `clearAuth` is present on `ConvexReactClient` and `BaseConvexClient`
|
|
12
|
+
* but not on the simplified `ConvexClient`. When available we call it
|
|
13
|
+
* during sign-out for a clean deauthentication.
|
|
14
|
+
*/
|
|
15
|
+
interface ConvexTransport {
|
|
16
|
+
action(action: unknown, args: unknown): Promise<unknown>;
|
|
17
|
+
setAuth(fetchToken: (args: {
|
|
18
|
+
forceRefreshToken: boolean;
|
|
19
|
+
}) => Promise<string | null | undefined>, onChange?: (isAuthenticated: boolean) => void): void;
|
|
20
|
+
clearAuth?(): void;
|
|
21
|
+
}
|
|
22
|
+
/** Minimal action-only transport used for unauthenticated auth flows. */
|
|
23
|
+
interface ActionTransport {
|
|
24
|
+
action(action: unknown, args: unknown): Promise<unknown>;
|
|
25
|
+
}
|
|
26
|
+
/** Pluggable key-value storage supplied by the host runtime. */
|
|
27
|
+
interface Storage {
|
|
28
|
+
getItem(key: string): string | null | undefined | Promise<string | null | undefined>;
|
|
29
|
+
setItem(key: string, value: string): void | Promise<void>;
|
|
30
|
+
removeItem(key: string): void | Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/** Platform-neutral location/navigation hooks. */
|
|
33
|
+
interface LocationRuntime {
|
|
34
|
+
get(): URL | null;
|
|
35
|
+
replace(relativeUrl: string): void | Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Platform-specific OAuth launch primitive.
|
|
39
|
+
*
|
|
40
|
+
* `open` receives the provider authorization URL. Platforms that navigate the
|
|
41
|
+
* whole page away (browser) return nothing; platforms that run the flow in an
|
|
42
|
+
* in-app session (Expo) return the callback URL so the core can complete the
|
|
43
|
+
* exchange inline.
|
|
44
|
+
*/
|
|
45
|
+
interface OAuthRuntime {
|
|
46
|
+
open(url: URL): void | string | URL | Promise<void | string | URL>;
|
|
47
|
+
}
|
|
48
|
+
/** Cross-context synchronization hooks, such as browser storage events. */
|
|
49
|
+
interface SyncRuntime {
|
|
50
|
+
subscribe(key: string, callback: (value: string | null) => void | Promise<void>): (() => void) | null;
|
|
51
|
+
}
|
|
52
|
+
/** Cross-context mutex/locking primitive. */
|
|
53
|
+
interface MutexRuntime {
|
|
54
|
+
withKey<T>(key: string, callback: () => Promise<T>): Promise<T>;
|
|
55
|
+
}
|
|
56
|
+
/** Proxy request execution supplied by the host runtime. */
|
|
57
|
+
interface ProxyRuntime {
|
|
58
|
+
fetch(body: Record<string, unknown>, proxyPath: string): Promise<Response>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Platform-neutral client runtime dependencies.
|
|
62
|
+
*
|
|
63
|
+
* The core `client` package should depend only on these interfaces, while the
|
|
64
|
+
* browser package can provide concrete implementations backed by DOM APIs.
|
|
65
|
+
*/
|
|
66
|
+
interface ClientRuntime {
|
|
67
|
+
environment?: "client" | "server";
|
|
68
|
+
storage?: Storage | null;
|
|
69
|
+
location?: LocationRuntime;
|
|
70
|
+
oauth?: OAuthRuntime;
|
|
71
|
+
sync?: SyncRuntime;
|
|
72
|
+
mutex?: MutexRuntime;
|
|
73
|
+
proxy?: ProxyRuntime;
|
|
74
|
+
}
|
|
75
|
+
/** Platform-specific factor adapters injected by entrypoints like `browser`. */
|
|
76
|
+
interface ClientAdapters {
|
|
77
|
+
webauthn?: WebAuthnClient;
|
|
78
|
+
totp?: TotpClient;
|
|
79
|
+
device?: DeviceClient;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Device authorization payload returned from the `deviceCode` sign-in flow.
|
|
83
|
+
*/
|
|
84
|
+
type DeviceCodeResult = {
|
|
85
|
+
deviceCode: string;
|
|
86
|
+
userCode: string;
|
|
87
|
+
verificationUri: string;
|
|
88
|
+
verificationUriComplete: string;
|
|
89
|
+
expiresIn: number;
|
|
90
|
+
interval: number;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Result of a `signIn` call.
|
|
94
|
+
*
|
|
95
|
+
* - `kind: "signedIn"` — credentials were accepted and a client session is now available.
|
|
96
|
+
* - `kind: "redirect"` — OAuth flow initiated; redirect the user to `redirect.toString()`.
|
|
97
|
+
* - `kind: "totpRequired"` — credentials valid but 2FA is needed; call `auth.totp.verify()`.
|
|
98
|
+
* - `kind: "deviceCode"` — device flow initiated; display the code and poll via `auth.device.poll()`.
|
|
99
|
+
* - `kind: "started"` — a non-immediate flow started (for example email/phone verification).
|
|
100
|
+
* - `kind: "failed"` — the flow did not complete; `code` is the typed {@link ErrorCode}.
|
|
101
|
+
*
|
|
102
|
+
* @see {@link AuthState}
|
|
103
|
+
*/
|
|
104
|
+
type SignInResult = {
|
|
105
|
+
kind: "signedIn";
|
|
106
|
+
} | {
|
|
107
|
+
kind: "redirect";
|
|
108
|
+
redirect: URL;
|
|
109
|
+
verifier: string;
|
|
110
|
+
} | {
|
|
111
|
+
kind: "totpRequired";
|
|
112
|
+
verifier: string;
|
|
113
|
+
} | {
|
|
114
|
+
kind: "deviceCode";
|
|
115
|
+
deviceCode: DeviceCodeResult;
|
|
116
|
+
} | {
|
|
117
|
+
kind: "started";
|
|
118
|
+
} | {
|
|
119
|
+
kind: "failed";
|
|
120
|
+
code: ErrorCode;
|
|
121
|
+
};
|
|
122
|
+
/** Reactive auth state. `token` is non-null only after Convex confirms auth. */
|
|
123
|
+
type AuthState = {
|
|
124
|
+
status: "loading";
|
|
125
|
+
token: null;
|
|
126
|
+
} | {
|
|
127
|
+
status: "signedOut";
|
|
128
|
+
token: null;
|
|
129
|
+
} | {
|
|
130
|
+
status: "signedIn";
|
|
131
|
+
token: string;
|
|
132
|
+
};
|
|
133
|
+
/** Handler for `auth.subscribe`. */
|
|
134
|
+
type AuthSubscriber = (state: AuthState) => void;
|
|
135
|
+
/**
|
|
136
|
+
* Typed Convex API references for the auth functions.
|
|
137
|
+
* Pass these from your generated `api` object.
|
|
138
|
+
*
|
|
139
|
+
* @typeParam HasWebAuthn - Whether the WebAuthn provider is configured.
|
|
140
|
+
* @typeParam HasTotp - Whether the TOTP provider is configured.
|
|
141
|
+
* @typeParam HasDevice - Whether the device provider is configured.
|
|
142
|
+
*/
|
|
143
|
+
type AuthApiRefs<HasWebAuthn extends boolean = boolean, HasTotp extends boolean = boolean, HasDevice extends boolean = boolean> = {
|
|
144
|
+
signIn: FunctionReference<"action", "public", Record<string, Value>, unknown>;
|
|
145
|
+
signOut: FunctionReference<"action", "public", Record<string, Value>, unknown>;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Optional hints for {@link WebAuthnClient.register}.
|
|
149
|
+
*/
|
|
150
|
+
type WebAuthnRegisterOptions = {
|
|
151
|
+
/** Human-readable label for this credential (e.g. `"MacBook Pro"`). */name?: string; /** WebAuthn `user.name` override. */
|
|
152
|
+
userName?: string; /** WebAuthn `user.displayName` override. */
|
|
153
|
+
userDisplayName?: string;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Optional hints for {@link WebAuthnClient.signIn}.
|
|
157
|
+
*/
|
|
158
|
+
type WebAuthnSignInOptions = {
|
|
159
|
+
/** Email hint to filter discoverable credentials. */email?: string; /** Set to `true` for conditional UI (autofill) mode. */
|
|
160
|
+
autofill?: boolean;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* WebAuthn client-side helpers.
|
|
164
|
+
*
|
|
165
|
+
* @see {@link TotpClient}
|
|
166
|
+
* @see {@link DeviceClient}
|
|
167
|
+
*/
|
|
168
|
+
interface WebAuthnClient {
|
|
169
|
+
/**
|
|
170
|
+
* Check whether the current runtime exposes WebAuthn passkey APIs.
|
|
171
|
+
*
|
|
172
|
+
* @returns `true` when `navigator.credentials` is available.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* if (auth.webauthn.isSupported()) {
|
|
177
|
+
* // Show passkey registration button
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
isSupported(): boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Check whether conditional mediation (autofill-style passkeys) is available.
|
|
184
|
+
*
|
|
185
|
+
* @returns `true` when the browser supports `PublicKeyCredential.isConditionalMediationAvailable`.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* if (await auth.webauthn.isAutofillSupported()) {
|
|
190
|
+
* await auth.webauthn.signIn({ autofill: true });
|
|
191
|
+
* }
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
isAutofillSupported(): Promise<boolean>;
|
|
195
|
+
/**
|
|
196
|
+
* Start a passkey registration flow and complete the WebAuthn ceremony.
|
|
197
|
+
*
|
|
198
|
+
* Creates a new credential bound to the current user's account.
|
|
199
|
+
*
|
|
200
|
+
* @param opts - Optional registration hints.
|
|
201
|
+
* @param opts.name - Human-readable name for the passkey (e.g. `"MacBook Pro"`).
|
|
202
|
+
* @param opts.userName - WebAuthn `user.name` override.
|
|
203
|
+
* @param opts.userDisplayName - WebAuthn `user.displayName` override.
|
|
204
|
+
* @returns A {@link SignInResult} — typically `{ kind: "signedIn" }` once a client session is available.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```ts
|
|
208
|
+
* const result = await auth.webauthn.register({ name: "My laptop" });
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
register(opts?: WebAuthnRegisterOptions): Promise<SignInResult>;
|
|
212
|
+
/**
|
|
213
|
+
* Sign in with an existing passkey and complete the WebAuthn ceremony.
|
|
214
|
+
*
|
|
215
|
+
* @param opts - Optional sign-in hints.
|
|
216
|
+
* @param opts.email - Email hint to filter discoverable credentials.
|
|
217
|
+
* @param opts.autofill - Set to `true` for conditional UI (autofill) mode.
|
|
218
|
+
* @returns A {@link SignInResult} — typically `{ kind: "signedIn" }` once a client session is available.
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```ts
|
|
222
|
+
* const result = await auth.webauthn.signIn();
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
signIn(opts?: WebAuthnSignInOptions): Promise<SignInResult>;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Optional hints for {@link TotpClient.setup}.
|
|
229
|
+
*/
|
|
230
|
+
type TotpSetupOptions = {
|
|
231
|
+
/** Issuer name shown in the authenticator app. */name?: string; /** Account label shown in the authenticator app. */
|
|
232
|
+
accountName?: string;
|
|
233
|
+
};
|
|
234
|
+
/** Result of {@link TotpClient.setup}. */
|
|
235
|
+
type TotpSetupResult = {
|
|
236
|
+
/** `otpauth://` URL — render as a QR code. */uri: string; /** Raw base32-encoded shared secret. */
|
|
237
|
+
secret: string; /** Verifier token to pass to {@link TotpClient.confirm}. */
|
|
238
|
+
verifier: string; /** Factor ID to pass to {@link TotpClient.confirm}. */
|
|
239
|
+
totpId: string;
|
|
240
|
+
};
|
|
241
|
+
/** Params for {@link TotpClient.confirm}. */
|
|
242
|
+
type TotpConfirmParams = {
|
|
243
|
+
/** Six-digit OTP from the authenticator app. */code: string; /** Verifier token from {@link TotpSetupResult.verifier}. */
|
|
244
|
+
verifier: string; /** Factor ID from {@link TotpSetupResult.totpId}. */
|
|
245
|
+
totpId: string;
|
|
246
|
+
};
|
|
247
|
+
/** Params for {@link TotpClient.verify}. */
|
|
248
|
+
type TotpVerifyParams = {
|
|
249
|
+
/** Six-digit OTP from the authenticator app. */code: string; /** Verifier token from a `totpRequired` sign-in result. */
|
|
250
|
+
verifier: string;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* TOTP two-factor authentication client-side helpers.
|
|
254
|
+
*
|
|
255
|
+
* @see {@link WebAuthnClient}
|
|
256
|
+
* @see {@link DeviceClient}
|
|
257
|
+
*/
|
|
258
|
+
interface TotpClient {
|
|
259
|
+
/**
|
|
260
|
+
* Start TOTP enrollment and return the setup URI, secret, verifier, and factor ID.
|
|
261
|
+
*
|
|
262
|
+
* The returned `uri` is an `otpauth://` URL that can be rendered as a QR code
|
|
263
|
+
* for the user to scan with their authenticator app.
|
|
264
|
+
*
|
|
265
|
+
* @param opts - Optional setup hints.
|
|
266
|
+
* @param opts.name - Issuer name shown in the authenticator app.
|
|
267
|
+
* @param opts.accountName - Account label in the authenticator app.
|
|
268
|
+
* @returns An object with `{ uri, secret, verifier, totpId }`.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* const { uri, secret, verifier, totpId } = await auth.totp.setup();
|
|
273
|
+
* // Render `uri` as a QR code, then confirm:
|
|
274
|
+
* await auth.totp.confirm({ code: userCode, verifier, totpId });
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
setup(opts?: TotpSetupOptions): Promise<TotpSetupResult>;
|
|
278
|
+
/**
|
|
279
|
+
* Confirm a newly created TOTP factor with the first authenticator code.
|
|
280
|
+
*
|
|
281
|
+
* Call this after the user scans the QR code and enters the first OTP.
|
|
282
|
+
*
|
|
283
|
+
* @param opts - Confirmation parameters.
|
|
284
|
+
* @param opts.code - The 6-digit TOTP code from the authenticator app.
|
|
285
|
+
* @param opts.verifier - The verifier string returned by {@link TotpClient.setup}.
|
|
286
|
+
* @param opts.totpId - The factor ID returned by {@link TotpClient.setup}.
|
|
287
|
+
* @returns A {@link SignInResult} — `{ kind: "signedIn" }` on success, or
|
|
288
|
+
* `{ kind: "failed", code }` when the code is rejected.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* const result = await auth.totp.confirm({ code: "123456", verifier, totpId });
|
|
293
|
+
* if (result.kind === "failed") showError(result.code);
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
confirm(opts: TotpConfirmParams): Promise<SignInResult>;
|
|
297
|
+
/**
|
|
298
|
+
* Complete a sign-in that is waiting on TOTP verification.
|
|
299
|
+
*
|
|
300
|
+
* Called when `signIn()` returns `{ kind: "totpRequired" }`.
|
|
301
|
+
*
|
|
302
|
+
* @param opts - Verification parameters.
|
|
303
|
+
* @param opts.code - The 6-digit TOTP code from the authenticator app.
|
|
304
|
+
* @param opts.verifier - The verifier string from the `totpRequired` result.
|
|
305
|
+
* @returns A {@link SignInResult} — `{ kind: "signedIn" }` on success, or
|
|
306
|
+
* `{ kind: "failed", code }` when the code is rejected.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* const result = await auth.signIn("password", { email, password });
|
|
311
|
+
* if (result.kind === "totpRequired") {
|
|
312
|
+
* const totp = await auth.totp.verify({ code: totpCode, verifier: result.verifier });
|
|
313
|
+
* if (totp.kind === "failed") showError(totp.code);
|
|
314
|
+
* }
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
verify(opts: TotpVerifyParams): Promise<SignInResult>;
|
|
318
|
+
}
|
|
319
|
+
/** Params for {@link DeviceClient.poll}. */
|
|
320
|
+
type DevicePollParams = {
|
|
321
|
+
code: DeviceCodeResult; /** Aborts the poll loop cleanly, e.g. on UI unmount. */
|
|
322
|
+
signal?: AbortSignal;
|
|
323
|
+
};
|
|
324
|
+
/** Params for {@link DeviceClient.verify}. */
|
|
325
|
+
type DeviceVerifyParams = {
|
|
326
|
+
code: string;
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* Device authorization (RFC 8628) client-side helpers.
|
|
330
|
+
*
|
|
331
|
+
* @see {@link WebAuthnClient}
|
|
332
|
+
* @see {@link TotpClient}
|
|
333
|
+
*/
|
|
334
|
+
interface DeviceClient {
|
|
335
|
+
/**
|
|
336
|
+
* Poll until a device flow is approved or expires.
|
|
337
|
+
*
|
|
338
|
+
* Polls the server at the interval specified in the {@link DeviceCodeResult}
|
|
339
|
+
* until the user authorizes the device or the code expires.
|
|
340
|
+
*
|
|
341
|
+
* @param opts - Poll options.
|
|
342
|
+
* @param opts.code - The {@link DeviceCodeResult} returned from `signIn("device")`.
|
|
343
|
+
* @param opts.signal - Optional {@link AbortSignal}; aborting returns cleanly
|
|
344
|
+
* at the next loop boundary (e.g. on UI unmount).
|
|
345
|
+
* @throws `ConvexError({ code: "DEVICE_CODE_EXPIRED" })` when the code expires before authorization.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```ts
|
|
349
|
+
* const controller = new AbortController();
|
|
350
|
+
* const result = await auth.signIn("device");
|
|
351
|
+
* if (result.kind === "deviceCode") {
|
|
352
|
+
* // Display result.deviceCode.userCode to the user
|
|
353
|
+
* await auth.device.poll({ code: result.deviceCode, signal: controller.signal });
|
|
354
|
+
* console.log("Device authorized!");
|
|
355
|
+
* }
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
358
|
+
poll(opts: DevicePollParams): Promise<void>;
|
|
359
|
+
/**
|
|
360
|
+
* Approve a device flow from the verification page using the displayed user code.
|
|
361
|
+
*
|
|
362
|
+
* Call this on the authorization page where the user enters the short code
|
|
363
|
+
* shown on the device screen.
|
|
364
|
+
*
|
|
365
|
+
* @param opts - Verification options.
|
|
366
|
+
* @param opts.code - The user code string (e.g. `"WDJB-MJHT"`).
|
|
367
|
+
* @throws `ConvexError({ code: "DEVICE_AUTHORIZATION_FAILED" })` when verification fails.
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```ts
|
|
371
|
+
* await auth.device.verify({ code: "WDJB-MJHT" });
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
verify(opts: DeviceVerifyParams): Promise<void>;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Extract capability flags from an AuthApiRefs type.
|
|
378
|
+
*
|
|
379
|
+
* @typeParam Api - An AuthApiRefs type to extract capability flags from.
|
|
380
|
+
*/
|
|
381
|
+
type InferCaps<Api extends AuthApiRefs<boolean, boolean, boolean>> = Api extends AuthApiRefs<infer P, infer T, infer D> ? {
|
|
382
|
+
webauthn: P;
|
|
383
|
+
totp: T;
|
|
384
|
+
device: D;
|
|
385
|
+
} : {
|
|
386
|
+
webauthn: boolean;
|
|
387
|
+
totp: boolean;
|
|
388
|
+
device: boolean;
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Include a capability when configured, omit it when disabled, and keep it
|
|
392
|
+
* optional when a framework binding cannot know the capability.
|
|
393
|
+
*/
|
|
394
|
+
type CapabilityClient<Enabled extends boolean, Name extends string, Client> = [Enabled] extends [false] ? {} : [boolean] extends [Enabled] ? { [Key in Name]?: Client } : { [Key in Name]: Client };
|
|
395
|
+
/** Pending invite detected from URL or recovered from storage after redirect. */
|
|
396
|
+
interface PendingInvite {
|
|
397
|
+
/**
|
|
398
|
+
* Raw one-time invite token. Pass to your invite acceptance mutation.
|
|
399
|
+
* @readonly
|
|
400
|
+
*/
|
|
401
|
+
readonly token: string;
|
|
402
|
+
/**
|
|
403
|
+
* Invite email from the URL or stored redirect state, if available.
|
|
404
|
+
* @readonly
|
|
405
|
+
*/
|
|
406
|
+
readonly email: string | null;
|
|
407
|
+
/**
|
|
408
|
+
* Consume the invite: clears storage/URL params and returns the token.
|
|
409
|
+
*
|
|
410
|
+
* @returns The invite token.
|
|
411
|
+
* @throws When there is no pending invite to accept.
|
|
412
|
+
*/
|
|
413
|
+
accept(): Promise<{
|
|
414
|
+
token: string;
|
|
415
|
+
}>;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Discriminated union of params for the password provider's flows.
|
|
419
|
+
*
|
|
420
|
+
* Each branch maps to one of the five password flows: `signUp`, `signIn`,
|
|
421
|
+
* `reset`, `verify`, `change`. Selecting a `flow` literal narrows the
|
|
422
|
+
* accepted params automatically.
|
|
423
|
+
*/
|
|
424
|
+
type PasswordParams = {
|
|
425
|
+
flow: "signUp";
|
|
426
|
+
email: string;
|
|
427
|
+
password: string;
|
|
428
|
+
redirectTo?: string;
|
|
429
|
+
} | {
|
|
430
|
+
flow: "signIn";
|
|
431
|
+
email: string;
|
|
432
|
+
password: string;
|
|
433
|
+
redirectTo?: string;
|
|
434
|
+
} | {
|
|
435
|
+
flow: "reset";
|
|
436
|
+
email: string;
|
|
437
|
+
redirectTo?: string;
|
|
438
|
+
} | {
|
|
439
|
+
flow: "verify";
|
|
440
|
+
email: string;
|
|
441
|
+
code: string; /** When set, completes a `reset` flow by updating the password. Otherwise confirms email. */
|
|
442
|
+
newPassword?: string;
|
|
443
|
+
redirectTo?: string;
|
|
444
|
+
} | {
|
|
445
|
+
flow: "change";
|
|
446
|
+
email: string;
|
|
447
|
+
currentPassword: string;
|
|
448
|
+
newPassword: string;
|
|
449
|
+
redirectTo?: string;
|
|
450
|
+
};
|
|
451
|
+
/** Params for the email (magic link) provider's initiation step. */
|
|
452
|
+
type EmailInitiateParams = {
|
|
453
|
+
email: string;
|
|
454
|
+
redirectTo?: string;
|
|
455
|
+
};
|
|
456
|
+
/**
|
|
457
|
+
* Params for completing a code-based flow (no provider). Used to finalise
|
|
458
|
+
* email magic-link sign-ins and password-reset OTPs when the verification
|
|
459
|
+
* call is made without re-specifying the originating provider.
|
|
460
|
+
*/
|
|
461
|
+
type CodeCompletionParams = {
|
|
462
|
+
code: string;
|
|
463
|
+
redirectTo?: string;
|
|
464
|
+
};
|
|
465
|
+
/** Params for the `connection` provider — requires a connection ID. */
|
|
466
|
+
type ConnectionParams = {
|
|
467
|
+
connectionId: string;
|
|
468
|
+
redirectTo?: string;
|
|
469
|
+
};
|
|
470
|
+
/** Params for the anonymous provider. Empty / `redirectTo` only. */
|
|
471
|
+
type AnonymousParams = {
|
|
472
|
+
redirectTo?: string;
|
|
473
|
+
};
|
|
474
|
+
/** Default params shape for OAuth-style providers (google, github, etc.). */
|
|
475
|
+
type OAuthSignInParams = {
|
|
476
|
+
redirectTo?: string;
|
|
477
|
+
};
|
|
478
|
+
/**
|
|
479
|
+
* Resolves the `params` argument shape from the `provider` literal.
|
|
480
|
+
*
|
|
481
|
+
* Known special providers (`"password"`, `"email"`, etc.) get strict typing.
|
|
482
|
+
* Any other string falls back to OAuth-style params, since custom OAuth
|
|
483
|
+
* providers can be registered under arbitrary IDs.
|
|
484
|
+
*/
|
|
485
|
+
type ParamsForProvider<P> = P extends "password" ? PasswordParams : P extends "email" ? EmailInitiateParams : P extends "anonymous" ? AnonymousParams | undefined : P extends "connection" ? ConnectionParams : P extends "webauthn" ? never : P extends undefined ? CodeCompletionParams : OAuthSignInParams | undefined;
|
|
486
|
+
/**
|
|
487
|
+
* Tuple-rest helper that flips `params` between required and optional based
|
|
488
|
+
* on whether `undefined` is in its resolved type.
|
|
489
|
+
*/
|
|
490
|
+
type SignInArgs<P> = undefined extends ParamsForProvider<P> ? [params?: ParamsForProvider<P>] : [params: ParamsForProvider<P>];
|
|
491
|
+
/**
|
|
492
|
+
* Public signature for `auth.signIn`. The provider literal discriminates the
|
|
493
|
+
* params shape via {@link ParamsForProvider}, and the params slot is
|
|
494
|
+
* automatically optional when the resolved type permits `undefined`.
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```ts
|
|
498
|
+
* auth.signIn("password", { flow: "signIn", email, password });
|
|
499
|
+
* auth.signIn("password", { flow: "change", email, currentPassword, newPassword });
|
|
500
|
+
* auth.signIn("anonymous"); // params optional
|
|
501
|
+
* ```
|
|
502
|
+
*/
|
|
503
|
+
type SignInOverloads = <const P extends string | undefined>(provider: P, ...args: SignInArgs<P>) => Promise<SignInResult>;
|
|
504
|
+
/** Base auth client — always present. */
|
|
505
|
+
interface AuthClientBase {
|
|
506
|
+
/** Restore initial auth state for the current runtime. */
|
|
507
|
+
initialize: () => Promise<void>;
|
|
508
|
+
/** SSR-safe query-param reader. */
|
|
509
|
+
param: (name: string) => string | null;
|
|
510
|
+
/**
|
|
511
|
+
* Pending invite recovered from the URL or storage, if present.
|
|
512
|
+
* @readonly
|
|
513
|
+
*/
|
|
514
|
+
readonly invite: PendingInvite | null;
|
|
515
|
+
/** Complete an OAuth callback using a URL or authorization code. */
|
|
516
|
+
completeOAuth: (input: URL | string | {
|
|
517
|
+
code: string;
|
|
518
|
+
}) => Promise<OAuthCompletionResult>;
|
|
519
|
+
/** Start a sign-in flow for a provider. */
|
|
520
|
+
signIn: SignInOverloads;
|
|
521
|
+
/** Sign out and clear local auth state. */
|
|
522
|
+
signOut: () => Promise<void>;
|
|
523
|
+
/** Subscribe to auth state changes; returns an unsubscribe. */
|
|
524
|
+
subscribe: (handler: AuthSubscriber) => () => void;
|
|
525
|
+
/** Read the current auth state synchronously, e.g. for `useSyncExternalStore`. */
|
|
526
|
+
getSnapshot: () => AuthState;
|
|
527
|
+
/** Tear down listeners and reject in-flight handshakes. */
|
|
528
|
+
destroy: () => void;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Framework-agnostic auth client return type.
|
|
532
|
+
*
|
|
533
|
+
* Conditionally includes `totp` and `device` helpers based on the
|
|
534
|
+
* capabilities in the `AuthApiRefs` type. Platform-specific `webauthn` helpers
|
|
535
|
+
* are added by {@link PlatformAuthClient}.
|
|
536
|
+
*
|
|
537
|
+
* @typeParam Api - An AuthApiRefs type that determines which factor helpers are included.
|
|
538
|
+
*/
|
|
539
|
+
type AuthClient<Api extends AuthApiRefs<boolean, boolean, boolean> = AuthApiRefs> = AuthClientBase & CapabilityClient<InferCaps<Api>["totp"], "totp", TotpClient> & CapabilityClient<InferCaps<Api>["device"], "device", DeviceClient>;
|
|
540
|
+
/**
|
|
541
|
+
* Browser auth client return type.
|
|
542
|
+
*
|
|
543
|
+
* Extends {@link AuthClient} with conditional WebAuthn helpers when the
|
|
544
|
+
* generated auth API exposes WebAuthn capabilities.
|
|
545
|
+
*
|
|
546
|
+
* @typeParam Api - An AuthApiRefs type that determines which factor helpers are included.
|
|
547
|
+
*/
|
|
548
|
+
type PlatformAuthClient<Api extends AuthApiRefs<boolean, boolean, boolean> = AuthApiRefs> = AuthClient<Api> & CapabilityClient<InferCaps<Api>["webauthn"], "webauthn", WebAuthnClient>;
|
|
549
|
+
/** @deprecated Use `PlatformAuthClient`. */
|
|
550
|
+
type BrowserAuthClient<Api extends AuthApiRefs<boolean, boolean, boolean> = AuthApiRefs> = PlatformAuthClient<Api>;
|
|
551
|
+
/**
|
|
552
|
+
* Options for {@link client}.
|
|
553
|
+
*
|
|
554
|
+
* @typeParam Api - An AuthApiRefs type.
|
|
555
|
+
*/
|
|
556
|
+
type ClientOptions<Api extends AuthApiRefs<boolean, boolean, boolean> = AuthApiRefs> = {
|
|
557
|
+
/** Any Convex client implementation used to run auth actions. */convex: ConvexTransport; /** Platform runtime implementation used by the client core. */
|
|
558
|
+
runtime?: ClientRuntime; /** Platform-specific factor adapters supplied by higher-level entrypoints. */
|
|
559
|
+
adapters?: ClientAdapters; /** Platform-specific adapter factories supplied by higher-level entrypoints. */
|
|
560
|
+
adapterFactories?: ClientAdapterFactories;
|
|
561
|
+
/**
|
|
562
|
+
* Typed auth function refs from your generated `api` object.
|
|
563
|
+
* Required outside proxy mode.
|
|
564
|
+
*/
|
|
565
|
+
api?: Api; /** Explicit Convex deployment URL when it cannot be inferred from the client. */
|
|
566
|
+
url?: string;
|
|
567
|
+
/**
|
|
568
|
+
* Optional action-only transport for direct code exchange outside proxy mode.
|
|
569
|
+
* Required in non-browser runtimes when `proxyPath` is not set.
|
|
570
|
+
*/
|
|
571
|
+
httpClient?: ActionTransport | null;
|
|
572
|
+
/**
|
|
573
|
+
* Storage backend for persisted tokens.
|
|
574
|
+
*
|
|
575
|
+
* Defaults to `runtime.storage` when provided, otherwise `null`.
|
|
576
|
+
*/
|
|
577
|
+
storage?: Storage | null;
|
|
578
|
+
/**
|
|
579
|
+
* Server-known auth used to seed the synchronous boot so SSR and hydration
|
|
580
|
+
* render the resolved state on first paint. A non-empty JWT boots signed in;
|
|
581
|
+
* `null` boots signed out. Providing this at all marks auth as resolved, so
|
|
582
|
+
* the client skips the loading phase. Omit it (leave `undefined`) to read the
|
|
583
|
+
* persisted value from `storage` instead. Ongoing persistence always uses
|
|
584
|
+
* `storage`.
|
|
585
|
+
*/
|
|
586
|
+
token?: string | null;
|
|
587
|
+
/**
|
|
588
|
+
* Proxy endpoint used instead of direct Convex auth calls.
|
|
589
|
+
* When set, provide `runtime.proxy` and omit direct `api`/`httpClient`
|
|
590
|
+
* transport requirements.
|
|
591
|
+
*/
|
|
592
|
+
proxyPath?: string; /** SSR-safe URL source for reading query parameters. */
|
|
593
|
+
location?: URL | (() => URL | null);
|
|
594
|
+
/**
|
|
595
|
+
* Default OAuth `redirectTo` applied to `signIn` calls that omit it. Platform
|
|
596
|
+
* entrypoints set this (e.g. Expo passes its native redirect URI) so the core
|
|
597
|
+
* can build the authorization URL without a platform-specific `signIn` wrapper.
|
|
598
|
+
*/
|
|
599
|
+
oauthRedirectTo?: string;
|
|
600
|
+
/**
|
|
601
|
+
* Milliseconds to wait for the Convex client to confirm a new token
|
|
602
|
+
* before a sign-in handshake rejects with `AUTH_HANDSHAKE_TIMEOUT`.
|
|
603
|
+
* Defaults to `5000`.
|
|
604
|
+
*/
|
|
605
|
+
handshakeTimeoutMs?: number;
|
|
606
|
+
};
|
|
607
|
+
type OAuthCompletionResult = {
|
|
608
|
+
handled: false;
|
|
609
|
+
} | {
|
|
610
|
+
handled: true;
|
|
611
|
+
cleanupUrl: URL | null;
|
|
612
|
+
};
|
|
613
|
+
//#endregion
|
|
614
|
+
export { AnonymousParams, AuthApiRefs, AuthClient, AuthState, BrowserAuthClient, ClientOptions, ClientRuntime, CodeCompletionParams, ConnectionParams, DeviceClient, DeviceCodeResult, DevicePollParams, DeviceVerifyParams, EmailInitiateParams, OAuthCompletionResult, OAuthSignInParams, ParamsForProvider, PasswordParams, PendingInvite, PlatformAuthClient, SignInOverloads, SignInResult, Storage, TotpClient, TotpConfirmParams, TotpSetupOptions, TotpSetupResult, TotpVerifyParams, WebAuthnClient, WebAuthnRegisterOptions, WebAuthnSignInOptions };
|
|
615
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/client/core/types.ts
|
|
2
|
+
/**
|
|
3
|
+
* Create a deferred promise that can be resolved or rejected externally.
|
|
4
|
+
*
|
|
5
|
+
* @returns A deferred object containing the promise and control methods.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function createDeferred() {
|
|
9
|
+
let resolve;
|
|
10
|
+
let reject;
|
|
11
|
+
return {
|
|
12
|
+
promise: new Promise((res, rej) => {
|
|
13
|
+
resolve = res;
|
|
14
|
+
reject = rej;
|
|
15
|
+
}),
|
|
16
|
+
resolve,
|
|
17
|
+
reject
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { createDeferred };
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ErrorCode } from "../shared/codes.js";
|
|
2
|
+
import { ConvexError } from "convex/values";
|
|
3
|
+
|
|
4
|
+
//#region src/client/errors.ts
|
|
5
|
+
/**
|
|
6
|
+
* Client-side error-code registry.
|
|
7
|
+
*
|
|
8
|
+
* Re-exports the shared {@link ErrorCode} registry and adds the handshake codes
|
|
9
|
+
* that are meaningful only in the client (they describe the browser⇄Convex
|
|
10
|
+
* confirmation handshake, not a server outcome), so client code has a single
|
|
11
|
+
* import surface for every code it can surface.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
const HANDSHAKE_ERROR_MESSAGES = {
|
|
16
|
+
AUTH_HANDSHAKE_TIMEOUT: "Sign-in succeeded but authentication confirmation timed out.",
|
|
17
|
+
AUTH_HANDSHAKE_REJECTED: "Authentication was rejected while confirming the session."
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
const createHandshakeError = (code, context) => {
|
|
21
|
+
return new ConvexError({
|
|
22
|
+
code,
|
|
23
|
+
message: HANDSHAKE_ERROR_MESSAGES[code],
|
|
24
|
+
...context
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { createHandshakeError };
|
|
30
|
+
//# sourceMappingURL=errors.js.map
|