From aa1453556e8024a62e781163eb681ee26ea38aac Mon Sep 17 00:00:00 2001 From: Jolly Good <1671375+good-lly@users.noreply.github.com> Date: Wed, 27 Nov 2024 12:29:20 +0100 Subject: [PATCH] cleanup --- .prettierrc.js | 12 ++++ .prettierrc.json | 12 ---- lib/index.js | 7 +- lib/index.js.map | 2 +- lib/index.min.js.map | 4 +- src/index.ts | 10 +-- src/utils/crypto-wrapper.ts | 123 ------------------------------------ tsconfig.json | 4 -- 8 files changed, 24 insertions(+), 150 deletions(-) create mode 100644 .prettierrc.js delete mode 100644 .prettierrc.json delete mode 100644 src/utils/crypto-wrapper.ts diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..c160545 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,12 @@ +module.exports = { + serverModuleFormat: 'js', + bracketSpacing: true, + bracketSameLine: false, + singleQuote: true, + semi: true, + endOfLine: "lf", + tabWidth: 2, + trailingComma: 'all', + arrowParens: 'avoid', + printWidth: 120, +}; \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index ebeb67d..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "serverModuleFormat": "js", - "bracketSpacing": true, - "bracketSameLine": false, - "singleQuote": true, - "semi": true, - "endOfLine": "lf", - "tabWidth": 2, - "trailingComma": "all", - "arrowParens": "avoid", - "printWidth": 120 -} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index 2e4cd86..be75805 100644 --- a/lib/index.js +++ b/lib/index.js @@ -35,6 +35,7 @@ const ERROR_DATA_BUFFER_REQUIRED = `${ERROR_PREFIX}data must be a Buffer or stri const ERROR_PREFIX_TYPE = `${ERROR_PREFIX}prefix must be a string`; const ERROR_MAX_KEYS_TYPE = `${ERROR_PREFIX}maxKeys must be a positive integer`; const ERROR_DELIMITER_REQUIRED = `${ERROR_PREFIX}delimiter must be a string`; +// the old way to work with crypto - without browser support let _createHmac = crypto.createHmac || (await import('node:crypto')).createHmac; let _createHash = crypto.createHash || (await import('node:crypto')).createHash; if (typeof _createHmac === 'undefined' && typeof _createHash === 'undefined') { @@ -830,11 +831,15 @@ class S3 { } async _sendRequest(url, method, headers, body, toleratedStatusCodes = []) { this._log('info', `Sending ${method} request to ${url}, headers: ${JSON.stringify(headers)}`); + // Remove forbidden headers + // const safeHeaders = { ...headers }; + // delete safeHeaders[HEADER_HOST]; // Browser sets this automatically + // delete safeHeaders[HEADER_CONTENT_LENGTH]; // Browser sets this based on the body const res = await fetch(url, { method, headers, body: ['GET', 'HEAD'].includes(method) ? undefined : body, - signal: this.requestAbortTimeout !== undefined ? AbortSignal.timeout(this.requestAbortTimeout) : undefined, + signal: this.requestAbortTimeout !== undefined ? AbortSignal.timeout(this.requestAbortTimeout) : undefined }); this._log('info', `Response status: ${(res.status, toleratedStatusCodes)}`); if (!res.ok && !toleratedStatusCodes.includes(res.status)) { diff --git a/lib/index.js.map b/lib/index.js.map index aaa0d67..36d7f7b 100644 --- a/lib/index.js.map +++ b/lib/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,YAAY;AACZ,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAC5C,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AAC/D,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAC3C,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAC7C,wDAAwD;AACxD,MAAM,uBAAuB,GAAG,CAAC,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;AAC/F,MAAM,6BAA6B,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD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C,CAAC;AAEF,OAAO,EAAE,EAAE,EAAE,CAAC;AACd,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/lib/index.min.js.map b/lib/index.min.js.map index c11fa0d..9e882a5 100644 --- a/lib/index.min.js.map +++ b/lib/index.min.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/index.ts"], - "sourcesContent": ["'use strict';\n\n// Constants\nconst AWS_ALGORITHM = 'AWS4-HMAC-SHA256';\nconst AWS_REQUEST_TYPE = 'aws4_request';\nconst S3_SERVICE = 's3';\nconst LIST_TYPE = '2';\nconst UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD';\nconst DEFAULT_STREAM_CONTENT_TYPE = 'application/octet-stream';\nconst XML_CONTENT_TYPE = 'application/xml';\nconst JSON_CONTENT_TYPE = 'application/json';\n// List of keys that might contain sensitive information\nconst SENSITIVE_KEYS_REDACTED = ['accessKeyId', 'secretAccessKey', 'sessionToken', 'password'];\nconst MIN_MAX_REQUEST_SIZE_IN_BYTES = 5 * 1024 * 1024;\n\n// Headers\nconst HEADER_AMZ_CONTENT_SHA256 = 'x-amz-content-sha256';\nconst HEADER_AMZ_DATE = 'x-amz-date';\nconst HEADER_HOST = 'host';\nconst HEADER_AUTHORIZATION = 'Authorization';\nconst HEADER_CONTENT_TYPE = 'Content-Type';\nconst HEADER_CONTENT_LENGTH = 'Content-Length';\nconst HEADER_ETAG = 'etag';\nconst HEADER_LAST_MODIFIED = 'last-modified';\n\n// Error messages\nconst ERROR_PREFIX = 'ultralight-s3 Module: ';\nconst ERROR_ACCESS_KEY_REQUIRED = `${ERROR_PREFIX}accessKeyId must be a non-empty string`;\nconst ERROR_SECRET_KEY_REQUIRED = `${ERROR_PREFIX}secretAccessKey must be a non-empty string`;\nconst ERROR_ENDPOINT_REQUIRED = `${ERROR_PREFIX}endpoint must be a non-empty string`;\nconst ERROR_BUCKET_NAME_REQUIRED = `${ERROR_PREFIX}bucketName must be a non-empty string`;\nconst ERROR_KEY_REQUIRED = `${ERROR_PREFIX}key must be a non-empty string`;\nconst ERROR_UPLOAD_ID_REQUIRED = `${ERROR_PREFIX}uploadId must be a non-empty string`;\nconst ERROR_PARTS_REQUIRED = `${ERROR_PREFIX}parts must be a non-empty array`;\nconst ERROR_INVALID_PART = `${ERROR_PREFIX}Each part must have a partNumber (number) and ETag (string)`;\nconst ERROR_DATA_BUFFER_REQUIRED = `${ERROR_PREFIX}data must be a Buffer or string`;\n// const ERROR_PATH_REQUIRED = `${ERROR_PREFIX}path must be a string`;\nconst ERROR_PREFIX_TYPE = `${ERROR_PREFIX}prefix must be a string`;\nconst ERROR_MAX_KEYS_TYPE = `${ERROR_PREFIX}maxKeys must be a positive integer`;\nconst ERROR_DELIMITER_REQUIRED = `${ERROR_PREFIX}delimiter must be a string`;\n\n// const STATUS_CODES: Record = {\n// 200: 'OK',\n// 204: 'No Content',\n// 205: 'Reset Content',\n// 206: 'Partial Content',\n// 301: 'Moved Permanently',\n// 302: 'Found',\n// 400: 'Bad Request',\n// 401: 'Unauthorized',\n// 403: 'Forbidden',\n// 404: 'Not Found',\n// 418: \"I'm a Teapot\",\n// 428: 'Precondition Required',\n// 429: 'Too Many Requests',\n// 500: 'Internal Server Error',\n// 501: 'Not Implemented',\n// };\n\ninterface S3Config {\n accessKeyId: string;\n secretAccessKey: string;\n endpoint: string;\n bucketName: string;\n region?: string;\n maxRequestSizeInBytes?: number;\n requestAbortTimeout?: number;\n logger?: Logger;\n}\n\ndeclare global {\n interface Crypto {\n createHmac: (\n algorithm: string,\n key: string | Buffer,\n ) => {\n update: (data: string | Buffer) => void;\n digest: (encoding?: 'hex' | 'base64' | 'latin1') => string;\n };\n createHash: (algorithm: string) => {\n update: (data: string | Buffer) => void;\n digest: (encoding?: 'hex' | 'base64' | 'latin1') => string;\n };\n }\n}\n\ninterface Logger {\n info: (message: string, ...args: any[]) => void;\n warn: (message: string, ...args: any[]) => void;\n error: (message: string, ...args: any[]) => void;\n}\n\ninterface UploadPart {\n partNumber: number;\n ETag: string;\n}\n\ninterface CompleteMultipartUploadResult {\n Location: string;\n Bucket: string;\n Key: string;\n ETag: string;\n}\n\ntype HttpMethod = 'POST' | 'GET' | 'HEAD' | 'PUT' | 'DELETE';\n\n// false - Not found (404)\n// true - Found (200)\n// null - ETag mismatch (412)\ntype ExistResponseCode = false | true | null;\n\nlet _createHmac = crypto.createHmac || (await import('node:crypto')).createHmac;\nlet _createHash = crypto.createHash || (await import('node:crypto')).createHash;\n\nif (typeof _createHmac === 'undefined' && typeof _createHash === 'undefined') {\n console.error(\n 'ultralight-S3 Module: Crypto functions are not available, please report the issue with necessary description: https://github.com/sentienhq/ultralight-s3/issues',\n );\n}\n\nconst expectArray: { [key: string]: boolean } = {\n contents: true,\n};\n\nconst encodeAsHex = (c: string): string => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;\n\nconst uriEscape = (uriStr: string): string => {\n return encodeURIComponent(uriStr).replace(/[!'()*]/g, encodeAsHex);\n};\n\nconst uriResourceEscape = (string: string): string => {\n return uriEscape(string).replace(/%2F/g, '/');\n};\n\n/**\n * S3 class for interacting with S3-compatible object storage services.\n * This class provides methods for common S3 operations such as uploading, downloading,\n * and deleting objects, as well as multipart uploads.\n *\n * @class\n * @example\n * const s3 = new S3({\n * accessKeyId: 'your-access-key',\n * secretAccessKey: 'your-secret-key',\n * endpoint: 'https://your-s3-endpoint.com',\n * bucketName: 'your-bucket-name',\n * region: 'us-east-1' // by default is auto\n * });\n *\n * // Upload a file\n * await s3.put('example.txt', 'Hello, World!');\n *\n * // Download a file\n * const content = await s3.get('example.txt');\n *\n * // Delete a file\n * await s3.delete('example.txt');\n */\nclass S3 {\n /**\n * Creates an instance of the S3 class.\n *\n * @constructor\n * @param {Object} config - Configuration options for the S3 instance.\n * @param {string} config.accessKeyId - The access key ID for authentication.\n * @param {string} config.secretAccessKey - The secret access key for authentication.\n * @param {string} config.endpoint - The endpoint URL of the S3-compatible service.\n * @param {string} [config.bucketName=''] - The name of the bucket to operate on.\n * @param {string} [config.region='auto'] - The region of the S3 service.\n * @param {number} [config.maxRequestSizeInBytes=5242880] - The maximum size of a single request in bytes (minimum for AWS S3 is 5MB).\n * @param {number} [config.requestAbortTimeout=undefined] - The timeout in milliseconds after which a request should be aborted (careful on streamed requests).\n * @param {Object} [config.logger=null] - A logger object with methods like info, warn, error.\n * @throws {TypeError} Will throw an error if required parameters are missing or of incorrect type.\n */\n private accessKeyId: string;\n private secretAccessKey: string;\n private endpoint: string;\n private bucketName: string;\n private region: string;\n private maxRequestSizeInBytes: number;\n private requestAbortTimeout?: number;\n private logger?: Logger;\n\n constructor({\n accessKeyId,\n secretAccessKey,\n endpoint,\n bucketName,\n region = 'auto',\n maxRequestSizeInBytes = MIN_MAX_REQUEST_SIZE_IN_BYTES,\n requestAbortTimeout = undefined,\n logger = undefined,\n }: S3Config) {\n this._validateConstructorParams(accessKeyId, secretAccessKey, endpoint, bucketName);\n this.accessKeyId = accessKeyId;\n this.secretAccessKey = secretAccessKey;\n this.endpoint = endpoint;\n this.bucketName = bucketName;\n this.region = region;\n this.maxRequestSizeInBytes = maxRequestSizeInBytes;\n this.requestAbortTimeout = requestAbortTimeout;\n this.logger = logger;\n }\n\n private _validateConstructorParams(\n accessKeyId: string,\n secretAccessKey: string,\n endpoint: string,\n bucketName: string,\n ): void {\n if (typeof accessKeyId !== 'string' || accessKeyId.trim().length === 0)\n throw new TypeError(ERROR_ACCESS_KEY_REQUIRED);\n if (typeof secretAccessKey !== 'string' || secretAccessKey.trim().length === 0)\n throw new TypeError(ERROR_SECRET_KEY_REQUIRED);\n if (typeof endpoint !== 'string' || endpoint.trim().length === 0) throw new TypeError(ERROR_ENDPOINT_REQUIRED);\n if (typeof bucketName !== 'string' || bucketName.trim().length === 0)\n throw new TypeError(ERROR_BUCKET_NAME_REQUIRED);\n }\n\n private _checkMethodHeadnGet(method: string): void {\n if (method !== 'GET' && method !== 'HEAD') {\n this._log('error', `${ERROR_PREFIX}method must be either GET or HEAD`);\n throw new Error('method must be either GET or HEAD');\n }\n }\n\n private _checkKey(key: string): void {\n if (typeof key !== 'string' || key.trim().length === 0) {\n this._log('error', ERROR_KEY_REQUIRED);\n throw new TypeError(ERROR_KEY_REQUIRED);\n }\n }\n\n private _checkDelimiter(delimiter: string): void {\n if (typeof delimiter !== 'string' || delimiter.trim().length === 0) {\n this._log('error', ERROR_DELIMITER_REQUIRED);\n throw new TypeError(ERROR_DELIMITER_REQUIRED);\n }\n }\n\n private _checkPrefix(prefix: string): void {\n if (typeof prefix !== 'string') {\n this._log('error', ERROR_PREFIX_TYPE);\n throw new TypeError(ERROR_PREFIX_TYPE);\n }\n }\n\n private _checkMaxKeys(maxKeys: number): void {\n if (typeof maxKeys !== 'number' || maxKeys <= 0) {\n this._log('error', ERROR_MAX_KEYS_TYPE);\n throw new TypeError(ERROR_MAX_KEYS_TYPE);\n }\n }\n\n private _checkOpts(opts: Record): void {\n if (typeof opts !== 'object') {\n this._log('error', `${ERROR_PREFIX}opts must be an object`);\n throw new TypeError(`${ERROR_PREFIX}opts must be an object`);\n }\n }\n\n /**\n * Internal method to log messages with sanitized sensitive information.\n * @param {string} level - The log level (e.g., 'info', 'warn', 'error').\n * @param {string} message - The message to log.\n * @param {Object} [additionalData={}] - Additional data to include in the log.\n * @private\n */\n private _log(\n level: 'info' | 'warn' | 'error',\n message: string,\n additionalData: Record | string = {},\n ): void {\n if (this.logger && typeof this.logger[level] === 'function') {\n // Function to recursively sanitize an object\n const sanitize = (obj: any): any => {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n return Object.keys(obj).reduce(\n (acc: any, key) => {\n if (SENSITIVE_KEYS_REDACTED.includes(key.toLowerCase())) {\n acc[key] = '[REDACTED]';\n } else if (typeof obj[key] === 'object' && obj[key] !== null) {\n acc[key] = sanitize(obj[key]);\n } else {\n acc[key] = obj[key];\n }\n return acc;\n },\n Array.isArray(obj) ? [] : {},\n );\n };\n\n // Sanitize the additional data\n const sanitizedData = sanitize(additionalData);\n // Prepare the log entry\n const logEntry = {\n timestamp: new Date().toISOString(),\n level,\n message,\n ...sanitizedData,\n // Include some general context, but sanitize sensitive parts\n context: sanitize({\n bucketName: this.bucketName,\n region: this.region,\n endpoint: this.endpoint,\n // Only include the first few characters of the access key, if it exists\n accessKeyId: this.accessKeyId ? `${this.accessKeyId.substring(0, 4)}...` : undefined,\n }),\n };\n\n // Log the sanitized entry\n this.logger[level](logEntry);\n }\n }\n\n getBucketName = () => this.bucketName;\n setBucketName = (bucketName: string) => {\n this.bucketName = bucketName;\n };\n getRegion = () => this.region;\n setRegion = (region: string) => {\n this.region = region;\n };\n getEndpoint = () => this.endpoint;\n setEndpoint = (endpoint: string) => {\n this.endpoint = endpoint;\n };\n getMaxRequestSizeInBytes = () => this.maxRequestSizeInBytes;\n setMaxRequestSizeInBytes = (maxRequestSizeInBytes: number) => {\n this.maxRequestSizeInBytes = maxRequestSizeInBytes;\n };\n sanitizeETag = (etag: string): string => sanitizeETag(etag);\n\n getProps = () => ({\n accessKeyId: this.accessKeyId,\n secretAccessKey: this.secretAccessKey,\n region: this.region,\n bucket: this.bucketName,\n endpoint: this.endpoint,\n maxRequestSizeInBytes: this.maxRequestSizeInBytes,\n requestAbortTimeout: this.requestAbortTimeout,\n logger: this.logger,\n });\n setProps = (props: S3Config) => {\n this._validateConstructorParams(props.accessKeyId, props.secretAccessKey, props.bucketName, props.endpoint);\n this.accessKeyId = props.accessKeyId;\n this.secretAccessKey = props.secretAccessKey;\n this.region = props.region || 'auto';\n this.bucketName = props.bucketName;\n this.endpoint = props.endpoint;\n this.maxRequestSizeInBytes = props.maxRequestSizeInBytes || MIN_MAX_REQUEST_SIZE_IN_BYTES;\n this.requestAbortTimeout = props.requestAbortTimeout;\n this.logger = props.logger;\n };\n\n /**\n * Get the content length of an object.\n * @param {string} key - The key of the object.\n * @returns {Promise} The content length of the object in bytes.\n * @throws {TypeError} If the key is not a non-empty string.\n */\n async getContentLength(key: string): Promise {\n this._checkKey(key);\n const headers = {\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('HEAD', encodedKey, {}, headers, '');\n const res = await this._sendRequest(url, 'HEAD', signedHeaders);\n const contentLength = res.headers.get(HEADER_CONTENT_LENGTH);\n return contentLength ? parseInt(contentLength, 10) : 0;\n }\n\n /**\n * Check if a bucket exists.\n * @returns {Promise} True if the bucket exists, false otherwise.\n */\n async bucketExists(): Promise {\n const headers = {\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const { url, headers: signedHeaders } = await this._sign('HEAD', '', {}, headers, '');\n const res = await this._sendRequest(url, 'HEAD', signedHeaders, '', [200, 404, 403]);\n this._log('error', `Response status: ${(res.status, res.statusText)}`);\n if (res.ok && res.status === 200) {\n return true;\n }\n return false;\n }\n\n // TBD\n async createBucket(): Promise {\n const xmlBody = `\n \n ${this.region}\n \n `;\n const headers = {\n [HEADER_CONTENT_TYPE]: XML_CONTENT_TYPE,\n [HEADER_CONTENT_LENGTH]: Buffer.byteLength(xmlBody).toString(),\n [HEADER_AMZ_CONTENT_SHA256]: await _hash(xmlBody),\n };\n const encodedKey = encodeURI('');\n const { url, headers: signedHeaders } = await this._sign('PUT', encodedKey, {}, headers, '');\n const res = await this._sendRequest(url, 'PUT', signedHeaders, xmlBody, [200, 404, 403]);\n if (res.ok && res.status === 200) {\n return true;\n }\n return false;\n }\n\n /**\n * Check if a file exists in the bucket.\n * @param {string} key - The key of the object.\n * @param {Object} [opts={}] - Additional options for the fileExists operation.\n * @returns {Promise} True if the file exists, false otherwise. 0 - Not found (404), 1 - Found (200), 2 - ETag mismatch (412).\n * @throws {TypeError} If the key is not a non-empty string.\n */\n async fileExists(key: string, opts: Record = {}): Promise {\n this._checkKey(key);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders(opts);\n const headers = { [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD, ...conditionalHeaders };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('HEAD', encodedKey, filteredOpts, headers, '');\n try {\n const res = await this._sendRequest(url, 'HEAD', signedHeaders, '', [200, 404, 412, 304]);\n if (res.status === 404) {\n return false;\n }\n if (res.status === 412 || res.status === 304) {\n return null;\n }\n if (res.ok && res.status === 200) return true;\n else this._handleErrorResponse(res);\n return false; // should never happen\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n this._log('error', `${ERROR_PREFIX}Failed to check if file exists: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to check if file exists: ${errorMessage}`);\n }\n }\n private async _sign(\n method: HttpMethod,\n keyPath: string,\n query: Object = {},\n headers: Record,\n body: string | Buffer,\n ): Promise<{ url: string; headers: Record }> {\n const datetime = new Date().toISOString().replace(/[:-]|\\.\\d{3}/g, '');\n const url =\n typeof keyPath === 'string' && keyPath.length > 0 ? new URL(keyPath, this.endpoint) : new URL(this.endpoint);\n url.pathname = `/${encodeURI(this.bucketName)}${url.pathname}`;\n headers[HEADER_AMZ_CONTENT_SHA256] = body ? await _hash(body) : UNSIGNED_PAYLOAD;\n headers[HEADER_AMZ_DATE] = datetime;\n headers[HEADER_HOST] = url.host;\n const canonicalHeaders = this._buildCanonicalHeaders(headers);\n const signedHeaders = Object.keys(headers)\n .map(key => key.toLowerCase())\n .sort()\n .join(';');\n\n const canonicalRequest = await this._buildCanonicalRequest(\n method,\n url,\n query,\n canonicalHeaders,\n signedHeaders,\n body,\n );\n const stringToSign = await this._buildStringToSign(datetime, canonicalRequest);\n const signature = await this._calculateSignature(datetime, stringToSign);\n const authorizationHeader = this._buildAuthorizationHeader(datetime, signedHeaders, signature);\n headers[HEADER_AUTHORIZATION] = authorizationHeader;\n return { url: url.toString(), headers };\n }\n\n private _buildCanonicalHeaders(headers: Record): string {\n return Object.entries(headers)\n .map(([key, value]) => `${key.toLowerCase()}:${String(value).trim()}`)\n .sort()\n .join('\\n');\n }\n\n async _buildCanonicalRequest(\n method: HttpMethod,\n url: URL,\n query: Object,\n canonicalHeaders: string,\n signedHeaders: string,\n body: string | Buffer,\n ): Promise {\n return [\n method,\n url.pathname,\n this._buildCanonicalQueryString(query),\n `${canonicalHeaders}\\n`,\n signedHeaders,\n body ? await _hash(body) : UNSIGNED_PAYLOAD,\n ].join('\\n');\n }\n\n async _buildStringToSign(datetime: string, canonicalRequest: string): Promise {\n const credentialScope = [datetime.slice(0, 8), this.region, S3_SERVICE, AWS_REQUEST_TYPE].join('/');\n return [AWS_ALGORITHM, datetime, credentialScope, await _hash(canonicalRequest)].join('\\n');\n }\n\n async _calculateSignature(datetime: string, stringToSign: string): Promise {\n const signingKey = await this._getSignatureKey(datetime.slice(0, 8));\n return _hmac(signingKey, stringToSign, 'hex');\n }\n\n private _buildAuthorizationHeader(datetime: string, signedHeaders: string, signature: string): string {\n const credentialScope = [datetime.slice(0, 8), this.region, S3_SERVICE, AWS_REQUEST_TYPE].join('/');\n return [\n `${AWS_ALGORITHM} Credential=${this.accessKeyId}/${credentialScope}`,\n `SignedHeaders=${signedHeaders}`,\n `Signature=${signature}`,\n ].join(', ');\n }\n\n private _filterIfHeaders(opts: Record): {\n filteredOpts: Record;\n conditionalHeaders: Record;\n } {\n const filteredOpts: Record = {};\n const conditionalHeaders: Record = {};\n const ifHeaders = ['if-match', 'if-none-match', 'if-modified-since', 'if-unmodified-since'];\n\n for (const [key, value] of Object.entries(opts)) {\n if (ifHeaders.includes(key)) {\n conditionalHeaders[key] = value;\n } else {\n filteredOpts[key] = value;\n }\n }\n\n return { filteredOpts, conditionalHeaders };\n }\n /**\n * List objects in the bucket.\n * @param {string} [delimiter='/'] - The delimiter to use for grouping objects in specific path.\n * @param {string} [prefix=''] - The prefix to filter objects in specific path.\n * @param {number} [maxKeys=1000] - The maximum number of keys to return.\n * @param {string} [method='GET'] - The HTTP method to use (GET or HEAD).\n * @param {Object} [opts={}] - Additional options for the list operation.\n * @returns {Promise} The list of objects or object metadata.\n * @throws {TypeError} If any of the parameters are of incorrect type.\n */\n async list(\n delimiter: string = '/',\n prefix: string = '',\n maxKeys: number = 1000,\n method: HttpMethod = 'GET',\n opts: Object = {},\n ): Promise> {\n this._checkDelimiter(delimiter);\n this._checkPrefix(prefix);\n this._checkMaxKeys(maxKeys);\n this._checkMethodHeadnGet(method);\n this._checkOpts(opts);\n this._log('info', `Listing objects in ${prefix}`);\n\n const query = {\n 'list-type': LIST_TYPE,\n 'max-keys': String(maxKeys),\n ...opts,\n } as { [key: string]: any };\n if (prefix.length > 0) {\n query['prefix'] = prefix;\n }\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const encodedKey = delimiter === '/' ? delimiter : uriEscape(delimiter);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, query, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n const res = await this._sendRequest(urlWithQuery, 'GET', signedHeaders);\n const responseBody = await res.text();\n\n if (method === 'HEAD') {\n const contentLength = res.headers.get(HEADER_CONTENT_LENGTH);\n const lastModified = res.headers.get(HEADER_LAST_MODIFIED);\n const etag = res.headers.get(HEADER_ETAG);\n\n return {\n size: contentLength ? +contentLength : undefined,\n mtime: lastModified ? new Date(lastModified) : undefined,\n ETag: etag || undefined,\n };\n }\n\n const data = _parseXml(responseBody);\n const output = data.listBucketResult || data.error || data;\n return output.contents || output;\n }\n\n /**\n * List multipart uploads in the bucket.\n * @param {string} [delimiter='/'] - The delimiter to use for grouping objects in specific path.\n * @param {string} [prefix=''] - The prefix to filter objects in specific path.\n * @param {string} [method='GET'] - The HTTP method to use (GET or HEAD).\n * @param {Object} [opts={}] - Additional options for the list operation.\n * @returns {Promise} The list of objects or object metadata.\n * @throws {TypeError} If any of the parameters are of incorrect type.\n */\n async listMultiPartUploads(\n delimiter: string = '/',\n prefix: string = '',\n method: HttpMethod = 'GET',\n opts: Object = {},\n ): Promise {\n this._checkDelimiter(delimiter);\n this._checkPrefix(prefix);\n this._checkMethodHeadnGet(method);\n this._checkOpts(opts);\n this._log('info', `Listing multipart uploads in ${prefix}`);\n\n const query = {\n uploads: '',\n ...opts,\n } as Record;\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const encodedKey = delimiter === '/' ? delimiter : uriEscape(delimiter);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, query, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n const res = await this._sendRequest(urlWithQuery, 'GET', signedHeaders);\n const responseBody = await res.text();\n\n if (method === 'HEAD') {\n return {\n size: +(res.headers.get(HEADER_CONTENT_LENGTH) ?? '0'),\n mtime: new Date(res.headers.get(HEADER_LAST_MODIFIED) ?? ''),\n ETag: res.headers.get(HEADER_ETAG) ?? '',\n };\n }\n\n const data = _parseXml(responseBody);\n const output = data.listMultipartUploadsResult || data.error || data;\n return output.uploads || output;\n }\n\n /**\n * Get an object from the bucket.\n * @param {string} key - The key of the object to get.\n * @param {Object} [opts={}] - Additional options for the get operation.\n * @returns {Promise} The response of the object. If the object does not exist, null will be returned.\n */\n async get(key: string, opts: Record = {}): Promise {\n this._checkKey(key);\n this._log('info', `Getting object ${key}`);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders(opts);\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n ...conditionalHeaders,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, filteredOpts, headers, '');\n const res = await this._sendRequest(url, 'GET', signedHeaders, '', [200, 404, 412, 304]);\n if (res.status === 404 || res.status === 412 || res.status === 304) {\n this._log('error', `Failed to get object. Status: ${res.status}`);\n return null;\n }\n if (!res.ok) {\n this._log('error', `Failed to get object. Status: ${res.status}`);\n throw new Error(`Failed to get object. Status: ${res.status}`);\n }\n return res;\n }\n\n /**\n *\n * @param {string} key - The key of the object to get.\n * @param {Object} [opts={}] - Additional options for the get operation.\n * @returns {Promise<{ etag: string|null; data: string|null }>} The content of the object. If the object does not exist, etag and data will be null.\n */\n async getObjectWithETag(\n key: string,\n opts: Record = {},\n ): Promise<{ etag: string | null; data: string | null }> {\n this._checkKey(key);\n this._log('info', `Getting object ${key}`);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders(opts);\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n ...conditionalHeaders,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, filteredOpts, headers, '');\n try {\n const res = await this._sendRequest(url, 'GET', signedHeaders, '', [200, 404, 412, 304]);\n if (res.status === 404 || res.status === 412 || res.status === 304) {\n this._log('error', `Failed to get object. Status: ${res.status}`);\n return { etag: null, data: null };\n }\n if (!res.ok) {\n this._log('error', `Failed to get object. Status: ${res.status}`);\n throw new Error(`Failed to get object. Status: ${res.status}`);\n }\n\n const etag = res.headers.get('etag');\n if (!etag) {\n throw new Error('ETag not found in response headers');\n }\n const data = await res.text();\n return { etag: sanitizeETag(etag), data };\n } catch (error) {\n this._log('error', `Error getting object ${key} with ETag: ${error}`);\n throw error;\n }\n }\n\n /**\n * Get the ETag of an object.\n * @param {string} key - The key of the object to get.\n * @param {Object} [opts={}] - Additional options for the get operation.\n * @returns {Promise} The ETag of the object or null if the object etag does not match.\n */\n async getEtag(key: string, opts: Record = {}): Promise {\n this._checkKey(key);\n this._log('info', `Getting etag object ${key}`);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders(opts);\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n ...conditionalHeaders,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('HEAD', encodedKey, filteredOpts, headers, '');\n\n const res = await this._sendRequest(url, 'HEAD', signedHeaders, '', [200, 412, 304]);\n this._log('info', `Response status: ${(res.status, res.statusText)}`);\n // etag does not match\n if (res.status === 412 || res.status === 304) {\n return null;\n }\n\n const etag = res.headers.get('etag');\n if (!etag) {\n this._log('error', `ETag not found in response headers`);\n throw new Error(`ETag not found in response headers`);\n }\n return sanitizeETag(etag);\n }\n\n /**\n * Get a response of an object from the bucket.\n * @param {string} key - The key of the object to get.\n * @param {boolean} [wholeFile=true] - Whether to get the whole file or a part.\n * @param {number} [rangeFrom=0] - The range from to get if not getting the whole file.\n * @param {number} [rangeTo=this.maxRequestSizeInBytes] - The range to to get if not getting the whole file. Note: rangeTo is inclusive.\n * @param {Object} [opts={}] - Additional options for the get operation.\n * @returns {Promise} Response of the object content. Use readableStream() to get the stream from .body.\n */\n async getResponse(\n key: string,\n wholeFile: boolean = true,\n rangeFrom: number = 0,\n rangeTo: number = this.maxRequestSizeInBytes,\n opts: Record = {},\n ): Promise {\n this._checkKey(key);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders({ ...opts });\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n ...(wholeFile ? {} : { range: `bytes=${rangeFrom}-${rangeTo - 1}` }),\n ...conditionalHeaders,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, filteredOpts, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(filteredOpts)}`;\n\n return this._sendRequest(urlWithQuery, 'GET', signedHeaders);\n }\n\n /**\n * Put an object into the bucket.\n * @param {string} key - The key of the object to put. To create a folder, include a trailing slash.\n * @param {Buffer|string} data - The content of the object to put.\n * @returns {Promise} The response from the put operation.\n * @throws {TypeError} If the key is not a non-empty string or data is not a Buffer or string.\n */\n async put(key: string, data: string | Buffer): Promise {\n this._checkKey(key);\n if (!(data instanceof Buffer || typeof data === 'string')) {\n this._log('error', ERROR_DATA_BUFFER_REQUIRED);\n throw new TypeError(ERROR_DATA_BUFFER_REQUIRED);\n }\n // const encodedKey = encodeURIComponent(key);\n this._log('info', `Uploading object ${key}`);\n const contentLength = typeof data === 'string' ? Buffer.byteLength(data) : data.length;\n const headers = {\n [HEADER_CONTENT_LENGTH]: contentLength,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('PUT', encodedKey, {}, headers, data);\n return this._sendRequest(url, 'PUT', signedHeaders, data, [200]);\n }\n\n /**\n * Initiate a multipart upload.\n * @param {string} key - The key of the object to upload.\n * @param {string} [fileType='application/octet-stream'] - The MIME type of the file.\n * @returns {Promise} The upload ID for the multipart upload.\n * @throws {TypeError} If the key is not a non-empty string or fileType is not a string.\n * @throws {Error} If the multipart upload initiation fails.\n */\n async getMultipartUploadId(key: string, fileType: string = DEFAULT_STREAM_CONTENT_TYPE): Promise {\n this._checkKey(key);\n if (typeof fileType !== 'string') {\n this._log('error', `${ERROR_PREFIX}fileType must be a string`);\n throw new TypeError(`${ERROR_PREFIX}fileType must be a string`);\n }\n this._log('info', `Initiating multipart upload for object ${key}`);\n const query = { uploads: '' };\n const headers = {\n [HEADER_CONTENT_TYPE]: fileType,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('POST', encodedKey, query, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n\n const res = await this._sendRequest(urlWithQuery, 'POST', signedHeaders);\n const responseBody = await res.text();\n const parsedResponse = _parseXml(responseBody);\n\n if (\n typeof parsedResponse === 'object' &&\n parsedResponse !== null &&\n 'error' in parsedResponse &&\n typeof parsedResponse.error === 'object' &&\n parsedResponse.error !== null &&\n 'message' in parsedResponse.error\n ) {\n const errorMessage = String(parsedResponse.error.message);\n this._log('error', `${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n }\n\n if (typeof parsedResponse === 'object' && parsedResponse !== null) {\n if (!parsedResponse.initiateMultipartUploadResult || !parsedResponse.initiateMultipartUploadResult.uploadId) {\n this._log('error', `${ERROR_PREFIX}Failed to create multipart upload: no uploadId in response`);\n throw new Error(`${ERROR_PREFIX}Failed to create multipart upload: Missing upload ID in response`);\n }\n\n return parsedResponse.initiateMultipartUploadResult.uploadId;\n } else {\n this._log('error', `${ERROR_PREFIX}Failed to create multipart upload: unexpected response format`);\n throw new Error(`${ERROR_PREFIX}Failed to create multipart upload: Unexpected response format`);\n }\n }\n\n /**\n * Upload a part in a multipart upload.\n * @param {string} key - The key of the object being uploaded.\n * @param {Buffer|string} data - The content of the part.\n * @param {string} uploadId - The upload ID of the multipart upload.\n * @param {number} partNumber - The part number.\n * @param {Object} [opts={}] - Additional options for the upload.\n * @returns {Promise} The ETag and part number of the uploaded part.\n * @throws {TypeError} If any of the parameters are of incorrect type.\n */\n async uploadPart(\n key: string,\n data: Buffer | string,\n uploadId: string,\n partNumber: number,\n opts: Object = {},\n ): Promise {\n this._validateUploadPartParams(key, data, uploadId, partNumber, opts);\n const query = { uploadId, partNumber, ...opts } as { [key: string]: any };\n const headers = {\n [HEADER_CONTENT_LENGTH]: data.length,\n } as { [key: string]: any };\n\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('PUT', encodedKey, query, headers, data);\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n\n const res = await this._sendRequest(urlWithQuery, 'PUT', signedHeaders, data);\n const ETag = sanitizeETag(res.headers.get('etag') || '');\n return { partNumber, ETag };\n }\n\n private _validateUploadPartParams(\n key: string,\n data: Buffer | string,\n uploadId: string,\n partNumber: number,\n opts: Object,\n ) {\n this._checkKey(key);\n if (!(data instanceof Buffer || typeof data === 'string')) {\n this._log('error', ERROR_DATA_BUFFER_REQUIRED);\n throw new TypeError(ERROR_DATA_BUFFER_REQUIRED);\n }\n if (typeof uploadId !== 'string' || uploadId.trim().length === 0) {\n this._log('error', ERROR_UPLOAD_ID_REQUIRED);\n throw new TypeError(ERROR_UPLOAD_ID_REQUIRED);\n }\n if (!Number.isInteger(partNumber) || partNumber <= 0) {\n this._log('error', `${ERROR_PREFIX}partNumber must be a positive integer`);\n throw new TypeError(`${ERROR_PREFIX}partNumber must be a positive integer`);\n }\n this._checkOpts(opts);\n }\n\n /**\n * Complete a multipart upload.\n * @param {string} key - The key of the object being uploaded.\n * @param {string} uploadId - The upload ID of the multipart upload.\n * @param {Array} parts - An array of objects containing PartNumber and ETag for each part.\n * @returns {Promise} The result of the complete multipart upload operation.\n * @throws {TypeError} If any of the parameters are of incorrect type.\n * @throws {Error} If the complete multipart upload operation fails.\n */\n async completeMultipartUpload(\n key: string,\n uploadId: string,\n parts: Array,\n ): Promise {\n this._checkKey(key);\n if (typeof uploadId !== 'string' || uploadId.trim().length === 0) {\n this._log('error', ERROR_UPLOAD_ID_REQUIRED);\n throw new TypeError(ERROR_UPLOAD_ID_REQUIRED);\n }\n if (!Array.isArray(parts) || parts.length === 0) {\n this._log('error', ERROR_PARTS_REQUIRED);\n throw new TypeError(ERROR_PARTS_REQUIRED);\n }\n if (!parts.every(part => typeof part.partNumber === 'number' && typeof part.ETag === 'string')) {\n this._log('error', ERROR_INVALID_PART);\n throw new TypeError(ERROR_INVALID_PART);\n }\n this._log('info', `Complete multipart upload ${uploadId} for object ${key}`);\n const query = { uploadId };\n const xmlBody = this._buildCompleteMultipartUploadXml(parts);\n const headers = {\n [HEADER_CONTENT_TYPE]: XML_CONTENT_TYPE,\n [HEADER_CONTENT_LENGTH]: Buffer.byteLength(xmlBody).toString(),\n [HEADER_AMZ_CONTENT_SHA256]: await _hash(xmlBody),\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('POST', encodedKey, query, headers, xmlBody);\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n\n const res = await this._sendRequest(urlWithQuery, 'POST', signedHeaders, xmlBody);\n const responseBody = await res.text();\n const parsedResponse = _parseXml(responseBody);\n\n if (\n typeof parsedResponse === 'object' &&\n parsedResponse !== null &&\n 'error' in parsedResponse &&\n typeof parsedResponse.error === 'object' &&\n parsedResponse.error !== null &&\n 'message' in parsedResponse.error\n ) {\n const errorMessage = String(parsedResponse.error.message);\n this._log('error', `${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n }\n\n return parsedResponse.completeMultipartUploadResult;\n }\n\n /**\n * Aborts a multipart upload.\n * @param {string} key - The key of the object being uploaded.\n * @param {string} uploadId - The ID of the multipart upload to abort.\n * @returns {Promise} - A promise that resolves to the abort response.\n * @throws {Error} If the abort operation fails.\n */\n async abortMultipartUpload(key: string, uploadId: string): Promise {\n // Input validation\n this._checkKey(key);\n if (typeof uploadId !== 'string' || uploadId.trim().length === 0) {\n this._log('error', ERROR_UPLOAD_ID_REQUIRED);\n throw new TypeError(ERROR_UPLOAD_ID_REQUIRED);\n }\n\n this._log('info', `Aborting multipart upload ${uploadId} for object ${key}`);\n\n // Prepare the request\n const query = { uploadId };\n const headers = {\n [HEADER_CONTENT_TYPE]: XML_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n\n try {\n // Sign and send the request\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('DELETE', encodedKey, query, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n\n const res = await this._sendRequest(urlWithQuery, 'DELETE', signedHeaders);\n\n // Check for successful response\n if (res.ok) {\n const responseBody = await res.text();\n const parsedResponse = _parseXml(responseBody);\n\n if (\n typeof parsedResponse === 'object' &&\n parsedResponse !== null &&\n 'error' in parsedResponse &&\n typeof parsedResponse.error === 'object' &&\n parsedResponse.error !== null &&\n 'message' in parsedResponse.error\n ) {\n const errorMessage = String(parsedResponse.error.message);\n this._log('error', `${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n }\n\n return {\n status: 'Aborted',\n key,\n uploadId,\n response: parsedResponse,\n };\n } else {\n this._log('error', `${ERROR_PREFIX}Abort request failed with status ${res.status}`);\n throw new Error(`${ERROR_PREFIX}Abort request failed with status ${res.status}`);\n }\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n this._log('error', `${ERROR_PREFIX}Failed to abort multipart upload for key ${key}: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to abort multipart upload for key ${key}: ${errorMessage}`);\n }\n }\n\n private _buildCompleteMultipartUploadXml(parts: Array): string {\n return `\n \n ${parts\n .map(\n part => `\n \n ${part.partNumber}\n ${part.ETag}\n \n `,\n )\n .join('')}\n \n `;\n }\n\n /**\n * Delete an object from the bucket.\n * @param {string} key - The key of the object to delete.\n * @returns {Promise} The response from the delete operation. True if the delete operation was successful, false otherwise. Note: The delete operation may return a 204 status code even if the object was not found.\n */\n async delete(key: string): Promise {\n this._checkKey(key);\n this._log('info', `Deleting object ${key}`);\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('DELETE', encodedKey, {}, headers, '');\n const res = await this._sendRequest(url, 'DELETE', signedHeaders);\n if (res.status === 204 || res.status === 200) {\n return true;\n }\n return false;\n }\n\n async _sendRequest(\n url: string,\n method: HttpMethod,\n headers: Record,\n body?: string | Buffer,\n toleratedStatusCodes: number[] = [],\n ): Promise {\n this._log('info', `Sending ${method} request to ${url}, headers: ${JSON.stringify(headers)}`);\n const res = await fetch(url, {\n method,\n headers,\n body: ['GET', 'HEAD'].includes(method) ? undefined : body,\n signal: this.requestAbortTimeout !== undefined ? AbortSignal.timeout(this.requestAbortTimeout) : undefined,\n });\n this._log('info', `Response status: ${(res.status, toleratedStatusCodes)}`);\n if (!res.ok && !toleratedStatusCodes.includes(res.status)) {\n await this._handleErrorResponse(res);\n }\n return res;\n }\n\n async _handleErrorResponse(res: Response) {\n const errorBody = await res.text();\n const errorCode = res.headers.get('x-amz-error-code') || 'Unknown';\n const errorMessage = res.headers.get('x-amz-error-message') || res.statusText;\n this._log(\n 'error',\n `${ERROR_PREFIX}Request failed with status ${res.status}: ${errorCode} - ${errorMessage},err body: ${errorBody}`,\n );\n throw new Error(\n `${ERROR_PREFIX}Request failed with status ${res.status}: ${errorCode} - ${errorMessage}, err body: ${errorBody}`,\n );\n }\n\n _buildCanonicalQueryString(queryParams: Object): string {\n if (Object.keys(queryParams).length < 1) {\n return '';\n }\n\n return Object.keys(queryParams)\n .sort()\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent((queryParams as Record)[key])}`)\n .join('&');\n }\n async _getSignatureKey(dateStamp: string): Promise {\n const kDate = await _hmac(`AWS4${this.secretAccessKey}`, dateStamp);\n const kRegion = await _hmac(kDate, this.region);\n const kService = await _hmac(kRegion, S3_SERVICE);\n return _hmac(kService, AWS_REQUEST_TYPE);\n }\n}\n\nconst _hash = async (content: string | Buffer): Promise => {\n const hashSum = _createHash('sha256');\n hashSum.update(content);\n return hashSum.digest('hex');\n};\n\nconst _hmac = async (key: string | Buffer, content: string, encoding?: 'hex'): Promise => {\n const hmacSum = _createHmac('sha256', key);\n hmacSum.update(content);\n return hmacSum.digest(encoding);\n};\nexport const sanitizeETag = (etag: string): string => {\n const replaceChars: Record = {\n '\"': '',\n '"': '',\n '"': '',\n '"': '',\n '"': '',\n };\n return etag.replace(/^(\"|"|")|(\"|"|")$/g, m => replaceChars[m] as string);\n};\n\nconst _parseXml = (str: string): string | object | any => {\n const unescapeXml = (value: string): string => {\n return value\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\")\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/&/g, '&');\n };\n\n const json = {};\n const re = /<(\\w)([-\\w]+)(?:\\/|[^>]*>((?:(?!<\\1)[\\s\\S])*)<\\/\\1\\2)>/gm;\n let match;\n\n while ((match = re.exec(str))) {\n const [, prefix, key, value] = match;\n const fullKey = prefix.toLowerCase() + key;\n const parsedValue = value != null ? _parseXml(value) : true;\n\n if (typeof parsedValue === 'string') {\n (json as { [key: string]: any })[fullKey] = sanitizeETag(unescapeXml(parsedValue));\n } else if (Array.isArray((json as { [key: string]: any })[fullKey])) {\n (json as { [key: string]: any })[fullKey].push(parsedValue);\n } else {\n (json as { [key: string]: any })[fullKey] =\n (json as { [key: string]: any })[fullKey] != null\n ? [(json as { [key: string]: any })[fullKey], parsedValue]\n : expectArray[fullKey]\n ? [parsedValue]\n : parsedValue;\n }\n }\n\n return Object.keys(json).length ? json : unescapeXml(str);\n};\n\nexport { S3 };\nexport default S3;\n"], - "mappings": "AAGA,IAAMA,EAAgB,mBAChBC,EAAmB,eACnBC,EAAa,KACbC,EAAY,IACZC,EAAmB,mBACnBC,EAA8B,2BAC9BC,EAAmB,kBACnBC,EAAoB,mBAEpBC,EAA0B,CAAC,cAAe,kBAAmB,eAAgB,UAAU,EAI7F,IAAMC,EAA4B,uBAC5BC,EAAkB,aAClBC,EAAc,OACdC,EAAuB,gBACvBC,EAAsB,eACtBC,EAAwB,iBACxBC,EAAc,OACdC,EAAuB,gBAGvBC,EAAe,yBACfC,GAA4B,GAAGD,CAAY,yCAC3CE,GAA4B,GAAGF,CAAY,6CAC3CG,GAA0B,GAAGH,CAAY,sCACzCI,GAA6B,GAAGJ,CAAY,wCAC5CK,EAAqB,GAAGL,CAAY,iCACpCM,EAA2B,GAAGN,CAAY,sCAC1CO,EAAuB,GAAGP,CAAY,kCACtCQ,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,EACzBC,EAAUjF,EAAO,YAAW,EAAKF,EACjCoF,EAAc/C,GAAS,KAAOc,EAAUd,CAAK,EAAI,GAEnD,OAAO+C,GAAgB,SACxBJ,EAAgCG,CAAO,EAAItF,EAAakF,EAAYK,CAAW,CAAC,EACxE,MAAM,QAASJ,EAAgCG,CAAO,CAAC,EAC/DH,EAAgCG,CAAO,EAAE,KAAKC,CAAW,EAEzDJ,EAAgCG,CAAO,EACrCH,EAAgCG,CAAO,GAAK,KACzC,CAAEH,EAAgCG,CAAO,EAAGC,CAAW,EACvDxG,GAAYuG,CAAO,EACjB,CAACC,CAAW,EACZA,CAEZ,CAEA,OAAO,OAAO,KAAKJ,CAAI,EAAE,OAASA,EAAOD,EAAYD,CAAG,CAC1D,EAGA,IAAAO,GAAeC", + "sourcesContent": ["'use strict';\n\n// Constants\nconst AWS_ALGORITHM = 'AWS4-HMAC-SHA256';\nconst AWS_REQUEST_TYPE = 'aws4_request';\nconst S3_SERVICE = 's3';\nconst LIST_TYPE = '2';\nconst UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD';\nconst DEFAULT_STREAM_CONTENT_TYPE = 'application/octet-stream';\nconst XML_CONTENT_TYPE = 'application/xml';\nconst JSON_CONTENT_TYPE = 'application/json';\n// List of keys that might contain sensitive information\nconst SENSITIVE_KEYS_REDACTED = ['accessKeyId', 'secretAccessKey', 'sessionToken', 'password'];\nconst MIN_MAX_REQUEST_SIZE_IN_BYTES = 5 * 1024 * 1024;\n\n// Headers\nconst HEADER_AMZ_CONTENT_SHA256 = 'x-amz-content-sha256';\nconst HEADER_AMZ_DATE = 'x-amz-date';\nconst HEADER_HOST = 'host';\nconst HEADER_AUTHORIZATION = 'Authorization';\nconst HEADER_CONTENT_TYPE = 'Content-Type';\nconst HEADER_CONTENT_LENGTH = 'Content-Length';\nconst HEADER_ETAG = 'etag';\nconst HEADER_LAST_MODIFIED = 'last-modified';\n\n// Error messages\nconst ERROR_PREFIX = 'ultralight-s3 Module: ';\nconst ERROR_ACCESS_KEY_REQUIRED = `${ERROR_PREFIX}accessKeyId must be a non-empty string`;\nconst ERROR_SECRET_KEY_REQUIRED = `${ERROR_PREFIX}secretAccessKey must be a non-empty string`;\nconst ERROR_ENDPOINT_REQUIRED = `${ERROR_PREFIX}endpoint must be a non-empty string`;\nconst ERROR_BUCKET_NAME_REQUIRED = `${ERROR_PREFIX}bucketName must be a non-empty string`;\nconst ERROR_KEY_REQUIRED = `${ERROR_PREFIX}key must be a non-empty string`;\nconst ERROR_UPLOAD_ID_REQUIRED = `${ERROR_PREFIX}uploadId must be a non-empty string`;\nconst ERROR_PARTS_REQUIRED = `${ERROR_PREFIX}parts must be a non-empty array`;\nconst ERROR_INVALID_PART = `${ERROR_PREFIX}Each part must have a partNumber (number) and ETag (string)`;\nconst ERROR_DATA_BUFFER_REQUIRED = `${ERROR_PREFIX}data must be a Buffer or string`;\n// const ERROR_PATH_REQUIRED = `${ERROR_PREFIX}path must be a string`;\nconst ERROR_PREFIX_TYPE = `${ERROR_PREFIX}prefix must be a string`;\nconst ERROR_MAX_KEYS_TYPE = `${ERROR_PREFIX}maxKeys must be a positive integer`;\nconst ERROR_DELIMITER_REQUIRED = `${ERROR_PREFIX}delimiter must be a string`;\n\n// const STATUS_CODES: Record = {\n// 200: 'OK',\n// 204: 'No Content',\n// 205: 'Reset Content',\n// 206: 'Partial Content',\n// 301: 'Moved Permanently',\n// 302: 'Found',\n// 400: 'Bad Request',\n// 401: 'Unauthorized',\n// 403: 'Forbidden',\n// 404: 'Not Found',\n// 418: \"I'm a Teapot\",\n// 428: 'Precondition Required',\n// 429: 'Too Many Requests',\n// 500: 'Internal Server Error',\n// 501: 'Not Implemented',\n// };\n\ninterface S3Config {\n accessKeyId: string;\n secretAccessKey: string;\n endpoint: string;\n bucketName: string;\n region?: string;\n maxRequestSizeInBytes?: number;\n requestAbortTimeout?: number;\n logger?: Logger;\n}\n\ndeclare global {\n interface Crypto {\n createHmac: (\n algorithm: string,\n key: string | Buffer,\n ) => {\n update: (data: string | Buffer) => void;\n digest: (encoding?: 'hex' | 'base64' | 'latin1') => string;\n };\n createHash: (algorithm: string) => {\n update: (data: string | Buffer) => void;\n digest: (encoding?: 'hex' | 'base64' | 'latin1') => string;\n };\n }\n}\n\ninterface Logger {\n info: (message: string, ...args: any[]) => void;\n warn: (message: string, ...args: any[]) => void;\n error: (message: string, ...args: any[]) => void;\n}\n\ninterface UploadPart {\n partNumber: number;\n ETag: string;\n}\n\ninterface CompleteMultipartUploadResult {\n Location: string;\n Bucket: string;\n Key: string;\n ETag: string;\n}\n\ntype HttpMethod = 'POST' | 'GET' | 'HEAD' | 'PUT' | 'DELETE';\n\n// false - Not found (404)\n// true - Found (200)\n// null - ETag mismatch (412)\ntype ExistResponseCode = false | true | null;\n\n// the old way to work with crypto - without browser support\nlet _createHmac = crypto.createHmac || (await import('node:crypto')).createHmac;\nlet _createHash = crypto.createHash || (await import('node:crypto')).createHash;\n\nif (typeof _createHmac === 'undefined' && typeof _createHash === 'undefined') {\n console.error(\n 'ultralight-S3 Module: Crypto functions are not available, please report the issue with necessary description: https://github.com/sentienhq/ultralight-s3/issues',\n );\n}\n\nconst expectArray: { [key: string]: boolean } = {\n contents: true,\n};\n\nconst encodeAsHex = (c: string): string => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;\n\nconst uriEscape = (uriStr: string): string => {\n return encodeURIComponent(uriStr).replace(/[!'()*]/g, encodeAsHex);\n};\n\nconst uriResourceEscape = (string: string): string => {\n return uriEscape(string).replace(/%2F/g, '/');\n};\n\n/**\n * S3 class for interacting with S3-compatible object storage services.\n * This class provides methods for common S3 operations such as uploading, downloading,\n * and deleting objects, as well as multipart uploads.\n *\n * @class\n * @example\n * const s3 = new S3({\n * accessKeyId: 'your-access-key',\n * secretAccessKey: 'your-secret-key',\n * endpoint: 'https://your-s3-endpoint.com',\n * bucketName: 'your-bucket-name',\n * region: 'us-east-1' // by default is auto\n * });\n *\n * // Upload a file\n * await s3.put('example.txt', 'Hello, World!');\n *\n * // Download a file\n * const content = await s3.get('example.txt');\n *\n * // Delete a file\n * await s3.delete('example.txt');\n */\nclass S3 {\n /**\n * Creates an instance of the S3 class.\n *\n * @constructor\n * @param {Object} config - Configuration options for the S3 instance.\n * @param {string} config.accessKeyId - The access key ID for authentication.\n * @param {string} config.secretAccessKey - The secret access key for authentication.\n * @param {string} config.endpoint - The endpoint URL of the S3-compatible service.\n * @param {string} [config.bucketName=''] - The name of the bucket to operate on.\n * @param {string} [config.region='auto'] - The region of the S3 service.\n * @param {number} [config.maxRequestSizeInBytes=5242880] - The maximum size of a single request in bytes (minimum for AWS S3 is 5MB).\n * @param {number} [config.requestAbortTimeout=undefined] - The timeout in milliseconds after which a request should be aborted (careful on streamed requests).\n * @param {Object} [config.logger=null] - A logger object with methods like info, warn, error.\n * @throws {TypeError} Will throw an error if required parameters are missing or of incorrect type.\n */\n private accessKeyId: string;\n private secretAccessKey: string;\n private endpoint: string;\n private bucketName: string;\n private region: string;\n private maxRequestSizeInBytes: number;\n private requestAbortTimeout?: number;\n private logger?: Logger;\n\n constructor({\n accessKeyId,\n secretAccessKey,\n endpoint,\n bucketName,\n region = 'auto',\n maxRequestSizeInBytes = MIN_MAX_REQUEST_SIZE_IN_BYTES,\n requestAbortTimeout = undefined,\n logger = undefined,\n }: S3Config) {\n this._validateConstructorParams(accessKeyId, secretAccessKey, endpoint, bucketName);\n this.accessKeyId = accessKeyId;\n this.secretAccessKey = secretAccessKey;\n this.endpoint = endpoint;\n this.bucketName = bucketName;\n this.region = region;\n this.maxRequestSizeInBytes = maxRequestSizeInBytes;\n this.requestAbortTimeout = requestAbortTimeout;\n this.logger = logger;\n }\n\n private _validateConstructorParams(\n accessKeyId: string,\n secretAccessKey: string,\n endpoint: string,\n bucketName: string,\n ): void {\n if (typeof accessKeyId !== 'string' || accessKeyId.trim().length === 0)\n throw new TypeError(ERROR_ACCESS_KEY_REQUIRED);\n if (typeof secretAccessKey !== 'string' || secretAccessKey.trim().length === 0)\n throw new TypeError(ERROR_SECRET_KEY_REQUIRED);\n if (typeof endpoint !== 'string' || endpoint.trim().length === 0) throw new TypeError(ERROR_ENDPOINT_REQUIRED);\n if (typeof bucketName !== 'string' || bucketName.trim().length === 0)\n throw new TypeError(ERROR_BUCKET_NAME_REQUIRED);\n }\n\n private _checkMethodHeadnGet(method: string): void {\n if (method !== 'GET' && method !== 'HEAD') {\n this._log('error', `${ERROR_PREFIX}method must be either GET or HEAD`);\n throw new Error('method must be either GET or HEAD');\n }\n }\n\n private _checkKey(key: string): void {\n if (typeof key !== 'string' || key.trim().length === 0) {\n this._log('error', ERROR_KEY_REQUIRED);\n throw new TypeError(ERROR_KEY_REQUIRED);\n }\n }\n\n private _checkDelimiter(delimiter: string): void {\n if (typeof delimiter !== 'string' || delimiter.trim().length === 0) {\n this._log('error', ERROR_DELIMITER_REQUIRED);\n throw new TypeError(ERROR_DELIMITER_REQUIRED);\n }\n }\n\n private _checkPrefix(prefix: string): void {\n if (typeof prefix !== 'string') {\n this._log('error', ERROR_PREFIX_TYPE);\n throw new TypeError(ERROR_PREFIX_TYPE);\n }\n }\n\n private _checkMaxKeys(maxKeys: number): void {\n if (typeof maxKeys !== 'number' || maxKeys <= 0) {\n this._log('error', ERROR_MAX_KEYS_TYPE);\n throw new TypeError(ERROR_MAX_KEYS_TYPE);\n }\n }\n\n private _checkOpts(opts: Record): void {\n if (typeof opts !== 'object') {\n this._log('error', `${ERROR_PREFIX}opts must be an object`);\n throw new TypeError(`${ERROR_PREFIX}opts must be an object`);\n }\n }\n\n /**\n * Internal method to log messages with sanitized sensitive information.\n * @param {string} level - The log level (e.g., 'info', 'warn', 'error').\n * @param {string} message - The message to log.\n * @param {Object} [additionalData={}] - Additional data to include in the log.\n * @private\n */\n private _log(\n level: 'info' | 'warn' | 'error',\n message: string,\n additionalData: Record | string = {},\n ): void {\n if (this.logger && typeof this.logger[level] === 'function') {\n // Function to recursively sanitize an object\n const sanitize = (obj: any): any => {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n return Object.keys(obj).reduce(\n (acc: any, key) => {\n if (SENSITIVE_KEYS_REDACTED.includes(key.toLowerCase())) {\n acc[key] = '[REDACTED]';\n } else if (typeof obj[key] === 'object' && obj[key] !== null) {\n acc[key] = sanitize(obj[key]);\n } else {\n acc[key] = obj[key];\n }\n return acc;\n },\n Array.isArray(obj) ? [] : {},\n );\n };\n\n // Sanitize the additional data\n const sanitizedData = sanitize(additionalData);\n // Prepare the log entry\n const logEntry = {\n timestamp: new Date().toISOString(),\n level,\n message,\n ...sanitizedData,\n // Include some general context, but sanitize sensitive parts\n context: sanitize({\n bucketName: this.bucketName,\n region: this.region,\n endpoint: this.endpoint,\n // Only include the first few characters of the access key, if it exists\n accessKeyId: this.accessKeyId ? `${this.accessKeyId.substring(0, 4)}...` : undefined,\n }),\n };\n\n // Log the sanitized entry\n this.logger[level](logEntry);\n }\n }\n\n getBucketName = () => this.bucketName;\n setBucketName = (bucketName: string) => {\n this.bucketName = bucketName;\n };\n getRegion = () => this.region;\n setRegion = (region: string) => {\n this.region = region;\n };\n getEndpoint = () => this.endpoint;\n setEndpoint = (endpoint: string) => {\n this.endpoint = endpoint;\n };\n getMaxRequestSizeInBytes = () => this.maxRequestSizeInBytes;\n setMaxRequestSizeInBytes = (maxRequestSizeInBytes: number) => {\n this.maxRequestSizeInBytes = maxRequestSizeInBytes;\n };\n sanitizeETag = (etag: string): string => sanitizeETag(etag);\n\n getProps = () => ({\n accessKeyId: this.accessKeyId,\n secretAccessKey: this.secretAccessKey,\n region: this.region,\n bucket: this.bucketName,\n endpoint: this.endpoint,\n maxRequestSizeInBytes: this.maxRequestSizeInBytes,\n requestAbortTimeout: this.requestAbortTimeout,\n logger: this.logger,\n });\n setProps = (props: S3Config) => {\n this._validateConstructorParams(props.accessKeyId, props.secretAccessKey, props.bucketName, props.endpoint);\n this.accessKeyId = props.accessKeyId;\n this.secretAccessKey = props.secretAccessKey;\n this.region = props.region || 'auto';\n this.bucketName = props.bucketName;\n this.endpoint = props.endpoint;\n this.maxRequestSizeInBytes = props.maxRequestSizeInBytes || MIN_MAX_REQUEST_SIZE_IN_BYTES;\n this.requestAbortTimeout = props.requestAbortTimeout;\n this.logger = props.logger;\n };\n\n /**\n * Get the content length of an object.\n * @param {string} key - The key of the object.\n * @returns {Promise} The content length of the object in bytes.\n * @throws {TypeError} If the key is not a non-empty string.\n */\n async getContentLength(key: string): Promise {\n this._checkKey(key);\n const headers = {\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('HEAD', encodedKey, {}, headers, '');\n const res = await this._sendRequest(url, 'HEAD', signedHeaders);\n const contentLength = res.headers.get(HEADER_CONTENT_LENGTH);\n return contentLength ? parseInt(contentLength, 10) : 0;\n }\n\n /**\n * Check if a bucket exists.\n * @returns {Promise} True if the bucket exists, false otherwise.\n */\n async bucketExists(): Promise {\n const headers = {\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const { url, headers: signedHeaders } = await this._sign('HEAD', '', {}, headers, '');\n const res = await this._sendRequest(url, 'HEAD', signedHeaders, '', [200, 404, 403]);\n this._log('error', `Response status: ${(res.status, res.statusText)}`);\n if (res.ok && res.status === 200) {\n return true;\n }\n return false;\n }\n\n // TBD\n async createBucket(): Promise {\n const xmlBody = `\n \n ${this.region}\n \n `;\n const headers = {\n [HEADER_CONTENT_TYPE]: XML_CONTENT_TYPE,\n [HEADER_CONTENT_LENGTH]: Buffer.byteLength(xmlBody).toString(),\n [HEADER_AMZ_CONTENT_SHA256]: await _hash(xmlBody),\n };\n const encodedKey = encodeURI('');\n const { url, headers: signedHeaders } = await this._sign('PUT', encodedKey, {}, headers, '');\n const res = await this._sendRequest(url, 'PUT', signedHeaders, xmlBody, [200, 404, 403]);\n if (res.ok && res.status === 200) {\n return true;\n }\n return false;\n }\n\n /**\n * Check if a file exists in the bucket.\n * @param {string} key - The key of the object.\n * @param {Object} [opts={}] - Additional options for the fileExists operation.\n * @returns {Promise} True if the file exists, false otherwise. 0 - Not found (404), 1 - Found (200), 2 - ETag mismatch (412).\n * @throws {TypeError} If the key is not a non-empty string.\n */\n async fileExists(key: string, opts: Record = {}): Promise {\n this._checkKey(key);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders(opts);\n const headers = { [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD, ...conditionalHeaders };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('HEAD', encodedKey, filteredOpts, headers, '');\n try {\n const res = await this._sendRequest(url, 'HEAD', signedHeaders, '', [200, 404, 412, 304]);\n if (res.status === 404) {\n return false;\n }\n if (res.status === 412 || res.status === 304) {\n return null;\n }\n if (res.ok && res.status === 200) return true;\n else this._handleErrorResponse(res);\n return false; // should never happen\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n this._log('error', `${ERROR_PREFIX}Failed to check if file exists: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to check if file exists: ${errorMessage}`);\n }\n }\n private async _sign(\n method: HttpMethod,\n keyPath: string,\n query: Object = {},\n headers: Record,\n body: string | Buffer,\n ): Promise<{ url: string; headers: Record }> {\n const datetime = new Date().toISOString().replace(/[:-]|\\.\\d{3}/g, '');\n const url =\n typeof keyPath === 'string' && keyPath.length > 0 ? new URL(keyPath, this.endpoint) : new URL(this.endpoint);\n url.pathname = `/${encodeURI(this.bucketName)}${url.pathname}`;\n headers[HEADER_AMZ_CONTENT_SHA256] = body ? await _hash(body) : UNSIGNED_PAYLOAD;\n headers[HEADER_AMZ_DATE] = datetime;\n headers[HEADER_HOST] = url.host;\n const canonicalHeaders = this._buildCanonicalHeaders(headers);\n const signedHeaders = Object.keys(headers)\n .map(key => key.toLowerCase())\n .sort()\n .join(';');\n\n const canonicalRequest = await this._buildCanonicalRequest(\n method,\n url,\n query,\n canonicalHeaders,\n signedHeaders,\n body,\n );\n const stringToSign = await this._buildStringToSign(datetime, canonicalRequest);\n const signature = await this._calculateSignature(datetime, stringToSign);\n const authorizationHeader = this._buildAuthorizationHeader(datetime, signedHeaders, signature);\n headers[HEADER_AUTHORIZATION] = authorizationHeader;\n return { url: url.toString(), headers };\n }\n\n private _buildCanonicalHeaders(headers: Record): string {\n return Object.entries(headers)\n .map(([key, value]) => `${key.toLowerCase()}:${String(value).trim()}`)\n .sort()\n .join('\\n');\n }\n\n async _buildCanonicalRequest(\n method: HttpMethod,\n url: URL,\n query: Object,\n canonicalHeaders: string,\n signedHeaders: string,\n body: string | Buffer,\n ): Promise {\n return [\n method,\n url.pathname,\n this._buildCanonicalQueryString(query),\n `${canonicalHeaders}\\n`,\n signedHeaders,\n body ? await _hash(body) : UNSIGNED_PAYLOAD,\n ].join('\\n');\n }\n\n async _buildStringToSign(datetime: string, canonicalRequest: string): Promise {\n const credentialScope = [datetime.slice(0, 8), this.region, S3_SERVICE, AWS_REQUEST_TYPE].join('/');\n return [AWS_ALGORITHM, datetime, credentialScope, await _hash(canonicalRequest)].join('\\n');\n }\n\n async _calculateSignature(datetime: string, stringToSign: string): Promise {\n const signingKey = await this._getSignatureKey(datetime.slice(0, 8));\n return _hmac(signingKey, stringToSign, 'hex');\n }\n\n private _buildAuthorizationHeader(datetime: string, signedHeaders: string, signature: string): string {\n const credentialScope = [datetime.slice(0, 8), this.region, S3_SERVICE, AWS_REQUEST_TYPE].join('/');\n return [\n `${AWS_ALGORITHM} Credential=${this.accessKeyId}/${credentialScope}`,\n `SignedHeaders=${signedHeaders}`,\n `Signature=${signature}`,\n ].join(', ');\n }\n\n private _filterIfHeaders(opts: Record): {\n filteredOpts: Record;\n conditionalHeaders: Record;\n } {\n const filteredOpts: Record = {};\n const conditionalHeaders: Record = {};\n const ifHeaders = ['if-match', 'if-none-match', 'if-modified-since', 'if-unmodified-since'];\n\n for (const [key, value] of Object.entries(opts)) {\n if (ifHeaders.includes(key)) {\n conditionalHeaders[key] = value;\n } else {\n filteredOpts[key] = value;\n }\n }\n\n return { filteredOpts, conditionalHeaders };\n }\n /**\n * List objects in the bucket.\n * @param {string} [delimiter='/'] - The delimiter to use for grouping objects in specific path.\n * @param {string} [prefix=''] - The prefix to filter objects in specific path.\n * @param {number} [maxKeys=1000] - The maximum number of keys to return.\n * @param {string} [method='GET'] - The HTTP method to use (GET or HEAD).\n * @param {Object} [opts={}] - Additional options for the list operation.\n * @returns {Promise} The list of objects or object metadata.\n * @throws {TypeError} If any of the parameters are of incorrect type.\n */\n async list(\n delimiter: string = '/',\n prefix: string = '',\n maxKeys: number = 1000,\n method: HttpMethod = 'GET',\n opts: Object = {},\n ): Promise> {\n this._checkDelimiter(delimiter);\n this._checkPrefix(prefix);\n this._checkMaxKeys(maxKeys);\n this._checkMethodHeadnGet(method);\n this._checkOpts(opts);\n this._log('info', `Listing objects in ${prefix}`);\n\n const query = {\n 'list-type': LIST_TYPE,\n 'max-keys': String(maxKeys),\n ...opts,\n } as { [key: string]: any };\n if (prefix.length > 0) {\n query['prefix'] = prefix;\n }\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const encodedKey = delimiter === '/' ? delimiter : uriEscape(delimiter);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, query, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n const res = await this._sendRequest(urlWithQuery, 'GET', signedHeaders);\n const responseBody = await res.text();\n\n if (method === 'HEAD') {\n const contentLength = res.headers.get(HEADER_CONTENT_LENGTH);\n const lastModified = res.headers.get(HEADER_LAST_MODIFIED);\n const etag = res.headers.get(HEADER_ETAG);\n\n return {\n size: contentLength ? +contentLength : undefined,\n mtime: lastModified ? new Date(lastModified) : undefined,\n ETag: etag || undefined,\n };\n }\n\n const data = _parseXml(responseBody);\n const output = data.listBucketResult || data.error || data;\n return output.contents || output;\n }\n\n /**\n * List multipart uploads in the bucket.\n * @param {string} [delimiter='/'] - The delimiter to use for grouping objects in specific path.\n * @param {string} [prefix=''] - The prefix to filter objects in specific path.\n * @param {string} [method='GET'] - The HTTP method to use (GET or HEAD).\n * @param {Object} [opts={}] - Additional options for the list operation.\n * @returns {Promise} The list of objects or object metadata.\n * @throws {TypeError} If any of the parameters are of incorrect type.\n */\n async listMultiPartUploads(\n delimiter: string = '/',\n prefix: string = '',\n method: HttpMethod = 'GET',\n opts: Object = {},\n ): Promise {\n this._checkDelimiter(delimiter);\n this._checkPrefix(prefix);\n this._checkMethodHeadnGet(method);\n this._checkOpts(opts);\n this._log('info', `Listing multipart uploads in ${prefix}`);\n\n const query = {\n uploads: '',\n ...opts,\n } as Record;\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const encodedKey = delimiter === '/' ? delimiter : uriEscape(delimiter);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, query, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n const res = await this._sendRequest(urlWithQuery, 'GET', signedHeaders);\n const responseBody = await res.text();\n\n if (method === 'HEAD') {\n return {\n size: +(res.headers.get(HEADER_CONTENT_LENGTH) ?? '0'),\n mtime: new Date(res.headers.get(HEADER_LAST_MODIFIED) ?? ''),\n ETag: res.headers.get(HEADER_ETAG) ?? '',\n };\n }\n\n const data = _parseXml(responseBody);\n const output = data.listMultipartUploadsResult || data.error || data;\n return output.uploads || output;\n }\n\n /**\n * Get an object from the bucket.\n * @param {string} key - The key of the object to get.\n * @param {Object} [opts={}] - Additional options for the get operation.\n * @returns {Promise} The response of the object. If the object does not exist, null will be returned.\n */\n async get(key: string, opts: Record = {}): Promise {\n this._checkKey(key);\n this._log('info', `Getting object ${key}`);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders(opts);\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n ...conditionalHeaders,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, filteredOpts, headers, '');\n const res = await this._sendRequest(url, 'GET', signedHeaders, '', [200, 404, 412, 304]);\n if (res.status === 404 || res.status === 412 || res.status === 304) {\n this._log('error', `Failed to get object. Status: ${res.status}`);\n return null;\n }\n if (!res.ok) {\n this._log('error', `Failed to get object. Status: ${res.status}`);\n throw new Error(`Failed to get object. Status: ${res.status}`);\n }\n return res;\n }\n\n /**\n *\n * @param {string} key - The key of the object to get.\n * @param {Object} [opts={}] - Additional options for the get operation.\n * @returns {Promise<{ etag: string|null; data: string|null }>} The content of the object. If the object does not exist, etag and data will be null.\n */\n async getObjectWithETag(\n key: string,\n opts: Record = {},\n ): Promise<{ etag: string | null; data: string | null }> {\n this._checkKey(key);\n this._log('info', `Getting object ${key}`);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders(opts);\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n ...conditionalHeaders,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, filteredOpts, headers, '');\n try {\n const res = await this._sendRequest(url, 'GET', signedHeaders, '', [200, 404, 412, 304]);\n if (res.status === 404 || res.status === 412 || res.status === 304) {\n this._log('error', `Failed to get object. Status: ${res.status}`);\n return { etag: null, data: null };\n }\n if (!res.ok) {\n this._log('error', `Failed to get object. Status: ${res.status}`);\n throw new Error(`Failed to get object. Status: ${res.status}`);\n }\n\n const etag = res.headers.get('etag');\n if (!etag) {\n throw new Error('ETag not found in response headers');\n }\n const data = await res.text();\n return { etag: sanitizeETag(etag), data };\n } catch (error) {\n this._log('error', `Error getting object ${key} with ETag: ${error}`);\n throw error;\n }\n }\n\n /**\n * Get the ETag of an object.\n * @param {string} key - The key of the object to get.\n * @param {Object} [opts={}] - Additional options for the get operation.\n * @returns {Promise} The ETag of the object or null if the object etag does not match.\n */\n async getEtag(key: string, opts: Record = {}): Promise {\n this._checkKey(key);\n this._log('info', `Getting etag object ${key}`);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders(opts);\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n ...conditionalHeaders,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('HEAD', encodedKey, filteredOpts, headers, '');\n\n const res = await this._sendRequest(url, 'HEAD', signedHeaders, '', [200, 412, 304]);\n this._log('info', `Response status: ${(res.status, res.statusText)}`);\n // etag does not match\n if (res.status === 412 || res.status === 304) {\n return null;\n }\n\n const etag = res.headers.get('etag');\n if (!etag) {\n this._log('error', `ETag not found in response headers`);\n throw new Error(`ETag not found in response headers`);\n }\n return sanitizeETag(etag);\n }\n\n /**\n * Get a response of an object from the bucket.\n * @param {string} key - The key of the object to get.\n * @param {boolean} [wholeFile=true] - Whether to get the whole file or a part.\n * @param {number} [rangeFrom=0] - The range from to get if not getting the whole file.\n * @param {number} [rangeTo=this.maxRequestSizeInBytes] - The range to to get if not getting the whole file. Note: rangeTo is inclusive.\n * @param {Object} [opts={}] - Additional options for the get operation.\n * @returns {Promise} Response of the object content. Use readableStream() to get the stream from .body.\n */\n async getResponse(\n key: string,\n wholeFile: boolean = true,\n rangeFrom: number = 0,\n rangeTo: number = this.maxRequestSizeInBytes,\n opts: Record = {},\n ): Promise {\n this._checkKey(key);\n const { filteredOpts, conditionalHeaders } = this._filterIfHeaders({ ...opts });\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n ...(wholeFile ? {} : { range: `bytes=${rangeFrom}-${rangeTo - 1}` }),\n ...conditionalHeaders,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('GET', encodedKey, filteredOpts, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(filteredOpts)}`;\n\n return this._sendRequest(urlWithQuery, 'GET', signedHeaders);\n }\n\n /**\n * Put an object into the bucket.\n * @param {string} key - The key of the object to put. To create a folder, include a trailing slash.\n * @param {Buffer|string} data - The content of the object to put.\n * @returns {Promise} The response from the put operation.\n * @throws {TypeError} If the key is not a non-empty string or data is not a Buffer or string.\n */\n async put(key: string, data: string | Buffer): Promise {\n this._checkKey(key);\n if (!(data instanceof Buffer || typeof data === 'string')) {\n this._log('error', ERROR_DATA_BUFFER_REQUIRED);\n throw new TypeError(ERROR_DATA_BUFFER_REQUIRED);\n }\n // const encodedKey = encodeURIComponent(key);\n this._log('info', `Uploading object ${key}`);\n const contentLength = typeof data === 'string' ? Buffer.byteLength(data) : data.length;\n const headers = {\n [HEADER_CONTENT_LENGTH]: contentLength,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('PUT', encodedKey, {}, headers, data);\n return this._sendRequest(url, 'PUT', signedHeaders, data, [200]);\n }\n\n /**\n * Initiate a multipart upload.\n * @param {string} key - The key of the object to upload.\n * @param {string} [fileType='application/octet-stream'] - The MIME type of the file.\n * @returns {Promise} The upload ID for the multipart upload.\n * @throws {TypeError} If the key is not a non-empty string or fileType is not a string.\n * @throws {Error} If the multipart upload initiation fails.\n */\n async getMultipartUploadId(key: string, fileType: string = DEFAULT_STREAM_CONTENT_TYPE): Promise {\n this._checkKey(key);\n if (typeof fileType !== 'string') {\n this._log('error', `${ERROR_PREFIX}fileType must be a string`);\n throw new TypeError(`${ERROR_PREFIX}fileType must be a string`);\n }\n this._log('info', `Initiating multipart upload for object ${key}`);\n const query = { uploads: '' };\n const headers = {\n [HEADER_CONTENT_TYPE]: fileType,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('POST', encodedKey, query, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n\n const res = await this._sendRequest(urlWithQuery, 'POST', signedHeaders);\n const responseBody = await res.text();\n const parsedResponse = _parseXml(responseBody);\n\n if (\n typeof parsedResponse === 'object' &&\n parsedResponse !== null &&\n 'error' in parsedResponse &&\n typeof parsedResponse.error === 'object' &&\n parsedResponse.error !== null &&\n 'message' in parsedResponse.error\n ) {\n const errorMessage = String(parsedResponse.error.message);\n this._log('error', `${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n }\n\n if (typeof parsedResponse === 'object' && parsedResponse !== null) {\n if (!parsedResponse.initiateMultipartUploadResult || !parsedResponse.initiateMultipartUploadResult.uploadId) {\n this._log('error', `${ERROR_PREFIX}Failed to create multipart upload: no uploadId in response`);\n throw new Error(`${ERROR_PREFIX}Failed to create multipart upload: Missing upload ID in response`);\n }\n\n return parsedResponse.initiateMultipartUploadResult.uploadId;\n } else {\n this._log('error', `${ERROR_PREFIX}Failed to create multipart upload: unexpected response format`);\n throw new Error(`${ERROR_PREFIX}Failed to create multipart upload: Unexpected response format`);\n }\n }\n\n /**\n * Upload a part in a multipart upload.\n * @param {string} key - The key of the object being uploaded.\n * @param {Buffer|string} data - The content of the part.\n * @param {string} uploadId - The upload ID of the multipart upload.\n * @param {number} partNumber - The part number.\n * @param {Object} [opts={}] - Additional options for the upload.\n * @returns {Promise} The ETag and part number of the uploaded part.\n * @throws {TypeError} If any of the parameters are of incorrect type.\n */\n async uploadPart(\n key: string,\n data: Buffer | string,\n uploadId: string,\n partNumber: number,\n opts: Object = {},\n ): Promise {\n this._validateUploadPartParams(key, data, uploadId, partNumber, opts);\n const query = { uploadId, partNumber, ...opts } as { [key: string]: any };\n const headers = {\n [HEADER_CONTENT_LENGTH]: data.length,\n } as { [key: string]: any };\n\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('PUT', encodedKey, query, headers, data);\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n\n const res = await this._sendRequest(urlWithQuery, 'PUT', signedHeaders, data);\n const ETag = sanitizeETag(res.headers.get('etag') || '');\n return { partNumber, ETag };\n }\n\n private _validateUploadPartParams(\n key: string,\n data: Buffer | string,\n uploadId: string,\n partNumber: number,\n opts: Object,\n ) {\n this._checkKey(key);\n if (!(data instanceof Buffer || typeof data === 'string')) {\n this._log('error', ERROR_DATA_BUFFER_REQUIRED);\n throw new TypeError(ERROR_DATA_BUFFER_REQUIRED);\n }\n if (typeof uploadId !== 'string' || uploadId.trim().length === 0) {\n this._log('error', ERROR_UPLOAD_ID_REQUIRED);\n throw new TypeError(ERROR_UPLOAD_ID_REQUIRED);\n }\n if (!Number.isInteger(partNumber) || partNumber <= 0) {\n this._log('error', `${ERROR_PREFIX}partNumber must be a positive integer`);\n throw new TypeError(`${ERROR_PREFIX}partNumber must be a positive integer`);\n }\n this._checkOpts(opts);\n }\n\n /**\n * Complete a multipart upload.\n * @param {string} key - The key of the object being uploaded.\n * @param {string} uploadId - The upload ID of the multipart upload.\n * @param {Array} parts - An array of objects containing PartNumber and ETag for each part.\n * @returns {Promise} The result of the complete multipart upload operation.\n * @throws {TypeError} If any of the parameters are of incorrect type.\n * @throws {Error} If the complete multipart upload operation fails.\n */\n async completeMultipartUpload(\n key: string,\n uploadId: string,\n parts: Array,\n ): Promise {\n this._checkKey(key);\n if (typeof uploadId !== 'string' || uploadId.trim().length === 0) {\n this._log('error', ERROR_UPLOAD_ID_REQUIRED);\n throw new TypeError(ERROR_UPLOAD_ID_REQUIRED);\n }\n if (!Array.isArray(parts) || parts.length === 0) {\n this._log('error', ERROR_PARTS_REQUIRED);\n throw new TypeError(ERROR_PARTS_REQUIRED);\n }\n if (!parts.every(part => typeof part.partNumber === 'number' && typeof part.ETag === 'string')) {\n this._log('error', ERROR_INVALID_PART);\n throw new TypeError(ERROR_INVALID_PART);\n }\n this._log('info', `Complete multipart upload ${uploadId} for object ${key}`);\n const query = { uploadId };\n const xmlBody = this._buildCompleteMultipartUploadXml(parts);\n const headers = {\n [HEADER_CONTENT_TYPE]: XML_CONTENT_TYPE,\n [HEADER_CONTENT_LENGTH]: Buffer.byteLength(xmlBody).toString(),\n [HEADER_AMZ_CONTENT_SHA256]: await _hash(xmlBody),\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('POST', encodedKey, query, headers, xmlBody);\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n\n const res = await this._sendRequest(urlWithQuery, 'POST', signedHeaders, xmlBody);\n const responseBody = await res.text();\n const parsedResponse = _parseXml(responseBody);\n\n if (\n typeof parsedResponse === 'object' &&\n parsedResponse !== null &&\n 'error' in parsedResponse &&\n typeof parsedResponse.error === 'object' &&\n parsedResponse.error !== null &&\n 'message' in parsedResponse.error\n ) {\n const errorMessage = String(parsedResponse.error.message);\n this._log('error', `${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n }\n\n return parsedResponse.completeMultipartUploadResult;\n }\n\n /**\n * Aborts a multipart upload.\n * @param {string} key - The key of the object being uploaded.\n * @param {string} uploadId - The ID of the multipart upload to abort.\n * @returns {Promise} - A promise that resolves to the abort response.\n * @throws {Error} If the abort operation fails.\n */\n async abortMultipartUpload(key: string, uploadId: string): Promise {\n // Input validation\n this._checkKey(key);\n if (typeof uploadId !== 'string' || uploadId.trim().length === 0) {\n this._log('error', ERROR_UPLOAD_ID_REQUIRED);\n throw new TypeError(ERROR_UPLOAD_ID_REQUIRED);\n }\n\n this._log('info', `Aborting multipart upload ${uploadId} for object ${key}`);\n\n // Prepare the request\n const query = { uploadId };\n const headers = {\n [HEADER_CONTENT_TYPE]: XML_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n\n try {\n // Sign and send the request\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('DELETE', encodedKey, query, headers, '');\n const urlWithQuery = `${url}?${new URLSearchParams(query)}`;\n\n const res = await this._sendRequest(urlWithQuery, 'DELETE', signedHeaders);\n\n // Check for successful response\n if (res.ok) {\n const responseBody = await res.text();\n const parsedResponse = _parseXml(responseBody);\n\n if (\n typeof parsedResponse === 'object' &&\n parsedResponse !== null &&\n 'error' in parsedResponse &&\n typeof parsedResponse.error === 'object' &&\n parsedResponse.error !== null &&\n 'message' in parsedResponse.error\n ) {\n const errorMessage = String(parsedResponse.error.message);\n this._log('error', `${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to abort multipart upload: ${errorMessage}`);\n }\n\n return {\n status: 'Aborted',\n key,\n uploadId,\n response: parsedResponse,\n };\n } else {\n this._log('error', `${ERROR_PREFIX}Abort request failed with status ${res.status}`);\n throw new Error(`${ERROR_PREFIX}Abort request failed with status ${res.status}`);\n }\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n this._log('error', `${ERROR_PREFIX}Failed to abort multipart upload for key ${key}: ${errorMessage}`);\n throw new Error(`${ERROR_PREFIX}Failed to abort multipart upload for key ${key}: ${errorMessage}`);\n }\n }\n\n private _buildCompleteMultipartUploadXml(parts: Array): string {\n return `\n \n ${parts\n .map(\n part => `\n \n ${part.partNumber}\n ${part.ETag}\n \n `,\n )\n .join('')}\n \n `;\n }\n\n /**\n * Delete an object from the bucket.\n * @param {string} key - The key of the object to delete.\n * @returns {Promise} The response from the delete operation. True if the delete operation was successful, false otherwise. Note: The delete operation may return a 204 status code even if the object was not found.\n */\n async delete(key: string): Promise {\n this._checkKey(key);\n this._log('info', `Deleting object ${key}`);\n const headers = {\n [HEADER_CONTENT_TYPE]: JSON_CONTENT_TYPE,\n [HEADER_AMZ_CONTENT_SHA256]: UNSIGNED_PAYLOAD,\n };\n const encodedKey = uriResourceEscape(key);\n const { url, headers: signedHeaders } = await this._sign('DELETE', encodedKey, {}, headers, '');\n const res = await this._sendRequest(url, 'DELETE', signedHeaders);\n if (res.status === 204 || res.status === 200) {\n return true;\n }\n return false;\n }\n\n async _sendRequest(\n url: string,\n method: HttpMethod,\n headers: Record,\n body?: string | Buffer,\n toleratedStatusCodes: number[] = [],\n ): Promise {\n this._log('info', `Sending ${method} request to ${url}, headers: ${JSON.stringify(headers)}`);\n // Remove forbidden headers\n // const safeHeaders = { ...headers };\n // delete safeHeaders[HEADER_HOST]; // Browser sets this automatically\n // delete safeHeaders[HEADER_CONTENT_LENGTH]; // Browser sets this based on the body\n\n const res = await fetch(url, {\n method,\n headers,\n body: ['GET', 'HEAD'].includes(method) ? undefined : body,\n signal: this.requestAbortTimeout !== undefined ? AbortSignal.timeout(this.requestAbortTimeout) : undefined\n });\n this._log('info', `Response status: ${(res.status, toleratedStatusCodes)}`);\n if (!res.ok && !toleratedStatusCodes.includes(res.status)) {\n await this._handleErrorResponse(res);\n }\n return res;\n }\n\n async _handleErrorResponse(res: Response) {\n const errorBody = await res.text();\n const errorCode = res.headers.get('x-amz-error-code') || 'Unknown';\n const errorMessage = res.headers.get('x-amz-error-message') || res.statusText;\n this._log(\n 'error',\n `${ERROR_PREFIX}Request failed with status ${res.status}: ${errorCode} - ${errorMessage},err body: ${errorBody}`,\n );\n throw new Error(\n `${ERROR_PREFIX}Request failed with status ${res.status}: ${errorCode} - ${errorMessage}, err body: ${errorBody}`,\n );\n }\n\n _buildCanonicalQueryString(queryParams: Object): string {\n if (Object.keys(queryParams).length < 1) {\n return '';\n }\n\n return Object.keys(queryParams)\n .sort()\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent((queryParams as any)[key])}`)\n .join('&');\n }\n async _getSignatureKey(dateStamp: string): Promise {\n const kDate = await _hmac(`AWS4${this.secretAccessKey}`, dateStamp);\n const kRegion = await _hmac(kDate, this.region);\n const kService = await _hmac(kRegion, S3_SERVICE);\n return _hmac(kService, AWS_REQUEST_TYPE);\n }\n}\n\nconst _hash = async (content: string | Buffer): Promise => {\n const hashSum = _createHash('sha256');\n hashSum.update(content);\n return hashSum.digest('hex');\n};\n\nconst _hmac = async (key: string | Buffer, content: string, encoding?: 'hex'): Promise => {\n const hmacSum = _createHmac('sha256', key);\n hmacSum.update(content);\n return hmacSum.digest(encoding);\n};\nexport const sanitizeETag = (etag: string): string => {\n const replaceChars: Record = {\n '\"': '',\n '"': '',\n '"': '',\n '"': '',\n '"': '',\n };\n return etag.replace(/^(\"|"|")|(\"|"|")$/g, m => replaceChars[m] as string);\n};\n\nconst _parseXml = (str: string): string | object | any => {\n const unescapeXml = (value: string): string => {\n return value\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\")\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/&/g, '&');\n };\n\n const json = {};\n const re = /<(\\w)([-\\w]+)(?:\\/|[^>]*>((?:(?!<\\1)[\\s\\S])*)<\\/\\1\\2)>/gm;\n let match;\n\n while ((match = re.exec(str))) {\n const [, prefix, key, value] = match;\n const fullKey = prefix.toLowerCase() + key;\n const parsedValue = value != null ? _parseXml(value) : true;\n\n if (typeof parsedValue === 'string') {\n (json as { [key: string]: any })[fullKey] = sanitizeETag(unescapeXml(parsedValue));\n } else if (Array.isArray((json as { [key: string]: any })[fullKey])) {\n (json as { [key: string]: any })[fullKey].push(parsedValue);\n } else {\n (json as { [key: string]: any })[fullKey] =\n (json as { [key: string]: any })[fullKey] != null\n ? [(json as { [key: string]: any })[fullKey], parsedValue]\n : expectArray[fullKey]\n ? [parsedValue]\n : parsedValue;\n }\n }\n\n return Object.keys(json).length ? json : unescapeXml(str);\n};\n\nexport { S3 };\nexport default S3;\n"], + "mappings": "AAGA,IAAMA,EAAgB,mBAChBC,EAAmB,eACnBC,EAAa,KACbC,EAAY,IACZC,EAAmB,mBACnBC,EAA8B,2BAC9BC,EAAmB,kBACnB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ACT,SAAU,GACV,WAAY,IAEd,OAAOhF,EAAK,QAAQ,uCAAwCiF,GAAKD,EAAaC,CAAC,CAAW,CAC5F,EAEM1B,EAAa2B,GAAsC,CACvD,IAAMC,EAAe1C,GACZA,EACJ,QAAQ,UAAW,GAAG,EACtB,QAAQ,UAAW,GAAG,EACtB,QAAQ,QAAS,GAAG,EACpB,QAAQ,QAAS,GAAG,EACpB,QAAQ,SAAU,GAAG,EAGpB2C,EAAO,CAAA,EACPC,EAAK,2DACPC,EAEJ,KAAQA,EAAQD,EAAG,KAAKH,CAAG,GAAI,CAC7B,GAAM,CAAC,CAAE5E,EAAQF,EAAKqC,CAAK,EAAI6C,EACzBC,EAAUjF,EAAO,YAAW,EAAKF,EACjCoF,EAAc/C,GAAS,KAAOc,EAAUd,CAAK,EAAI,GAEnD,OAAO+C,GAAgB,SACxBJ,EAAgCG,CAAO,EAAItF,EAAakF,EAAYK,CAAW,CAAC,EACxE,MAAM,QAASJ,EAAgCG,CAAO,CAAC,EAC/DH,EAAgCG,CAAO,EAAE,KAAKC,CAAW,EAEzDJ,EAAgCG,CAAO,EACrCH,EAAgCG,CAAO,GAAK,KACzC,CAAEH,EAAgCG,CAAO,EAAGC,CAAW,EACvDxG,GAAYuG,CAAO,EACjB,CAACC,CAAW,EACZA,CAEZ,CAEA,OAAO,OAAO,KAAKJ,CAAI,EAAE,OAASA,EAAOD,EAAYD,CAAG,CAC1D,EAGA,IAAAO,GAAeC", "names": ["AWS_ALGORITHM", "AWS_REQUEST_TYPE", "S3_SERVICE", "LIST_TYPE", "UNSIGNED_PAYLOAD", "DEFAULT_STREAM_CONTENT_TYPE", "XML_CONTENT_TYPE", "JSON_CONTENT_TYPE", "SENSITIVE_KEYS_REDACTED", "HEADER_AMZ_CONTENT_SHA256", "HEADER_AMZ_DATE", "HEADER_HOST", "HEADER_AUTHORIZATION", "HEADER_CONTENT_TYPE", "HEADER_CONTENT_LENGTH", "HEADER_ETAG", "HEADER_LAST_MODIFIED", "ERROR_PREFIX", "ERROR_ACCESS_KEY_REQUIRED", "ERROR_SECRET_KEY_REQUIRED", "ERROR_ENDPOINT_REQUIRED", "ERROR_BUCKET_NAME_REQUIRED", "ERROR_KEY_REQUIRED", "ERROR_UPLOAD_ID_REQUIRED", "ERROR_PARTS_REQUIRED", "ERROR_INVALID_PART", "ERROR_DATA_BUFFER_REQUIRED", "ERROR_PREFIX_TYPE", "ERROR_MAX_KEYS_TYPE", "ERROR_DELIMITER_REQUIRED", "_createHmac", "_createHash", "expectArray", "encodeAsHex", "c", "uriEscape", "uriStr", "uriResourceEscape", "string", "S3", "accessKeyId", "secretAccessKey", "endpoint", "bucketName", "region", "maxRequestSizeInBytes", "requestAbortTimeout", "logger", "etag", "sanitizeETag", "props", "method", "key", "delimiter", "prefix", "maxKeys", "opts", "level", "message", "additionalData", "sanitize", "obj", "acc", "SENSITIVE_KEYS_REDACTED", "sanitizedData", "logEntry", "headers", "UNSIGNED_PAYLOAD", "encodedKey", "url", "signedHeaders", "contentLength", "res", "xmlBody", "XML_CONTENT_TYPE", "_hash", "filteredOpts", "conditionalHeaders", "error", "errorMessage", "keyPath", "query", "body", "datetime", "canonicalHeaders", "canonicalRequest", "stringToSign", "signature", "authorizationHeader", "value", "credentialScope", "S3_SERVICE", "AWS_REQUEST_TYPE", "AWS_ALGORITHM", "signingKey", "_hmac", "ifHeaders", "LIST_TYPE", "JSON_CONTENT_TYPE", "urlWithQuery", "responseBody", "lastModified", "data", "_parseXml", "output", "wholeFile", "rangeFrom", "rangeTo", "fileType", "DEFAULT_STREAM_CONTENT_TYPE", "parsedResponse", "uploadId", "partNumber", "ETag", "parts", "part", "toleratedStatusCodes", "errorBody", "errorCode", "queryParams", "dateStamp", "kDate", "kRegion", "kService", "content", "hashSum", "encoding", "hmacSum", "replaceChars", "m", "str", "unescapeXml", "json", "re", "match", "fullKey", "parsedValue", "lib_default", "S3"] } diff --git a/src/index.ts b/src/index.ts index b1ed7bb..9ea42dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -110,10 +110,9 @@ type HttpMethod = 'POST' | 'GET' | 'HEAD' | 'PUT' | 'DELETE'; type ExistResponseCode = false | true | null; // the old way to work with crypto - without browser support -// let _createHmac = crypto.createHmac || (await import('node:crypto')).createHmac; -// let _createHash = crypto.createHash || (await import('node:crypto')).createHash; +let _createHmac = crypto.createHmac || (await import('node:crypto')).createHmac; +let _createHash = crypto.createHash || (await import('node:crypto')).createHash; -import { _createHmac, _createHash } from 'crypto-wrapper'; if (typeof _createHmac === 'undefined' && typeof _createHash === 'undefined') { console.error( 'ultralight-S3 Module: Crypto functions are not available, please report the issue with necessary description: https://github.com/sentienhq/ultralight-s3/issues', @@ -1098,10 +1097,7 @@ class S3 { method, headers, body: ['GET', 'HEAD'].includes(method) ? undefined : body, - signal: this.requestAbortTimeout !== undefined ? AbortSignal.timeout(this.requestAbortTimeout) : undefined, - mode: 'cors', // Ensure CORS mode is enabled - credentials: 'omit', // Ensure credentials are included - cache: 'no-store', + signal: this.requestAbortTimeout !== undefined ? AbortSignal.timeout(this.requestAbortTimeout) : undefined }); this._log('info', `Response status: ${(res.status, toleratedStatusCodes)}`); if (!res.ok && !toleratedStatusCodes.includes(res.status)) { diff --git a/src/utils/crypto-wrapper.ts b/src/utils/crypto-wrapper.ts deleted file mode 100644 index fa482ce..0000000 --- a/src/utils/crypto-wrapper.ts +++ /dev/null @@ -1,123 +0,0 @@ -type HashAlgorithm = 'sha256'; -type Encoding = 'hex' | 'base64' | 'latin1'; - -interface Hmac { - update(data: string | Buffer): void; - digest(encoding?: Encoding): Promise; -} - -interface Hash { - update(data: string | Buffer): void; - digest(encoding?: Encoding): Promise; -} - -type HashFunction = (algorithm: HashAlgorithm) => Hash; -type HmacFunction = (algorithm: HashAlgorithm, key: string | Buffer) => Hmac; - -let _createHmac: any = crypto.createHmac; -let _createHash: any = crypto.createHash; - -if (typeof _createHmac === 'undefined' || typeof _createHash === 'undefined') { - try { - const isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null; - if (isNode) { - // Import `crypto` from Node if available (useful for Node.js environments). - const nodeCrypto = await import('node:crypto'); - _createHmac = nodeCrypto.createHmac; - _createHash = nodeCrypto.createHash; - } else { - function concatUint8Arrays(arrays: Uint8Array[]): Uint8Array { - const totalLength = arrays.reduce((sum, arr) => sum + arr.length, 0); - const result = new Uint8Array(totalLength); - let offset = 0; - for (const arr of arrays) { - result.set(arr, offset); - offset += arr.length; - } - return result; - } - - function encodeDigest(buffer: ArrayBuffer, encoding: String) { - const hashArray = Array.from(new Uint8Array(buffer)); - - if (encoding === 'hex') { - return hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); - } else if (encoding === 'base64') { - const binary = String.fromCharCode(...hashArray); - return btoa(binary); - } else if (encoding === 'latin1') { - return String.fromCharCode(...hashArray); - } else { - throw new Error(`Unsupported encoding: ${encoding}`); - } - } - - // Browser-compatible `createHash` using `crypto.subtle` for SHA-256 - _createHash = (algorithm: string): any => { - if (algorithm !== 'sha256') throw new Error('Only SHA-256 is supported in the browser.'); - - const chunks: Uint8Array[] = []; - - return { - update(data: string | Buffer) { - const encoder = new TextEncoder(); - const encoded = typeof data === 'string' ? encoder.encode(data) : new Uint8Array(data); - chunks.push(encoded); - // Allow method chaining - return this; - }, - async digest(encoding = 'hex') { - const concatenated = concatUint8Arrays(chunks); - const hashBuffer = await crypto.subtle.digest('SHA-256', concatenated); - return encodeDigest(hashBuffer, encoding); - }, - }; - }; - - // Browser-compatible `createHmac` using a polyfill approach (for HMAC). - _createHmac = (algorithm: string, key: string | Buffer) => { - if (algorithm !== 'sha256') throw new Error('Only SHA-256 HMAC is supported in the browser.'); - - const chunks: Uint8Array[] = []; - const encoder = new TextEncoder(); - const keyData = typeof key === 'string' ? encoder.encode(key) : new Uint8Array(key); - - let cryptoKeyPromise: Promise | null = null; - - function ensureCryptoKey() { - if (!cryptoKeyPromise) { - cryptoKeyPromise = crypto.subtle.importKey( - 'raw', - keyData, - { name: 'HMAC', hash: { name: 'SHA-256' } }, - false, - ['sign'], - ); - } - return cryptoKeyPromise; - } - - return { - update(data: string | Buffer) { - const encoded = typeof data === 'string' ? encoder.encode(data) : new Uint8Array(data); - chunks.push(encoded); - // Allow method chaining - return this; - }, - async digest(encoding = 'hex') { - const cryptoKey = await ensureCryptoKey(); - const concatenated = concatUint8Arrays(chunks); - const signature = await crypto.subtle.sign('HMAC', cryptoKey, concatenated); - return encodeDigest(signature, encoding); - }, - }; - }; - } - } catch (e) { - console.warn( - 'ultralight-s3 Module: Crypto functions are not available. Using SubtleCrypto for browser compatibility.', - ); - } -} - -export { _createHmac, _createHash }; diff --git a/tsconfig.json b/tsconfig.json index ce7125a..abc48fe 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,10 +12,6 @@ "esModuleInterop": true, "sourceMap": true, "baseUrl": ".", - "paths": { - "crypto-wrapper": ["src/utils/crypto-wrapper.ts"] - } }, - "include": ["src/*", "src/utils/crypto-wrapper.ts"], "exclude": ["node_modules", "dev", "tests", "lib"], }