@camstack/types 1.1.37 → 1.1.39

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.
@@ -40,6 +40,15 @@ import { type InferProvider } from './capability-definition.js';
40
40
  * - `listPasskeys({userId})` — enumerate user's enrolled credentials.
41
41
  * - `removePasskey({userId, credentialId})` — revoke one credential.
42
42
  *
43
+ * 4. Second-factor preference (opt-in, default OFF):
44
+ * Enrolling a passkey only enables passkey-FIRST sign-in. It is
45
+ * demanded as a second factor after a password login ONLY when the
46
+ * user explicitly opts in via `setSecondFactorPreference`.
47
+ * - `getSecondFactorPreference({userId})` → `{ enabled }` (missing
48
+ * row ⇒ `enabled: false`).
49
+ * - `setSecondFactorPreference({userId, enabled})` — persisted by
50
+ * the providing addon beside its credentials.
51
+ *
43
52
  * Challenges are short-lived (5 min, in-memory). The cap is internal —
44
53
  * the admin-ui composes the begin/finish round-trip and never exposes
45
54
  * the cap to non-admins.
@@ -107,6 +116,17 @@ export declare const userPasskeysCapability: {
107
116
  }, z.core.$strip>, z.ZodObject<{
108
117
  success: z.ZodLiteral<true>;
109
118
  }, z.core.$strip>, "mutation">;
119
+ readonly getSecondFactorPreference: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
120
+ userId: z.ZodString;
121
+ }, z.core.$strip>, z.ZodObject<{
122
+ enabled: z.ZodBoolean;
123
+ }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
124
+ readonly setSecondFactorPreference: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
125
+ userId: z.ZodString;
126
+ enabled: z.ZodBoolean;
127
+ }, z.core.$strip>, z.ZodObject<{
128
+ success: z.ZodLiteral<true>;
129
+ }, z.core.$strip>, "mutation">;
110
130
  };
111
131
  };
112
132
  export type IUserPasskeysProvider = InferProvider<typeof userPasskeysCapability>;
@@ -714,6 +714,44 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
714
714
  };
715
715
  meta: object;
716
716
  }>;
717
+ exchangeSession: import("@trpc/server").TRPCMutationProcedure<{
718
+ input: Record<string, never> | undefined;
719
+ output: {
720
+ token: string;
721
+ user: {
722
+ id: string;
723
+ username: string;
724
+ isAdmin: boolean;
725
+ };
726
+ requiresTotp?: boolean | undefined;
727
+ secondFactors?: ("totp" | "passkey")[] | undefined;
728
+ };
729
+ meta: object;
730
+ }>;
731
+ createHandoffCode: import("@trpc/server").TRPCMutationProcedure<{
732
+ input: void;
733
+ output: {
734
+ code: string;
735
+ expiresAt: number;
736
+ };
737
+ meta: object;
738
+ }>;
739
+ redeemHandoffCode: import("@trpc/server").TRPCMutationProcedure<{
740
+ input: {
741
+ code: string;
742
+ };
743
+ output: {
744
+ token: string;
745
+ user: {
746
+ id: string;
747
+ username: string;
748
+ isAdmin: boolean;
749
+ };
750
+ requiresTotp?: boolean | undefined;
751
+ secondFactors?: ("totp" | "passkey")[] | undefined;
752
+ };
753
+ meta: object;
754
+ }>;
717
755
  me: import("@trpc/server").TRPCQueryProcedure<{
718
756
  input: void;
719
757
  output: {
@@ -810,6 +848,22 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
810
848
  };
811
849
  meta: object;
812
850
  }>;
851
+ getOwnPasskeySecondFactorPreference: import("@trpc/server").TRPCQueryProcedure<{
852
+ input: void;
853
+ output: {
854
+ enabled: boolean;
855
+ };
856
+ meta: object;
857
+ }>;
858
+ setOwnPasskeySecondFactorPreference: import("@trpc/server").TRPCMutationProcedure<{
859
+ input: {
860
+ enabled: boolean;
861
+ };
862
+ output: {
863
+ success: true;
864
+ };
865
+ meta: object;
866
+ }>;
813
867
  createShareToken: import("@trpc/server").TRPCMutationProcedure<{
814
868
  input: {
815
869
  scope: {
@@ -14196,6 +14250,27 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
14196
14250
  };
14197
14251
  meta: object;
14198
14252
  }>;
14253
+ getSecondFactorPreference: import("@trpc/server").TRPCQueryProcedure<{
14254
+ input: {
14255
+ [x: string]: unknown;
14256
+ userId: string;
14257
+ };
14258
+ output: {
14259
+ enabled: boolean;
14260
+ };
14261
+ meta: object;
14262
+ }>;
14263
+ setSecondFactorPreference: import("@trpc/server").TRPCMutationProcedure<{
14264
+ input: {
14265
+ [x: string]: unknown;
14266
+ userId: string;
14267
+ enabled: boolean;
14268
+ };
14269
+ output: {
14270
+ success: true;
14271
+ };
14272
+ meta: object;
14273
+ }>;
14199
14274
  }>>;
14200
14275
  vacuumControl: import("@trpc/server").TRPCBuiltRouter<{
14201
14276
  ctx: TrpcContext;
@@ -15542,6 +15617,44 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
15542
15617
  };
15543
15618
  meta: object;
15544
15619
  }>;
15620
+ exchangeSession: import("@trpc/server").TRPCMutationProcedure<{
15621
+ input: Record<string, never> | undefined;
15622
+ output: {
15623
+ token: string;
15624
+ user: {
15625
+ id: string;
15626
+ username: string;
15627
+ isAdmin: boolean;
15628
+ };
15629
+ requiresTotp?: boolean | undefined;
15630
+ secondFactors?: ("totp" | "passkey")[] | undefined;
15631
+ };
15632
+ meta: object;
15633
+ }>;
15634
+ createHandoffCode: import("@trpc/server").TRPCMutationProcedure<{
15635
+ input: void;
15636
+ output: {
15637
+ code: string;
15638
+ expiresAt: number;
15639
+ };
15640
+ meta: object;
15641
+ }>;
15642
+ redeemHandoffCode: import("@trpc/server").TRPCMutationProcedure<{
15643
+ input: {
15644
+ code: string;
15645
+ };
15646
+ output: {
15647
+ token: string;
15648
+ user: {
15649
+ id: string;
15650
+ username: string;
15651
+ isAdmin: boolean;
15652
+ };
15653
+ requiresTotp?: boolean | undefined;
15654
+ secondFactors?: ("totp" | "passkey")[] | undefined;
15655
+ };
15656
+ meta: object;
15657
+ }>;
15545
15658
  me: import("@trpc/server").TRPCQueryProcedure<{
15546
15659
  input: void;
15547
15660
  output: {
@@ -15638,6 +15751,22 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
15638
15751
  };
15639
15752
  meta: object;
15640
15753
  }>;
15754
+ getOwnPasskeySecondFactorPreference: import("@trpc/server").TRPCQueryProcedure<{
15755
+ input: void;
15756
+ output: {
15757
+ enabled: boolean;
15758
+ };
15759
+ meta: object;
15760
+ }>;
15761
+ setOwnPasskeySecondFactorPreference: import("@trpc/server").TRPCMutationProcedure<{
15762
+ input: {
15763
+ enabled: boolean;
15764
+ };
15765
+ output: {
15766
+ success: true;
15767
+ };
15768
+ meta: object;
15769
+ }>;
15641
15770
  createShareToken: import("@trpc/server").TRPCMutationProcedure<{
15642
15771
  input: {
15643
15772
  scope: {
@@ -29024,6 +29153,27 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
29024
29153
  };
29025
29154
  meta: object;
29026
29155
  }>;
29156
+ getSecondFactorPreference: import("@trpc/server").TRPCQueryProcedure<{
29157
+ input: {
29158
+ [x: string]: unknown;
29159
+ userId: string;
29160
+ };
29161
+ output: {
29162
+ enabled: boolean;
29163
+ };
29164
+ meta: object;
29165
+ }>;
29166
+ setSecondFactorPreference: import("@trpc/server").TRPCMutationProcedure<{
29167
+ input: {
29168
+ [x: string]: unknown;
29169
+ userId: string;
29170
+ enabled: boolean;
29171
+ };
29172
+ output: {
29173
+ success: true;
29174
+ };
29175
+ meta: object;
29176
+ }>;
29027
29177
  }>>;
29028
29178
  vacuumControl: import("@trpc/server").TRPCBuiltRouter<{
29029
29179
  ctx: TrpcContext;
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 732 method paths across 112 capabilities.
9
+ * Coverage: 734 method paths across 112 capabilities.
10
10
  */
11
11
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
12
12
  export interface MethodAccessRecord {
package/dist/index.js CHANGED
@@ -19175,6 +19175,15 @@ getTurnServers: require_sleep.method(zod.z.void(), zod.z.array(TurnServerSchema)
19175
19175
  * - `listPasskeys({userId})` — enumerate user's enrolled credentials.
19176
19176
  * - `removePasskey({userId, credentialId})` — revoke one credential.
19177
19177
  *
19178
+ * 4. Second-factor preference (opt-in, default OFF):
19179
+ * Enrolling a passkey only enables passkey-FIRST sign-in. It is
19180
+ * demanded as a second factor after a password login ONLY when the
19181
+ * user explicitly opts in via `setSecondFactorPreference`.
19182
+ * - `getSecondFactorPreference({userId})` → `{ enabled }` (missing
19183
+ * row ⇒ `enabled: false`).
19184
+ * - `setSecondFactorPreference({userId, enabled})` — persisted by
19185
+ * the providing addon beside its credentials.
19186
+ *
19178
19187
  * Challenges are short-lived (5 min, in-memory). The cap is internal —
19179
19188
  * the admin-ui composes the begin/finish round-trip and never exposes
19180
19189
  * the cap to non-admins.
@@ -19248,6 +19257,15 @@ response: zod.z.record(zod.z.string(), zod.z.unknown()) }), zod.z.object({
19248
19257
  kind: "mutation",
19249
19258
  auth: "admin",
19250
19259
  access: "delete"
19260
+ }),
19261
+ getSecondFactorPreference: require_sleep.method(zod.z.object({ userId: zod.z.string() }), zod.z.object({ enabled: zod.z.boolean() }), { auth: "admin" }),
19262
+ setSecondFactorPreference: require_sleep.method(zod.z.object({
19263
+ userId: zod.z.string(),
19264
+ enabled: zod.z.boolean()
19265
+ }), zod.z.object({ success: zod.z.literal(true) }), {
19266
+ kind: "mutation",
19267
+ auth: "admin",
19268
+ access: "create"
19251
19269
  })
19252
19270
  }
19253
19271
  };
@@ -27948,6 +27966,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
27948
27966
  addonId: null,
27949
27967
  access: "create"
27950
27968
  },
27969
+ "userPasskeys.getSecondFactorPreference": {
27970
+ capName: "user-passkeys",
27971
+ capScope: "system",
27972
+ addonId: null,
27973
+ access: "view"
27974
+ },
27951
27975
  "userPasskeys.listPasskeys": {
27952
27976
  capName: "user-passkeys",
27953
27977
  capScope: "system",
@@ -27960,6 +27984,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
27960
27984
  addonId: null,
27961
27985
  access: "delete"
27962
27986
  },
27987
+ "userPasskeys.setSecondFactorPreference": {
27988
+ capName: "user-passkeys",
27989
+ capScope: "system",
27990
+ addonId: null,
27991
+ access: "create"
27992
+ },
27963
27993
  "vacuumControl.locate": {
27964
27994
  capName: "vacuum-control",
27965
27995
  capScope: "device",
package/dist/index.mjs CHANGED
@@ -19174,6 +19174,15 @@ getTurnServers: method(z.void(), z.array(TurnServerSchema).readonly()) }
19174
19174
  * - `listPasskeys({userId})` — enumerate user's enrolled credentials.
19175
19175
  * - `removePasskey({userId, credentialId})` — revoke one credential.
19176
19176
  *
19177
+ * 4. Second-factor preference (opt-in, default OFF):
19178
+ * Enrolling a passkey only enables passkey-FIRST sign-in. It is
19179
+ * demanded as a second factor after a password login ONLY when the
19180
+ * user explicitly opts in via `setSecondFactorPreference`.
19181
+ * - `getSecondFactorPreference({userId})` → `{ enabled }` (missing
19182
+ * row ⇒ `enabled: false`).
19183
+ * - `setSecondFactorPreference({userId, enabled})` — persisted by
19184
+ * the providing addon beside its credentials.
19185
+ *
19177
19186
  * Challenges are short-lived (5 min, in-memory). The cap is internal —
19178
19187
  * the admin-ui composes the begin/finish round-trip and never exposes
19179
19188
  * the cap to non-admins.
@@ -19247,6 +19256,15 @@ response: z.record(z.string(), z.unknown()) }), z.object({
19247
19256
  kind: "mutation",
19248
19257
  auth: "admin",
19249
19258
  access: "delete"
19259
+ }),
19260
+ getSecondFactorPreference: method(z.object({ userId: z.string() }), z.object({ enabled: z.boolean() }), { auth: "admin" }),
19261
+ setSecondFactorPreference: method(z.object({
19262
+ userId: z.string(),
19263
+ enabled: z.boolean()
19264
+ }), z.object({ success: z.literal(true) }), {
19265
+ kind: "mutation",
19266
+ auth: "admin",
19267
+ access: "create"
19250
19268
  })
19251
19269
  }
19252
19270
  };
@@ -27947,6 +27965,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
27947
27965
  addonId: null,
27948
27966
  access: "create"
27949
27967
  },
27968
+ "userPasskeys.getSecondFactorPreference": {
27969
+ capName: "user-passkeys",
27970
+ capScope: "system",
27971
+ addonId: null,
27972
+ access: "view"
27973
+ },
27950
27974
  "userPasskeys.listPasskeys": {
27951
27975
  capName: "user-passkeys",
27952
27976
  capScope: "system",
@@ -27959,6 +27983,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
27959
27983
  addonId: null,
27960
27984
  access: "delete"
27961
27985
  },
27986
+ "userPasskeys.setSecondFactorPreference": {
27987
+ capName: "user-passkeys",
27988
+ capScope: "system",
27989
+ addonId: null,
27990
+ access: "create"
27991
+ },
27962
27992
  "vacuumControl.locate": {
27963
27993
  capName: "vacuum-control",
27964
27994
  capScope: "device",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.1.37",
3
+ "version": "1.1.39",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",