@opensecret/react 1.3.1 → 1.3.2

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/index.d.ts CHANGED
@@ -43,6 +43,8 @@ declare namespace api {
43
43
  generateThirdPartyToken,
44
44
  encryptData,
45
45
  decryptData,
46
+ requestAccountDeletion,
47
+ confirmAccountDeletion,
46
48
  LoginResponse,
47
49
  UserResponse,
48
50
  KVListItem,
@@ -202,6 +204,21 @@ declare function changePlatformPassword(currentPassword: string, newPassword: st
202
204
  message: string;
203
205
  }>;
204
206
 
207
+ /**
208
+ * Confirms and completes the account deletion process
209
+ * @param uuid - The UUID from the verification email
210
+ * @param plaintextSecret - The plaintext secret that was hashed in the request step
211
+ * @returns A promise resolving to void
212
+ *
213
+ * @description
214
+ * This function:
215
+ * 1. Requires the user to be logged in (uses authenticatedApiCall)
216
+ * 2. Verifies both the UUID from email and the secret known only to the client
217
+ * 3. Permanently deletes the user account and all associated data
218
+ * 4. After successful deletion, the client should clear all local storage and tokens
219
+ */
220
+ declare function confirmAccountDeletion(uuid: string, plaintextSecret: string): Promise<void>;
221
+
205
222
  declare function confirmPasswordReset(email: string, alphanumericCode: string, plaintextSecret: string, newPassword: string, client_id: string): Promise<void>;
206
223
 
207
224
  /**
@@ -786,6 +803,33 @@ export declare type OpenSecretContextType = {
786
803
  refreshAccessToken: typeof api.refreshToken;
787
804
  requestPasswordReset: (email: string, hashedSecret: string) => Promise<void>;
788
805
  confirmPasswordReset: (email: string, alphanumericCode: string, plaintextSecret: string, newPassword: string) => Promise<void>;
806
+ /**
807
+ * Initiates the account deletion process for logged-in users
808
+ * @param hashedSecret - Client-side hashed secret for verification
809
+ * @returns A promise resolving to void
810
+ * @throws {Error} If request fails
811
+ *
812
+ * This function:
813
+ * 1. Requires the user to be logged in (uses authenticatedApiCall)
814
+ * 2. Sends a verification email to the user's email address
815
+ * 3. The email contains a UUID that will be needed for confirmation
816
+ * 4. The client must store the plaintext secret for confirmation
817
+ */
818
+ requestAccountDeletion: (hashedSecret: string) => Promise<void>;
819
+ /**
820
+ * Confirms and completes the account deletion process
821
+ * @param uuid - The UUID from the verification email
822
+ * @param plaintextSecret - The plaintext secret that was hashed in the request step
823
+ * @returns A promise resolving to void
824
+ * @throws {Error} If confirmation fails
825
+ *
826
+ * This function:
827
+ * 1. Requires the user to be logged in (uses authenticatedApiCall)
828
+ * 2. Verifies both the UUID from email and the secret known only to the client
829
+ * 3. Permanently deletes the user account and all associated data
830
+ * 4. After successful deletion, the client should clear all local storage and tokens
831
+ */
832
+ confirmAccountDeletion: (uuid: string, plaintextSecret: string) => Promise<void>;
789
833
  initiateGitHubAuth: (inviteCode: string) => Promise<api.GithubAuthResponse>;
790
834
  handleGitHubCallback: (code: string, state: string, inviteCode: string) => Promise<void>;
791
835
  initiateGoogleAuth: (inviteCode: string) => Promise<api.GoogleAuthResponse>;
@@ -1659,6 +1703,20 @@ declare function refreshToken(): Promise<RefreshResponse>;
1659
1703
 
1660
1704
  declare function removeMember(orgId: string, userId: string): Promise<void>;
1661
1705
 
1706
+ /**
1707
+ * Initiates the account deletion process for logged-in users
1708
+ * @param hashedSecret - Client-side hashed secret for verification
1709
+ * @returns A promise resolving to void
1710
+ *
1711
+ * @description
1712
+ * This function:
1713
+ * 1. Requires the user to be logged in (uses authenticatedApiCall)
1714
+ * 2. Sends a verification email to the user's email address
1715
+ * 3. The email contains a UUID that will be needed for confirmation
1716
+ * 4. The client must store the plaintext secret for confirmation
1717
+ */
1718
+ declare function requestAccountDeletion(hashedSecret: string): Promise<void>;
1719
+
1662
1720
  /**
1663
1721
  * Requests a new verification email for a platform user
1664
1722
  * @returns A promise that resolves to a success message