@guinetik/primitives-ts 0.1.2 → 0.2.1

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 CHANGED
@@ -1,87 +1,87 @@
1
- # @guinetik/primitives-ts
2
-
3
- Shared TypeScript primitives for Guinetik projects.
4
-
5
- ## Overview
6
-
7
- This package contains pure TypeScript type definitions and interfaces used across the Guinetik ecosystem. It provides a single source of truth for data contracts between frontend and backend applications.
8
-
9
- ## Features
10
-
11
- - ✅ **Pure TypeScript** - No runtime dependencies
12
- - ✅ **Type-safe** - Full TypeScript support with declaration files
13
- - ✅ **Lightweight** - Minimal bundle size
14
- - ✅ **Universal** - Works in Node.js, browsers, and other JavaScript runtimes
15
-
16
- ## Installation
17
-
18
- ```bash
19
- npm install @guinetik/primitives-ts
20
- ```
21
-
22
- ## Usage
23
-
24
- ```typescript
25
- import { User, SystemMetrics, Container } from '@guinetik/primitives-ts';
26
-
27
- // Use the types in your application
28
- const user: User = {
29
- uid: '123',
30
- email: 'user@example.com',
31
- displayName: 'John Doe'
32
- };
33
-
34
- const metrics: SystemMetrics = {
35
- cpu: { usage: 45.2, cores: 4, model: 'Intel Xeon' },
36
- memory: { used: 8, total: 16, percentage: 50 },
37
- disk: { used: 100, total: 500, percentage: 20 },
38
- uptime: 86400,
39
- timestamp: new Date()
40
- };
41
- ```
42
-
43
- ## Type Categories
44
-
45
- ### Authentication (`auth.types.ts`)
46
- - `User` - User information
47
- - `AuthResponse` - Authentication response
48
- - `AuthProvider` - Authentication provider types
49
- - `UserUpdateData` - User profile update data
50
- - `LoginPayload` - Login request payload
51
-
52
- ### System Monitoring (`system.types.ts`)
53
- - `SystemMetrics` - System metrics (CPU, memory, disk)
54
- - `Container` - Docker container information
55
- - `LogEntry` - Container log entry
56
- - `NetworkStats` - Network statistics
57
- - `DeploymentInfo` - Deployment information
58
- - `CommandResult` - Shell command execution result
59
-
60
- ### Website Content (`website.types.ts`)
61
- - `SiteContent` - Full site content structure
62
- - `SiteMetadata` - Site metadata
63
- - `Menu`, `MenuItem` - Navigation menu
64
- - `Theme`, `ThemeConfig` - Theme configuration
65
- - `Card`, `Tag` - Project/demo cards with tags
66
- - `Experiment` - CodePen experiments
67
- - `AboutSection`, `ProjectsSection`, `DemosSection`, `ReposSection` - Content sections
68
-
69
- ## Development
70
-
71
- ```bash
72
- # Build the package
73
- npm run build
74
-
75
- # The build output will be in the dist/ folder
76
- ```
77
-
78
- ## Publishing
79
-
80
- ```bash
81
- # Publish to npm (requires authentication)
82
- npm publish --access public
83
- ```
84
-
85
- ## License
86
-
87
- MIT © Guinetik
1
+ # @guinetik/primitives-ts
2
+
3
+ Shared TypeScript primitives for Guinetik projects.
4
+
5
+ ## Overview
6
+
7
+ This package contains pure TypeScript type definitions and interfaces used across the Guinetik ecosystem. It provides a single source of truth for data contracts between frontend and backend applications.
8
+
9
+ ## Features
10
+
11
+ - ✅ **Pure TypeScript** - No runtime dependencies
12
+ - ✅ **Type-safe** - Full TypeScript support with declaration files
13
+ - ✅ **Lightweight** - Minimal bundle size
14
+ - ✅ **Universal** - Works in Node.js, browsers, and other JavaScript runtimes
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @guinetik/primitives-ts
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```typescript
25
+ import { User, SystemMetrics, Container } from '@guinetik/primitives-ts';
26
+
27
+ // Use the types in your application
28
+ const user: User = {
29
+ uid: '123',
30
+ email: 'user@example.com',
31
+ displayName: 'John Doe'
32
+ };
33
+
34
+ const metrics: SystemMetrics = {
35
+ cpu: { usage: 45.2, cores: 4, model: 'Intel Xeon' },
36
+ memory: { used: 8, total: 16, percentage: 50 },
37
+ disk: { used: 100, total: 500, percentage: 20 },
38
+ uptime: 86400,
39
+ timestamp: new Date()
40
+ };
41
+ ```
42
+
43
+ ## Type Categories
44
+
45
+ ### Authentication (`auth.types.ts`)
46
+ - `User` - User information
47
+ - `AuthResponse` - Authentication response
48
+ - `AuthProvider` - Authentication provider types
49
+ - `UserUpdateData` - User profile update data
50
+ - `LoginPayload` - Login request payload
51
+
52
+ ### System Monitoring (`system.types.ts`)
53
+ - `SystemMetrics` - System metrics (CPU, memory, disk)
54
+ - `Container` - Docker container information
55
+ - `LogEntry` - Container log entry
56
+ - `NetworkStats` - Network statistics
57
+ - `DeploymentInfo` - Deployment information
58
+ - `CommandResult` - Shell command execution result
59
+
60
+ ### Website Content (`website.types.ts`)
61
+ - `SiteContent` - Full site content structure
62
+ - `SiteMetadata` - Site metadata
63
+ - `Menu`, `MenuItem` - Navigation menu
64
+ - `Theme`, `ThemeConfig` - Theme configuration
65
+ - `Card`, `Tag` - Project/demo cards with tags
66
+ - `Experiment` - CodePen experiments
67
+ - `AboutSection`, `ProjectsSection`, `DemosSection`, `ReposSection` - Content sections
68
+
69
+ ## Development
70
+
71
+ ```bash
72
+ # Build the package
73
+ npm run build
74
+
75
+ # The build output will be in the dist/ folder
76
+ ```
77
+
78
+ ## Publishing
79
+
80
+ ```bash
81
+ # Publish to npm (requires authentication)
82
+ npm publish --access public
83
+ ```
84
+
85
+ ## License
86
+
87
+ MIT © Guinetik
package/dist/index.d.ts CHANGED
@@ -12,4 +12,7 @@ export * from './system.types';
12
12
  export * from './website.types';
13
13
  export * from './firestore.types';
14
14
  export * from './website-firestore.types';
15
+ export * from './totp.types';
16
+ export type { Security, SecurityChallengeOptions, SecurityChallengeResult } from './security.interface';
17
+ export { SecurityLevel } from './security.interface';
15
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,cAAc,CAAC;AAG7B,YAAY,EAAE,QAAQ,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
23
23
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.SecurityLevel = void 0;
26
27
  // Auth types
27
28
  __exportStar(require("./auth.types"), exports);
28
29
  // System monitoring types
@@ -33,3 +34,7 @@ __exportStar(require("./website.types"), exports);
33
34
  __exportStar(require("./firestore.types"), exports);
34
35
  // Website Firestore document types (backend only)
35
36
  __exportStar(require("./website-firestore.types"), exports);
37
+ // TOTP/2FA types
38
+ __exportStar(require("./totp.types"), exports);
39
+ var security_interface_1 = require("./security.interface");
40
+ Object.defineProperty(exports, "SecurityLevel", { enumerable: true, get: function () { return security_interface_1.SecurityLevel; } });
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Security Clearance Levels
3
+ *
4
+ * Hierarchical security levels similar to log levels.
5
+ * Higher numbers = stronger security requirements.
6
+ *
7
+ * Usage:
8
+ * - Sensitive operations specify minimum required level
9
+ * - System selects appropriate challenge based on user's available methods
10
+ * - User must have a method at or above the required level
11
+ *
12
+ * Example:
13
+ * ```typescript
14
+ * // Shell execution requires at least 2FA
15
+ * const executeCommand = withSecurityChallenge(fn, {
16
+ * minLevel: SecurityLevel.TWO_FACTOR
17
+ * });
18
+ * ```
19
+ */
20
+ export declare enum SecurityLevel {
21
+ /** Password confirmation - baseline, everyone has this */
22
+ PASSWORD = 1,
23
+ /** Two-factor authentication - authenticator app codes */
24
+ TWO_FACTOR = 2,
25
+ /** Biometric verification - fingerprint, face ID, etc. */
26
+ BIOMETRIC = 3,
27
+ /** Hardware security key - YubiKey, etc. */
28
+ HARDWARE_KEY = 4
29
+ }
30
+ /**
31
+ * Security Challenge Options
32
+ *
33
+ * Configuration for security challenge dialogs and verification flows
34
+ */
35
+ export interface SecurityChallengeOptions {
36
+ /** Minimum security level required (defaults to PASSWORD) */
37
+ minLevel?: SecurityLevel;
38
+ /** Title shown in the challenge dialog */
39
+ title?: string;
40
+ /** Description/reason for the security challenge */
41
+ message?: string;
42
+ /** Additional context passed to the implementation */
43
+ context?: Record<string, any>;
44
+ }
45
+ /**
46
+ * Security - Abstract Security Challenge Interface
47
+ *
48
+ * Base interface for all security challenge implementations (2FA, biometric, SMS, etc.).
49
+ * Each implementation handles its own UI (dialog) and verification logic.
50
+ *
51
+ * Design Pattern: Strategy Pattern
52
+ * - Different security methods implement this interface
53
+ * - Each strategy encapsulates its own verification logic
54
+ * - Consumers don't need to know the implementation details
55
+ *
56
+ * Example Implementations:
57
+ * - Security2FactorChallenge (TOTP/authenticator apps)
58
+ * - SecurityBiometricChallenge (fingerprint/face ID)
59
+ * - SecuritySmsChallenge (SMS verification codes)
60
+ * - SecurityEmailChallenge (email verification codes)
61
+ *
62
+ * Usage:
63
+ * ```typescript
64
+ * const twoFactorSecurity = new Security2FactorChallenge();
65
+ * const verified = await twoFactorSecurity.challenge(userId, {
66
+ * title: 'Delete Account',
67
+ * message: 'This action cannot be undone'
68
+ * });
69
+ *
70
+ * if (verified) {
71
+ * // Proceed with sensitive operation
72
+ * }
73
+ * ```
74
+ */
75
+ export interface Security {
76
+ /**
77
+ * Initiates a security challenge for the user
78
+ *
79
+ * Shows the appropriate UI (dialog, prompt, biometric scanner, etc.)
80
+ * and waits for the user to complete the challenge.
81
+ *
82
+ * The promise resolves to:
83
+ * - `true` if the challenge succeeds (user verified)
84
+ * - `false` if the challenge fails or is cancelled
85
+ *
86
+ * Implementation Note:
87
+ * Each concrete implementation should:
88
+ * 1. Show its own UI (dialog, modal, native prompt, etc.)
89
+ * 2. Wait for user input/interaction
90
+ * 3. Verify the credentials/input
91
+ * 4. Resolve the promise based on verification result
92
+ *
93
+ * @param uid - User ID to verify against
94
+ * @param options - Challenge customization options
95
+ * @returns Promise resolving to true if verified, false otherwise
96
+ */
97
+ challenge(uid: string, options?: SecurityChallengeOptions): Promise<boolean>;
98
+ /**
99
+ * Gets the type identifier for this security implementation
100
+ *
101
+ * Used by the SecurityService registry to identify and retrieve
102
+ * the correct implementation.
103
+ *
104
+ * Examples: '2fa', 'biometric', 'password', 'hardware-key'
105
+ *
106
+ * @returns Unique identifier for this security type
107
+ */
108
+ getType(): string;
109
+ /**
110
+ * Gets the security level of this implementation
111
+ *
112
+ * Used by SecurityService to determine if this method meets
113
+ * the minimum required security level for an operation.
114
+ *
115
+ * @returns SecurityLevel enum value
116
+ */
117
+ getLevel(): SecurityLevel;
118
+ /**
119
+ * Checks if this security method is available for the user
120
+ *
121
+ * Some security methods may not be available depending on:
122
+ * - User hasn't enrolled (e.g., no 2FA setup)
123
+ * - Device capabilities (e.g., no biometric sensor)
124
+ * - Browser support (e.g., WebAuthn not supported)
125
+ *
126
+ * @param uid - User ID to check availability for
127
+ * @returns Promise resolving to true if available, false otherwise
128
+ */
129
+ isAvailable(uid: string): Promise<boolean>;
130
+ }
131
+ /**
132
+ * Security Challenge Result
133
+ *
134
+ * Extended result object that implementations can optionally return
135
+ * with additional metadata about the challenge
136
+ */
137
+ export interface SecurityChallengeResult {
138
+ /** Whether the challenge succeeded */
139
+ verified: boolean;
140
+ /** Optional error message if verification failed */
141
+ error?: string;
142
+ /** Optional metadata (e.g., biometric sensor used, code expiry time) */
143
+ metadata?: Record<string, any>;
144
+ }
145
+ //# sourceMappingURL=security.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.interface.d.ts","sourceRoot":"","sources":["../src/security.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,oBAAY,aAAa;IACvB,0DAA0D;IAC1D,QAAQ,IAAI;IAEZ,0DAA0D;IAC1D,UAAU,IAAI;IAEd,0DAA0D;IAC1D,SAAS,IAAI;IAEb,4CAA4C;IAC5C,YAAY,IAAI;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7E;;;;;;;;;OASG;IACH,OAAO,IAAI,MAAM,CAAC;IAElB;;;;;;;OAOG;IACH,QAAQ,IAAI,aAAa,CAAC;IAE1B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5C;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,sCAAsC;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SecurityLevel = void 0;
4
+ /**
5
+ * Security Clearance Levels
6
+ *
7
+ * Hierarchical security levels similar to log levels.
8
+ * Higher numbers = stronger security requirements.
9
+ *
10
+ * Usage:
11
+ * - Sensitive operations specify minimum required level
12
+ * - System selects appropriate challenge based on user's available methods
13
+ * - User must have a method at or above the required level
14
+ *
15
+ * Example:
16
+ * ```typescript
17
+ * // Shell execution requires at least 2FA
18
+ * const executeCommand = withSecurityChallenge(fn, {
19
+ * minLevel: SecurityLevel.TWO_FACTOR
20
+ * });
21
+ * ```
22
+ */
23
+ var SecurityLevel;
24
+ (function (SecurityLevel) {
25
+ /** Password confirmation - baseline, everyone has this */
26
+ SecurityLevel[SecurityLevel["PASSWORD"] = 1] = "PASSWORD";
27
+ /** Two-factor authentication - authenticator app codes */
28
+ SecurityLevel[SecurityLevel["TWO_FACTOR"] = 2] = "TWO_FACTOR";
29
+ /** Biometric verification - fingerprint, face ID, etc. */
30
+ SecurityLevel[SecurityLevel["BIOMETRIC"] = 3] = "BIOMETRIC";
31
+ /** Hardware security key - YubiKey, etc. */
32
+ SecurityLevel[SecurityLevel["HARDWARE_KEY"] = 4] = "HARDWARE_KEY";
33
+ })(SecurityLevel || (exports.SecurityLevel = SecurityLevel = {}));
@@ -0,0 +1,95 @@
1
+ /**
2
+ * TOTP/2FA Types
3
+ * Types for Time-based One-Time Password authentication
4
+ */
5
+ import { FirestoreDocument } from './firestore.types';
6
+ /**
7
+ * Firestore document for TOTP secrets collection
8
+ * Collection: totp_secrets
9
+ * Document ID: Firebase user ID
10
+ *
11
+ * Stores TOTP secret keys for two-factor authentication.
12
+ * One document per user, identified by their Firebase UID.
13
+ */
14
+ export interface TotpSecretDocument extends FirestoreDocument {
15
+ /** TOTP secret key (Base32 encoded) */
16
+ secret: string;
17
+ /** Is 2FA enabled for this user? */
18
+ enabled: boolean;
19
+ /** Document creation timestamp */
20
+ created_at: Date | any;
21
+ /** Document last update timestamp */
22
+ updated_at: Date | any;
23
+ }
24
+ /**
25
+ * Request to setup 2FA for a user
26
+ */
27
+ export interface TotpSetupRequest {
28
+ /** Firebase user ID */
29
+ uid: string;
30
+ }
31
+ /**
32
+ * Response from 2FA setup endpoint
33
+ */
34
+ export interface TotpSetupResponse {
35
+ /** Base32 encoded TOTP secret */
36
+ secret: string;
37
+ /** QR code as base64 data URI */
38
+ qr_code: string;
39
+ /** OTPAuth URI for manual entry */
40
+ uri: string;
41
+ }
42
+ /**
43
+ * Request to verify a TOTP code
44
+ */
45
+ export interface TotpVerifyRequest {
46
+ /** Firebase user ID */
47
+ uid: string;
48
+ /** 6-digit TOTP code */
49
+ code: string;
50
+ }
51
+ /**
52
+ * Response from TOTP verification
53
+ */
54
+ export interface TotpVerifyResponse {
55
+ /** Was the code valid? */
56
+ verified: boolean;
57
+ /** Human-readable message */
58
+ message: string;
59
+ }
60
+ /**
61
+ * Request to disable 2FA
62
+ */
63
+ export interface TotpDisableRequest {
64
+ /** Firebase user ID */
65
+ uid: string;
66
+ /** Current valid TOTP code (required to confirm) */
67
+ code: string;
68
+ }
69
+ /**
70
+ * Response from checking 2FA status
71
+ */
72
+ export interface TotpStatusResponse {
73
+ /** Is user enrolled in 2FA? (has a secret) */
74
+ enrolled: boolean;
75
+ /** Is 2FA currently enabled? */
76
+ enabled: boolean;
77
+ }
78
+ /**
79
+ * TOTP collection name in Firestore
80
+ */
81
+ export declare const TOTP_COLLECTION: "totp_secrets";
82
+ /**
83
+ * TOTP configuration constants
84
+ */
85
+ export declare const TOTP_CONFIG: {
86
+ /** Number of digits in TOTP code */
87
+ readonly DIGITS: 6;
88
+ /** Time step in seconds */
89
+ readonly INTERVAL: 30;
90
+ /** Issuer name displayed in authenticator apps */
91
+ readonly ISSUER: "Guinetik";
92
+ /** Algorithm used for TOTP */
93
+ readonly ALGORITHM: "SHA1";
94
+ };
95
+ //# sourceMappingURL=totp.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"totp.types.d.ts","sourceRoot":"","sources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D;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB,oCAAoC;;IAGpC,2BAA2B;;IAG3B,kDAAkD;;IAGlD,8BAA8B;;CAEtB,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * TOTP/2FA Types
4
+ * Types for Time-based One-Time Password authentication
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.TOTP_CONFIG = exports.TOTP_COLLECTION = void 0;
8
+ // ============================================================================
9
+ // Constants
10
+ // ============================================================================
11
+ /**
12
+ * TOTP collection name in Firestore
13
+ */
14
+ exports.TOTP_COLLECTION = 'totp_secrets';
15
+ /**
16
+ * TOTP configuration constants
17
+ */
18
+ exports.TOTP_CONFIG = {
19
+ /** Number of digits in TOTP code */
20
+ DIGITS: 6,
21
+ /** Time step in seconds */
22
+ INTERVAL: 30,
23
+ /** Issuer name displayed in authenticator apps */
24
+ ISSUER: 'Guinetik',
25
+ /** Algorithm used for TOTP */
26
+ ALGORITHM: 'SHA1',
27
+ };
@@ -133,6 +133,7 @@ export declare const FIRESTORE_COLLECTIONS: {
133
133
  readonly DEMOS: "website-demos";
134
134
  readonly EXPERIMENTS: "website-experiments";
135
135
  readonly RUNTIME_CONFIG: "runtime-config";
136
+ readonly TOTP_SECRETS: "totp_secrets";
136
137
  };
137
138
  /**
138
139
  * Firestore document IDs for singleton documents
@@ -1 +1 @@
1
- {"version":3,"file":"website-firestore.types.d.ts","sourceRoot":"","sources":["../src/website-firestore.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMlF;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,uBAAuB;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CAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAa,SAAQ,iBAAiB,EAAE,IAAI;IAC3D,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IAEd,uBAAuB;IACvB,OAAO,EAAE,OAAO,CAAC;IAEjB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB,EAAE,UAAU;IACvE,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IAEd,6BAA6B;IAC7B,OAAO,EAAE,OAAO,CAAC;IAEjB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IAEZ,sEAAsE;IACtE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACxD;AAMD;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;CASxB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC"}
@@ -22,6 +22,7 @@ exports.FIRESTORE_COLLECTIONS = {
22
22
  DEMOS: 'website-demos',
23
23
  EXPERIMENTS: 'website-experiments',
24
24
  RUNTIME_CONFIG: 'runtime-config',
25
+ TOTP_SECRETS: 'totp_secrets',
25
26
  };
26
27
  /**
27
28
  * Firestore document IDs for singleton documents
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guinetik/primitives-ts",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "Shared TypeScript primitives for Guinetik projects",
5
5
  "author": "Guinetik",
6
6
  "license": "MIT",