@opensecret/react 1.0.0-beta.2 → 1.0.0-beta.4

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>;
@@ -684,10 +721,54 @@ export declare type OpenSecretDeveloperContextType = {
684
721
  * Alias for requestNewVerificationCode - for consistency with OpenSecretContext
685
722
  */
686
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;
687
767
  /**
688
768
  * Registers a new developer account
689
769
  * @param email - Developer's email address
690
770
  * @param password - Developer's password
771
+ * @param invite_code - Required invitation code in UUID format
691
772
  * @param name - Optional developer name
692
773
  * @returns A promise that resolves to the login response with access and refresh tokens
693
774
  *
@@ -697,7 +778,7 @@ export declare type OpenSecretDeveloperContextType = {
697
778
  * - Updates the developer state with new user information
698
779
  * - Throws an error if account creation fails
699
780
  */
700
- signUp: (email: string, password: string, name?: string) => Promise<platformApi.PlatformLoginResponse>;
781
+ signUp: (email: string, password: string, invite_code: string, name?: string) => Promise<platformApi.PlatformLoginResponse>;
701
782
  /**
702
783
  * Signs out the current developer by removing authentication tokens
703
784
  *
@@ -1045,6 +1126,9 @@ declare namespace platformApi {
1045
1126
  platformMe,
1046
1127
  verifyPlatformEmail,
1047
1128
  requestNewPlatformVerificationCode,
1129
+ requestPlatformPasswordReset,
1130
+ confirmPlatformPasswordReset,
1131
+ changePlatformPassword,
1048
1132
  PlatformLoginResponse,
1049
1133
  PlatformRefreshResponse,
1050
1134
  PlatformOrg,
@@ -1105,7 +1189,15 @@ declare type PlatformRefreshResponse = {
1105
1189
  */
1106
1190
  declare function platformRefreshToken(): Promise<PlatformRefreshResponse>;
1107
1191
 
1108
- declare function platformRegister(email: string, password: string, name?: string): Promise<PlatformLoginResponse>;
1192
+ /**
1193
+ * Registers a new platform developer account
1194
+ * @param email Developer's email address
1195
+ * @param password Developer's password
1196
+ * @param invite_code Required invitation code in UUID format
1197
+ * @param name Optional developer name
1198
+ * @returns A promise that resolves to the login response with access and refresh tokens
1199
+ */
1200
+ declare function platformRegister(email: string, password: string, invite_code: string, name?: string): Promise<PlatformLoginResponse>;
1109
1201
 
1110
1202
  declare type PlatformUser = {
1111
1203
  id: string;
@@ -1179,6 +1271,22 @@ declare function requestNewVerificationCode(): Promise<void>;
1179
1271
 
1180
1272
  declare function requestPasswordReset(email: string, hashedSecret: string, client_id: string): Promise<void>;
1181
1273
 
1274
+ /**
1275
+ * Initiates the password reset process for a platform developer account
1276
+ * @param email - Developer's email address
1277
+ * @param hashedSecret - Hashed secret used for additional security verification
1278
+ * @returns A promise that resolves when the reset request is successfully processed
1279
+ * @throws {Error} If the request fails or the email doesn't exist
1280
+ *
1281
+ * @description
1282
+ * This function:
1283
+ * 1. Sends a password reset request for a platform developer
1284
+ * 2. The server will send an email with an alphanumeric code
1285
+ * 3. The email and hashed_secret are paired for the reset process
1286
+ * 4. Use confirmPlatformPasswordReset to complete the process
1287
+ */
1288
+ declare function requestPlatformPasswordReset(email: string, hashedSecret: string): Promise<void>;
1289
+
1182
1290
  declare function setApiUrl(url: string): void;
1183
1291
 
1184
1292
  declare function setPlatformApiUrl(url: string): void;