@keetanetwork/anchor 0.0.40 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/services/asset-movement/server.d.ts +0 -10
- package/services/asset-movement/server.d.ts.map +1 -1
- package/services/asset-movement/server.js +0 -2
- package/services/asset-movement/server.js.map +1 -1
- package/services/storage/client.d.ts +11 -1
- package/services/storage/client.d.ts.map +1 -1
- package/services/storage/client.js +23 -3
- package/services/storage/client.js.map +1 -1
- package/services/storage/clients/contacts.d.ts +94 -0
- package/services/storage/clients/contacts.d.ts.map +1 -0
- package/services/storage/clients/contacts.generated.d.ts +3 -0
- package/services/storage/clients/contacts.generated.d.ts.map +1 -0
- package/services/storage/clients/contacts.generated.js +1197 -0
- package/services/storage/clients/contacts.generated.js.map +1 -0
- package/services/storage/clients/contacts.js +141 -0
- package/services/storage/clients/contacts.js.map +1 -0
- package/services/storage/common.d.ts +14 -0
- package/services/storage/common.d.ts.map +1 -1
- package/services/storage/common.js.map +1 -1
- package/services/username/server.d.ts +0 -2
- package/services/username/server.d.ts.map +1 -1
- package/services/username/server.js +0 -2
- package/services/username/server.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/services/storage/client.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAiBjD,OAAO,EACN,kCAAkC,EAClC,+BAA+B,EAC/B,kCAAkC,EAClC,iCAAiC,EACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,6CAA6C,EAC7C,0CAA0C,EAC1C,0CAA0C,EAC1C,6CAA6C,EAC7C,4CAA4C,EAC5C,qBAAqB,EACrB,MAAM,EACN,iBAAiB,EACjB,yBAAyB,EACzB,8BAA8B,EAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE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AAM,EAAE,IAAI,CAAC,OAAO;YACpB,OAAO,EAAE,IAAI,CAAC,QAAQ;SACtB,CAAC,CAAC;IACJ,CAAC;CACD;AAED,eAAe,wBAAwB,CAAC","sourcesContent":["import type { UserClient as KeetaNetUserClient } from '@keetanetwork/keetanet-client';\nimport { KeetaNet } from '../../client/index.js';\nimport type { Logger } from '../../lib/log/index.ts';\nimport type { HTTPSignedField } from '../../lib/http-server/common.js';\nimport type { ServiceMetadata, ServiceMetadataAuthenticationType, ServiceMetadataEndpoint } from '../../lib/resolver.ts';\nimport type { Signable } from '../../lib/utils/signing.js';\nimport type { Buffer } from '../../lib/utils/buffer.js';\nimport type {\n\tKeetaNetAccount,\n\tStorageObjectMetadata,\n\tSearchCriteria,\n\tSearchPagination,\n\tQuotaStatus,\n\tStorageObjectVisibility,\n\tKeetaStorageAnchorDeleteClientRequest,\n\tKeetaStorageAnchorSearchRequest,\n\tKeetaStorageAnchorQuotaRequest\n} from './common.ts';\nimport {\n\tisKeetaStorageAnchorDeleteResponse,\n\tisKeetaStorageAnchorPutResponse,\n\tisKeetaStorageAnchorSearchResponse,\n\tisKeetaStorageAnchorQuotaResponse\n} from './common.generated.js';\nimport {\n\tgetKeetaStorageAnchorDeleteRequestSigningData,\n\tgetKeetaStorageAnchorPutRequestSigningData,\n\tgetKeetaStorageAnchorGetRequestSigningData,\n\tgetKeetaStorageAnchorSearchRequestSigningData,\n\tgetKeetaStorageAnchorQuotaRequestSigningData,\n\tparseContainerPayload,\n\tErrors,\n\tCONTENT_TYPE_JSON,\n\tCONTENT_TYPE_OCTET_STREAM,\n\tDEFAULT_SIGNED_URL_TTL_SECONDS\n} from './common.js';\nimport { getDefaultResolver } from '../../config.js';\nimport { EncryptedContainer } from '../../lib/encrypted-container.js';\nimport Resolver from '../../lib/resolver.js';\nimport crypto from '../../lib/utils/crypto.js';\nimport { createAssertEquals } from 'typia';\nimport { addSignatureToURL } from '../../lib/http-server/common.js';\nimport { SignData } from '../../lib/utils/signing.js';\nimport { KeetaAnchorError } from '../../lib/error.js';\nimport { arrayBufferLikeToBuffer } from '../../lib/utils/buffer.js';\n\n/**\n * The configuration options for the Storage Anchor client.\n */\nexport type KeetaStorageAnchorClientConfig = {\n\t/**\n\t * The ID of the client. This is used to identify the client in logs.\n\t * If not provided, a random ID will be generated.\n\t */\n\tid?: string;\n\t/**\n\t * The logger to use for logging messages. If not provided, no logging\n\t * will be done.\n\t */\n\tlogger?: Logger;\n\t/**\n\t * The resolver to use for resolving Storage Anchor services. If not\n\t * provided, a default resolver will be created using the provided\n\t * client and network.\n\t */\n\tresolver?: Resolver;\n\t/**\n\t * The account to use for signing requests. If not provided, the\n\t * account associated with the provided client will be used.\n\t */\n\tsigner?: KeetaNetAccount;\n\t/**\n\t * Account to perform changes on. If not provided, the account\n\t * associated with the provided client will be used.\n\t */\n\taccount?: KeetaNetAccount;\n} & Omit<NonNullable<Parameters<typeof getDefaultResolver>[1]>, 'client'>;\n\n/**\n * Configuration for a storage session.\n * Sessions provide a simplified API with default account, working directory, and visibility.\n */\nexport type SessionConfig = {\n\t/**\n\t * The account to use for all operations in this session.\n\t */\n\taccount: KeetaNetAccount;\n\t/**\n\t * Optional working directory prefix for relative paths.\n\t * e.g., '/user/pubkey/docs/' - relative paths will be appended to this.\n\t */\n\tworkingDirectory?: string;\n\t/**\n\t * Default visibility for put operations (defaults to 'private').\n\t */\n\tdefaultVisibility?: StorageObjectVisibility;\n};\n\n/**\n * An opaque type that represents a provider ID.\n */\ntype ProviderID = string;\n\nconst KeetaStorageAnchorClientAccessToken = Symbol('KeetaStorageAnchorClientAccessToken');\n\nconst assertServiceMetadataEndpoint = createAssertEquals<ServiceMetadataEndpoint>();\n\n/**\n * A list of operations that can be performed by the Storage Anchor service.\n */\ntype KeetaStorageAnchorOperations = {\n\t[operation in keyof NonNullable<ServiceMetadata['services']['storage']>[string]['operations']]?: {\n\t\turl: (params?: { [key: string]: string; }) => URL;\n\t\toptions: {\n\t\t\tauthentication: ServiceMetadataAuthenticationType;\n\t\t};\n\t};\n};\n\n/**\n * The service information for a Storage Anchor service.\n */\ntype KeetaStorageServiceInfo = {\n\toperations: {\n\t\t[operation in keyof KeetaStorageAnchorOperations]: Promise<KeetaStorageAnchorOperations[operation]>;\n\t};\n\t/**\n\t * The anchor's public key string (for converting to Account object).\n\t */\n\tanchorAccountPublicKey?: string;\n};\n\n/**\n * For each matching Storage Anchor service, this type describes the\n * operations available.\n */\ntype GetEndpointsResult = {\n\t[id: ProviderID]: KeetaStorageServiceInfo;\n};\n\nfunction validateURL(url: string | undefined): URL {\n\tif (url === undefined || url === null) {\n\t\tthrow(new Errors.InvalidPath('Invalid URL: null or undefined'));\n\t}\n\n\ttry {\n\t\treturn(new URL(url));\n\t} catch {\n\t\tthrow(new Errors.InvalidResponse(`Invalid URL in service metadata: ${url}`));\n\t}\n}\n\nasync function getEndpoints(resolver: Resolver, logger?: Logger): Promise<GetEndpointsResult | null> {\n\tconst response = await resolver.lookup('storage', {});\n\tif (response === undefined) {\n\t\treturn(null);\n\t}\n\n\tconst serviceInfoPromises = Object.entries(response).map(async function([id, serviceInfo]): Promise<[ProviderID, KeetaStorageServiceInfo]> {\n\t\tconst operations = await serviceInfo.operations('object');\n\t\tconst operationsFunctions: KeetaStorageServiceInfo['operations'] = {};\n\t\tfor (const [key, operation] of Object.entries(operations)) {\n\t\t\tif (operation === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tObject.defineProperty(operationsFunctions, key, {\n\t\t\t\tget: async function() {\n\t\t\t\t\tconst endpointInfo = assertServiceMetadataEndpoint(await Resolver.Metadata.fullyResolveValuizable(operation));\n\n\t\t\t\t\tlet url;\n\t\t\t\t\tlet authentication: ServiceMetadataAuthenticationType = {\n\t\t\t\t\t\ttype: 'none',\n\t\t\t\t\t\tmethod: 'keeta-account'\n\t\t\t\t\t};\n\n\t\t\t\t\tif (typeof endpointInfo === 'string') {\n\t\t\t\t\t\turl = endpointInfo;\n\t\t\t\t\t} else {\n\t\t\t\t\t\turl = endpointInfo.url;\n\t\t\t\t\t\tif (endpointInfo.options?.authentication) {\n\t\t\t\t\t\t\tauthentication = endpointInfo.options.authentication;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn({\n\t\t\t\t\t\turl: function(params?: { [key: string]: string; }): URL {\n\t\t\t\t\t\t\tlet substitutedURL;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tsubstitutedURL = decodeURI(url);\n\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\tlogger?.debug('getEndpoints', 'Failed to decode URI, using original URL for substitution', error, url);\n\n\t\t\t\t\t\t\t\tsubstitutedURL = url;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor (const [paramKey, paramValue] of Object.entries(params ?? {})) {\n\t\t\t\t\t\t\t\tsubstitutedURL = substitutedURL.replace(`{${paramKey}}`, encodeURIComponent(paramValue));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn(validateURL(substitutedURL));\n\t\t\t\t\t\t},\n\t\t\t\t\t\toptions: { authentication }\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\t\t}\n\n\t\t// Extract anchor account public key from service metadata\n\t\tconst result: KeetaStorageServiceInfo = { operations: operationsFunctions };\n\t\tif ('anchorAccount' in serviceInfo && typeof serviceInfo.anchorAccount === 'function') {\n\t\t\tconst anchorAccountValue = await serviceInfo.anchorAccount('primitive');\n\t\t\tif (typeof anchorAccountValue === 'string') {\n\t\t\t\tresult.anchorAccountPublicKey = anchorAccountValue;\n\t\t\t}\n\t\t}\n\n\t\treturn([\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tid as unknown as ProviderID,\n\t\t\tresult\n\t\t]);\n\t});\n\n\tconst retval = Object.fromEntries(await Promise.all(serviceInfoPromises));\n\treturn(retval);\n}\n\ninterface KeetaStorageAnchorBaseConfig {\n\tclient: KeetaNetUserClient;\n\tlogger?: Logger | undefined;\n}\n\nclass KeetaStorageAnchorBase {\n\tprotected readonly logger?: Logger | undefined;\n\tprotected readonly client: KeetaNetUserClient;\n\n\tconstructor(config: KeetaStorageAnchorBaseConfig) {\n\t\tthis.client = config.client;\n\t\tthis.logger = config.logger;\n\t}\n}\n\n/**\n * A session provides a simplified API for storage operations with default account,\n * working directory, and visibility settings.\n */\nexport class KeetaStorageAnchorSession {\n\treadonly provider: KeetaStorageAnchorProvider;\n\treadonly account: KeetaNetAccount;\n\treadonly workingDirectory: string;\n\treadonly #defaultVisibility: StorageObjectVisibility;\n\n\tconstructor(provider: KeetaStorageAnchorProvider, config: SessionConfig) {\n\t\tthis.provider = provider;\n\t\tthis.account = config.account;\n\t\tthis.workingDirectory = config.workingDirectory ?? '/';\n\t\tthis.#defaultVisibility = config.defaultVisibility ?? 'private';\n\t}\n\n\t/**\n\t * Resolve a relative path to a full storage path.\n\t *\n\t * @param relativePath - Path to resolve (absolute paths returned as-is)\n\t *\n\t * @returns The full storage path with working directory prepended if relative\n\t */\n\t#resolvePath(relativePath: string): string {\n\t\t// If path is already absolute (starts with /), use it as-is\n\t\tif (relativePath.startsWith('/')) {\n\t\t\treturn(relativePath);\n\t\t}\n\n\t\t// Otherwise, prepend working directory\n\t\treturn(this.workingDirectory + relativePath);\n\t}\n\n\t/**\n\t * Store data at a relative path.\n\t * For public visibility, the anchor account is automatically fetched from the provider.\n\t *\n\t * @param relativePath - The relative path\n\t * @param data - The binary data to store\n\t * @param options.mimeType - MIME type of the data\n\t * @param options.tags - Optional plaintext tags\n\t * @param options.visibility - Object visibility\n\t *\n\t * @returns The created/updated object metadata\n\t */\n\tasync put(\n\t\trelativePath: string,\n\t\tdata: Buffer,\n\t\toptions: {\n\t\t\tmimeType: string;\n\t\t\ttags?: string[];\n\t\t\tvisibility?: StorageObjectVisibility;\n\t\t}\n\t): Promise<StorageObjectMetadata> {\n\t\tconst fullPath = this.#resolvePath(relativePath);\n\t\tconst visibility = options.visibility ?? this.#defaultVisibility;\n\t\tconst putOpts: Parameters<typeof this.provider.put>[0] = {\n\t\t\tpath: fullPath,\n\t\t\tdata,\n\t\t\tmimeType: options.mimeType,\n\t\t\tvisibility,\n\t\t\taccount: this.account\n\t\t};\n\t\tif (options.tags) {\n\t\t\tputOpts.tags = options.tags;\n\t\t}\n\t\tif (visibility === 'public' && this.provider.anchorAccount) {\n\t\t\tputOpts.anchorAccount = this.provider.anchorAccount;\n\t\t}\n\n\t\treturn(await this.provider.put(putOpts));\n\t}\n\n\t/**\n\t * Get data from a relative path.\n\t *\n\t * @param relativePath - The relative path\n\t *\n\t * @returns The decrypted data and mime-type, or null if not found\n\t */\n\tasync get(relativePath: string): Promise<{ data: Buffer; mimeType: string } | null> {\n\t\tconst fullPath = this.#resolvePath(relativePath);\n\t\treturn(await this.provider.get({ path: fullPath, account: this.account }));\n\t}\n\n\t/**\n\t * Delete data at a relative path.\n\t *\n\t * @param relativePath - The relative path\n\t *\n\t * @returns True if the object was deleted, false if it didn't exist\n\t */\n\tasync delete(relativePath: string): Promise<boolean> {\n\t\tconst fullPath = this.#resolvePath(relativePath);\n\t\treturn(await this.provider.delete({ path: fullPath, account: this.account }));\n\t}\n\n\t/**\n\t * Search for objects. Owner is automatically set to the session account.\n\t *\n\t * @param criteria - Optional search criteria (owner is set automatically)\n\t * @param pagination - Optional pagination settings\n\t *\n\t * @returns Search results with optional nextCursor for pagination\n\t */\n\tasync search(\n\t\tcriteria?: Omit<SearchCriteria, 'owner'>,\n\t\tpagination?: SearchPagination\n\t): Promise<{ results: StorageObjectMetadata[]; nextCursor?: string }> {\n\t\tconst fullCriteria: SearchCriteria = {\n\t\t\t...criteria,\n\t\t\towner: this.account.publicKeyString.get()\n\t\t};\n\n\t\tconst searchOpts: Parameters<typeof this.provider.search>[0] = {\n\t\t\tcriteria: fullCriteria,\n\t\t\taccount: this.account\n\t\t};\n\t\tif (pagination) {\n\t\t\tsearchOpts.pagination = pagination;\n\t\t}\n\n\t\treturn(await this.provider.search(searchOpts));\n\t}\n\n\t/**\n\t * Get a pre-signed public URL for a relative path.\n\t *\n\t * @param relativePath - The relative path\n\t * @param options.ttl - Optional TTL in seconds\n\t *\n\t * @returns The pre-signed URL for public access\n\t */\n\tasync getPublicUrl(relativePath: string, options?: { ttl?: number }): Promise<string> {\n\t\tconst fullPath = this.#resolvePath(relativePath);\n\t\tconst urlOpts: Parameters<typeof this.provider.getPublicUrl>[0] = {\n\t\t\tpath: fullPath,\n\t\t\taccount: this.account\n\t\t};\n\t\tif (options?.ttl) {\n\t\t\turlOpts.ttl = options.ttl;\n\t\t}\n\n\t\treturn(await this.provider.getPublicUrl(urlOpts));\n\t}\n}\n\n/**\n * Represents a Storage Anchor provider for performing storage operations.\n */\nexport class KeetaStorageAnchorProvider extends KeetaStorageAnchorBase {\n\t/**\n\t * Service information including available operations and endpoints.\n\t */\n\treadonly serviceInfo: KeetaStorageServiceInfo;\n\t/**\n\t * Unique identifier for this provider.\n\t */\n\treadonly providerID: ProviderID;\n\t/**\n\t * The anchor account for this provider.\n\t */\n\treadonly anchorAccount: KeetaNetAccount | null;\n\n\tconstructor(serviceInfo: KeetaStorageServiceInfo, providerID: ProviderID, parent: KeetaStorageAnchorClient) {\n\t\tconst parentPrivate = parent._internals(KeetaStorageAnchorClientAccessToken);\n\t\tsuper(parentPrivate);\n\n\t\tthis.serviceInfo = serviceInfo;\n\t\tthis.providerID = providerID;\n\n\t\t// Convert anchor account public key string to Account\n\t\tif (serviceInfo.anchorAccountPublicKey) {\n\t\t\ttry {\n\t\t\t\tthis.anchorAccount = KeetaNet.lib.Account.fromPublicKeyString(serviceInfo.anchorAccountPublicKey).assertAccount();\n\t\t\t} catch {\n\t\t\t\tthrow(new Errors.InvalidAnchorAccount(serviceInfo.anchorAccountPublicKey));\n\t\t\t}\n\t\t} else {\n\t\t\tthis.anchorAccount = null;\n\t\t}\n\t}\n\n\t/**\n\t * Get operation endpoint data for a given operation.\n\t *\n\t * @param operationName - The operation to get endpoint data for\n\t * @param params - Optional URL template parameters to substitute\n\t *\n\t * @returns The endpoint URL and authentication configuration\n\t *\n\t * @throws OperationNotSupported if the operation is not available\n\t * @throws UnsupportedAuthMethod if the authentication method is not supported\n\t */\n\tasync #getOperationData(operationName: keyof KeetaStorageAnchorOperations, params?: { [key: string]: string; }) {\n\t\tconst endpoint = await this.serviceInfo.operations[operationName];\n\t\tif (endpoint === undefined) {\n\t\t\tthrow(new Errors.OperationNotSupported(operationName));\n\t\t}\n\n\t\tif (endpoint.options.authentication.method !== 'keeta-account') {\n\t\t\tthrow(new Errors.UnsupportedAuthMethod(endpoint.options.authentication.method));\n\t\t}\n\n\t\treturn({\n\t\t\turl: endpoint.url(params),\n\t\t\tauth: endpoint.options.authentication\n\t\t});\n\t}\n\n\t/**\n\t * Parse an error response from the server.\n\t * Attempts to restore structured error types from JSON.\n\t *\n\t * @param data - The error response data\n\t *\n\t * @returns A KeetaAnchorError or generic Error with the error message\n\t *\n\t * @throws InvariantViolation if the response is not a valid error object\n\t */\n\tasync #parseResponseError(data: unknown) {\n\t\tif (typeof data !== 'object' || data === null) {\n\t\t\tthrow(new Errors.InvariantViolation('expected error response object'));\n\t\t}\n\n\t\tif (!('ok' in data) || data.ok !== false) {\n\t\t\tthrow(new Errors.InvariantViolation('expected error response with ok=false'));\n\t\t}\n\n\t\tlet parsedError: KeetaAnchorError | null = null;\n\t\ttry {\n\t\t\tparsedError = await KeetaAnchorError.fromJSON(data);\n\t\t} catch (error: unknown) {\n\t\t\tthis.logger?.debug('Failed to parse error response as KeetaAnchorError', error, data);\n\t\t}\n\n\t\tif (parsedError) {\n\t\t\treturn(parsedError);\n\t\t} else {\n\t\t\tlet errorStr;\n\t\t\tif ('error' in data && typeof data.error === 'string') {\n\t\t\t\terrorStr = data.error;\n\t\t\t} else {\n\t\t\t\terrorStr = 'Unknown error';\n\t\t\t}\n\n\t\t\treturn(new Error(`storage request failed: ${errorStr}`));\n\t\t}\n\t}\n\n\t/**\n\t * Resolve account to use for signing, with private key validation.\n\t *\n\t * @param account - Optional account override (falls back to client account)\n\t * @param requirePrivateKey - Whether private key is required\n\t *\n\t * @returns The resolved account with optional private key validation\n\t *\n\t * @throws PrivateKeyRequired if private key is needed but not available\n\t */\n\t#resolveSignerAccount(\n\t\taccount: KeetaNetAccount | undefined,\n\t\trequirePrivateKey = true\n\t): KeetaNetAccount {\n\t\tconst resolved = account ?? this.client.account;\n\t\tif (requirePrivateKey && !resolved?.hasPrivateKey) {\n\t\t\tthrow(new Errors.PrivateKeyRequired());\n\t\t}\n\t\tif (!resolved) {\n\t\t\tthrow(new Errors.AccountRequired());\n\t\t}\n\n\t\treturn(resolved);\n\t}\n\n\t/**\n\t * Handle error responses from binary PUT/GET requests.\n\t * Attempts to parse JSON error response, otherwise throws generic error.\n\t *\n\t * @param response - The failed HTTP response to handle\n\t *\n\t * @throws The parsed error from the response body, or a generic ServiceUnavailable error\n\t */\n\tasync #handleBinaryResponseError(response: Response): Promise<never> {\n\t\tlet errorJSON: unknown;\n\t\ttry {\n\t\t\terrorJSON = await response.json();\n\t\t} catch {\n\t\t\t// JSON parsing failed - throw generic error\n\t\t\tthrow(new Errors.InvalidResponse(`HTTP ${response.status}: ${response.statusText}`));\n\t\t}\n\n\t\t// JSON parsed successfully - attempt to extract error\n\t\tif (typeof errorJSON === 'object' && errorJSON !== null && 'ok' in errorJSON && errorJSON.ok === false) {\n\t\t\tthrow(await this.#parseResponseError(errorJSON));\n\t\t}\n\n\t\t// Unexpected response shape\n\t\tthrow(new Errors.InvalidResponse(`HTTP ${response.status}: ${response.statusText}`));\n\t}\n\n\t/**\n\t * Normalize a path suffix and append it to a URL pathname.\n\t * Handles leading slashes and trailing slashes consistently.\n\t * Validates against path traversal attacks.\n\t *\n\t * @param url - The URL object to modify (mutated in place)\n\t * @param path - The path suffix to append\n\t *\n\t * @throws InvalidPath if path contains traversal patterns\n\t */\n\t#appendPathToUrl(url: URL, path: string): void {\n\t\t// Validate path is not empty\n\t\tif (!path || path.trim().length === 0) {\n\t\t\tthrow(new Errors.InvalidPath('Path cannot be empty'));\n\t\t}\n\t\t// Validate against path traversal attacks\n\t\tif (path.includes('..') || path.includes('//')) {\n\t\t\tthrow(new Errors.InvalidPath('Path contains invalid segments'));\n\t\t}\n\n\t\tconst pathSuffix = path.startsWith('/') ? path.slice(1) : path;\n\t\turl.pathname = url.pathname.replace(/\\/$/, '') + '/' + pathSuffix;\n\t}\n\n\t/**\n\t * Make a JSON API request to the storage service.\n\t * Handles authentication, serialization, and response parsing.\n\t *\n\t * @typeParam Response - The expected response type\n\t * @typeParam Request - The request body type\n\t * @typeParam SerializedRequest - The serialized request type\n\t *\n\t * @param input.method - HTTP method\n\t * @param input.endpoint - Operation endpoint name\n\t * @param input.account - Account for signing the request\n\t * @param input.params - URL template parameters\n\t * @param input.queryParams - Query string parameters\n\t * @param input.pathSuffix - Path to append to the endpoint URL\n\t * @param input.body - Request body\n\t * @param input.serializeRequest - Function to serialize the request body\n\t * @param input.getSignedData - Function to get signing data from request\n\t * @param input.isResponse - Type guard for the response\n\t *\n\t * @returns The successful response\n\t *\n\t * @throws AccountRequired if account is required but not provided\n\t * @throws InvariantViolation if getSignedData is required but not provided\n\t * @throws InvalidResponse if the response is invalid\n\t */\n\tasync #makeRequest<\n\t\tResponse extends { ok: true } | { ok: false; error: string; },\n\t\tRequest = undefined,\n\t\tSerializedRequest = Request\n\t>(input: {\n\t\tmethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n\t\tendpoint: keyof KeetaStorageAnchorOperations;\n\t\taccount?: KeetaNetAccount | undefined;\n\t\tparams?: { [key: string]: string; } | undefined;\n\t\tqueryParams?: { [key: string]: string; } | undefined;\n\t\tpathSuffix?: string | undefined;\n\t\tbody?: Request | undefined;\n\t\tserializeRequest?: (body: Request) => Omit<SerializedRequest, 'signed'> | Promise<Omit<SerializedRequest, 'signed'>>;\n\t\tgetSignedData?: (request?: Omit<SerializedRequest, 'signed'>) => Signable;\n\t\tisResponse: (data: unknown) => data is Response;\n\t}): Promise<Extract<Response, { ok: true }>> {\n\t\tconst { url, auth } = await this.#getOperationData(input.endpoint, input.params);\n\n\t\t// Append path suffix to URL pathname if provided\n\t\tif (input.pathSuffix) {\n\t\t\tthis.#appendPathToUrl(url, input.pathSuffix);\n\t\t}\n\n\t\t// Add query parameters to URL if provided\n\t\tif (input.queryParams) {\n\t\t\tfor (const [key, value] of Object.entries(input.queryParams)) {\n\t\t\t\turl.searchParams.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\t// Serialize the request body if provided.\n\t\tlet serializedBody: Omit<SerializedRequest, 'signed'> | undefined;\n\t\tif (input.body !== undefined && input.serializeRequest) {\n\t\t\tserializedBody = await input.serializeRequest(input.body);\n\t\t}\n\n\t\tlet signed: HTTPSignedField | undefined;\n\t\tif (auth.type === 'required' || (auth.type === 'optional' && input.account)) {\n\t\t\tif (!input.account) {\n\t\t\t\tthrow(new Errors.AccountRequired());\n\t\t\t}\n\n\t\t\tif (!input.getSignedData) {\n\t\t\t\tthrow(new Errors.InvariantViolation('getSignedData required for signed requests'));\n\t\t\t}\n\n\t\t\tconst signable = input.getSignedData(serializedBody);\n\t\t\tsigned = await SignData(input.account.assertAccount(), signable);\n\t\t}\n\n\t\tconst headers: { [key: string]: string } = { 'Accept': CONTENT_TYPE_JSON };\n\n\t\tlet usingUrl = url;\n\t\tlet body: BodyInit | null = null;\n\t\tif (input.method === 'POST' || input.method === 'PUT') {\n\t\t\theaders['Content-Type'] = CONTENT_TYPE_JSON;\n\t\t\tbody = JSON.stringify({ ...serializedBody, signed });\n\t\t} else {\n\t\t\tif (signed) {\n\t\t\t\tif (!input.account) {\n\t\t\t\t\tthrow(new Errors.InvariantViolation('Account information is required for this operation'));\n\t\t\t\t}\n\n\t\t\t\tusingUrl = addSignatureToURL(usingUrl, { signedField: signed, account: input.account.assertAccount() });\n\t\t\t}\n\n\t\t\tif (input.body) {\n\t\t\t\tthrow(new Errors.InvariantViolation('body cannot be sent with GET/DELETE requests'));\n\t\t\t}\n\t\t}\n\n\t\tlet httpResponse: globalThis.Response;\n\t\ttry {\n\t\t\thttpResponse = await fetch(usingUrl, {\n\t\t\t\tmethod: input.method, headers, body\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tthrow(new Errors.ServiceUnavailable(`Network error: ${e instanceof Error ? e.message : String(e)}`));\n\t\t}\n\n\t\tconst requestInformationJSON: unknown = await httpResponse.json();\n\t\tif (!input.isResponse(requestInformationJSON)) {\n\t\t\tthrow(new Errors.InvalidResponse(JSON.stringify(requestInformationJSON)));\n\t\t}\n\n\t\tif (!requestInformationJSON.ok) {\n\t\t\tthrow(await this.#parseResponseError(requestInformationJSON));\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(requestInformationJSON as Extract<Response, { ok: true }>);\n\t}\n\n\t/**\n\t * Make a PUT request with raw binary body.\n\t * Used for uploading encrypted container data to storage.\n\t *\n\t * @param input.path - The storage path for the object\n\t * @param input.data - The binary data (encrypted container) to upload\n\t * @param input.visibility - Object visibility (public or private)\n\t * @param input.tags - Optional tags to associate with the object\n\t * @param input.account - Account for signing the request\n\t *\n\t * @returns The created/updated object metadata\n\t *\n\t * @throws AccountRequired if authentication is required but no account provided\n\t * @throws ServiceUnavailable if the request fails\n\t */\n\tasync #makeBinaryPutRequest(input: {\n\t\tpath: string;\n\t\tdata: Buffer;\n\t\tvisibility?: StorageObjectVisibility;\n\t\ttags?: string[];\n\t\taccount: KeetaNetAccount;\n\t}): Promise<{ ok: true; object: StorageObjectMetadata }> {\n\t\tconst { url, auth } = await this.#getOperationData('put');\n\t\tconst visibility = input.visibility ?? 'private';\n\n\t\tthis.#appendPathToUrl(url, input.path);\n\n\t\tif (auth.type === 'required' && !input.account) {\n\t\t\tthrow(new Errors.AccountRequired());\n\t\t}\n\n\t\tconst tags = input.tags ?? [];\n\t\tfor (const tag of tags) {\n\t\t\t// Validate tags are not empty\n\t\t\tif (!tag || tag.trim().length === 0) {\n\t\t\t\tthrow(new Errors.InvalidTag('Tags cannot be empty'));\n\t\t\t}\n\t\t\t// Validate tags don't contain commas (used as delimiter in query params)\n\t\t\tif (tag.includes(',')) {\n\t\t\t\tthrow(new Errors.InvalidTag('Tags cannot contain commas'));\n\t\t\t}\n\t\t}\n\n\t\tconst signable = getKeetaStorageAnchorPutRequestSigningData({ path: input.path, visibility, tags });\n\t\tconst signed = await SignData(input.account.assertAccount(), signable);\n\n\t\t// Add auth to query params using helper\n\t\tconst signedUrl = addSignatureToURL(url, { signedField: signed, account: input.account.assertAccount() });\n\t\tsignedUrl.searchParams.set('visibility', visibility);\n\t\tif (tags.length > 0) {\n\t\t\tsignedUrl.searchParams.set('tags', tags.join(','));\n\t\t}\n\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tresponse = await fetch(signedUrl, {\n\t\t\t\tmethod: 'PUT',\n\t\t\t\theaders: { 'Content-Type': CONTENT_TYPE_OCTET_STREAM, 'Accept': CONTENT_TYPE_JSON },\n\t\t\t\tbody: input.data\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tthrow(new Errors.ServiceUnavailable(`Network error: ${e instanceof Error ? e.message : String(e)}`));\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tawait this.#handleBinaryResponseError(response);\n\t\t}\n\n\t\tconst responseJSON: unknown = await response.json();\n\t\tif (!isKeetaStorageAnchorPutResponse(responseJSON)) {\n\t\t\tthrow(new Errors.InvalidResponse(JSON.stringify(responseJSON)));\n\t\t}\n\n\t\tif (!responseJSON.ok) {\n\t\t\tthrow(await this.#parseResponseError(responseJSON));\n\t\t}\n\n\t\treturn(responseJSON);\n\t}\n\n\t/**\n\t * Make a GET request that returns raw binary data.\n\t * Used for downloading encrypted container data from storage.\n\t *\n\t * @param input.path - The storage path to retrieve\n\t * @param input.account - Account for signing the request\n\t *\n\t * @returns The raw binary data (encrypted container)\n\t *\n\t * @throws AccountRequired if authentication is required but no account provided\n\t * @throws ServiceUnavailable if the request fails\n\t */\n\tasync #makeBinaryGetRequest(input: {\n\t\tpath: string;\n\t\taccount: KeetaNetAccount;\n\t}): Promise<Buffer> {\n\t\tconst { url, auth } = await this.#getOperationData('get');\n\n\t\tthis.#appendPathToUrl(url, input.path);\n\n\t\tif (auth.type === 'required' && !input.account) {\n\t\t\tthrow(new Errors.AccountRequired());\n\t\t}\n\n\t\t// Sign the request\n\t\tconst signable = getKeetaStorageAnchorGetRequestSigningData({ path: input.path, account: input.account.publicKeyString.get() });\n\t\tconst signed = await SignData(input.account.assertAccount(), signable);\n\n\t\t// Add auth to query params\n\t\tconst signedUrl = addSignatureToURL(url, { signedField: signed, account: input.account.assertAccount() });\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tresponse = await fetch(signedUrl, {\n\t\t\t\tmethod: 'GET',\n\t\t\t\theaders: { 'Accept': CONTENT_TYPE_OCTET_STREAM }\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tthrow(new Errors.ServiceUnavailable(`Network error: ${e instanceof Error ? e.message : String(e)}`));\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tawait this.#handleBinaryResponseError(response);\n\t\t}\n\n\t\tconst arrayBuffer = await response.arrayBuffer();\n\t\treturn(arrayBufferLikeToBuffer(arrayBuffer));\n\t}\n\n\t/**\n\t * Delete an object by path.\n\t *\n\t * @param request - The delete request parameters\n\t * @param request.path - The storage path to delete\n\t * @param request.account - Optional account for signing (falls back to client account)\n\t *\n\t * @returns True if the object was deleted, false if it didn't exist\n\t */\n\tasync delete(request: KeetaStorageAnchorDeleteClientRequest): Promise<boolean> {\n\t\tthis.logger?.debug(`Deleting object at ${request.path} for provider ID: ${String(this.providerID)}`);\n\n\t\tconst response = await this.#makeRequest<\n\t\t\t{ ok: true; deleted: boolean } | { ok: false; error: string }\n\t\t>({\n\t\t\tmethod: 'DELETE',\n\t\t\tendpoint: 'delete',\n\t\t\taccount: request.account,\n\t\t\tpathSuffix: request.path,\n\t\t\tgetSignedData: function() {\n\t\t\t\treturn(getKeetaStorageAnchorDeleteRequestSigningData({ path: request.path }));\n\t\t\t},\n\t\t\tisResponse: isKeetaStorageAnchorDeleteResponse\n\t\t});\n\n\t\tthis.logger?.debug(`Delete request successful for path: ${request.path}`);\n\n\t\treturn(response.deleted);\n\t}\n\n\t/**\n\t * Get (retrieve) an object by path.\n\t * Data is automatically decrypted from the EncryptedContainer.\n\t *\n\t * @param options.path - The storage path (e.g., \"/user/<publicKey>/myfile.txt\")\n\t * @param options.account - Optional account for signing and decryption (falls back to client account)\n\t *\n\t * @returns The decrypted data and mime-type, or null if not found\n\t *\n\t * @throws PrivateKeyRequired if no account with private key is available\n\t * @throws InvalidResponse if the stored data cannot be decrypted\n\t */\n\tasync get(options: {\n\t\tpath: string;\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<{ data: Buffer; mimeType: string } | null> {\n\t\tconst { path } = options;\n\t\tthis.logger?.debug(`Getting object at path: ${path}`);\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\t\ttry {\n\t\t\tconst encodedData = await this.#makeBinaryGetRequest({\n\t\t\t\tpath,\n\t\t\t\taccount: signerAccount\n\t\t\t});\n\n\t\t\t// Decrypt the container and extract mimeType from encrypted payload\n\t\t\tconst container = EncryptedContainer.fromEncryptedBuffer(encodedData, [signerAccount]);\n\t\t\tconst plaintext = await container.getPlaintext();\n\t\t\tconst { mimeType, content: data } = parseContainerPayload(plaintext);\n\n\t\t\tthis.logger?.debug(`Get request successful for path: ${path}`);\n\n\t\t\treturn({\n\t\t\t\tdata,\n\t\t\t\tmimeType\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tif (Errors.DocumentNotFound.isInstance(e)) {\n\t\t\t\treturn(null);\n\t\t\t}\n\t\t\tthrow(e);\n\t\t}\n\t}\n\n\t/**\n\t * Get metadata for an object by path.\n\t *\n\t * @param options.path - The storage path (e.g., \"/user/<publicKey>/myfile.txt\")\n\t * @param options.account - Optional account for signing (falls back to client account)\n\t *\n\t * @returns The object metadata, or null if not found\n\t *\n\t * @throws PrivateKeyRequired if no account with private key is available\n\t */\n\tasync getMetadata(options: {\n\t\tpath: string;\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<StorageObjectMetadata | null> {\n\t\tconst { path } = options;\n\t\tthis.logger?.debug(`Getting metadata at path: ${path}`);\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\t\ttry {\n\t\t\tconst response = await this.#makeRequest<\n\t\t\t\t{ ok: true; object: StorageObjectMetadata } | { ok: false; error: string }\n\t\t\t>({\n\t\t\t\tmethod: 'GET',\n\t\t\t\tendpoint: 'metadata',\n\t\t\t\taccount: signerAccount,\n\t\t\t\tpathSuffix: path,\n\t\t\t\tgetSignedData: function() {\n\t\t\t\t\treturn(getKeetaStorageAnchorGetRequestSigningData({\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\taccount: signerAccount.publicKeyString.get()\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t\tisResponse: function(data: unknown): data is ({ ok: true; object: StorageObjectMetadata } | { ok: false; error: string }) {\n\t\t\t\t\tif (typeof data !== 'object' || data === null || !('ok' in data)) {\n\t\t\t\t\t\treturn(false);\n\t\t\t\t\t}\n\t\t\t\t\tif ('object' in data && typeof data.object === 'object' && data.object !== null) {\n\t\t\t\t\t\treturn(data.ok === true);\n\t\t\t\t\t}\n\t\t\t\t\tif ('error' in data && typeof data.error === 'string') {\n\t\t\t\t\t\treturn(data.ok === false);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.logger?.debug(`Get metadata successful for path: ${path}`);\n\n\t\t\treturn(response.object);\n\t\t} catch (e) {\n\t\t\t// Check if it's a \"not found\" error\n\t\t\tif (Errors.DocumentNotFound.isInstance(e)) {\n\t\t\t\treturn(null);\n\t\t\t}\n\t\t\tthrow(e);\n\t\t}\n\t}\n\n\t/**\n\t * Put (create/update) an object.\n\t * Data is automatically wrapped in an EncryptedContainer.\n\t *\n\t * @param options.path - The storage path (e.g., \"/user/<publicKey>/myfile.txt\")\n\t * @param options.data - The binary data to store\n\t * @param options.mimeType - MIME type of the data (stored encrypted in the container)\n\t * @param options.tags - Optional plaintext tags for the object\n\t * @param options.visibility - Object visibility\n\t * @param options.account - Optional account for signing (falls back to client account)\n\t * @param options.anchorAccount - Anchor account for public object encryption (falls back to provider's anchor)\n\t *\n\t * @returns The created/updated object metadata\n\t *\n\t * @throws PrivateKeyRequired if no account with private key is available\n\t * @throws InvalidAnchorAccount if public visibility requires an anchor account that's not available\n\t */\n\tasync put(options: {\n\t\tpath: string;\n\t\tdata: Buffer;\n\t\tmimeType: string;\n\t\ttags?: string[];\n\t\tvisibility?: StorageObjectVisibility;\n\t\taccount?: KeetaNetAccount;\n\t\tanchorAccount?: KeetaNetAccount;\n\t}): Promise<StorageObjectMetadata> {\n\t\tconst { path, data, mimeType, tags, visibility, anchorAccount } = options;\n\t\tthis.logger?.debug(`Putting object at path: ${path}`);\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\t\tconst principals: KeetaNetAccount[] = [signerAccount];\n\n\t\tif (visibility === 'public') {\n\t\t\tconst effectiveAnchor = anchorAccount ?? this.anchorAccount;\n\t\t\tif (!effectiveAnchor) {\n\t\t\t\tthrow(new Errors.AccountRequired('anchorAccount is required for public visibility and no provider anchor account is available'));\n\t\t\t}\n\n\t\t\tprincipals.push(effectiveAnchor);\n\t\t}\n\n\t\t// Create payload with mimeType inside (encrypted)\n\t\tconst payload = {\n\t\t\tmimeType,\n\t\t\tdata: data.toString('base64')\n\t\t};\n\n\t\tconst container = EncryptedContainer.fromPlaintext(\n\t\t\tJSON.stringify(payload),\n\t\t\tprincipals,\n\t\t\t{ signer: signerAccount }\n\t\t);\n\n\t\tconst encodedBuffer = await container.getEncodedBuffer();\n\t\tconst binaryData = arrayBufferLikeToBuffer(encodedBuffer);\n\n\t\tconst response = await this.#makeBinaryPutRequest({\n\t\t\tpath,\n\t\t\tdata: binaryData,\n\t\t\taccount: signerAccount,\n\t\t\t...(visibility !== undefined && { visibility }),\n\t\t\t...(tags !== undefined && { tags })\n\t\t});\n\n\t\tthis.logger?.debug(`Put request successful for path: ${path}`);\n\n\t\treturn(response.object);\n\t}\n\n\t/**\n\t * Search for objects matching criteria.\n\t *\n\t * @param options.criteria - Search criteria\n\t * @param options.pagination - Optional pagination settings\n\t * @param options.account - Optional account for signing (falls back to client account)\n\t *\n\t * @returns Search results with optional nextCursor for pagination\n\t */\n\tasync search(options: {\n\t\tcriteria: SearchCriteria;\n\t\tpagination?: SearchPagination;\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<{ results: StorageObjectMetadata[]; nextCursor?: string }> {\n\t\tconst { criteria, pagination } = options;\n\t\tthis.logger?.debug('Searching for objects');\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\t\tconst bodyToSend: { criteria: SearchCriteria; pagination?: SearchPagination; account?: KeetaNetAccount } = {\n\t\t\tcriteria,\n\t\t\taccount: signerAccount\n\t\t};\n\t\tif (pagination !== undefined) {\n\t\t\tbodyToSend.pagination = pagination;\n\t\t}\n\n\t\tconst response = await this.#makeRequest<\n\t\t\t{ ok: true; results: StorageObjectMetadata[]; nextCursor?: string } | { ok: false; error: string },\n\t\t\t{ criteria: SearchCriteria; pagination?: SearchPagination; account?: KeetaNetAccount },\n\t\t\tKeetaStorageAnchorSearchRequest\n\t\t>({\n\t\t\tmethod: 'POST',\n\t\t\tendpoint: 'search',\n\t\t\taccount: signerAccount,\n\t\t\tserializeRequest(body) {\n\t\t\t\tconst serialized: KeetaStorageAnchorSearchRequest = {\n\t\t\t\t\tcriteria: body.criteria\n\t\t\t\t};\n\t\t\t\tif (body.pagination !== undefined) {\n\t\t\t\t\tserialized.pagination = body.pagination;\n\t\t\t\t}\n\t\t\t\tif (body.account !== undefined) {\n\t\t\t\t\tserialized.account = body.account.assertAccount().publicKeyString.get();\n\t\t\t\t}\n\n\t\t\t\treturn(serialized);\n\t\t\t},\n\t\t\tbody: bodyToSend,\n\t\t\tgetSignedData: function() {\n\t\t\t\treturn(getKeetaStorageAnchorSearchRequestSigningData({\n\t\t\t\t\tcriteria,\n\t\t\t\t\t...(pagination !== undefined ? { pagination } : {})\n\t\t\t\t}));\n\t\t\t},\n\t\t\tisResponse: isKeetaStorageAnchorSearchResponse\n\t\t});\n\n\t\tthis.logger?.debug(`Search returned ${response.results.length} results`);\n\n\t\treturn({\n\t\t\tresults: response.results,\n\t\t\t...(response.nextCursor !== undefined ? { nextCursor: response.nextCursor } : {})\n\t\t});\n\t}\n\n\t/**\n\t * Get quota status for the authenticated user.\n\t *\n\t * @param options.account - Optional account for signing (falls back to client account)\n\t *\n\t * @returns Current quota status\n\t */\n\tasync getQuotaStatus(options?: {\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<QuotaStatus> {\n\t\tthis.logger?.debug('Getting quota status');\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options?.account);\n\t\tconst response = await this.#makeRequest<\n\t\t\t{ ok: true; quota: QuotaStatus } | { ok: false; error: string },\n\t\t\t{ account?: KeetaNetAccount },\n\t\t\tKeetaStorageAnchorQuotaRequest\n\t\t>({\n\t\t\tmethod: 'GET',\n\t\t\tendpoint: 'quota',\n\t\t\taccount: signerAccount,\n\t\t\tgetSignedData: function() {\n\t\t\t\treturn(getKeetaStorageAnchorQuotaRequestSigningData({}));\n\t\t\t},\n\t\t\tisResponse: isKeetaStorageAnchorQuotaResponse\n\t\t});\n\n\t\tthis.logger?.debug('Quota status retrieved successfully');\n\n\t\treturn(response.quota);\n\t}\n\n\t/**\n\t * Generate a pre-signed URL for public access to an object.\n\t * The URL is signed by the owner and has a limited lifetime.\n\t *\n\t * @param options.path - The storage path to the public object\n\t * @param options.ttl - TTL in seconds\n\t * @param options.account - Owner account for signing (falls back to client account, must have private key)\n\t *\n\t * @returns The pre-signed URL for unauthenticated access\n\t *\n\t * @throws PrivateKeyRequired if no account with private key is available\n\t * @throws OperationNotSupported if the public endpoint is not available\n\t */\n\tasync getPublicUrl(options: {\n\t\tpath: string;\n\t\tttl?: number;\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<string> {\n\t\tconst { path } = options;\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\n\t\tconst ttl = options.ttl ?? DEFAULT_SIGNED_URL_TTL_SECONDS;\n\t\tif (ttl <= 0) {\n\t\t\tthrow(new Errors.InvariantViolation('TTL must be positive'));\n\t\t}\n\t\tconst expiresAt = Math.floor(Date.now() / 1000) + ttl;\n\n\t\t// Sign the message with signer pubkey cryptographically bound\n\t\tconst signerPubKey = signerAccount.publicKeyString.get();\n\t\tconst signed = await SignData(signerAccount.assertAccount(), [path, expiresAt, signerPubKey]);\n\n\t\t// Get base URL from service info\n\t\tconst operationInfo = await this.serviceInfo.operations.public;\n\t\tif (!operationInfo) {\n\t\t\tthrow(new Errors.OperationNotSupported('public'));\n\t\t}\n\n\t\t// Construct the public URL using standard signed field convention\n\t\tconst publicUrl = new URL(operationInfo.url().href);\n\t\tthis.#appendPathToUrl(publicUrl, path);\n\t\tpublicUrl.searchParams.set('expires', String(expiresAt));\n\n\t\tconst finalUrl = addSignatureToURL(publicUrl, { signedField: signed, account: signerAccount.assertAccount() });\n\t\treturn(finalUrl.toString());\n\t}\n\n\t/**\n\t * Create a session.\n\t */\n\tbeginSession(config: SessionConfig): KeetaStorageAnchorSession {\n\t\treturn(new KeetaStorageAnchorSession(this, config));\n\t}\n\n\t/**\n\t * Execute a function within a session scope.\n\t */\n\tasync withSession<T>(config: SessionConfig, fn: (session: KeetaStorageAnchorSession) => Promise<T>): Promise<T> {\n\t\tconst session = this.beginSession(config);\n\t\treturn(await fn(session));\n\t}\n}\n\nclass KeetaStorageAnchorClient extends KeetaStorageAnchorBase {\n\treadonly resolver: Resolver;\n\treadonly id: string;\n\treadonly #signer: KeetaNetAccount;\n\treadonly #account: KeetaNetAccount;\n\n\tconstructor(client: KeetaNetUserClient, config: KeetaStorageAnchorClientConfig = {}) {\n\t\tsuper({ client, logger: config.logger });\n\t\tthis.resolver = config.resolver ?? getDefaultResolver(client, config);\n\t\tthis.id = config.id ?? crypto.randomUUID();\n\n\t\tif (config.signer) {\n\t\t\tthis.#signer = config.signer;\n\t\t} else if ('signer' in client && client.signer !== null) {\n\t\t\tthis.#signer = client.signer;\n\t\t} else if ('account' in client && client.account.hasPrivateKey) {\n\t\t\tthis.#signer = client.account;\n\t\t} else {\n\t\t\tthrow(new Errors.SignerRequired());\n\t\t}\n\n\t\tif (config.account) {\n\t\t\tthis.#account = config.account;\n\t\t} else if ('account' in client) {\n\t\t\tthis.#account = client.account;\n\t\t} else {\n\t\t\tthrow(new Errors.AccountRequired());\n\t\t}\n\t}\n\n\tasync #lookup(): Promise<KeetaStorageAnchorProvider[] | null> {\n\t\tconst endpoints = await getEndpoints(this.resolver, this.logger);\n\t\tif (endpoints === null) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tconst providers = Object.entries(endpoints).map(([id, serviceInfo]) => {\n\t\t\treturn(new KeetaStorageAnchorProvider(serviceInfo, id, this));\n\t\t});\n\n\t\treturn(providers);\n\t}\n\n\t/**\n\t * Get all available storage providers\n\t */\n\tasync getProviders(): Promise<KeetaStorageAnchorProvider[] | null> {\n\t\treturn(await this.#lookup());\n\t}\n\n\t/**\n\t * Get a specific provider by ID\n\t */\n\tasync getProviderByID(providerID: string): Promise<KeetaStorageAnchorProvider | null> {\n\t\tconst providers = await this.#lookup();\n\t\tif (!providers) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tconst provider = providers.find(function(p) {\n\t\t\treturn(p.providerID === providerID);\n\t\t});\n\t\treturn(provider ?? null);\n\t}\n\n\t/** @internal */\n\t_internals(accessToken: symbol) {\n\t\tif (accessToken !== KeetaStorageAnchorClientAccessToken) {\n\t\t\tthrow(new Errors.InvariantViolation('invalid internal access token'));\n\t\t}\n\n\t\treturn({\n\t\t\tresolver: this.resolver,\n\t\t\tlogger: this.logger,\n\t\t\tclient: this.client,\n\t\t\tsigner: this.#signer,\n\t\t\taccount: this.#account\n\t\t});\n\t}\n}\n\nexport default KeetaStorageAnchorClient;\n"]}
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/services/storage/client.ts"],"names":[],"mappings":";;AAkBA,OAAO,EACN,kCAAkC,EAClC,+BAA+B,EAC/B,kCAAkC,EAClC,iCAAiC,EACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,6CAA6C,EAC7C,0CAA0C,EAC1C,0CAA0C,EAC1C,6CAA6C,EAC7C,4CAA4C,EAC5C,qBAAqB,EACrB,MAAM,EACN,iBAAiB,EACjB,yBAAyB,EACzB,8BAA8B,EAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,MAAM,MAAM,2BAA2B,CAAC;AA2D/C,MAAM,mCAAmC,GAAG,MAAM,CAAC,qCAAqC,CAAC,CAAC;AAE1F,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA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IAAI,CAAC,QAAQ;SACtB,CAAC,CAAC;IACJ,CAAC;CACD;AAED,eAAe,wBAAwB,CAAC","sourcesContent":["import type { UserClient as KeetaNetUserClient } from '@keetanetwork/keetanet-client';\nimport type { Logger } from '../../lib/log/index.ts';\nimport type { HTTPSignedField } from '../../lib/http-server/common.js';\nimport type { ServiceMetadata, ServiceMetadataAuthenticationType, ServiceMetadataEndpoint } from '../../lib/resolver.ts';\nimport type { Signable } from '../../lib/utils/signing.js';\nimport type { Buffer } from '../../lib/utils/buffer.js';\nimport type {\n\tKeetaNetAccount,\n\tContactsClientConfig,\n\tStorageObjectMetadata,\n\tSearchCriteria,\n\tSearchPagination,\n\tQuotaStatus,\n\tStorageObjectVisibility,\n\tKeetaStorageAnchorDeleteClientRequest,\n\tKeetaStorageAnchorSearchRequest,\n\tKeetaStorageAnchorQuotaRequest\n} from './common.ts';\nimport {\n\tisKeetaStorageAnchorDeleteResponse,\n\tisKeetaStorageAnchorPutResponse,\n\tisKeetaStorageAnchorSearchResponse,\n\tisKeetaStorageAnchorQuotaResponse\n} from './common.generated.js';\nimport {\n\tgetKeetaStorageAnchorDeleteRequestSigningData,\n\tgetKeetaStorageAnchorPutRequestSigningData,\n\tgetKeetaStorageAnchorGetRequestSigningData,\n\tgetKeetaStorageAnchorSearchRequestSigningData,\n\tgetKeetaStorageAnchorQuotaRequestSigningData,\n\tparseContainerPayload,\n\tErrors,\n\tCONTENT_TYPE_JSON,\n\tCONTENT_TYPE_OCTET_STREAM,\n\tDEFAULT_SIGNED_URL_TTL_SECONDS\n} from './common.js';\nimport { KeetaNet } from '../../client/index.js';\nimport { getDefaultResolver } from '../../config.js';\nimport { EncryptedContainer } from '../../lib/encrypted-container.js';\nimport { createAssertEquals } from 'typia';\nimport { addSignatureToURL } from '../../lib/http-server/common.js';\nimport { SignData } from '../../lib/utils/signing.js';\nimport { KeetaAnchorError } from '../../lib/error.js';\nimport { arrayBufferLikeToBuffer } from '../../lib/utils/buffer.js';\nimport { StorageContactsClient } from './clients/contacts.js';\nimport Resolver from '../../lib/resolver.js';\nimport crypto from '../../lib/utils/crypto.js';\n\n/**\n * The configuration options for the Storage Anchor client.\n */\nexport type KeetaStorageAnchorClientConfig = {\n\t/**\n\t * The ID of the client. This is used to identify the client in logs.\n\t * If not provided, a random ID will be generated.\n\t */\n\tid?: string;\n\t/**\n\t * The logger to use for logging messages. If not provided, no logging\n\t * will be done.\n\t */\n\tlogger?: Logger;\n\t/**\n\t * The resolver to use for resolving Storage Anchor services. If not\n\t * provided, a default resolver will be created using the provided\n\t * client and network.\n\t */\n\tresolver?: Resolver;\n\t/**\n\t * The account to use for signing requests. If not provided, the\n\t * account associated with the provided client will be used.\n\t */\n\tsigner?: KeetaNetAccount;\n\t/**\n\t * Account to perform changes on. If not provided, the account\n\t * associated with the provided client will be used.\n\t */\n\taccount?: KeetaNetAccount;\n} & Omit<NonNullable<Parameters<typeof getDefaultResolver>[1]>, 'client'>;\n\n/**\n * Configuration for a storage session.\n * Sessions provide a simplified API with default account, working directory, and visibility.\n */\nexport type SessionConfig = {\n\t/**\n\t * The account to use for all operations in this session.\n\t */\n\taccount: KeetaNetAccount;\n\t/**\n\t * Optional working directory prefix for relative paths.\n\t * e.g., '/user/pubkey/docs/' - relative paths will be appended to this.\n\t */\n\tworkingDirectory?: string;\n\t/**\n\t * Default visibility for put operations (defaults to 'private').\n\t */\n\tdefaultVisibility?: StorageObjectVisibility;\n};\n\n/**\n * An opaque type that represents a provider ID.\n */\ntype ProviderID = string;\n\nconst KeetaStorageAnchorClientAccessToken = Symbol('KeetaStorageAnchorClientAccessToken');\n\nconst assertServiceMetadataEndpoint = createAssertEquals<ServiceMetadataEndpoint>();\n\n/**\n * A list of operations that can be performed by the Storage Anchor service.\n */\ntype KeetaStorageAnchorOperations = {\n\t[operation in keyof NonNullable<ServiceMetadata['services']['storage']>[string]['operations']]?: {\n\t\turl: (params?: { [key: string]: string; }) => URL;\n\t\toptions: {\n\t\t\tauthentication: ServiceMetadataAuthenticationType;\n\t\t};\n\t};\n};\n\n/**\n * The service information for a Storage Anchor service.\n */\ntype KeetaStorageServiceInfo = {\n\toperations: {\n\t\t[operation in keyof KeetaStorageAnchorOperations]: Promise<KeetaStorageAnchorOperations[operation]>;\n\t};\n\t/**\n\t * The anchor's public key string (for converting to Account object).\n\t */\n\tanchorAccountPublicKey?: string;\n};\n\n/**\n * For each matching Storage Anchor service, this type describes the\n * operations available.\n */\ntype GetEndpointsResult = {\n\t[id: ProviderID]: KeetaStorageServiceInfo;\n};\n\nfunction validateURL(url: string | undefined): URL {\n\tif (url === undefined || url === null) {\n\t\tthrow(new Errors.InvalidPath('Invalid URL: null or undefined'));\n\t}\n\n\ttry {\n\t\treturn(new URL(url));\n\t} catch {\n\t\tthrow(new Errors.InvalidResponse(`Invalid URL in service metadata: ${url}`));\n\t}\n}\n\nasync function getEndpoints(resolver: Resolver, logger?: Logger): Promise<GetEndpointsResult | null> {\n\tconst response = await resolver.lookup('storage', {});\n\tif (response === undefined) {\n\t\treturn(null);\n\t}\n\n\tconst serviceInfoPromises = Object.entries(response).map(async function([id, serviceInfo]): Promise<[ProviderID, KeetaStorageServiceInfo]> {\n\t\tconst operations = await serviceInfo.operations('object');\n\t\tconst operationsFunctions: KeetaStorageServiceInfo['operations'] = {};\n\t\tfor (const [key, operation] of Object.entries(operations)) {\n\t\t\tif (operation === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tObject.defineProperty(operationsFunctions, key, {\n\t\t\t\tget: async function() {\n\t\t\t\t\tconst endpointInfo = assertServiceMetadataEndpoint(await Resolver.Metadata.fullyResolveValuizable(operation));\n\n\t\t\t\t\tlet url;\n\t\t\t\t\tlet authentication: ServiceMetadataAuthenticationType = {\n\t\t\t\t\t\ttype: 'none',\n\t\t\t\t\t\tmethod: 'keeta-account'\n\t\t\t\t\t};\n\n\t\t\t\t\tif (typeof endpointInfo === 'string') {\n\t\t\t\t\t\turl = endpointInfo;\n\t\t\t\t\t} else {\n\t\t\t\t\t\turl = endpointInfo.url;\n\t\t\t\t\t\tif (endpointInfo.options?.authentication) {\n\t\t\t\t\t\t\tauthentication = endpointInfo.options.authentication;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn({\n\t\t\t\t\t\turl: function(params?: { [key: string]: string; }): URL {\n\t\t\t\t\t\t\tlet substitutedURL;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tsubstitutedURL = decodeURI(url);\n\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\tlogger?.debug('getEndpoints', 'Failed to decode URI, using original URL for substitution', error, url);\n\n\t\t\t\t\t\t\t\tsubstitutedURL = url;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor (const [paramKey, paramValue] of Object.entries(params ?? {})) {\n\t\t\t\t\t\t\t\tsubstitutedURL = substitutedURL.replace(`{${paramKey}}`, encodeURIComponent(paramValue));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn(validateURL(substitutedURL));\n\t\t\t\t\t\t},\n\t\t\t\t\t\toptions: { authentication }\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\t\t}\n\n\t\t// Extract anchor account public key from service metadata\n\t\tconst result: KeetaStorageServiceInfo = { operations: operationsFunctions };\n\t\tif ('anchorAccount' in serviceInfo && typeof serviceInfo.anchorAccount === 'function') {\n\t\t\tconst anchorAccountValue = await serviceInfo.anchorAccount('primitive');\n\t\t\tif (typeof anchorAccountValue === 'string') {\n\t\t\t\tresult.anchorAccountPublicKey = anchorAccountValue;\n\t\t\t}\n\t\t}\n\n\t\treturn([\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tid as unknown as ProviderID,\n\t\t\tresult\n\t\t]);\n\t});\n\n\tconst retval = Object.fromEntries(await Promise.all(serviceInfoPromises));\n\treturn(retval);\n}\n\ninterface KeetaStorageAnchorBaseConfig {\n\tclient: KeetaNetUserClient;\n\tlogger?: Logger | undefined;\n}\n\nclass KeetaStorageAnchorBase {\n\tprotected readonly logger?: Logger | undefined;\n\tprotected readonly client: KeetaNetUserClient;\n\n\tconstructor(config: KeetaStorageAnchorBaseConfig) {\n\t\tthis.client = config.client;\n\t\tthis.logger = config.logger;\n\t}\n}\n\n/**\n * A session provides a simplified API for storage operations with default account,\n * working directory, and visibility settings.\n */\nexport class KeetaStorageAnchorSession {\n\treadonly provider: KeetaStorageAnchorProvider;\n\treadonly account: KeetaNetAccount;\n\treadonly workingDirectory: string;\n\treadonly #defaultVisibility: StorageObjectVisibility;\n\n\tconstructor(provider: KeetaStorageAnchorProvider, config: SessionConfig) {\n\t\tthis.provider = provider;\n\t\tthis.account = config.account;\n\t\tthis.workingDirectory = config.workingDirectory ?? '/';\n\t\tthis.#defaultVisibility = config.defaultVisibility ?? 'private';\n\t}\n\n\t/**\n\t * Resolve a relative path to a full storage path.\n\t *\n\t * @param relativePath - Path to resolve (absolute paths returned as-is)\n\t *\n\t * @returns The full storage path with working directory prepended if relative\n\t */\n\t#resolvePath(relativePath: string): string {\n\t\t// If path is already absolute (starts with /), use it as-is\n\t\tif (relativePath.startsWith('/')) {\n\t\t\treturn(relativePath);\n\t\t}\n\n\t\t// Otherwise, prepend working directory\n\t\treturn(this.workingDirectory + relativePath);\n\t}\n\n\t/**\n\t * Store data at a relative path.\n\t * For public visibility, the anchor account is automatically fetched from the provider.\n\t *\n\t * @param relativePath - The relative path\n\t * @param data - The binary data to store\n\t * @param options.mimeType - MIME type of the data\n\t * @param options.tags - Optional plaintext tags\n\t * @param options.visibility - Object visibility\n\t *\n\t * @returns The created/updated object metadata\n\t */\n\tasync put(\n\t\trelativePath: string,\n\t\tdata: Buffer,\n\t\toptions: {\n\t\t\tmimeType: string;\n\t\t\ttags?: string[];\n\t\t\tvisibility?: StorageObjectVisibility;\n\t\t}\n\t): Promise<StorageObjectMetadata> {\n\t\tconst fullPath = this.#resolvePath(relativePath);\n\t\tconst visibility = options.visibility ?? this.#defaultVisibility;\n\t\tconst putOpts: Parameters<typeof this.provider.put>[0] = {\n\t\t\tpath: fullPath,\n\t\t\tdata,\n\t\t\tmimeType: options.mimeType,\n\t\t\tvisibility,\n\t\t\taccount: this.account\n\t\t};\n\t\tif (options.tags) {\n\t\t\tputOpts.tags = options.tags;\n\t\t}\n\t\tif (visibility === 'public' && this.provider.anchorAccount) {\n\t\t\tputOpts.anchorAccount = this.provider.anchorAccount;\n\t\t}\n\n\t\treturn(await this.provider.put(putOpts));\n\t}\n\n\t/**\n\t * Get data from a relative path.\n\t *\n\t * @param relativePath - The relative path\n\t *\n\t * @returns The decrypted data and mime-type, or null if not found\n\t */\n\tasync get(relativePath: string): Promise<{ data: Buffer; mimeType: string } | null> {\n\t\tconst fullPath = this.#resolvePath(relativePath);\n\t\treturn(await this.provider.get({ path: fullPath, account: this.account }));\n\t}\n\n\t/**\n\t * Delete data at a relative path.\n\t *\n\t * @param relativePath - The relative path\n\t *\n\t * @returns True if the object was deleted, false if it didn't exist\n\t */\n\tasync delete(relativePath: string): Promise<boolean> {\n\t\tconst fullPath = this.#resolvePath(relativePath);\n\t\treturn(await this.provider.delete({ path: fullPath, account: this.account }));\n\t}\n\n\t/**\n\t * Search for objects. Owner is automatically set to the session account.\n\t *\n\t * @param criteria - Optional search criteria (owner is set automatically)\n\t * @param pagination - Optional pagination settings\n\t *\n\t * @returns Search results with optional nextCursor for pagination\n\t */\n\tasync search(\n\t\tcriteria?: Omit<SearchCriteria, 'owner'>,\n\t\tpagination?: SearchPagination\n\t): Promise<{ results: StorageObjectMetadata[]; nextCursor?: string }> {\n\t\tconst fullCriteria: SearchCriteria = {\n\t\t\t...criteria,\n\t\t\towner: this.account.publicKeyString.get()\n\t\t};\n\n\t\tconst searchOpts: Parameters<typeof this.provider.search>[0] = {\n\t\t\tcriteria: fullCriteria,\n\t\t\taccount: this.account\n\t\t};\n\t\tif (pagination) {\n\t\t\tsearchOpts.pagination = pagination;\n\t\t}\n\n\t\treturn(await this.provider.search(searchOpts));\n\t}\n\n\t/**\n\t * Get a pre-signed public URL for a relative path.\n\t *\n\t * @param relativePath - The relative path\n\t * @param options.ttl - Optional TTL in seconds\n\t *\n\t * @returns The pre-signed URL for public access\n\t */\n\tasync getPublicUrl(relativePath: string, options?: { ttl?: number }): Promise<string> {\n\t\tconst fullPath = this.#resolvePath(relativePath);\n\t\tconst urlOpts: Parameters<typeof this.provider.getPublicUrl>[0] = {\n\t\t\tpath: fullPath,\n\t\t\taccount: this.account\n\t\t};\n\t\tif (options?.ttl) {\n\t\t\turlOpts.ttl = options.ttl;\n\t\t}\n\n\t\treturn(await this.provider.getPublicUrl(urlOpts));\n\t}\n}\n\n/**\n * Represents a Storage Anchor provider for performing storage operations.\n */\nexport class KeetaStorageAnchorProvider extends KeetaStorageAnchorBase {\n\t/**\n\t * Service information including available operations and endpoints.\n\t */\n\treadonly serviceInfo: KeetaStorageServiceInfo;\n\t/**\n\t * Unique identifier for this provider.\n\t */\n\treadonly providerID: ProviderID;\n\t/**\n\t * The anchor account for this provider.\n\t */\n\treadonly anchorAccount: KeetaNetAccount | null;\n\n\tconstructor(serviceInfo: KeetaStorageServiceInfo, providerID: ProviderID, parent: KeetaStorageAnchorClient) {\n\t\tconst parentPrivate = parent._internals(KeetaStorageAnchorClientAccessToken);\n\t\tsuper(parentPrivate);\n\n\t\tthis.serviceInfo = serviceInfo;\n\t\tthis.providerID = providerID;\n\n\t\t// Convert anchor account public key string to Account\n\t\tif (serviceInfo.anchorAccountPublicKey) {\n\t\t\ttry {\n\t\t\t\tthis.anchorAccount = KeetaNet.lib.Account.fromPublicKeyString(serviceInfo.anchorAccountPublicKey).assertAccount();\n\t\t\t} catch {\n\t\t\t\tthrow(new Errors.InvalidAnchorAccount(serviceInfo.anchorAccountPublicKey));\n\t\t\t}\n\t\t} else {\n\t\t\tthis.anchorAccount = null;\n\t\t}\n\t}\n\n\t/**\n\t * Get operation endpoint data for a given operation.\n\t *\n\t * @param operationName - The operation to get endpoint data for\n\t * @param params - Optional URL template parameters to substitute\n\t *\n\t * @returns The endpoint URL and authentication configuration\n\t *\n\t * @throws OperationNotSupported if the operation is not available\n\t * @throws UnsupportedAuthMethod if the authentication method is not supported\n\t */\n\tasync #getOperationData(operationName: keyof KeetaStorageAnchorOperations, params?: { [key: string]: string; }) {\n\t\tconst endpoint = await this.serviceInfo.operations[operationName];\n\t\tif (endpoint === undefined) {\n\t\t\tthrow(new Errors.OperationNotSupported(operationName));\n\t\t}\n\t\tif (endpoint.options.authentication.method !== 'keeta-account') {\n\t\t\tthrow(new Errors.UnsupportedAuthMethod(endpoint.options.authentication.method));\n\t\t}\n\n\t\treturn({\n\t\t\turl: endpoint.url(params),\n\t\t\tauth: endpoint.options.authentication\n\t\t});\n\t}\n\n\t/**\n\t * Parse an error response from the server.\n\t * Attempts to restore structured error types from JSON.\n\t *\n\t * @param data - The error response data\n\t *\n\t * @returns A KeetaAnchorError or generic Error with the error message\n\t *\n\t * @throws InvariantViolation if the response is not a valid error object\n\t */\n\tasync #parseResponseError(data: unknown) {\n\t\tif (typeof data !== 'object' || data === null) {\n\t\t\tthrow(new Errors.InvariantViolation('expected error response object'));\n\t\t}\n\n\t\tif (!('ok' in data) || data.ok !== false) {\n\t\t\tthrow(new Errors.InvariantViolation('expected error response with ok=false'));\n\t\t}\n\n\t\tlet parsedError: KeetaAnchorError | null = null;\n\t\ttry {\n\t\t\tparsedError = await KeetaAnchorError.fromJSON(data);\n\t\t} catch (error: unknown) {\n\t\t\tthis.logger?.debug('Failed to parse error response as KeetaAnchorError', error, data);\n\t\t}\n\n\t\tif (parsedError) {\n\t\t\treturn(parsedError);\n\t\t} else {\n\t\t\tlet errorStr;\n\t\t\tif ('error' in data && typeof data.error === 'string') {\n\t\t\t\terrorStr = data.error;\n\t\t\t} else {\n\t\t\t\terrorStr = 'Unknown error';\n\t\t\t}\n\n\t\t\treturn(new Error(`storage request failed: ${errorStr}`));\n\t\t}\n\t}\n\n\t/**\n\t * Resolve account to use for signing, with private key validation.\n\t *\n\t * @param account - Optional account override (falls back to client account)\n\t * @param requirePrivateKey - Whether private key is required\n\t *\n\t * @returns The resolved account with optional private key validation\n\t *\n\t * @throws PrivateKeyRequired if private key is needed but not available\n\t */\n\t#resolveSignerAccount(\n\t\taccount: KeetaNetAccount | undefined,\n\t\trequirePrivateKey = true\n\t): KeetaNetAccount {\n\t\tconst resolved = account ?? this.client.account;\n\t\tif (requirePrivateKey && !resolved?.hasPrivateKey) {\n\t\t\tthrow(new Errors.PrivateKeyRequired());\n\t\t}\n\t\tif (!resolved) {\n\t\t\tthrow(new Errors.AccountRequired());\n\t\t}\n\n\t\treturn(resolved);\n\t}\n\n\t/**\n\t * Handle error responses from binary PUT/GET requests.\n\t * Attempts to parse JSON error response, otherwise throws generic error.\n\t *\n\t * @param response - The failed HTTP response to handle\n\t *\n\t * @throws The parsed error from the response body, or a generic ServiceUnavailable error\n\t */\n\tasync #handleBinaryResponseError(response: Response): Promise<never> {\n\t\tlet errorJSON: unknown;\n\t\ttry {\n\t\t\terrorJSON = await response.json();\n\t\t} catch {\n\t\t\t// JSON parsing failed - throw generic error\n\t\t\tthrow(new Errors.InvalidResponse(`HTTP ${response.status}: ${response.statusText}`));\n\t\t}\n\n\t\t// JSON parsed successfully - attempt to extract error\n\t\tif (typeof errorJSON === 'object' && errorJSON !== null && 'ok' in errorJSON && errorJSON.ok === false) {\n\t\t\tthrow(await this.#parseResponseError(errorJSON));\n\t\t}\n\n\t\t// Unexpected response shape\n\t\tthrow(new Errors.InvalidResponse(`HTTP ${response.status}: ${response.statusText}`));\n\t}\n\n\t/**\n\t * Normalize a path suffix and append it to a URL pathname.\n\t * Handles leading slashes and trailing slashes consistently.\n\t * Validates against path traversal attacks.\n\t *\n\t * @param url - The URL object to modify (mutated in place)\n\t * @param path - The path suffix to append\n\t *\n\t * @throws InvalidPath if path contains traversal patterns\n\t */\n\t#appendPathToUrl(url: URL, path: string): void {\n\t\t// Validate path is not empty\n\t\tif (!path || path.trim().length === 0) {\n\t\t\tthrow(new Errors.InvalidPath('Path cannot be empty'));\n\t\t}\n\t\t// Validate against path traversal attacks\n\t\tif (path.includes('..') || path.includes('//')) {\n\t\t\tthrow(new Errors.InvalidPath('Path contains invalid segments'));\n\t\t}\n\n\t\tconst pathSuffix = path.startsWith('/') ? path.slice(1) : path;\n\t\turl.pathname = url.pathname.replace(/\\/$/, '') + '/' + pathSuffix;\n\t}\n\n\t/**\n\t * Make a JSON API request to the storage service.\n\t * Handles authentication, serialization, and response parsing.\n\t *\n\t * @typeParam Response - The expected response type\n\t * @typeParam Request - The request body type\n\t * @typeParam SerializedRequest - The serialized request type\n\t *\n\t * @param input.method - HTTP method\n\t * @param input.endpoint - Operation endpoint name\n\t * @param input.account - Account for signing the request\n\t * @param input.params - URL template parameters\n\t * @param input.queryParams - Query string parameters\n\t * @param input.pathSuffix - Path to append to the endpoint URL\n\t * @param input.body - Request body\n\t * @param input.serializeRequest - Function to serialize the request body\n\t * @param input.getSignedData - Function to get signing data from request\n\t * @param input.isResponse - Type guard for the response\n\t *\n\t * @returns The successful response\n\t *\n\t * @throws AccountRequired if account is required but not provided\n\t * @throws InvariantViolation if getSignedData is required but not provided\n\t * @throws InvalidResponse if the response is invalid\n\t */\n\tasync #makeRequest<\n\t\tResponse extends { ok: true } | { ok: false; error: string; },\n\t\tRequest = undefined,\n\t\tSerializedRequest = Request\n\t>(input: {\n\t\tmethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n\t\tendpoint: keyof KeetaStorageAnchorOperations;\n\t\taccount?: KeetaNetAccount | undefined;\n\t\tparams?: { [key: string]: string; } | undefined;\n\t\tqueryParams?: { [key: string]: string; } | undefined;\n\t\tpathSuffix?: string | undefined;\n\t\tbody?: Request | undefined;\n\t\tserializeRequest?: (body: Request) => Omit<SerializedRequest, 'signed'> | Promise<Omit<SerializedRequest, 'signed'>>;\n\t\tgetSignedData?: (request?: Omit<SerializedRequest, 'signed'>) => Signable;\n\t\tisResponse: (data: unknown) => data is Response;\n\t}): Promise<Extract<Response, { ok: true }>> {\n\t\tconst { url, auth } = await this.#getOperationData(input.endpoint, input.params);\n\n\t\t// Append path suffix to URL pathname if provided\n\t\tif (input.pathSuffix) {\n\t\t\tthis.#appendPathToUrl(url, input.pathSuffix);\n\t\t}\n\n\t\t// Add query parameters to URL if provided\n\t\tif (input.queryParams) {\n\t\t\tfor (const [key, value] of Object.entries(input.queryParams)) {\n\t\t\t\turl.searchParams.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\t// Serialize the request body if provided.\n\t\tlet serializedBody: Omit<SerializedRequest, 'signed'> | undefined;\n\t\tif (input.body !== undefined && input.serializeRequest) {\n\t\t\tserializedBody = await input.serializeRequest(input.body);\n\t\t}\n\n\t\tlet signed: HTTPSignedField | undefined;\n\t\tif (auth.type === 'required' || (auth.type === 'optional' && input.account)) {\n\t\t\tif (!input.account) {\n\t\t\t\tthrow(new Errors.AccountRequired());\n\t\t\t}\n\n\t\t\tif (!input.getSignedData) {\n\t\t\t\tthrow(new Errors.InvariantViolation('getSignedData required for signed requests'));\n\t\t\t}\n\n\t\t\tconst signable = input.getSignedData(serializedBody);\n\t\t\tsigned = await SignData(input.account.assertAccount(), signable);\n\t\t}\n\n\t\tconst headers: { [key: string]: string } = { 'Accept': CONTENT_TYPE_JSON };\n\n\t\tlet usingUrl = url;\n\t\tlet body: BodyInit | null = null;\n\t\tif (input.method === 'POST' || input.method === 'PUT') {\n\t\t\theaders['Content-Type'] = CONTENT_TYPE_JSON;\n\t\t\tbody = JSON.stringify({ ...serializedBody, signed });\n\t\t} else {\n\t\t\tif (signed) {\n\t\t\t\tif (!input.account) {\n\t\t\t\t\tthrow(new Errors.InvariantViolation('Account information is required for this operation'));\n\t\t\t\t}\n\n\t\t\t\tusingUrl = addSignatureToURL(usingUrl, { signedField: signed, account: input.account.assertAccount() });\n\t\t\t}\n\n\t\t\tif (input.body) {\n\t\t\t\tthrow(new Errors.InvariantViolation('body cannot be sent with GET/DELETE requests'));\n\t\t\t}\n\t\t}\n\n\t\tlet httpResponse: globalThis.Response;\n\t\ttry {\n\t\t\thttpResponse = await fetch(usingUrl, {\n\t\t\t\tmethod: input.method, headers, body\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tthrow(new Errors.ServiceUnavailable(`Network error: ${e instanceof Error ? e.message : String(e)}`));\n\t\t}\n\n\t\tconst requestInformationJSON: unknown = await httpResponse.json();\n\t\tif (!input.isResponse(requestInformationJSON)) {\n\t\t\tthrow(new Errors.InvalidResponse(JSON.stringify(requestInformationJSON)));\n\t\t}\n\n\t\tif (!requestInformationJSON.ok) {\n\t\t\tthrow(await this.#parseResponseError(requestInformationJSON));\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(requestInformationJSON as Extract<Response, { ok: true }>);\n\t}\n\n\t/**\n\t * Make a PUT request with raw binary body.\n\t * Used for uploading encrypted container data to storage.\n\t *\n\t * @param input.path - The storage path for the object\n\t * @param input.data - The binary data (encrypted container) to upload\n\t * @param input.visibility - Object visibility (public or private)\n\t * @param input.tags - Optional tags to associate with the object\n\t * @param input.account - Account for signing the request\n\t *\n\t * @returns The created/updated object metadata\n\t *\n\t * @throws AccountRequired if authentication is required but no account provided\n\t * @throws ServiceUnavailable if the request fails\n\t */\n\tasync #makeBinaryPutRequest(input: {\n\t\tpath: string;\n\t\tdata: Buffer;\n\t\tvisibility?: StorageObjectVisibility;\n\t\ttags?: string[];\n\t\taccount: KeetaNetAccount;\n\t}): Promise<{ ok: true; object: StorageObjectMetadata }> {\n\t\tconst { url, auth } = await this.#getOperationData('put');\n\t\tconst visibility = input.visibility ?? 'private';\n\n\t\tthis.#appendPathToUrl(url, input.path);\n\n\t\tif (auth.type === 'required' && !input.account) {\n\t\t\tthrow(new Errors.AccountRequired());\n\t\t}\n\n\t\tconst tags = input.tags ?? [];\n\t\tfor (const tag of tags) {\n\t\t\t// Validate tags are not empty\n\t\t\tif (!tag || tag.trim().length === 0) {\n\t\t\t\tthrow(new Errors.InvalidTag('Tags cannot be empty'));\n\t\t\t}\n\t\t\t// Validate tags don't contain commas (used as delimiter in query params)\n\t\t\tif (tag.includes(',')) {\n\t\t\t\tthrow(new Errors.InvalidTag('Tags cannot contain commas'));\n\t\t\t}\n\t\t}\n\n\t\tconst signable = getKeetaStorageAnchorPutRequestSigningData({ path: input.path, visibility, tags });\n\t\tconst signed = await SignData(input.account.assertAccount(), signable);\n\n\t\t// Add auth to query params using helper\n\t\tconst signedUrl = addSignatureToURL(url, { signedField: signed, account: input.account.assertAccount() });\n\t\tsignedUrl.searchParams.set('visibility', visibility);\n\t\tif (tags.length > 0) {\n\t\t\tsignedUrl.searchParams.set('tags', tags.join(','));\n\t\t}\n\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tresponse = await fetch(signedUrl, {\n\t\t\t\tmethod: 'PUT',\n\t\t\t\theaders: { 'Content-Type': CONTENT_TYPE_OCTET_STREAM, 'Accept': CONTENT_TYPE_JSON },\n\t\t\t\tbody: input.data\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tthrow(new Errors.ServiceUnavailable(`Network error: ${e instanceof Error ? e.message : String(e)}`));\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tawait this.#handleBinaryResponseError(response);\n\t\t}\n\n\t\tconst responseJSON: unknown = await response.json();\n\t\tif (!isKeetaStorageAnchorPutResponse(responseJSON)) {\n\t\t\tthrow(new Errors.InvalidResponse(JSON.stringify(responseJSON)));\n\t\t}\n\n\t\tif (!responseJSON.ok) {\n\t\t\tthrow(await this.#parseResponseError(responseJSON));\n\t\t}\n\n\t\treturn(responseJSON);\n\t}\n\n\t/**\n\t * Make a GET request that returns raw binary data.\n\t * Used for downloading encrypted container data from storage.\n\t *\n\t * @param input.path - The storage path to retrieve\n\t * @param input.account - Account for signing the request\n\t *\n\t * @returns The raw binary data (encrypted container)\n\t *\n\t * @throws AccountRequired if authentication is required but no account provided\n\t * @throws ServiceUnavailable if the request fails\n\t */\n\tasync #makeBinaryGetRequest(input: {\n\t\tpath: string;\n\t\taccount: KeetaNetAccount;\n\t}): Promise<Buffer> {\n\t\tconst { url, auth } = await this.#getOperationData('get');\n\n\t\tthis.#appendPathToUrl(url, input.path);\n\n\t\tif (auth.type === 'required' && !input.account) {\n\t\t\tthrow(new Errors.AccountRequired());\n\t\t}\n\n\t\t// Sign the request\n\t\tconst signable = getKeetaStorageAnchorGetRequestSigningData({ path: input.path, account: input.account.publicKeyString.get() });\n\t\tconst signed = await SignData(input.account.assertAccount(), signable);\n\n\t\t// Add auth to query params\n\t\tconst signedUrl = addSignatureToURL(url, { signedField: signed, account: input.account.assertAccount() });\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tresponse = await fetch(signedUrl, {\n\t\t\t\tmethod: 'GET',\n\t\t\t\theaders: { 'Accept': CONTENT_TYPE_OCTET_STREAM }\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tthrow(new Errors.ServiceUnavailable(`Network error: ${e instanceof Error ? e.message : String(e)}`));\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tawait this.#handleBinaryResponseError(response);\n\t\t}\n\n\t\tconst arrayBuffer = await response.arrayBuffer();\n\t\treturn(arrayBufferLikeToBuffer(arrayBuffer));\n\t}\n\n\t/**\n\t * Delete an object by path.\n\t *\n\t * @param request - The delete request parameters\n\t * @param request.path - The storage path to delete\n\t * @param request.account - Optional account for signing (falls back to client account)\n\t *\n\t * @returns True if the object was deleted, false if it didn't exist\n\t */\n\tasync delete(request: KeetaStorageAnchorDeleteClientRequest): Promise<boolean> {\n\t\tthis.logger?.debug(`Deleting object at ${request.path} for provider ID: ${String(this.providerID)}`);\n\n\t\tconst response = await this.#makeRequest<\n\t\t\t{ ok: true; deleted: boolean } | { ok: false; error: string }\n\t\t>({\n\t\t\tmethod: 'DELETE',\n\t\t\tendpoint: 'delete',\n\t\t\taccount: request.account,\n\t\t\tpathSuffix: request.path,\n\t\t\tgetSignedData: function() {\n\t\t\t\treturn(getKeetaStorageAnchorDeleteRequestSigningData({ path: request.path }));\n\t\t\t},\n\t\t\tisResponse: isKeetaStorageAnchorDeleteResponse\n\t\t});\n\n\t\tthis.logger?.debug(`Delete request successful for path: ${request.path}`);\n\n\t\treturn(response.deleted);\n\t}\n\n\t/**\n\t * Get (retrieve) an object by path.\n\t * Data is automatically decrypted from the EncryptedContainer.\n\t *\n\t * @param options.path - The storage path (e.g., \"/user/<publicKey>/myfile.txt\")\n\t * @param options.account - Optional account for signing and decryption (falls back to client account)\n\t *\n\t * @returns The decrypted data and mime-type, or null if not found\n\t *\n\t * @throws PrivateKeyRequired if no account with private key is available\n\t * @throws InvalidResponse if the stored data cannot be decrypted\n\t */\n\tasync get(options: {\n\t\tpath: string;\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<{ data: Buffer; mimeType: string } | null> {\n\t\tconst { path } = options;\n\t\tthis.logger?.debug(`Getting object at path: ${path}`);\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\t\ttry {\n\t\t\tconst encodedData = await this.#makeBinaryGetRequest({\n\t\t\t\tpath,\n\t\t\t\taccount: signerAccount\n\t\t\t});\n\n\t\t\t// Decrypt the container and extract mimeType from encrypted payload\n\t\t\tconst container = EncryptedContainer.fromEncryptedBuffer(encodedData, [signerAccount]);\n\t\t\tconst plaintext = await container.getPlaintext();\n\t\t\tconst { mimeType, content: data } = parseContainerPayload(plaintext);\n\n\t\t\tthis.logger?.debug(`Get request successful for path: ${path}`);\n\n\t\t\treturn({\n\t\t\t\tdata,\n\t\t\t\tmimeType\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tif (Errors.DocumentNotFound.isInstance(e)) {\n\t\t\t\treturn(null);\n\t\t\t}\n\t\t\tthrow(e);\n\t\t}\n\t}\n\n\t/**\n\t * Get metadata for an object by path.\n\t *\n\t * @param options.path - The storage path (e.g., \"/user/<publicKey>/myfile.txt\")\n\t * @param options.account - Optional account for signing (falls back to client account)\n\t *\n\t * @returns The object metadata, or null if not found\n\t *\n\t * @throws PrivateKeyRequired if no account with private key is available\n\t */\n\tasync getMetadata(options: {\n\t\tpath: string;\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<StorageObjectMetadata | null> {\n\t\tconst { path } = options;\n\t\tthis.logger?.debug(`Getting metadata at path: ${path}`);\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\t\ttry {\n\t\t\tconst response = await this.#makeRequest<\n\t\t\t\t{ ok: true; object: StorageObjectMetadata } | { ok: false; error: string }\n\t\t\t>({\n\t\t\t\tmethod: 'GET',\n\t\t\t\tendpoint: 'metadata',\n\t\t\t\taccount: signerAccount,\n\t\t\t\tpathSuffix: path,\n\t\t\t\tgetSignedData: function() {\n\t\t\t\t\treturn(getKeetaStorageAnchorGetRequestSigningData({\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\taccount: signerAccount.publicKeyString.get()\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t\tisResponse: function(data: unknown): data is ({ ok: true; object: StorageObjectMetadata } | { ok: false; error: string }) {\n\t\t\t\t\tif (typeof data !== 'object' || data === null || !('ok' in data)) {\n\t\t\t\t\t\treturn(false);\n\t\t\t\t\t}\n\t\t\t\t\tif ('object' in data && typeof data.object === 'object' && data.object !== null) {\n\t\t\t\t\t\treturn(data.ok === true);\n\t\t\t\t\t}\n\t\t\t\t\tif ('error' in data && typeof data.error === 'string') {\n\t\t\t\t\t\treturn(data.ok === false);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.logger?.debug(`Get metadata successful for path: ${path}`);\n\n\t\t\treturn(response.object);\n\t\t} catch (e) {\n\t\t\t// Check if it's a \"not found\" error\n\t\t\tif (Errors.DocumentNotFound.isInstance(e)) {\n\t\t\t\treturn(null);\n\t\t\t}\n\t\t\tthrow(e);\n\t\t}\n\t}\n\n\t/**\n\t * Put (create/update) an object.\n\t * Data is automatically wrapped in an EncryptedContainer.\n\t *\n\t * @param options.path - The storage path (e.g., \"/user/<publicKey>/myfile.txt\")\n\t * @param options.data - The binary data to store\n\t * @param options.mimeType - MIME type of the data (stored encrypted in the container)\n\t * @param options.tags - Optional plaintext tags for the object\n\t * @param options.visibility - Object visibility\n\t * @param options.account - Optional account for signing (falls back to client account)\n\t * @param options.anchorAccount - Anchor account for public object encryption (falls back to provider's anchor)\n\t *\n\t * @returns The created/updated object metadata\n\t *\n\t * @throws PrivateKeyRequired if no account with private key is available\n\t * @throws InvalidAnchorAccount if public visibility requires an anchor account that's not available\n\t */\n\tasync put(options: {\n\t\tpath: string;\n\t\tdata: Buffer;\n\t\tmimeType: string;\n\t\ttags?: string[];\n\t\tvisibility?: StorageObjectVisibility;\n\t\taccount?: KeetaNetAccount;\n\t\tanchorAccount?: KeetaNetAccount;\n\t}): Promise<StorageObjectMetadata> {\n\t\tconst { path, data, mimeType, tags, visibility, anchorAccount } = options;\n\t\tthis.logger?.debug(`Putting object at path: ${path}`);\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\t\tconst principals: KeetaNetAccount[] = [signerAccount];\n\n\t\tif (visibility === 'public') {\n\t\t\tconst effectiveAnchor = anchorAccount ?? this.anchorAccount;\n\t\t\tif (!effectiveAnchor) {\n\t\t\t\tthrow(new Errors.AccountRequired('anchorAccount is required for public visibility and no provider anchor account is available'));\n\t\t\t}\n\n\t\t\tprincipals.push(effectiveAnchor);\n\t\t}\n\n\t\t// Create payload with mimeType inside (encrypted)\n\t\tconst payload = {\n\t\t\tmimeType,\n\t\t\tdata: data.toString('base64')\n\t\t};\n\n\t\tconst container = EncryptedContainer.fromPlaintext(\n\t\t\tJSON.stringify(payload),\n\t\t\tprincipals,\n\t\t\t{ signer: signerAccount }\n\t\t);\n\n\t\tconst encodedBuffer = await container.getEncodedBuffer();\n\t\tconst binaryData = arrayBufferLikeToBuffer(encodedBuffer);\n\n\t\tconst response = await this.#makeBinaryPutRequest({\n\t\t\tpath,\n\t\t\tdata: binaryData,\n\t\t\taccount: signerAccount,\n\t\t\t...(visibility !== undefined && { visibility }),\n\t\t\t...(tags !== undefined && { tags })\n\t\t});\n\n\t\tthis.logger?.debug(`Put request successful for path: ${path}`);\n\n\t\treturn(response.object);\n\t}\n\n\t/**\n\t * Search for objects matching criteria.\n\t *\n\t * @param options.criteria - Search criteria\n\t * @param options.pagination - Optional pagination settings\n\t * @param options.account - Optional account for signing (falls back to client account)\n\t *\n\t * @returns Search results with optional nextCursor for pagination\n\t */\n\tasync search(options: {\n\t\tcriteria: SearchCriteria;\n\t\tpagination?: SearchPagination;\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<{ results: StorageObjectMetadata[]; nextCursor?: string }> {\n\t\tconst { criteria, pagination } = options;\n\t\tthis.logger?.debug('Searching for objects');\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\t\tconst bodyToSend: { criteria: SearchCriteria; pagination?: SearchPagination; account?: KeetaNetAccount } = {\n\t\t\tcriteria,\n\t\t\taccount: signerAccount\n\t\t};\n\t\tif (pagination !== undefined) {\n\t\t\tbodyToSend.pagination = pagination;\n\t\t}\n\n\t\tconst response = await this.#makeRequest<\n\t\t\t{ ok: true; results: StorageObjectMetadata[]; nextCursor?: string } | { ok: false; error: string },\n\t\t\t{ criteria: SearchCriteria; pagination?: SearchPagination; account?: KeetaNetAccount },\n\t\t\tKeetaStorageAnchorSearchRequest\n\t\t>({\n\t\t\tmethod: 'POST',\n\t\t\tendpoint: 'search',\n\t\t\taccount: signerAccount,\n\t\t\tserializeRequest(body) {\n\t\t\t\tconst serialized: KeetaStorageAnchorSearchRequest = {\n\t\t\t\t\tcriteria: body.criteria\n\t\t\t\t};\n\t\t\t\tif (body.pagination !== undefined) {\n\t\t\t\t\tserialized.pagination = body.pagination;\n\t\t\t\t}\n\t\t\t\tif (body.account !== undefined) {\n\t\t\t\t\tserialized.account = body.account.assertAccount().publicKeyString.get();\n\t\t\t\t}\n\n\t\t\t\treturn(serialized);\n\t\t\t},\n\t\t\tbody: bodyToSend,\n\t\t\tgetSignedData: function() {\n\t\t\t\treturn(getKeetaStorageAnchorSearchRequestSigningData({\n\t\t\t\t\tcriteria,\n\t\t\t\t\t...(pagination !== undefined ? { pagination } : {})\n\t\t\t\t}));\n\t\t\t},\n\t\t\tisResponse: isKeetaStorageAnchorSearchResponse\n\t\t});\n\n\t\tthis.logger?.debug(`Search returned ${response.results.length} results`);\n\n\t\treturn({\n\t\t\tresults: response.results,\n\t\t\t...(response.nextCursor !== undefined ? { nextCursor: response.nextCursor } : {})\n\t\t});\n\t}\n\n\t/**\n\t * Get quota status for the authenticated user.\n\t *\n\t * @param options.account - Optional account for signing (falls back to client account)\n\t *\n\t * @returns Current quota status\n\t */\n\tasync getQuotaStatus(options?: {\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<QuotaStatus> {\n\t\tthis.logger?.debug('Getting quota status');\n\n\t\tconst signerAccount = this.#resolveSignerAccount(options?.account);\n\t\tconst response = await this.#makeRequest<\n\t\t\t{ ok: true; quota: QuotaStatus } | { ok: false; error: string },\n\t\t\t{ account?: KeetaNetAccount },\n\t\t\tKeetaStorageAnchorQuotaRequest\n\t\t>({\n\t\t\tmethod: 'GET',\n\t\t\tendpoint: 'quota',\n\t\t\taccount: signerAccount,\n\t\t\tgetSignedData: function() {\n\t\t\t\treturn(getKeetaStorageAnchorQuotaRequestSigningData({}));\n\t\t\t},\n\t\t\tisResponse: isKeetaStorageAnchorQuotaResponse\n\t\t});\n\n\t\tthis.logger?.debug('Quota status retrieved successfully');\n\n\t\treturn(response.quota);\n\t}\n\n\t/**\n\t * Generate a pre-signed URL for public access to an object.\n\t * The URL is signed by the owner and has a limited lifetime.\n\t *\n\t * @param options.path - The storage path to the public object\n\t * @param options.ttl - TTL in seconds\n\t * @param options.account - Owner account for signing (falls back to client account, must have private key)\n\t *\n\t * @returns The pre-signed URL for unauthenticated access\n\t *\n\t * @throws PrivateKeyRequired if no account with private key is available\n\t * @throws OperationNotSupported if the public endpoint is not available\n\t */\n\tasync getPublicUrl(options: {\n\t\tpath: string;\n\t\tttl?: number;\n\t\taccount?: KeetaNetAccount;\n\t}): Promise<string> {\n\t\tconst { path } = options;\n\t\tconst signerAccount = this.#resolveSignerAccount(options.account);\n\n\t\tconst ttl = options.ttl ?? DEFAULT_SIGNED_URL_TTL_SECONDS;\n\t\tif (ttl <= 0) {\n\t\t\tthrow(new Errors.InvariantViolation('TTL must be positive'));\n\t\t}\n\t\tconst expiresAt = Math.floor(Date.now() / 1000) + ttl;\n\n\t\t// Sign the message with signer pubkey cryptographically bound\n\t\tconst signerPubKey = signerAccount.publicKeyString.get();\n\t\tconst signed = await SignData(signerAccount.assertAccount(), [path, expiresAt, signerPubKey]);\n\n\t\t// Get base URL from service info\n\t\tconst operationInfo = await this.serviceInfo.operations.public;\n\t\tif (!operationInfo) {\n\t\t\tthrow(new Errors.OperationNotSupported('public'));\n\t\t}\n\n\t\t// Construct the public URL using standard signed field convention\n\t\tconst publicUrl = new URL(operationInfo.url().href);\n\t\tthis.#appendPathToUrl(publicUrl, path);\n\t\tpublicUrl.searchParams.set('expires', String(expiresAt));\n\n\t\tconst finalUrl = addSignatureToURL(publicUrl, { signedField: signed, account: signerAccount.assertAccount() });\n\t\treturn(finalUrl.toString());\n\t}\n\n\t/**\n\t * Create a session.\n\t */\n\tbeginSession(config: SessionConfig): KeetaStorageAnchorSession {\n\t\treturn(new KeetaStorageAnchorSession(this, config));\n\t}\n\n\t/**\n\t * Execute a function within a session scope.\n\t */\n\tasync withSession<T>(config: SessionConfig, fn: (session: KeetaStorageAnchorSession) => Promise<T>): Promise<T> {\n\t\tconst session = this.beginSession(config);\n\t\treturn(await fn(session));\n\t}\n\n\t/**\n\t * Get a contacts client bound to the given account.\n\t */\n\tgetContactsClient(config: ContactsClientConfig): StorageContactsClient {\n\t\tconst session = this.beginSession({ account: config.account, workingDirectory: config.basePath });\n\t\treturn(new StorageContactsClient(session));\n\t}\n}\n\nclass KeetaStorageAnchorClient extends KeetaStorageAnchorBase {\n\treadonly resolver: Resolver;\n\treadonly id: string;\n\treadonly #signer: KeetaNetAccount;\n\treadonly #account: KeetaNetAccount;\n\n\tconstructor(client: KeetaNetUserClient, config: KeetaStorageAnchorClientConfig = {}) {\n\t\tsuper({ client, logger: config.logger });\n\t\tthis.resolver = config.resolver ?? getDefaultResolver(client, config);\n\t\tthis.id = config.id ?? crypto.randomUUID();\n\n\t\tif (config.signer) {\n\t\t\tthis.#signer = config.signer;\n\t\t} else if ('signer' in client && client.signer !== null) {\n\t\t\tthis.#signer = client.signer;\n\t\t} else if ('account' in client && client.account.hasPrivateKey) {\n\t\t\tthis.#signer = client.account;\n\t\t} else {\n\t\t\tthrow(new Errors.SignerRequired());\n\t\t}\n\n\t\tif (config.account) {\n\t\t\tthis.#account = config.account;\n\t\t} else if ('account' in client) {\n\t\t\tthis.#account = client.account;\n\t\t} else {\n\t\t\tthrow(new Errors.AccountRequired());\n\t\t}\n\t}\n\n\tasync #lookup(): Promise<KeetaStorageAnchorProvider[] | null> {\n\t\tconst endpoints = await getEndpoints(this.resolver, this.logger);\n\t\tif (endpoints === null) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tconst providers = Object.entries(endpoints).map(([id, serviceInfo]) => {\n\t\t\treturn(new KeetaStorageAnchorProvider(serviceInfo, id, this));\n\t\t});\n\n\t\treturn(providers);\n\t}\n\n\t/**\n\t * Get all available storage providers\n\t */\n\tasync getProviders(): Promise<KeetaStorageAnchorProvider[] | null> {\n\t\treturn(await this.#lookup());\n\t}\n\n\t/**\n\t * Get a specific provider by ID\n\t */\n\tasync getProviderByID(providerID: string): Promise<KeetaStorageAnchorProvider | null> {\n\t\tconst providers = await this.#lookup();\n\t\tif (!providers) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tconst provider = providers.find(function(p) {\n\t\t\treturn(p.providerID === providerID);\n\t\t});\n\t\treturn(provider ?? null);\n\t}\n\n\t/**\n\t * Get a contacts client bound to the given account.\n\t * Resolves the first available provider and constructs a StorageContactsClient.\n\t */\n\tasync getContactsClient(config: ContactsClientConfig): Promise<StorageContactsClient | null> {\n\t\tconst providers = await this.getProviders();\n\t\tconst provider = providers?.[0];\n\t\tif (!provider) {\n\t\t\treturn(null);\n\t\t}\n\n\t\treturn(provider.getContactsClient(config));\n\t}\n\n\t/** @internal */\n\t_internals(accessToken: symbol) {\n\t\tif (accessToken !== KeetaStorageAnchorClientAccessToken) {\n\t\t\tthrow(new Errors.InvariantViolation('invalid internal access token'));\n\t\t}\n\n\t\treturn({\n\t\t\tresolver: this.resolver,\n\t\t\tlogger: this.logger,\n\t\t\tclient: this.client,\n\t\t\tsigner: this.#signer,\n\t\t\taccount: this.#account\n\t\t});\n\t}\n}\n\nexport default KeetaStorageAnchorClient;\n"]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { AssetTransferInstructions, RecipientResolved, KeetaNetAccount } from '../../asset-movement/common.js';
|
|
2
|
+
import type { AssetLocationLike, PickChainLocation } from '../../asset-movement/lib/location.js';
|
|
3
|
+
import type { KeetaStorageAnchorSession } from '../client.js';
|
|
4
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
5
|
+
/**
|
|
6
|
+
* The structural shape of a transfer instruction, excluding transaction-specific fields.
|
|
7
|
+
*/
|
|
8
|
+
export type TransferInstructionShape = DistributiveOmit<AssetTransferInstructions, 'value' | 'assetFee' | 'totalReceiveAmount' | 'persistentAddressId'>;
|
|
9
|
+
/**
|
|
10
|
+
* The type of provider information allowed for a contact address.
|
|
11
|
+
*/
|
|
12
|
+
export type ProviderInformationType = 'username' | 'template';
|
|
13
|
+
/**
|
|
14
|
+
* The type of recipient for a persistent address template.
|
|
15
|
+
*/
|
|
16
|
+
export type PersistentAddressTemplateRecipient = Extract<RecipientResolved, {
|
|
17
|
+
type: 'persistent-address';
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Base interface for contact addresses with narrowed generic parameters.
|
|
21
|
+
*/
|
|
22
|
+
export interface ContactAddressBase<RecipientType extends RecipientResolved, Location extends AssetLocationLike, ProviderInformationAllowedTypes extends ProviderInformationType> {
|
|
23
|
+
recipient: RecipientType;
|
|
24
|
+
location?: Location;
|
|
25
|
+
providerInformation?: {
|
|
26
|
+
[providerId: string]: ProviderInformationAllowedTypes[];
|
|
27
|
+
};
|
|
28
|
+
pastInstructions?: TransferInstructionShape[];
|
|
29
|
+
}
|
|
30
|
+
export type KeetaAssetLocation = PickChainLocation<'keeta'> | `chain:keeta:${bigint}`;
|
|
31
|
+
/**
|
|
32
|
+
* A contact address for a Keeta account.
|
|
33
|
+
*/
|
|
34
|
+
export type KeetaContactAddress = ContactAddressBase<string, KeetaAssetLocation, 'username'>;
|
|
35
|
+
/**
|
|
36
|
+
* A contact address for a persistent address template.
|
|
37
|
+
*/
|
|
38
|
+
export type TemplateContactAddress = ContactAddressBase<PersistentAddressTemplateRecipient, AssetLocationLike, 'template'>;
|
|
39
|
+
/**
|
|
40
|
+
* A contact address for a non-Keeta, non-persistent-address recipient.
|
|
41
|
+
*/
|
|
42
|
+
export type OtherContactAddress = ContactAddressBase<Exclude<RecipientResolved, KeetaNetAccount | PersistentAddressTemplateRecipient>, Exclude<AssetLocationLike, KeetaAssetLocation>, 'template'>;
|
|
43
|
+
export type ContactAddress = KeetaContactAddress | TemplateContactAddress | OtherContactAddress;
|
|
44
|
+
/**
|
|
45
|
+
* A stored contact with metadata and an address.
|
|
46
|
+
*/
|
|
47
|
+
export type Contact = {
|
|
48
|
+
id: string;
|
|
49
|
+
label: string;
|
|
50
|
+
address: ContactAddress;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Generic contacts client interface
|
|
54
|
+
*/
|
|
55
|
+
export interface ContactsClient {
|
|
56
|
+
deriveId(address: ContactAddress): string;
|
|
57
|
+
create(options: {
|
|
58
|
+
label: string;
|
|
59
|
+
address: ContactAddress;
|
|
60
|
+
}): Promise<Contact>;
|
|
61
|
+
get(id: string): Promise<Contact | null>;
|
|
62
|
+
update(id: string, options: {
|
|
63
|
+
label?: string;
|
|
64
|
+
address?: ContactAddress;
|
|
65
|
+
}): Promise<Contact>;
|
|
66
|
+
delete(id: string): Promise<boolean>;
|
|
67
|
+
list(options?: {
|
|
68
|
+
location?: AssetLocationLike;
|
|
69
|
+
}): Promise<Contact[]>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Storage Anchor-backed implementation of `ContactsClient`.
|
|
73
|
+
* Stores contacts as encrypted JSON objects via a `KeetaStorageAnchorSession`.
|
|
74
|
+
*/
|
|
75
|
+
export declare class StorageContactsClient implements ContactsClient {
|
|
76
|
+
#private;
|
|
77
|
+
constructor(session: KeetaStorageAnchorSession);
|
|
78
|
+
deriveId(address: ContactAddress): string;
|
|
79
|
+
create(options: {
|
|
80
|
+
label: string;
|
|
81
|
+
address: ContactAddress;
|
|
82
|
+
}): Promise<Contact>;
|
|
83
|
+
get(id: string): Promise<Contact | null>;
|
|
84
|
+
update(id: string, options: {
|
|
85
|
+
label?: string;
|
|
86
|
+
address?: ContactAddress;
|
|
87
|
+
}): Promise<Contact>;
|
|
88
|
+
delete(id: string): Promise<boolean>;
|
|
89
|
+
list(options?: {
|
|
90
|
+
location?: AssetLocationLike;
|
|
91
|
+
}): Promise<Contact[]>;
|
|
92
|
+
}
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=contacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../../../src/services/storage/clients/contacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACpH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACjG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAS9D,KAAK,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AM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IASxC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;QACjC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,cAAc,CAAC;KACzB,GAAG,OAAO,CAAC,OAAO,CAAC;IA+Bd,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIpC,IAAI,CAAC,OAAO,CAAC,EAAE;QACpB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;KAC7B,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAqBtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.generated.d.ts","sourceRoot":"","sources":["../../../../src/services/storage/clients/contacts.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAiC,CAAC"}
|