More fixes

This commit is contained in:
Daniel Hougaard
2024-08-30 07:20:12 +04:00
parent 7fd8c56cc8
commit 6cb5ebfef2
3 changed files with 37 additions and 27 deletions

View File

@@ -4,23 +4,13 @@ import { DefaultApi as InfisicalApi } from "../infisicalapi_client";
type AuthenticatorFunction = (accessToken: string) => InfisicalSDK;
const getAwsRegion = () => {
// Implement AWS region retrieval logic here
// For simplicity, we'll use an environment variable
const region = process.env.AWS_REGION;
if (!region) {
throw new Error("AWS region not set");
}
return region;
};
export default class AuthClient {
sdkAuthenticator: AuthenticatorFunction;
apiClient: InfisicalApi;
constructor(authenticator: AuthenticatorFunction) {
constructor(authenticator: AuthenticatorFunction, apiInstance: InfisicalApi) {
this.sdkAuthenticator = authenticator;
this.apiClient = new InfisicalApi();
this.apiClient = apiInstance;
}
universalAuth = {
@@ -37,10 +27,3 @@ export default class AuthClient {
return this.sdkAuthenticator(token);
};
}
import * as crypto from "crypto";
import axios from "axios";
import { SignatureV4 } from "@aws-sdk/signature-v4";
import { Sha256 } from "@aws-crypto/sha256-js";
import { defaultProvider } from "@aws-sdk/credential-provider-node";
import { fromNodeProviderChain } from "@aws-sdk/credential-providers";