@opensecret/react 1.3.0 → 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 +65 -0
- package/dist/opensecret-react.es.js +711 -682
- package/dist/opensecret-react.umd.js +17 -17
- package/package.json +1 -1
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,
|
|
@@ -129,6 +131,7 @@ declare type AppleAuthResponse = {
|
|
|
129
131
|
* @property email - Optional email address (only provided on first sign-in)
|
|
130
132
|
* @property given_name - Optional user's first name (only provided on first sign-in)
|
|
131
133
|
* @property family_name - Optional user's last name (only provided on first sign-in)
|
|
134
|
+
* @property nonce - Optional nonce for preventing replay attacks
|
|
132
135
|
*/
|
|
133
136
|
declare type AppleUser = {
|
|
134
137
|
user_identifier: string;
|
|
@@ -136,6 +139,7 @@ declare type AppleUser = {
|
|
|
136
139
|
email?: string;
|
|
137
140
|
given_name?: string;
|
|
138
141
|
family_name?: string;
|
|
142
|
+
nonce?: string;
|
|
139
143
|
};
|
|
140
144
|
|
|
141
145
|
declare interface Attestation {
|
|
@@ -200,6 +204,21 @@ declare function changePlatformPassword(currentPassword: string, newPassword: st
|
|
|
200
204
|
message: string;
|
|
201
205
|
}>;
|
|
202
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
|
+
|
|
203
222
|
declare function confirmPasswordReset(email: string, alphanumericCode: string, plaintextSecret: string, newPassword: string, client_id: string): Promise<void>;
|
|
204
223
|
|
|
205
224
|
/**
|
|
@@ -518,6 +537,11 @@ declare function handleAppleCallback(code: string, state: string, inviteCode: st
|
|
|
518
537
|
*
|
|
519
538
|
* Note: Email and name information are only provided by Apple on the first
|
|
520
539
|
* authentication. Your backend should store this information for future use.
|
|
540
|
+
*
|
|
541
|
+
* The nonce parameter (optional) can be provided as part of the appleUser object.
|
|
542
|
+
* When using Sign in with Apple, you can generate a nonce on your client and pass
|
|
543
|
+
* it both to Apple during authentication initiation and to this function for validation.
|
|
544
|
+
* The backend will verify that the nonce in the JWT matches what was provided.
|
|
521
545
|
*/
|
|
522
546
|
declare function handleAppleNativeSignIn(appleUser: AppleUser, client_id: string, inviteCode?: string): Promise<LoginResponse>;
|
|
523
547
|
|
|
@@ -779,6 +803,33 @@ export declare type OpenSecretContextType = {
|
|
|
779
803
|
refreshAccessToken: typeof api.refreshToken;
|
|
780
804
|
requestPasswordReset: (email: string, hashedSecret: string) => Promise<void>;
|
|
781
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>;
|
|
782
833
|
initiateGitHubAuth: (inviteCode: string) => Promise<api.GithubAuthResponse>;
|
|
783
834
|
handleGitHubCallback: (code: string, state: string, inviteCode: string) => Promise<void>;
|
|
784
835
|
initiateGoogleAuth: (inviteCode: string) => Promise<api.GoogleAuthResponse>;
|
|
@@ -1652,6 +1703,20 @@ declare function refreshToken(): Promise<RefreshResponse>;
|
|
|
1652
1703
|
|
|
1653
1704
|
declare function removeMember(orgId: string, userId: string): Promise<void>;
|
|
1654
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
|
+
|
|
1655
1720
|
/**
|
|
1656
1721
|
* Requests a new verification email for a platform user
|
|
1657
1722
|
* @returns A promise that resolves to a success message
|