@appsemble/utils 0.36.3-test.5 → 0.36.3

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,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.36.3-test.5/config/assets/logo.svg) Appsemble Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.36.3/config/assets/logo.svg) Appsemble Utilities
2
2
 
3
3
  > Internal utility functions used across multiple Appsemble projects.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/utils)](https://www.npmjs.com/package/@appsemble/utils)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.36.3-test.5/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.36.3-test.5)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.36.3/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.36.3)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -26,5 +26,5 @@ not guaranteed.
26
26
 
27
27
  ## License
28
28
 
29
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.36.3-test.5/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.36.3/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
@@ -63,6 +63,16 @@ This doesn’t affect whether or not the app can be accessed on its own domain.
63
63
  If this is set to \`fullLock\`, no changes can be made to the app,
64
64
  if this is set to \`studioLock\`, no changes can be made from the studio but updating from the CLI is possible,
65
65
  and to make any changes from the studio, this should be set to \`unlocked\`.
66
+ `,
67
+ },
68
+ totp: {
69
+ enum: ['disabled', 'enabled', 'required'],
70
+ default: 'disabled',
71
+ description: `The TOTP (two-factor authentication) setting for the app.
72
+
73
+ - **disabled**: TOTP is not available for app members.
74
+ - **enabled**: TOTP is available but optional for app members.
75
+ - **required**: TOTP is required for all app members. **WARNING**: Setting this will lock out existing users who have not yet enabled 2FA on their accounts.
66
76
  `,
67
77
  },
68
78
  displayAppMemberName: {
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const pathItems: OpenAPIV3.PathItemObject;
@@ -0,0 +1,42 @@
1
+ export const pathItems = {
2
+ parameters: [{ $ref: '#/components/parameters/appId' }],
3
+ post: {
4
+ tags: ['app', 'auth', 'totp'],
5
+ description: 'Disable TOTP two-factor authentication for the current app member.',
6
+ operationId: 'disableAppMemberTotp',
7
+ requestBody: {
8
+ description: 'The TOTP token to verify before disabling.',
9
+ required: true,
10
+ content: {
11
+ 'application/json': {
12
+ schema: {
13
+ type: 'object',
14
+ required: ['token'],
15
+ properties: {
16
+ token: {
17
+ type: 'string',
18
+ minLength: 6,
19
+ maxLength: 6,
20
+ pattern: '^[0-9]{6}$',
21
+ description: 'The 6-digit TOTP token from the authenticator app.',
22
+ },
23
+ },
24
+ },
25
+ },
26
+ },
27
+ },
28
+ responses: {
29
+ 204: {
30
+ description: 'TOTP has been successfully disabled.',
31
+ },
32
+ 400: {
33
+ description: 'Invalid TOTP token or TOTP is not enabled.',
34
+ },
35
+ 401: {
36
+ description: 'User is not authenticated.',
37
+ },
38
+ },
39
+ security: [{ app: [] }],
40
+ },
41
+ };
42
+ //# sourceMappingURL=disable.js.map
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const pathItems: OpenAPIV3.PathItemObject;
@@ -0,0 +1,57 @@
1
+ export const pathItems = {
2
+ parameters: [{ $ref: '#/components/parameters/appId' }],
3
+ post: {
4
+ tags: ['app', 'auth', 'totp'],
5
+ description: 'Initialize TOTP setup for the current app member. Returns a secret and otpauth URL for QR code generation. When TOTP is required for the app, unauthenticated setup is allowed by providing a memberId.',
6
+ operationId: 'setupAppMemberTotp',
7
+ requestBody: {
8
+ content: {
9
+ 'application/json': {
10
+ schema: {
11
+ type: 'object',
12
+ properties: {
13
+ memberId: {
14
+ type: 'string',
15
+ format: 'uuid',
16
+ description: 'The app member ID. Only used for unauthenticated setup when TOTP is required.',
17
+ },
18
+ },
19
+ },
20
+ },
21
+ },
22
+ },
23
+ responses: {
24
+ 200: {
25
+ description: 'TOTP secret and QR code URL generated successfully.',
26
+ content: {
27
+ 'application/json': {
28
+ schema: {
29
+ type: 'object',
30
+ properties: {
31
+ secret: {
32
+ type: 'string',
33
+ description: 'The TOTP secret key.',
34
+ },
35
+ otpauthUrl: {
36
+ type: 'string',
37
+ description: 'The otpauth URL for generating a QR code.',
38
+ },
39
+ },
40
+ },
41
+ },
42
+ },
43
+ },
44
+ 400: {
45
+ description: 'TOTP is already enabled for this member or TOTP is disabled for this app.',
46
+ },
47
+ 401: {
48
+ description: 'User is not authenticated.',
49
+ },
50
+ 403: {
51
+ description: 'Unauthenticated TOTP setup is only allowed when TOTP is required.',
52
+ },
53
+ },
54
+ security: [{ app: [] }, {}],
55
+ },
56
+ };
57
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const pathItems: OpenAPIV3.PathItemObject;
@@ -0,0 +1,78 @@
1
+ export const pathItems = {
2
+ parameters: [{ $ref: '#/components/parameters/appId' }],
3
+ post: {
4
+ tags: ['app', 'auth', 'totp'],
5
+ description: 'Verify a TOTP token during login to complete the two-factor authentication process.',
6
+ operationId: 'verifyAppMemberTotp',
7
+ requestBody: {
8
+ description: 'The member ID and TOTP token to verify.',
9
+ required: true,
10
+ content: {
11
+ 'application/json': {
12
+ schema: {
13
+ type: 'object',
14
+ required: ['memberId', 'token'],
15
+ properties: {
16
+ memberId: {
17
+ type: 'string',
18
+ format: 'uuid',
19
+ description: 'The ID of the app member attempting to login.',
20
+ },
21
+ token: {
22
+ type: 'string',
23
+ minLength: 6,
24
+ maxLength: 6,
25
+ pattern: '^[0-9]{6}$',
26
+ description: 'The 6-digit TOTP token from the authenticator app.',
27
+ },
28
+ scope: {
29
+ type: 'string',
30
+ description: 'The OAuth2 scope to include in the token.',
31
+ },
32
+ },
33
+ },
34
+ },
35
+ },
36
+ },
37
+ responses: {
38
+ 200: {
39
+ description: 'TOTP verified successfully. Returns JWT tokens.',
40
+ content: {
41
+ 'application/json': {
42
+ schema: {
43
+ type: 'object',
44
+ properties: {
45
+ access_token: {
46
+ type: 'string',
47
+ description: 'The access token.',
48
+ },
49
+ expires_in: {
50
+ type: 'number',
51
+ description: 'Token expiration time in seconds.',
52
+ },
53
+ refresh_token: {
54
+ type: 'string',
55
+ description: 'The refresh token.',
56
+ },
57
+ token_type: {
58
+ type: 'string',
59
+ description: 'The token type (bearer).',
60
+ },
61
+ },
62
+ },
63
+ },
64
+ },
65
+ },
66
+ 400: {
67
+ description: 'TOTP is not enabled for this member.',
68
+ },
69
+ 401: {
70
+ description: 'Invalid TOTP token.',
71
+ },
72
+ 404: {
73
+ description: 'App member not found.',
74
+ },
75
+ },
76
+ },
77
+ };
78
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const pathItems: OpenAPIV3.PathItemObject;
@@ -0,0 +1,50 @@
1
+ export const pathItems = {
2
+ parameters: [{ $ref: '#/components/parameters/appId' }],
3
+ post: {
4
+ tags: ['app', 'auth', 'totp'],
5
+ description: 'Verify a TOTP token to complete the TOTP setup process and enable two-factor authentication. When TOTP is required for the app, unauthenticated verification is allowed by providing a memberId.',
6
+ operationId: 'verifyAppMemberTotpSetup',
7
+ requestBody: {
8
+ description: 'The TOTP token to verify.',
9
+ required: true,
10
+ content: {
11
+ 'application/json': {
12
+ schema: {
13
+ type: 'object',
14
+ required: ['token'],
15
+ properties: {
16
+ token: {
17
+ type: 'string',
18
+ minLength: 6,
19
+ maxLength: 6,
20
+ pattern: '^[0-9]{6}$',
21
+ description: 'The 6-digit TOTP token from the authenticator app.',
22
+ },
23
+ memberId: {
24
+ type: 'string',
25
+ format: 'uuid',
26
+ description: 'The app member ID. Only used for unauthenticated verification when TOTP is required.',
27
+ },
28
+ },
29
+ },
30
+ },
31
+ },
32
+ },
33
+ responses: {
34
+ 204: {
35
+ description: 'TOTP has been successfully enabled.',
36
+ },
37
+ 400: {
38
+ description: 'Invalid TOTP token or TOTP setup not initiated.',
39
+ },
40
+ 401: {
41
+ description: 'User is not authenticated.',
42
+ },
43
+ 403: {
44
+ description: 'Unauthenticated TOTP verification is only allowed when TOTP is required.',
45
+ },
46
+ },
47
+ security: [{ app: [] }, {}],
48
+ },
49
+ };
50
+ //# sourceMappingURL=verifySetup.js.map
@@ -111,6 +111,9 @@ export const pathItems = {
111
111
  type: 'boolean',
112
112
  description: 'Whether the Appsemble OAuth2 login method should be shown.',
113
113
  },
114
+ totp: {
115
+ $ref: '#/components/schemas/App/properties/totp',
116
+ },
114
117
  enableSelfRegistration: {
115
118
  type: 'boolean',
116
119
  description: 'Whether new users should be able to register themselves.',
package/api/paths/apps.js CHANGED
@@ -34,6 +34,9 @@ export const pathItems = {
34
34
  demoMode: {
35
35
  $ref: '#/components/schemas/App/properties/demoMode',
36
36
  },
37
+ totp: {
38
+ $ref: '#/components/schemas/App/properties/totp',
39
+ },
37
40
  yaml: {
38
41
  type: 'string',
39
42
  description: 'The original YAML definition used to define the app.',
@@ -92,6 +92,10 @@ export declare const paths: {
92
92
  '/api/apps/{appId}/auth/email/reset-password': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
93
93
  '/api/apps/{appId}/auth/email/verify': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
94
94
  '/api/apps/{appId}/auth/email/unverified': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
95
+ '/api/apps/{appId}/auth/totp/setup': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
96
+ '/api/apps/{appId}/auth/totp/verify-setup': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
97
+ '/api/apps/{appId}/auth/totp/verify': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
98
+ '/api/apps/{appId}/auth/totp/disable': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
95
99
  '/api/apps': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
96
100
  '/api/app-templates': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
97
101
  '/api/auth/email/login': import("openapi-types").OpenAPIV3.PathItemObject<{}>;
@@ -18,6 +18,10 @@ import { pathItems as appsAppIdAuthEmailResendVerification } from './apps/appId/
18
18
  import { pathItems as appsAppIdAuthEmailResetPassword } from './apps/appId/auth/email/resetPassword.js';
19
19
  import { pathItems as appsAppIdAuthEmailUnverified } from './apps/appId/auth/email/unverified.js';
20
20
  import { pathItems as appsAppIdAuthEmailVerify } from './apps/appId/auth/email/verify.js';
21
+ import { pathItems as appsAppIdAuthTotpDisable } from './apps/appId/auth/totp/disable.js';
22
+ import { pathItems as appsAppIdAuthTotpSetup } from './apps/appId/auth/totp/setup.js';
23
+ import { pathItems as appsAppIdAuthTotpVerify } from './apps/appId/auth/totp/verify.js';
24
+ import { pathItems as appsAppIdAuthTotpVerifySetup } from './apps/appId/auth/totp/verifySetup.js';
21
25
  import { pathItems as appsAppIdBroadcast } from './apps/appId/broadcast.js';
22
26
  import { pathItems as appsAppIdClonableAssets } from './apps/appId/clonable-assets.js';
23
27
  import { pathItems as appsAppIdClonableResources } from './apps/appId/clonable-resources.js';
@@ -258,6 +262,10 @@ export const paths = {
258
262
  '/api/apps/{appId}/auth/email/reset-password': appsAppIdAuthEmailResetPassword,
259
263
  '/api/apps/{appId}/auth/email/verify': appsAppIdAuthEmailVerify,
260
264
  '/api/apps/{appId}/auth/email/unverified': appsAppIdAuthEmailUnverified,
265
+ '/api/apps/{appId}/auth/totp/setup': appsAppIdAuthTotpSetup,
266
+ '/api/apps/{appId}/auth/totp/verify-setup': appsAppIdAuthTotpVerifySetup,
267
+ '/api/apps/{appId}/auth/totp/verify': appsAppIdAuthTotpVerify,
268
+ '/api/apps/{appId}/auth/totp/disable': appsAppIdAuthTotpDisable,
261
269
  '/api/apps': apps,
262
270
  '/api/app-templates': appTemplates,
263
271
  '/api/auth/email/login': authEmailLogin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/utils",
3
- "version": "0.36.3-test.5",
3
+ "version": "0.36.3",
4
4
  "description": "Utility functions used in Appsemble internally",
5
5
  "keywords": [
6
6
  "app",
@@ -39,8 +39,8 @@
39
39
  "test": "vitest"
40
40
  },
41
41
  "dependencies": {
42
- "@appsemble/lang-sdk": "0.36.3-test.5",
43
- "@appsemble/types": "0.36.3-test.5",
42
+ "@appsemble/lang-sdk": "0.36.3",
43
+ "@appsemble/types": "0.36.3",
44
44
  "@fortawesome/fontawesome-common-types": "^6.0.0",
45
45
  "axios": "^1.0.0",
46
46
  "langmap": "^0.0.16",