@opensecret/react 0.4.0 → 1.0.0-beta.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/README.md +6 -0
- package/dist/index.d.ts +623 -3
- package/dist/opensecret-react.es.js +6322 -6457
- package/dist/opensecret-react.umd.js +44 -73
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { default as default_2 } from 'react';
|
|
|
2
2
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
+
declare function acceptInvite(code: string): Promise<{
|
|
6
|
+
message: string;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
5
9
|
declare namespace api {
|
|
6
10
|
export {
|
|
7
11
|
setApiUrl,
|
|
@@ -49,6 +53,54 @@ declare namespace api {
|
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
export declare const apiConfig: ApiConfigService;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* ApiConfig service that manages URL configuration for both contexts
|
|
60
|
+
*/
|
|
61
|
+
declare class ApiConfigService {
|
|
62
|
+
private _appApiUrl;
|
|
63
|
+
private _platformApiUrl;
|
|
64
|
+
/**
|
|
65
|
+
* Configure the API URLs for both app and platform contexts
|
|
66
|
+
*/
|
|
67
|
+
configure(appApiUrl: string, platformApiUrl: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get the platform API URL
|
|
70
|
+
*/
|
|
71
|
+
get platformApiUrl(): string;
|
|
72
|
+
/**
|
|
73
|
+
* Get the app API URL
|
|
74
|
+
*/
|
|
75
|
+
get appApiUrl(): string;
|
|
76
|
+
/**
|
|
77
|
+
* Determine if a path is for the platform context
|
|
78
|
+
*/
|
|
79
|
+
isPlatformPath(path: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Get the API endpoint for a given path
|
|
82
|
+
*/
|
|
83
|
+
resolveEndpoint(path: string): ApiEndpoint;
|
|
84
|
+
/**
|
|
85
|
+
* Build a complete URL for an API path
|
|
86
|
+
*/
|
|
87
|
+
buildUrl(path: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Get the appropriate refresh token function name for a given path
|
|
90
|
+
*/
|
|
91
|
+
getRefreshFunction(path: string): "platformRefreshToken" | "refreshToken";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* API configuration service that manages endpoints for both app and platform APIs
|
|
96
|
+
*/
|
|
97
|
+
export declare type ApiContext = "app" | "platform";
|
|
98
|
+
|
|
99
|
+
export declare interface ApiEndpoint {
|
|
100
|
+
baseUrl: string;
|
|
101
|
+
context: ApiContext;
|
|
102
|
+
}
|
|
103
|
+
|
|
52
104
|
declare interface Attestation {
|
|
53
105
|
sessionKey: Uint8Array | null;
|
|
54
106
|
sessionId: string | null;
|
|
@@ -98,9 +150,37 @@ declare function confirmPasswordReset(email: string, alphanumericCode: string, p
|
|
|
98
150
|
|
|
99
151
|
declare function convertGuestToEmailAccount(email: string, password: string, name?: string | null): Promise<void>;
|
|
100
152
|
|
|
153
|
+
declare function createOrganization(name: string): Promise<Organization>;
|
|
154
|
+
|
|
155
|
+
declare function createProject(orgId: string, name: string, description?: string): Promise<Project>;
|
|
156
|
+
|
|
157
|
+
declare function createProjectSecret(orgId: string, projectId: string, keyName: string, secret: string): Promise<ProjectSecret>;
|
|
158
|
+
|
|
159
|
+
declare function deleteOrganization(orgId: string): Promise<void>;
|
|
160
|
+
|
|
161
|
+
declare function deleteOrganizationInvite(orgId: string, inviteCode: string): Promise<{
|
|
162
|
+
message: string;
|
|
163
|
+
}>;
|
|
164
|
+
|
|
165
|
+
declare function deleteProject(orgId: string, projectId: string): Promise<void>;
|
|
166
|
+
|
|
167
|
+
declare function deleteProjectSecret(orgId: string, projectId: string, keyName: string): Promise<void>;
|
|
168
|
+
|
|
169
|
+
declare type DeveloperResponse = PlatformUser & {
|
|
170
|
+
organizations: PlatformOrg[];
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export declare type DeveloperRole = "owner" | "admin" | "developer" | "viewer";
|
|
174
|
+
|
|
175
|
+
declare type EmailSettings = {
|
|
176
|
+
provider: string;
|
|
177
|
+
send_from: string;
|
|
178
|
+
email_verification_url: string;
|
|
179
|
+
};
|
|
180
|
+
|
|
101
181
|
declare const EXPECTED_ROOT_CERT_HASH = "641a0321a3e244efe456463195d606317ed7cdcc3c1756e09893f3c68f79bb5b";
|
|
102
182
|
|
|
103
|
-
declare function fetchAttestationDocument(nonce: string): Promise<string>;
|
|
183
|
+
declare function fetchAttestationDocument(nonce: string, explicitApiUrl?: string): Promise<string>;
|
|
104
184
|
|
|
105
185
|
declare function fetchDelete(key: string): Promise<void>;
|
|
106
186
|
|
|
@@ -161,7 +241,17 @@ declare function generateThirdPartyToken(audience: string): Promise<ThirdPartyTo
|
|
|
161
241
|
|
|
162
242
|
declare function getApiUrl(): string;
|
|
163
243
|
|
|
164
|
-
declare function getAttestation(forceRefresh?: boolean,
|
|
244
|
+
declare function getAttestation(forceRefresh?: boolean, explicitApiUrl?: string): Promise<Attestation>;
|
|
245
|
+
|
|
246
|
+
declare function getEmailSettings(orgId: string, projectId: string): Promise<EmailSettings>;
|
|
247
|
+
|
|
248
|
+
declare function getOAuthSettings(orgId: string, projectId: string): Promise<OAuthSettings>;
|
|
249
|
+
|
|
250
|
+
declare function getOrganizationInvite(orgId: string, inviteCode: string): Promise<OrganizationInvite>;
|
|
251
|
+
|
|
252
|
+
declare function getPlatformApiUrl(): string;
|
|
253
|
+
|
|
254
|
+
declare function getProject(orgId: string, projectId: string): Promise<Project>;
|
|
165
255
|
|
|
166
256
|
export declare type GithubAuthResponse = {
|
|
167
257
|
auth_url: string;
|
|
@@ -183,7 +273,9 @@ declare function initiateGitHubAuth(client_id: string, inviteCode?: string): Pro
|
|
|
183
273
|
|
|
184
274
|
declare function initiateGoogleAuth(client_id: string, inviteCode?: string): Promise<GoogleAuthResponse>;
|
|
185
275
|
|
|
186
|
-
declare function
|
|
276
|
+
declare function inviteDeveloper(orgId: string, email: string, role?: string): Promise<OrganizationInvite>;
|
|
277
|
+
|
|
278
|
+
declare function keyExchange(clientPublicKey: string, nonce: string, explicitApiUrl?: string): Promise<{
|
|
187
279
|
encrypted_session_key: string;
|
|
188
280
|
session_id: string;
|
|
189
281
|
}>;
|
|
@@ -195,6 +287,16 @@ export declare type KVListItem = {
|
|
|
195
287
|
updated_at: number;
|
|
196
288
|
};
|
|
197
289
|
|
|
290
|
+
declare function listOrganizationInvites(orgId: string): Promise<OrganizationInvite[]>;
|
|
291
|
+
|
|
292
|
+
declare function listOrganizationMembers(orgId: string): Promise<OrganizationMember[]>;
|
|
293
|
+
|
|
294
|
+
declare function listOrganizations(): Promise<Organization[]>;
|
|
295
|
+
|
|
296
|
+
declare function listProjects(orgId: string): Promise<Project[]>;
|
|
297
|
+
|
|
298
|
+
declare function listProjectSecrets(orgId: string, projectId: string): Promise<ProjectSecret[]>;
|
|
299
|
+
|
|
198
300
|
export declare type LoginResponse = {
|
|
199
301
|
id: string;
|
|
200
302
|
email?: string;
|
|
@@ -202,6 +304,26 @@ export declare type LoginResponse = {
|
|
|
202
304
|
refresh_token: string;
|
|
203
305
|
};
|
|
204
306
|
|
|
307
|
+
declare type MeResponse = {
|
|
308
|
+
user: PlatformUser;
|
|
309
|
+
organizations: PlatformOrg[];
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Provider-specific OAuth settings
|
|
314
|
+
*/
|
|
315
|
+
declare type OAuthProviderSettings = {
|
|
316
|
+
client_id: string;
|
|
317
|
+
redirect_url: string;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
declare type OAuthSettings = {
|
|
321
|
+
google_oauth_enabled: boolean;
|
|
322
|
+
github_oauth_enabled: boolean;
|
|
323
|
+
google_oauth_settings?: OAuthProviderSettings;
|
|
324
|
+
github_oauth_settings?: OAuthProviderSettings;
|
|
325
|
+
};
|
|
326
|
+
|
|
205
327
|
export declare type OpenSecretAuthState = {
|
|
206
328
|
loading: boolean;
|
|
207
329
|
user?: api.UserResponse;
|
|
@@ -490,6 +612,316 @@ export declare type OpenSecretContextType = {
|
|
|
490
612
|
generateThirdPartyToken: (audience: string) => Promise<ThirdPartyTokenResponse>;
|
|
491
613
|
};
|
|
492
614
|
|
|
615
|
+
/**
|
|
616
|
+
* Provider component for OpenSecret developer operations.
|
|
617
|
+
* This provider is used for managing organizations, projects, and developer access.
|
|
618
|
+
*
|
|
619
|
+
* @param props - Configuration properties for the OpenSecret developer provider
|
|
620
|
+
* @param props.children - React child components to be wrapped by the provider
|
|
621
|
+
* @param props.apiUrl - URL of OpenSecret developer API
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* ```tsx
|
|
625
|
+
* <OpenSecretDeveloper
|
|
626
|
+
* apiUrl='https://developer.opensecret.cloud'
|
|
627
|
+
* >
|
|
628
|
+
* <App />
|
|
629
|
+
* </OpenSecretDeveloper>
|
|
630
|
+
* ```
|
|
631
|
+
*/
|
|
632
|
+
export declare function OpenSecretDeveloper({ children, apiUrl, pcrConfig }: {
|
|
633
|
+
children: default_2.ReactNode;
|
|
634
|
+
apiUrl: string;
|
|
635
|
+
pcrConfig?: PcrConfig;
|
|
636
|
+
}): JSX_2.Element;
|
|
637
|
+
|
|
638
|
+
export declare type OpenSecretDeveloperAuthState = {
|
|
639
|
+
loading: boolean;
|
|
640
|
+
developer?: DeveloperResponse;
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
export declare const OpenSecretDeveloperContext: default_2.Context<OpenSecretDeveloperContextType>;
|
|
644
|
+
|
|
645
|
+
export declare type OpenSecretDeveloperContextType = {
|
|
646
|
+
auth: OpenSecretDeveloperAuthState;
|
|
647
|
+
/**
|
|
648
|
+
* Signs in a developer with email and password
|
|
649
|
+
* @param email - Developer's email address
|
|
650
|
+
* @param password - Developer's password
|
|
651
|
+
* @returns A promise that resolves to the login response with access and refresh tokens
|
|
652
|
+
*
|
|
653
|
+
* @description
|
|
654
|
+
* - Calls the login API endpoint
|
|
655
|
+
* - Stores access_token and refresh_token in localStorage
|
|
656
|
+
* - Updates the developer state with user information
|
|
657
|
+
* - Throws an error if authentication fails
|
|
658
|
+
*/
|
|
659
|
+
signIn: (email: string, password: string) => Promise<platformApi.PlatformLoginResponse>;
|
|
660
|
+
/**
|
|
661
|
+
* Verifies a platform user's email using the verification code
|
|
662
|
+
* @param code - The verification code sent to the user's email
|
|
663
|
+
* @returns A promise that resolves when verification is complete
|
|
664
|
+
* @throws {Error} If verification fails
|
|
665
|
+
*
|
|
666
|
+
* @description
|
|
667
|
+
* - Takes the verification code from the verification email link
|
|
668
|
+
* - Calls the verification API endpoint
|
|
669
|
+
* - Updates email_verified status if successful
|
|
670
|
+
*/
|
|
671
|
+
verifyEmail: typeof platformApi.verifyPlatformEmail;
|
|
672
|
+
/**
|
|
673
|
+
* Requests a new verification email for the current user
|
|
674
|
+
* @returns A promise that resolves to a success message
|
|
675
|
+
* @throws {Error} If the user is already verified or request fails
|
|
676
|
+
*
|
|
677
|
+
* @description
|
|
678
|
+
* - Used when the user needs a new verification email
|
|
679
|
+
* - Requires the user to be authenticated
|
|
680
|
+
* - Sends a new verification email to the user's registered email address
|
|
681
|
+
*/
|
|
682
|
+
requestNewVerificationCode: typeof platformApi.requestNewPlatformVerificationCode;
|
|
683
|
+
/**
|
|
684
|
+
* Alias for requestNewVerificationCode - for consistency with OpenSecretContext
|
|
685
|
+
*/
|
|
686
|
+
requestNewVerificationEmail: typeof platformApi.requestNewPlatformVerificationCode;
|
|
687
|
+
/**
|
|
688
|
+
* Registers a new developer account
|
|
689
|
+
* @param email - Developer's email address
|
|
690
|
+
* @param password - Developer's password
|
|
691
|
+
* @param name - Optional developer name
|
|
692
|
+
* @returns A promise that resolves to the login response with access and refresh tokens
|
|
693
|
+
*
|
|
694
|
+
* @description
|
|
695
|
+
* - Calls the registration API endpoint
|
|
696
|
+
* - Stores access_token and refresh_token in localStorage
|
|
697
|
+
* - Updates the developer state with new user information
|
|
698
|
+
* - Throws an error if account creation fails
|
|
699
|
+
*/
|
|
700
|
+
signUp: (email: string, password: string, name?: string) => Promise<platformApi.PlatformLoginResponse>;
|
|
701
|
+
/**
|
|
702
|
+
* Signs out the current developer by removing authentication tokens
|
|
703
|
+
*
|
|
704
|
+
* @description
|
|
705
|
+
* - Calls the logout API endpoint with the current refresh_token
|
|
706
|
+
* - Removes access_token, refresh_token from localStorage
|
|
707
|
+
* - Resets the developer state to show no user is authenticated
|
|
708
|
+
*/
|
|
709
|
+
signOut: () => Promise<void>;
|
|
710
|
+
/**
|
|
711
|
+
* Refreshes the developer's authentication state
|
|
712
|
+
* @returns A promise that resolves when the refresh is complete
|
|
713
|
+
* @throws {Error} If the refresh fails
|
|
714
|
+
*
|
|
715
|
+
* @description
|
|
716
|
+
* - Retrieves the latest developer information from the server
|
|
717
|
+
* - Updates the developer state with fresh data
|
|
718
|
+
* - Useful after making changes that affect developer profile or organization membership
|
|
719
|
+
*/
|
|
720
|
+
refetchDeveloper: () => Promise<void>;
|
|
721
|
+
/**
|
|
722
|
+
* Additional PCR0 hashes to validate against
|
|
723
|
+
*/
|
|
724
|
+
pcrConfig: PcrConfig;
|
|
725
|
+
/**
|
|
726
|
+
* Gets attestation from the enclave
|
|
727
|
+
*/
|
|
728
|
+
getAttestation: typeof getAttestation;
|
|
729
|
+
/**
|
|
730
|
+
* Authenticates an attestation document
|
|
731
|
+
*/
|
|
732
|
+
authenticate: typeof authenticate;
|
|
733
|
+
/**
|
|
734
|
+
* Parses an attestation document for viewing
|
|
735
|
+
*/
|
|
736
|
+
parseAttestationForView: (document: AttestationDocument, cabundle: Uint8Array[], pcrConfig?: PcrConfig) => Promise<ParsedAttestationView>;
|
|
737
|
+
/**
|
|
738
|
+
* AWS root certificate in DER format
|
|
739
|
+
*/
|
|
740
|
+
awsRootCertDer: typeof AWS_ROOT_CERT_DER;
|
|
741
|
+
/**
|
|
742
|
+
* Expected hash of the AWS root certificate
|
|
743
|
+
*/
|
|
744
|
+
expectedRootCertHash: typeof EXPECTED_ROOT_CERT_HASH;
|
|
745
|
+
/**
|
|
746
|
+
* Gets and verifies an attestation document from the enclave
|
|
747
|
+
* @returns A promise resolving to the parsed attestation document
|
|
748
|
+
* @throws {Error} If attestation fails or is invalid
|
|
749
|
+
*
|
|
750
|
+
* @description
|
|
751
|
+
* This is a convenience function that:
|
|
752
|
+
* 1. Fetches the attestation document with a random nonce
|
|
753
|
+
* 2. Authenticates the document
|
|
754
|
+
* 3. Parses it for viewing
|
|
755
|
+
*/
|
|
756
|
+
getAttestationDocument: () => Promise<ParsedAttestationView>;
|
|
757
|
+
/**
|
|
758
|
+
* Creates a new organization
|
|
759
|
+
* @param name - Organization name
|
|
760
|
+
* @returns A promise that resolves to the created organization
|
|
761
|
+
*/
|
|
762
|
+
createOrganization: (name: string) => Promise<Organization>;
|
|
763
|
+
/**
|
|
764
|
+
* Lists all organizations the developer has access to
|
|
765
|
+
* @returns A promise resolving to array of organization details
|
|
766
|
+
*/
|
|
767
|
+
listOrganizations: () => Promise<Organization[]>;
|
|
768
|
+
/**
|
|
769
|
+
* Deletes an organization (requires owner role)
|
|
770
|
+
* @param orgId - Organization ID
|
|
771
|
+
*/
|
|
772
|
+
deleteOrganization: (orgId: string) => Promise<void>;
|
|
773
|
+
/**
|
|
774
|
+
* Creates a new project within an organization
|
|
775
|
+
* @param orgId - Organization ID
|
|
776
|
+
* @param name - Project name
|
|
777
|
+
* @param description - Optional project description
|
|
778
|
+
* @returns A promise that resolves to the project details including client ID
|
|
779
|
+
*/
|
|
780
|
+
createProject: (orgId: string, name: string, description?: string) => Promise<Project>;
|
|
781
|
+
/**
|
|
782
|
+
* Lists all projects within an organization
|
|
783
|
+
* @param orgId - Organization ID
|
|
784
|
+
* @returns A promise resolving to array of project details
|
|
785
|
+
*/
|
|
786
|
+
listProjects: (orgId: string) => Promise<Project[]>;
|
|
787
|
+
/**
|
|
788
|
+
* Gets a single project by ID
|
|
789
|
+
* @param orgId - Organization ID
|
|
790
|
+
* @param projectId - Project ID
|
|
791
|
+
* @returns A promise resolving to the project details
|
|
792
|
+
*/
|
|
793
|
+
getProject: (orgId: string, projectId: string) => Promise<Project>;
|
|
794
|
+
/**
|
|
795
|
+
* Updates project details
|
|
796
|
+
* @param orgId - Organization ID
|
|
797
|
+
* @param projectId - Project ID
|
|
798
|
+
* @param updates - Object containing fields to update
|
|
799
|
+
*/
|
|
800
|
+
updateProject: (orgId: string, projectId: string, updates: {
|
|
801
|
+
name?: string;
|
|
802
|
+
description?: string;
|
|
803
|
+
status?: string;
|
|
804
|
+
}) => Promise<Project>;
|
|
805
|
+
/**
|
|
806
|
+
* Deletes a project
|
|
807
|
+
* @param orgId - Organization ID
|
|
808
|
+
* @param projectId - Project ID
|
|
809
|
+
*/
|
|
810
|
+
deleteProject: (orgId: string, projectId: string) => Promise<void>;
|
|
811
|
+
/**
|
|
812
|
+
* Creates a new secret for a project
|
|
813
|
+
* @param orgId - Organization ID
|
|
814
|
+
* @param projectId - Project ID
|
|
815
|
+
* @param keyName - Secret key name (must be alphanumeric)
|
|
816
|
+
* @param secret - Secret value (must be base64 encoded by the caller)
|
|
817
|
+
*
|
|
818
|
+
* Example:
|
|
819
|
+
* ```typescript
|
|
820
|
+
* // To encode a string secret
|
|
821
|
+
* import { encode } from "@stablelib/base64";
|
|
822
|
+
* const encodedSecret = encode(new TextEncoder().encode("my-secret-value"));
|
|
823
|
+
*
|
|
824
|
+
* // Now pass the encoded secret to the function
|
|
825
|
+
* createProjectSecret(orgId, projectId, "mySecretKey", encodedSecret);
|
|
826
|
+
* ```
|
|
827
|
+
*/
|
|
828
|
+
createProjectSecret: (orgId: string, projectId: string, keyName: string, secret: string) => Promise<ProjectSecret>;
|
|
829
|
+
/**
|
|
830
|
+
* Lists all secrets for a project
|
|
831
|
+
* @param orgId - Organization ID
|
|
832
|
+
* @param projectId - Project ID
|
|
833
|
+
*/
|
|
834
|
+
listProjectSecrets: (orgId: string, projectId: string) => Promise<ProjectSecret[]>;
|
|
835
|
+
/**
|
|
836
|
+
* Deletes a project secret
|
|
837
|
+
* @param orgId - Organization ID
|
|
838
|
+
* @param projectId - Project ID
|
|
839
|
+
* @param keyName - Secret key name
|
|
840
|
+
*/
|
|
841
|
+
deleteProjectSecret: (orgId: string, projectId: string, keyName: string) => Promise<void>;
|
|
842
|
+
/**
|
|
843
|
+
* Gets email configuration for a project
|
|
844
|
+
* @param orgId - Organization ID
|
|
845
|
+
* @param projectId - Project ID
|
|
846
|
+
*/
|
|
847
|
+
getEmailSettings: (orgId: string, projectId: string) => Promise<EmailSettings>;
|
|
848
|
+
/**
|
|
849
|
+
* Updates email configuration
|
|
850
|
+
* @param orgId - Organization ID
|
|
851
|
+
* @param projectId - Project ID
|
|
852
|
+
* @param settings - Email settings
|
|
853
|
+
*/
|
|
854
|
+
updateEmailSettings: (orgId: string, projectId: string, settings: EmailSettings) => Promise<EmailSettings>;
|
|
855
|
+
/**
|
|
856
|
+
* Gets OAuth settings for a project
|
|
857
|
+
* @param orgId - Organization ID
|
|
858
|
+
* @param projectId - Project ID
|
|
859
|
+
*/
|
|
860
|
+
getOAuthSettings: (orgId: string, projectId: string) => Promise<OAuthSettings>;
|
|
861
|
+
/**
|
|
862
|
+
* Updates OAuth configuration
|
|
863
|
+
* @param orgId - Organization ID
|
|
864
|
+
* @param projectId - Project ID
|
|
865
|
+
* @param settings - OAuth settings
|
|
866
|
+
*/
|
|
867
|
+
updateOAuthSettings: (orgId: string, projectId: string, settings: OAuthSettings) => Promise<OAuthSettings>;
|
|
868
|
+
/**
|
|
869
|
+
* Creates an invitation to join an organization
|
|
870
|
+
* @param orgId - Organization ID
|
|
871
|
+
* @param email - Developer's email address
|
|
872
|
+
* @param role - Role to assign (defaults to "admin")
|
|
873
|
+
*/
|
|
874
|
+
inviteDeveloper: (orgId: string, email: string, role?: string) => Promise<OrganizationInvite>;
|
|
875
|
+
/**
|
|
876
|
+
* Lists all members of an organization
|
|
877
|
+
* @param orgId - Organization ID
|
|
878
|
+
*/
|
|
879
|
+
listOrganizationMembers: (orgId: string) => Promise<OrganizationMember[]>;
|
|
880
|
+
/**
|
|
881
|
+
* Lists all pending invitations for an organization
|
|
882
|
+
* @param orgId - Organization ID
|
|
883
|
+
*/
|
|
884
|
+
listOrganizationInvites: (orgId: string) => Promise<OrganizationInvite[]>;
|
|
885
|
+
/**
|
|
886
|
+
* Gets a specific invitation by code
|
|
887
|
+
* @param orgId - Organization ID
|
|
888
|
+
* @param inviteCode - Invitation UUID code
|
|
889
|
+
*/
|
|
890
|
+
getOrganizationInvite: (orgId: string, inviteCode: string) => Promise<OrganizationInvite>;
|
|
891
|
+
/**
|
|
892
|
+
* Deletes an invitation
|
|
893
|
+
* @param orgId - Organization ID
|
|
894
|
+
* @param inviteCode - Invitation UUID code
|
|
895
|
+
*/
|
|
896
|
+
deleteOrganizationInvite: (orgId: string, inviteCode: string) => Promise<{
|
|
897
|
+
message: string;
|
|
898
|
+
}>;
|
|
899
|
+
/**
|
|
900
|
+
* Updates a member's role
|
|
901
|
+
* @param orgId - Organization ID
|
|
902
|
+
* @param userId - User ID to update
|
|
903
|
+
* @param role - New role to assign
|
|
904
|
+
*/
|
|
905
|
+
updateMemberRole: (orgId: string, userId: string, role: string) => Promise<OrganizationMember>;
|
|
906
|
+
/**
|
|
907
|
+
* Removes a member from the organization
|
|
908
|
+
* @param orgId - Organization ID
|
|
909
|
+
* @param userId - User ID to remove
|
|
910
|
+
*/
|
|
911
|
+
removeMember: (orgId: string, userId: string) => Promise<void>;
|
|
912
|
+
/**
|
|
913
|
+
* Accepts an organization invitation
|
|
914
|
+
* @param code - Invitation UUID code
|
|
915
|
+
*/
|
|
916
|
+
acceptInvite: (code: string) => Promise<{
|
|
917
|
+
message: string;
|
|
918
|
+
}>;
|
|
919
|
+
/**
|
|
920
|
+
* Returns the current OpenSecret developer API URL being used
|
|
921
|
+
*/
|
|
922
|
+
apiUrl: string;
|
|
923
|
+
};
|
|
924
|
+
|
|
493
925
|
/**
|
|
494
926
|
* Provider component for OpenSecret authentication and key-value storage.
|
|
495
927
|
*
|
|
@@ -523,6 +955,30 @@ export declare function OpenSecretProvider({ children, apiUrl, clientId, pcrConf
|
|
|
523
955
|
pcrConfig?: PcrConfig;
|
|
524
956
|
}): JSX_2.Element;
|
|
525
957
|
|
|
958
|
+
declare type Organization = {
|
|
959
|
+
id: string;
|
|
960
|
+
name: string;
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
export declare type OrganizationDetails = Organization;
|
|
964
|
+
|
|
965
|
+
declare type OrganizationInvite = {
|
|
966
|
+
code: string;
|
|
967
|
+
email: string;
|
|
968
|
+
role: string;
|
|
969
|
+
used: boolean;
|
|
970
|
+
expires_at: string;
|
|
971
|
+
created_at: string;
|
|
972
|
+
updated_at: string;
|
|
973
|
+
organization_name?: string;
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
declare type OrganizationMember = {
|
|
977
|
+
user_id: string;
|
|
978
|
+
role: string;
|
|
979
|
+
name?: string;
|
|
980
|
+
};
|
|
981
|
+
|
|
526
982
|
export declare type ParsedAttestationView = {
|
|
527
983
|
moduleId: string;
|
|
528
984
|
publicKey: string | null;
|
|
@@ -555,6 +1011,111 @@ export declare type PcrConfig = {
|
|
|
555
1011
|
pcr0DevValues?: string[];
|
|
556
1012
|
};
|
|
557
1013
|
|
|
1014
|
+
declare namespace platformApi {
|
|
1015
|
+
export {
|
|
1016
|
+
setPlatformApiUrl,
|
|
1017
|
+
getPlatformApiUrl,
|
|
1018
|
+
platformLogin,
|
|
1019
|
+
platformRegister,
|
|
1020
|
+
platformLogout,
|
|
1021
|
+
platformRefreshToken,
|
|
1022
|
+
createOrganization,
|
|
1023
|
+
listOrganizations,
|
|
1024
|
+
deleteOrganization,
|
|
1025
|
+
createProject,
|
|
1026
|
+
listProjects,
|
|
1027
|
+
getProject,
|
|
1028
|
+
updateProject,
|
|
1029
|
+
deleteProject,
|
|
1030
|
+
createProjectSecret,
|
|
1031
|
+
listProjectSecrets,
|
|
1032
|
+
deleteProjectSecret,
|
|
1033
|
+
getEmailSettings,
|
|
1034
|
+
updateEmailSettings,
|
|
1035
|
+
getOAuthSettings,
|
|
1036
|
+
updateOAuthSettings,
|
|
1037
|
+
inviteDeveloper,
|
|
1038
|
+
listOrganizationInvites,
|
|
1039
|
+
getOrganizationInvite,
|
|
1040
|
+
deleteOrganizationInvite,
|
|
1041
|
+
listOrganizationMembers,
|
|
1042
|
+
updateMemberRole,
|
|
1043
|
+
removeMember,
|
|
1044
|
+
acceptInvite,
|
|
1045
|
+
platformMe,
|
|
1046
|
+
verifyPlatformEmail,
|
|
1047
|
+
requestNewPlatformVerificationCode,
|
|
1048
|
+
PlatformLoginResponse,
|
|
1049
|
+
PlatformRefreshResponse,
|
|
1050
|
+
PlatformOrg,
|
|
1051
|
+
PlatformUser,
|
|
1052
|
+
MeResponse,
|
|
1053
|
+
Organization,
|
|
1054
|
+
OrganizationInvite,
|
|
1055
|
+
Project,
|
|
1056
|
+
ProjectSecret,
|
|
1057
|
+
ProjectSettings,
|
|
1058
|
+
EmailSettings,
|
|
1059
|
+
OAuthProviderSettings,
|
|
1060
|
+
OAuthSettings,
|
|
1061
|
+
OrganizationMember
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
declare function platformLogin(email: string, password: string): Promise<PlatformLoginResponse>;
|
|
1066
|
+
|
|
1067
|
+
declare type PlatformLoginResponse = {
|
|
1068
|
+
id: string;
|
|
1069
|
+
email: string;
|
|
1070
|
+
name?: string;
|
|
1071
|
+
access_token: string;
|
|
1072
|
+
refresh_token: string;
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
declare function platformLogout(refresh_token: string): Promise<void>;
|
|
1076
|
+
|
|
1077
|
+
declare function platformMe(): Promise<MeResponse>;
|
|
1078
|
+
|
|
1079
|
+
declare type PlatformOrg = {
|
|
1080
|
+
id: string;
|
|
1081
|
+
name: string;
|
|
1082
|
+
role?: string;
|
|
1083
|
+
created_at?: string;
|
|
1084
|
+
updated_at?: string;
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
declare type PlatformRefreshResponse = {
|
|
1088
|
+
access_token: string;
|
|
1089
|
+
refresh_token: string;
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Refreshes platform access and refresh tokens
|
|
1094
|
+
*
|
|
1095
|
+
* This function:
|
|
1096
|
+
* 1. Gets the refresh token from localStorage
|
|
1097
|
+
* 2. Calls the platform-specific refresh endpoint (/platform/refresh)
|
|
1098
|
+
* 3. Updates localStorage with the new tokens
|
|
1099
|
+
*
|
|
1100
|
+
* The platform refresh endpoint expects:
|
|
1101
|
+
* - A refresh token with audience "platform_refresh" in the request body
|
|
1102
|
+
* - The request to be encrypted according to the platform's encryption scheme
|
|
1103
|
+
*
|
|
1104
|
+
* It returns new access and refresh tokens if validation succeeds.
|
|
1105
|
+
*/
|
|
1106
|
+
declare function platformRefreshToken(): Promise<PlatformRefreshResponse>;
|
|
1107
|
+
|
|
1108
|
+
declare function platformRegister(email: string, password: string, name?: string): Promise<PlatformLoginResponse>;
|
|
1109
|
+
|
|
1110
|
+
declare type PlatformUser = {
|
|
1111
|
+
id: string;
|
|
1112
|
+
email: string;
|
|
1113
|
+
name?: string;
|
|
1114
|
+
email_verified: boolean;
|
|
1115
|
+
created_at: string;
|
|
1116
|
+
updated_at: string;
|
|
1117
|
+
};
|
|
1118
|
+
|
|
558
1119
|
declare type PrivateKeyBytesResponse = {
|
|
559
1120
|
/** 32-byte hex string (64 characters) representing the private key */
|
|
560
1121
|
private_key: string;
|
|
@@ -565,6 +1126,30 @@ declare type PrivateKeyResponse = {
|
|
|
565
1126
|
mnemonic: string;
|
|
566
1127
|
};
|
|
567
1128
|
|
|
1129
|
+
declare type Project = {
|
|
1130
|
+
id: string;
|
|
1131
|
+
client_id: string;
|
|
1132
|
+
name: string;
|
|
1133
|
+
description?: string;
|
|
1134
|
+
status: string;
|
|
1135
|
+
created_at: string;
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
export declare type ProjectDetails = Project;
|
|
1139
|
+
|
|
1140
|
+
declare type ProjectSecret = {
|
|
1141
|
+
key_name: string;
|
|
1142
|
+
created_at: string;
|
|
1143
|
+
updated_at: string;
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
export declare type ProjectSettings = {
|
|
1147
|
+
category: string;
|
|
1148
|
+
settings: Record<string, unknown>;
|
|
1149
|
+
created_at: string;
|
|
1150
|
+
updated_at: string;
|
|
1151
|
+
};
|
|
1152
|
+
|
|
568
1153
|
declare type PublicKeyResponse = {
|
|
569
1154
|
/** Public key in hex format */
|
|
570
1155
|
public_key: string;
|
|
@@ -579,12 +1164,25 @@ declare type RefreshResponse = {
|
|
|
579
1164
|
|
|
580
1165
|
declare function refreshToken(): Promise<RefreshResponse>;
|
|
581
1166
|
|
|
1167
|
+
declare function removeMember(orgId: string, userId: string): Promise<void>;
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Requests a new verification email for a platform user
|
|
1171
|
+
* @returns A promise that resolves to a success message
|
|
1172
|
+
* @throws {Error} If the user is already verified or request fails
|
|
1173
|
+
*/
|
|
1174
|
+
declare function requestNewPlatformVerificationCode(): Promise<{
|
|
1175
|
+
message: string;
|
|
1176
|
+
}>;
|
|
1177
|
+
|
|
582
1178
|
declare function requestNewVerificationCode(): Promise<void>;
|
|
583
1179
|
|
|
584
1180
|
declare function requestPasswordReset(email: string, hashedSecret: string, client_id: string): Promise<void>;
|
|
585
1181
|
|
|
586
1182
|
declare function setApiUrl(url: string): void;
|
|
587
1183
|
|
|
1184
|
+
declare function setPlatformApiUrl(url: string): void;
|
|
1185
|
+
|
|
588
1186
|
declare type SigningAlgorithm = "schnorr" | "ecdsa";
|
|
589
1187
|
|
|
590
1188
|
/**
|
|
@@ -628,8 +1226,22 @@ declare type ThirdPartyTokenResponse = {
|
|
|
628
1226
|
token: string;
|
|
629
1227
|
};
|
|
630
1228
|
|
|
1229
|
+
declare function updateEmailSettings(orgId: string, projectId: string, settings: EmailSettings): Promise<EmailSettings>;
|
|
1230
|
+
|
|
1231
|
+
declare function updateMemberRole(orgId: string, userId: string, role: string): Promise<OrganizationMember>;
|
|
1232
|
+
|
|
1233
|
+
declare function updateOAuthSettings(orgId: string, projectId: string, settings: OAuthSettings): Promise<OAuthSettings>;
|
|
1234
|
+
|
|
1235
|
+
declare function updateProject(orgId: string, projectId: string, updates: {
|
|
1236
|
+
name?: string;
|
|
1237
|
+
description?: string;
|
|
1238
|
+
status?: string;
|
|
1239
|
+
}): Promise<Project>;
|
|
1240
|
+
|
|
631
1241
|
export declare function useOpenSecret(): OpenSecretContextType;
|
|
632
1242
|
|
|
1243
|
+
export declare function useOpenSecretDeveloper(): OpenSecretDeveloperContextType;
|
|
1244
|
+
|
|
633
1245
|
export declare type UserResponse = {
|
|
634
1246
|
user: {
|
|
635
1247
|
id: string;
|
|
@@ -644,4 +1256,12 @@ export declare type UserResponse = {
|
|
|
644
1256
|
|
|
645
1257
|
declare function verifyEmail(code: string): Promise<void>;
|
|
646
1258
|
|
|
1259
|
+
/**
|
|
1260
|
+
* Verifies a platform user's email using the verification code
|
|
1261
|
+
* @param code - The verification code sent to the user's email
|
|
1262
|
+
* @returns A promise that resolves when verification is complete
|
|
1263
|
+
* @throws {Error} If verification fails
|
|
1264
|
+
*/
|
|
1265
|
+
declare function verifyPlatformEmail(code: string): Promise<void>;
|
|
1266
|
+
|
|
647
1267
|
export { }
|