mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 22:46:24 +00:00
Merge pull request #3647 from Infisical/ENG-2814
feat(secret-sync): 1Password Secret Sync + App Connection
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export * from "./queries";
|
||||
export * from "./types";
|
||||
@@ -0,0 +1,37 @@
|
||||
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { appConnectionKeys } from "../queries";
|
||||
import { TOnePassVault } from "./types";
|
||||
|
||||
const onePassConnectionKeys = {
|
||||
all: [...appConnectionKeys.all, "1password"] as const,
|
||||
listVaults: (connectionId: string) =>
|
||||
[...onePassConnectionKeys.all, "vaults", connectionId] as const
|
||||
};
|
||||
|
||||
export const useOnePassConnectionListVaults = (
|
||||
connectionId: string,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
TOnePassVault[],
|
||||
unknown,
|
||||
TOnePassVault[],
|
||||
ReturnType<typeof onePassConnectionKeys.listVaults>
|
||||
>,
|
||||
"queryKey" | "queryFn"
|
||||
>
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: onePassConnectionKeys.listVaults(connectionId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<TOnePassVault[]>(
|
||||
`/api/v1/app-connections/1password/${connectionId}/vaults`
|
||||
);
|
||||
|
||||
return data;
|
||||
},
|
||||
...options
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
export type TOnePassVault = {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
items: number;
|
||||
|
||||
attributeVersion: number;
|
||||
contentVersion: number;
|
||||
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
@@ -17,5 +17,6 @@ export enum AppConnection {
|
||||
HCVault = "hashicorp-vault",
|
||||
LDAP = "ldap",
|
||||
TeamCity = "teamcity",
|
||||
OCI = "oci"
|
||||
OCI = "oci",
|
||||
OnePass = "1password"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { AppConnection } from "@app/hooks/api/appConnections/enums";
|
||||
import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
|
||||
|
||||
export enum OnePassConnectionMethod {
|
||||
ApiToken = "api-token"
|
||||
}
|
||||
|
||||
export type TOnePassConnection = TRootAppConnection & { app: AppConnection.OnePass } & {
|
||||
method: OnePassConnectionMethod.ApiToken;
|
||||
credentials: {
|
||||
apiToken: string;
|
||||
instanceUrl: string;
|
||||
};
|
||||
};
|
||||
@@ -88,6 +88,10 @@ export type TOCIConnectionOption = TAppConnectionOptionBase & {
|
||||
app: AppConnection.OCI;
|
||||
};
|
||||
|
||||
export type TOnePassConnectionOption = TAppConnectionOptionBase & {
|
||||
app: AppConnection.OnePass;
|
||||
};
|
||||
|
||||
export type TAppConnectionOption =
|
||||
| TAwsConnectionOption
|
||||
| TGitHubConnectionOption
|
||||
@@ -106,7 +110,8 @@ export type TAppConnectionOption =
|
||||
| TAuth0ConnectionOption
|
||||
| THCVaultConnectionOption
|
||||
| TTeamCityConnectionOption
|
||||
| TOCIConnectionOption;
|
||||
| TOCIConnectionOption
|
||||
| TOnePassConnectionOption;
|
||||
|
||||
export type TAppConnectionOptionMap = {
|
||||
[AppConnection.AWS]: TAwsConnectionOption;
|
||||
@@ -128,4 +133,5 @@ export type TAppConnectionOptionMap = {
|
||||
[AppConnection.LDAP]: TLdapConnectionOption;
|
||||
[AppConnection.TeamCity]: TTeamCityConnectionOption;
|
||||
[AppConnection.OCI]: TOCIConnectionOption;
|
||||
[AppConnection.OnePass]: TOnePassConnectionOption;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AppConnection } from "../enums";
|
||||
import { TOnePassConnection } from "./1password-connection";
|
||||
import { TAppConnectionOption } from "./app-options";
|
||||
import { TAuth0Connection } from "./auth0-connection";
|
||||
import { TAwsConnection } from "./aws-connection";
|
||||
@@ -20,6 +21,7 @@ import { TTerraformCloudConnection } from "./terraform-cloud-connection";
|
||||
import { TVercelConnection } from "./vercel-connection";
|
||||
import { TWindmillConnection } from "./windmill-connection";
|
||||
|
||||
export * from "./1password-connection";
|
||||
export * from "./auth0-connection";
|
||||
export * from "./aws-connection";
|
||||
export * from "./azure-app-configuration-connection";
|
||||
@@ -59,7 +61,8 @@ export type TAppConnection =
|
||||
| THCVaultConnection
|
||||
| TLdapConnection
|
||||
| TTeamCityConnection
|
||||
| TOCIConnection;
|
||||
| TOCIConnection
|
||||
| TOnePassConnection;
|
||||
|
||||
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id">;
|
||||
|
||||
@@ -106,4 +109,5 @@ export type TAppConnectionMap = {
|
||||
[AppConnection.LDAP]: TLdapConnection;
|
||||
[AppConnection.TeamCity]: TTeamCityConnection;
|
||||
[AppConnection.OCI]: TOCIConnection;
|
||||
[AppConnection.OnePass]: TOnePassConnection;
|
||||
};
|
||||
|
||||
@@ -13,7 +13,8 @@ export enum SecretSync {
|
||||
Windmill = "windmill",
|
||||
HCVault = "hashicorp-vault",
|
||||
TeamCity = "teamcity",
|
||||
OCIVault = "oci-vault"
|
||||
OCIVault = "oci-vault",
|
||||
OnePass = "1password"
|
||||
}
|
||||
|
||||
export enum SecretSyncStatus {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { AppConnection } from "@app/hooks/api/appConnections/enums";
|
||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
|
||||
|
||||
export type TOnePassSync = TRootSecretSync & {
|
||||
destination: SecretSync.OnePass;
|
||||
destinationConfig: {
|
||||
vaultId: string;
|
||||
};
|
||||
connection: {
|
||||
app: AppConnection.OnePass;
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
import { SecretSync, SecretSyncImportBehavior } from "@app/hooks/api/secretSyncs";
|
||||
import { DiscriminativePick } from "@app/types";
|
||||
|
||||
import { TOnePassSync } from "./1password-sync";
|
||||
import { TAwsParameterStoreSync } from "./aws-parameter-store-sync";
|
||||
import { TAwsSecretsManagerSync } from "./aws-secrets-manager-sync";
|
||||
import { TAzureAppConfigurationSync } from "./azure-app-configuration-sync";
|
||||
@@ -39,7 +40,8 @@ export type TSecretSync =
|
||||
| TWindmillSync
|
||||
| THCVaultSync
|
||||
| TTeamCitySync
|
||||
| TOCIVaultSync;
|
||||
| TOCIVaultSync
|
||||
| TOnePassSync;
|
||||
|
||||
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user