@dbx-tools/tunnel 0.9.202 → 0.9.205

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/src/plugin.ts CHANGED
@@ -102,6 +102,7 @@ export const AuthGateConfigSchema = AuthStorageConfigSchema.extend({
102
102
  allow: textOrList("Email allow-list patterns."),
103
103
  subject: text("Verification email subject."),
104
104
  brandName: text("Verification email brand name."),
105
+ passkeys: z.boolean().optional().describe("Passkey sign-in and enrollment."),
105
106
  passkeyNamePrefix: text("Prefix for humanized tunnel passkey names."),
106
107
  message: text("Verification email message."),
107
108
  sessionTtlSeconds: z.coerce
@@ -151,6 +152,7 @@ export interface ResolvedAuthGateConfig {
151
152
  allow: string[];
152
153
  subject: string;
153
154
  brandName: string;
155
+ passkeys: boolean;
154
156
  passkeyNamePrefix: string;
155
157
  message: string;
156
158
  sessionTtlSeconds: number;
@@ -182,6 +184,7 @@ const DEFAULTS = {
182
184
  // `branding/brand.yaml` overrides it by passing `brandName`; the shared default
183
185
  // is the fallback when nothing is configured.
184
186
  brandName: defaultBrandContext.name,
187
+ passkeys: true,
185
188
  message: "Your verification code is:",
186
189
  // 30 days, the same window the cache-backed signing key is stored for.
187
190
  sessionTtlSeconds: KEY_TTL_SECONDS,
@@ -213,6 +216,7 @@ export function resolveAuthGateConfig(config: AuthGateConfig): ResolvedAuthGateC
213
216
  ],
214
217
  subject: string(config.subject, "TUNNEL_AUTH_SUBJECT", TUNNEL_CONFIG) ?? DEFAULTS.subject,
215
218
  brandName,
219
+ passkeys: boolean(config.passkeys, "TUNNEL_AUTH_PASSKEYS", TUNNEL_CONFIG) ?? DEFAULTS.passkeys,
216
220
  passkeyNamePrefix:
217
221
  string(config.passkeyNamePrefix, "TUNNEL_AUTH_PASSKEY_NAME_PREFIX", TUNNEL_CONFIG) ??
218
222
  projectUtils.name(),
@@ -344,6 +348,7 @@ export class AuthGatePlugin extends Plugin<AuthGateConfig> {
344
348
  trustedOrigins: [origin],
345
349
  basePath: AUTH_BASE_PATH,
346
350
  appName: this.resolved.brandName,
351
+ passkeys: this.resolved.passkeys,
347
352
  passkeyNamePrefix: this.resolved.passkeyNamePrefix,
348
353
  secret: Buffer.from(key).toString("base64url"),
349
354
  sessionTtlSeconds: this.resolved.sessionTtlSeconds,
@@ -370,6 +375,7 @@ export class AuthGatePlugin extends Plugin<AuthGateConfig> {
370
375
  sessionTtlSeconds: this.resolved.sessionTtlSeconds,
371
376
  publicDomains: this.resolved.publicDomains,
372
377
  insecure: this.resolved.insecure,
378
+ passkeys: this.resolved.passkeys,
373
379
  storage: this.resolved.storage,
374
380
  logoutRedirectPath: this.resolved.logoutRedirectPath,
375
381
  sessionCutoff:
package/src/portr.ts CHANGED
@@ -37,15 +37,6 @@ export interface PortrInstallOptions {
37
37
  homeDir?: string;
38
38
  }
39
39
 
40
- /** Resolved portr wiring, or `undefined` when no tunnel is configured. */
41
- export interface PortrConfig {
42
- subdomain: string;
43
- server: string;
44
- sshUrl: string;
45
- token: string;
46
- port: number;
47
- }
48
-
49
40
  export const PortrOptionsSchema = z
50
41
  .object({
51
42
  publicDomain: z.string().trim().min(1).optional().describe("Public tunnel domain."),
@@ -59,6 +50,17 @@ export const PortrOptionsSchema = z
59
50
 
60
51
  export type PortrOptions = z.input<typeof PortrOptionsSchema>;
61
52
 
53
+ /** Resolved control endpoint and credentials derived from Portr options. */
54
+ export const PortrConfigSchema = PortrOptionsSchema.omit({ publicDomain: true })
55
+ .required()
56
+ .extend({
57
+ server: PortrOptionsSchema.shape.publicDomain.unwrap().describe("Portr control host."),
58
+ })
59
+ .describe("Resolved Portr tunnel configuration.");
60
+
61
+ /** Resolved portr wiring, or `undefined` when no tunnel is configured. */
62
+ export type PortrConfig = z.output<typeof PortrConfigSchema>;
63
+
62
64
  /**
63
65
  * Resolve portr config from `TUNNEL_PUBLIC_DOMAIN` + `PORTR_TOKEN`, or an
64
66
  * explicit `subdomain`. The domain is `<subdomain>.<server>` (e.g.