lemmy-js-client 0.19.0-rc.12 → 0.19.0-rc.13

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/dist/http.d.ts CHANGED
@@ -128,6 +128,9 @@ import { UploadImage, UploadImageResponse } from "./types/others";
128
128
  import { HideCommunity } from "./types/HideCommunity";
129
129
  import { BlockInstance } from "./types/BlockInstance";
130
130
  import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
131
+ import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
132
+ import { UpdateTotp } from "./types/UpdateTotp";
133
+ import { UpdateTotpResponse } from "./types/UpdateTotpResponse";
131
134
  /**
132
135
  * Helps build lemmy HTTP requests.
133
136
  */
@@ -168,6 +171,24 @@ export declare class LemmyHttp {
168
171
  * `HTTP.POST /user/leave_admin`
169
172
  */
170
173
  leaveAdmin(): Promise<GetSiteResponse>;
174
+ /**
175
+ * Generate a TOTP / two-factor secret.
176
+ *
177
+ * Afterwards you need to call `/user/totp/update` with a valid token to enable it.
178
+ *
179
+ * `HTTP.POST /user/totp/generate`
180
+ */
181
+ generateTotpSecret(): Promise<GenerateTotpSecretResponse>;
182
+ /**
183
+ * Enable / Disable TOTP / two-factor authentication.
184
+ *
185
+ * To enable, you need to first call `/user/totp/generate` and then pass a valid token to this.
186
+ *
187
+ * Disabling is only possible if 2FA was previously enabled. Again it is necessary to pass a valid token.
188
+ *
189
+ * `HTTP.POST /user/totp/update`
190
+ */
191
+ updateTotp(form: UpdateTotp): Promise<UpdateTotpResponse>;
171
192
  /**
172
193
  * Get the modlog.
173
194
  *
package/dist/http.js CHANGED
@@ -90,6 +90,28 @@ class LemmyHttp {
90
90
  leaveAdmin() {
91
91
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/leave_admin", {});
92
92
  }
93
+ /**
94
+ * Generate a TOTP / two-factor secret.
95
+ *
96
+ * Afterwards you need to call `/user/totp/update` with a valid token to enable it.
97
+ *
98
+ * `HTTP.POST /user/totp/generate`
99
+ */
100
+ generateTotpSecret() {
101
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/totp/generate", {});
102
+ }
103
+ /**
104
+ * Enable / Disable TOTP / two-factor authentication.
105
+ *
106
+ * To enable, you need to first call `/user/totp/generate` and then pass a valid token to this.
107
+ *
108
+ * Disabling is only possible if 2FA was previously enabled. Again it is necessary to pass a valid token.
109
+ *
110
+ * `HTTP.POST /user/totp/update`
111
+ */
112
+ updateTotp(form) {
113
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/totp/update", form);
114
+ }
93
115
  /**
94
116
  * Get the modlog.
95
117
  *
package/dist/index.d.ts CHANGED
@@ -82,6 +82,7 @@ export { EditSite } from "./types/EditSite";
82
82
  export { FeaturePost } from "./types/FeaturePost";
83
83
  export { FederatedInstances } from "./types/FederatedInstances";
84
84
  export { FollowCommunity } from "./types/FollowCommunity";
85
+ export { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
85
86
  export { GetCaptchaResponse } from "./types/GetCaptchaResponse";
86
87
  export { GetComment } from "./types/GetComment";
87
88
  export { GetComments } from "./types/GetComments";
@@ -236,6 +237,8 @@ export { SortType } from "./types/SortType";
236
237
  export { SubscribedType } from "./types/SubscribedType";
237
238
  export { Tagline } from "./types/Tagline";
238
239
  export { TransferCommunity } from "./types/TransferCommunity";
240
+ export { UpdateTotp } from "./types/UpdateTotp";
241
+ export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
239
242
  export { VerifyEmail } from "./types/VerifyEmail";
240
243
  export { VerifyEmailResponse } from "./types/VerifyEmailResponse";
241
244
  export { UploadImage, UploadImageResponse, ImageFile } from "./types/others";
@@ -0,0 +1,3 @@
1
+ export interface GenerateTotpSecretResponse {
2
+ totp_secret_url: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -21,11 +21,11 @@ export interface LocalUser {
21
21
  show_new_post_notifs: boolean;
22
22
  email_verified: boolean;
23
23
  accepted_application: boolean;
24
- totp_2fa_url?: string;
25
24
  open_links_in_new_tab: boolean;
26
25
  blur_nsfw: boolean;
27
26
  auto_expand: boolean;
28
27
  infinite_scroll_enabled: boolean;
29
28
  admin: boolean;
30
29
  post_listing_mode: PostListingMode;
30
+ totp_2fa_enabled: boolean;
31
31
  }
@@ -23,7 +23,6 @@ export interface SaveUserSettings {
23
23
  show_read_posts?: boolean;
24
24
  show_new_post_notifs?: boolean;
25
25
  discussion_languages?: Array<LanguageId>;
26
- generate_totp_2fa?: boolean;
27
26
  open_links_in_new_tab?: boolean;
28
27
  infinite_scroll_enabled?: boolean;
29
28
  }
@@ -0,0 +1,4 @@
1
+ export interface UpdateTotp {
2
+ totp_token: string;
3
+ enabled: boolean;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface UpdateTotpResponse {
2
+ enabled: boolean;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
- "version": "0.19.0-rc.12",
3
+ "version": "0.19.0-rc.13",
4
4
  "description": "A javascript / typescript client for Lemmy",
5
5
  "repository": "https://github.com/LemmyNet/lemmy-js-client",
6
6
  "license": "AGPL-3.0",