@opensecret/react 1.0.0-beta.1 → 1.0.0-beta.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/dist/index.d.ts CHANGED
@@ -146,8 +146,45 @@ declare const AWS_ROOT_CERT_DER: Uint8Array;
146
146
 
147
147
  declare function changePassword(currentPassword: string, newPassword: string): Promise<void>;
148
148
 
149
+ /**
150
+ * Changes password for a platform developer account
151
+ * @param currentPassword - Current password for verification
152
+ * @param newPassword - New password to set
153
+ * @returns A promise that resolves when the password is successfully changed
154
+ * @throws {Error} If current password is incorrect or the request fails
155
+ *
156
+ * @description
157
+ * This function:
158
+ * 1. Requires the user to be authenticated
159
+ * 2. Verifies the current password before allowing the change
160
+ * 3. Updates to the new password if verification succeeds
161
+ */
162
+ declare function changePlatformPassword(currentPassword: string, newPassword: string): Promise<{
163
+ message: string;
164
+ }>;
165
+
149
166
  declare function confirmPasswordReset(email: string, alphanumericCode: string, plaintextSecret: string, newPassword: string, client_id: string): Promise<void>;
150
167
 
168
+ /**
169
+ * Completes the password reset process for a platform developer account
170
+ * @param email - Developer's email address
171
+ * @param alphanumericCode - Code received via email
172
+ * @param plaintextSecret - The plaintext secret that corresponds to the hashed_secret sent in the request
173
+ * @param newPassword - New password to set
174
+ * @returns A promise that resolves when the password is successfully reset
175
+ * @throws {Error} If the verification fails or the request is invalid
176
+ *
177
+ * @description
178
+ * This function:
179
+ * 1. Completes the password reset process using the code from the email
180
+ * 2. Requires the plaintext_secret that matches the previously sent hashed_secret
181
+ * 3. Sets the new password if all verification succeeds
182
+ * 4. The user can then log in with the new password
183
+ */
184
+ declare function confirmPlatformPasswordReset(email: string, alphanumericCode: string, plaintextSecret: string, newPassword: string): Promise<{
185
+ message: string;
186
+ }>;
187
+
151
188
  declare function convertGuestToEmailAccount(email: string, password: string, name?: string | null): Promise<void>;
152
189
 
153
190
  declare function createOrganization(name: string): Promise<Organization>;
@@ -657,6 +694,76 @@ export declare type OpenSecretDeveloperContextType = {
657
694
  * - Throws an error if authentication fails
658
695
  */
659
696
  signIn: (email: string, password: string) => Promise<platformApi.PlatformLoginResponse>;
697
+ /**
698
+ * Verifies a platform user's email using the verification code
699
+ * @param code - The verification code sent to the user's email
700
+ * @returns A promise that resolves when verification is complete
701
+ * @throws {Error} If verification fails
702
+ *
703
+ * @description
704
+ * - Takes the verification code from the verification email link
705
+ * - Calls the verification API endpoint
706
+ * - Updates email_verified status if successful
707
+ */
708
+ verifyEmail: typeof platformApi.verifyPlatformEmail;
709
+ /**
710
+ * Requests a new verification email for the current user
711
+ * @returns A promise that resolves to a success message
712
+ * @throws {Error} If the user is already verified or request fails
713
+ *
714
+ * @description
715
+ * - Used when the user needs a new verification email
716
+ * - Requires the user to be authenticated
717
+ * - Sends a new verification email to the user's registered email address
718
+ */
719
+ requestNewVerificationCode: typeof platformApi.requestNewPlatformVerificationCode;
720
+ /**
721
+ * Alias for requestNewVerificationCode - for consistency with OpenSecretContext
722
+ */
723
+ requestNewVerificationEmail: typeof platformApi.requestNewPlatformVerificationCode;
724
+ /**
725
+ * Initiates the password reset process for a platform developer account
726
+ * @param email - Developer's email address
727
+ * @param hashedSecret - Hashed secret used for additional security verification
728
+ * @returns A promise that resolves when the reset request is successfully processed
729
+ * @throws {Error} If the request fails or the email doesn't exist
730
+ *
731
+ * @description
732
+ * - Sends a password reset request for a platform developer
733
+ * - The server will send an email with an alphanumeric code
734
+ * - The email and hashed_secret are paired for the reset process
735
+ * - Use confirmPasswordReset to complete the process
736
+ */
737
+ requestPasswordReset: typeof platformApi.requestPlatformPasswordReset;
738
+ /**
739
+ * Completes the password reset process for a platform developer account
740
+ * @param email - Developer's email address
741
+ * @param alphanumericCode - Code received via email
742
+ * @param plaintextSecret - The plaintext secret that corresponds to the hashed_secret sent in the request
743
+ * @param newPassword - New password to set
744
+ * @returns A promise that resolves when the password is successfully reset
745
+ * @throws {Error} If the verification fails or the request is invalid
746
+ *
747
+ * @description
748
+ * - Completes the password reset process using the code from the email
749
+ * - Requires the plaintext_secret that matches the previously sent hashed_secret
750
+ * - Sets the new password if all verification succeeds
751
+ * - The user can then log in with the new password
752
+ */
753
+ confirmPasswordReset: typeof platformApi.confirmPlatformPasswordReset;
754
+ /**
755
+ * Changes password for a platform developer account
756
+ * @param currentPassword - Current password for verification
757
+ * @param newPassword - New password to set
758
+ * @returns A promise that resolves when the password is successfully changed
759
+ * @throws {Error} If current password is incorrect or the request fails
760
+ *
761
+ * @description
762
+ * - Requires the user to be authenticated
763
+ * - Verifies the current password before allowing the change
764
+ * - Updates to the new password if verification succeeds
765
+ */
766
+ changePassword: typeof platformApi.changePlatformPassword;
660
767
  /**
661
768
  * Registers a new developer account
662
769
  * @param email - Developer's email address
@@ -1016,6 +1123,11 @@ declare namespace platformApi {
1016
1123
  removeMember,
1017
1124
  acceptInvite,
1018
1125
  platformMe,
1126
+ verifyPlatformEmail,
1127
+ requestNewPlatformVerificationCode,
1128
+ requestPlatformPasswordReset,
1129
+ confirmPlatformPasswordReset,
1130
+ changePlatformPassword,
1019
1131
  PlatformLoginResponse,
1020
1132
  PlatformRefreshResponse,
1021
1133
  PlatformOrg,
@@ -1137,10 +1249,35 @@ declare function refreshToken(): Promise<RefreshResponse>;
1137
1249
 
1138
1250
  declare function removeMember(orgId: string, userId: string): Promise<void>;
1139
1251
 
1252
+ /**
1253
+ * Requests a new verification email for a platform user
1254
+ * @returns A promise that resolves to a success message
1255
+ * @throws {Error} If the user is already verified or request fails
1256
+ */
1257
+ declare function requestNewPlatformVerificationCode(): Promise<{
1258
+ message: string;
1259
+ }>;
1260
+
1140
1261
  declare function requestNewVerificationCode(): Promise<void>;
1141
1262
 
1142
1263
  declare function requestPasswordReset(email: string, hashedSecret: string, client_id: string): Promise<void>;
1143
1264
 
1265
+ /**
1266
+ * Initiates the password reset process for a platform developer account
1267
+ * @param email - Developer's email address
1268
+ * @param hashedSecret - Hashed secret used for additional security verification
1269
+ * @returns A promise that resolves when the reset request is successfully processed
1270
+ * @throws {Error} If the request fails or the email doesn't exist
1271
+ *
1272
+ * @description
1273
+ * This function:
1274
+ * 1. Sends a password reset request for a platform developer
1275
+ * 2. The server will send an email with an alphanumeric code
1276
+ * 3. The email and hashed_secret are paired for the reset process
1277
+ * 4. Use confirmPlatformPasswordReset to complete the process
1278
+ */
1279
+ declare function requestPlatformPasswordReset(email: string, hashedSecret: string): Promise<void>;
1280
+
1144
1281
  declare function setApiUrl(url: string): void;
1145
1282
 
1146
1283
  declare function setPlatformApiUrl(url: string): void;
@@ -1218,4 +1355,12 @@ export declare type UserResponse = {
1218
1355
 
1219
1356
  declare function verifyEmail(code: string): Promise<void>;
1220
1357
 
1358
+ /**
1359
+ * Verifies a platform user's email using the verification code
1360
+ * @param code - The verification code sent to the user's email
1361
+ * @returns A promise that resolves when verification is complete
1362
+ * @throws {Error} If verification fails
1363
+ */
1364
+ declare function verifyPlatformEmail(code: string): Promise<void>;
1365
+
1221
1366
  export { }