· last year · Nov 17, 2023, 08:05 AM
1import { IncomingMessage } from 'http';
2import { request } from 'https';
3
4import { getJsonBody, getStringHeader } from '../request-utils';
5import { hasProp, validateArray, validateString } from '../validation-utils';
6
7export interface IMinioParams {
8 endpoint: string;
9 accessKey: string;
10 secretKey: string;
11}
12
13export interface IMinioAuth {
14 url: string;
15 accessKey: string;
16 secretKey: string;
17}
18
19export interface IMinioAuthenticator {
20 getAuth(): Promise<IMinioAuth>;
21}
22
23const createMinIOAuthenticator = (params: IMinioParams): IMinioAuthenticator => {
24 const authenticator: IMinioAuthenticator = {
25 getAuth: async () => {
26 return Promise.resolve({
27 url: params.endpoint,
28 accessKey: params.accessKey,
29 secretKey: params.secretKey,
30 });
31 },
32 };
33
34 return authenticator;
35};
36
37const minIOParams: IMinioParams = {
38 endpoint: 'https://s3.estpak.ee:9000',
39 accessKey: 'your-access-key',
40 secretKey: 'your-secret-key'
41};
42
43const minIOAuthenticator = createMinIOAuthenticator(minIOParams);
44