@keetanetwork/anchor 0.0.39 → 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.
Files changed (95) hide show
  1. package/client/index.d.ts +6 -0
  2. package/client/index.d.ts.map +1 -1
  3. package/client/index.js +7 -0
  4. package/client/index.js.map +1 -1
  5. package/lib/block-listener.d.ts +93 -0
  6. package/lib/block-listener.d.ts.map +1 -0
  7. package/lib/block-listener.js +259 -0
  8. package/lib/block-listener.js.map +1 -0
  9. package/lib/error.d.ts.map +1 -1
  10. package/lib/error.js +3 -1
  11. package/lib/error.js.map +1 -1
  12. package/lib/http-server/index.d.ts +14 -1
  13. package/lib/http-server/index.d.ts.map +1 -1
  14. package/lib/http-server/index.js +86 -7
  15. package/lib/http-server/index.js.map +1 -1
  16. package/lib/queue/index.d.ts +20 -5
  17. package/lib/queue/index.d.ts.map +1 -1
  18. package/lib/queue/index.js +52 -17
  19. package/lib/queue/index.js.map +1 -1
  20. package/lib/resolver.d.ts +57 -0
  21. package/lib/resolver.d.ts.map +1 -1
  22. package/lib/resolver.js +864 -250
  23. package/lib/resolver.js.map +1 -1
  24. package/npm-shrinkwrap.json +4 -4
  25. package/package.json +1 -1
  26. package/services/asset-movement/client.d.ts +9 -2
  27. package/services/asset-movement/client.d.ts.map +1 -1
  28. package/services/asset-movement/client.js +35 -2
  29. package/services/asset-movement/client.js.map +1 -1
  30. package/services/asset-movement/common.d.ts +1 -0
  31. package/services/asset-movement/common.d.ts.map +1 -1
  32. package/services/asset-movement/common.js +75 -0
  33. package/services/asset-movement/common.js.map +1 -1
  34. package/services/asset-movement/server.d.ts +0 -10
  35. package/services/asset-movement/server.d.ts.map +1 -1
  36. package/services/asset-movement/server.js +0 -2
  37. package/services/asset-movement/server.js.map +1 -1
  38. package/services/fx/common.d.ts +1 -1
  39. package/services/fx/common.js.map +1 -1
  40. package/services/fx/server.d.ts +37 -6
  41. package/services/fx/server.d.ts.map +1 -1
  42. package/services/fx/server.js +207 -66
  43. package/services/fx/server.js.map +1 -1
  44. package/services/storage/client.d.ts +332 -0
  45. package/services/storage/client.d.ts.map +1 -0
  46. package/services/storage/client.js +1078 -0
  47. package/services/storage/client.js.map +1 -0
  48. package/services/storage/clients/contacts.d.ts +94 -0
  49. package/services/storage/clients/contacts.d.ts.map +1 -0
  50. package/services/storage/clients/contacts.generated.d.ts +3 -0
  51. package/services/storage/clients/contacts.generated.d.ts.map +1 -0
  52. package/services/storage/clients/contacts.generated.js +1197 -0
  53. package/services/storage/clients/contacts.generated.js.map +1 -0
  54. package/services/storage/clients/contacts.js +141 -0
  55. package/services/storage/clients/contacts.js.map +1 -0
  56. package/services/storage/common.d.ts +667 -0
  57. package/services/storage/common.d.ts.map +1 -0
  58. package/services/storage/common.generated.d.ts +17 -0
  59. package/services/storage/common.generated.d.ts.map +1 -0
  60. package/services/storage/common.generated.js +863 -0
  61. package/services/storage/common.generated.js.map +1 -0
  62. package/services/storage/common.js +587 -0
  63. package/services/storage/common.js.map +1 -0
  64. package/services/storage/lib/validators.d.ts +64 -0
  65. package/services/storage/lib/validators.d.ts.map +1 -0
  66. package/services/storage/lib/validators.js +82 -0
  67. package/services/storage/lib/validators.js.map +1 -0
  68. package/services/storage/server.d.ts +127 -0
  69. package/services/storage/server.d.ts.map +1 -0
  70. package/services/storage/server.js +626 -0
  71. package/services/storage/server.js.map +1 -0
  72. package/services/storage/test-utils.d.ts +70 -0
  73. package/services/storage/test-utils.d.ts.map +1 -0
  74. package/services/storage/test-utils.js +347 -0
  75. package/services/storage/test-utils.js.map +1 -0
  76. package/services/storage/utils.d.ts +3 -0
  77. package/services/storage/utils.d.ts.map +1 -0
  78. package/services/storage/utils.js +10 -0
  79. package/services/storage/utils.js.map +1 -0
  80. package/services/username/client.d.ts +145 -0
  81. package/services/username/client.d.ts.map +1 -0
  82. package/services/username/client.js +681 -0
  83. package/services/username/client.js.map +1 -0
  84. package/services/username/common.d.ts +136 -0
  85. package/services/username/common.d.ts.map +1 -0
  86. package/services/username/common.generated.d.ts +13 -0
  87. package/services/username/common.generated.d.ts.map +1 -0
  88. package/services/username/common.generated.js +256 -0
  89. package/services/username/common.generated.js.map +1 -0
  90. package/services/username/common.js +226 -0
  91. package/services/username/common.js.map +1 -0
  92. package/services/username/server.d.ts +49 -0
  93. package/services/username/server.d.ts.map +1 -0
  94. package/services/username/server.js +262 -0
  95. package/services/username/server.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/services/storage/common.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAQ5E,2BAA2B;AAE3B,qCAAqC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAEpD,oDAAoD;AACpD,MAAM,CAAC,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AAEpE,sDAAsD;AACtD,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAsPnD,MAAM,UAAU,0CAA0C,CACzD,KAA8E;IAE9E,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,SAAS,CAAC;IACjD,MAAM,IAAI,GAAa,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,OAAM,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;AACxD,CAAC;AA4BD,MAAM,UAAU,0CAA0C,CACzD,KAAmC;IAEnC,OAAM,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7B,CAAC;AA+BD,MAAM,UAAU,6CAA6C,CAC5D,KAAsC;IAEt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K,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAChF,MAAM,WAAW,GAAG,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;YACzE,MAAM,WAAW,GAAG,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;YACjE,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;gBACrC,QAAQ,GAAG,WAAW,CAAC;YACxB,CAAC;YACD,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;gBACrC,OAAO,GAAG,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;YACvE,CAAC;iBAAM,CAAC;gBACP,OAAO,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;YAC9C,CAAC;QACF,CAAC;aAAM,CAAC;YACP,OAAO,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;QAC9C,CAAC;QACD,OAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACR,OAAM,CAAC;YACN,QAAQ,EAAE,yBAAyB;YACnC,OAAO,EAAE,uBAAuB,CAAC,SAAS,CAAC;SAC3C,CAAC,CAAC;IACJ,CAAC;AACF,CAAC","sourcesContent":["import type { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\nimport type { HTTPSignedField } from '../../lib/http-server/common.js';\nimport type { Signable } from '../../lib/utils/signing.js';\nimport { KeetaAnchorUserError, KeetaAnchorUserValidationError } from '../../lib/error.js';\nimport { Buffer, arrayBufferLikeToBuffer } from '../../lib/utils/buffer.js';\n\n/**\n * Type alias for a KeetaNet Account instance.\n * Used throughout the storage service for account authentication and signing.\n */\nexport type KeetaNetAccount = InstanceType<typeof KeetaNetLib.Account>;\n\n// #region Shared Constants\n\n/** Content type for JSON payloads */\nexport const CONTENT_TYPE_JSON = 'application/json';\n\n/** Content type for binary/octet-stream payloads */\nexport const CONTENT_TYPE_OCTET_STREAM = 'application/octet-stream';\n\n/** Default TTL for signed URLs in seconds (1 hour) */\nexport const DEFAULT_SIGNED_URL_TTL_SECONDS = 3600;\n\n// #endregion\n\n// #region Common Types\n\n/**\n * Visibility of a storage object\n */\nexport type StorageObjectVisibility = 'public' | 'private';\n\n// #endregion\n\n// #region Object Metadata\n\n/**\n * Metadata for a stored object\n */\nexport type StorageObjectMetadata = {\n\t/**\n\t * Full path (the unique ID)\n\t */\n\tpath: string;\n\n\t/**\n\t * Owner's identifier\n\t */\n\towner: string;\n\n\t/**\n\t * Plaintext tags (searchable)\n\t */\n\ttags: string[];\n\n\t/**\n\t * Visibility setting\n\t */\n\tvisibility: StorageObjectVisibility;\n\n\t/**\n\t * Size in bytes\n\t */\n\tsize: number;\n\n\t/**\n\t * ISO timestamp of creation\n\t */\n\tcreatedAt: string;\n\n\t/**\n\t * ISO timestamp of last update\n\t */\n\tupdatedAt?: string;\n};\n\n// #endregion\n\n// #region Search\n\n/**\n * Criteria for searching storage objects.\n * Note: Content/keyword search is not supported (content is encrypted).\n */\nexport type SearchCriteria = {\n\t/**\n\t * Match objects with paths starting with this prefix\n\t * e.g., \"/user/keeta1abc.../contacts/\"\n\t */\n\tpathPrefix?: string;\n\n\t/**\n\t * Match objects that have ANY of these tags\n\t */\n\ttags?: string[];\n\n\t/**\n\t * Match path segment (filename portion)\n\t */\n\tname?: string;\n\n\t/**\n\t * Filter by owner's public key\n\t */\n\towner?: string;\n\n\t/**\n\t * Include objects in nested paths (default: false)\n\t */\n\trecursive?: boolean;\n\n\t/**\n\t * Filter by visibility.\n\t * When 'public', allows searching public objects outside caller's namespace.\n\t */\n\tvisibility?: StorageObjectVisibility;\n};\n\n/**\n * Pagination options for search\n */\nexport type SearchPagination = {\n\t/**\n\t * Cursor for pagination (from previous response)\n\t */\n\tcursor?: string;\n\n\t/**\n\t * Maximum number of results to return\n\t */\n\tlimit?: number;\n};\n\n/**\n * Search results with pagination\n */\nexport type SearchResults = {\n\t/**\n\t * Matching objects\n\t */\n\tresults: StorageObjectMetadata[];\n\n\t/**\n\t * Cursor for next page (undefined if no more results)\n\t */\n\tnextCursor?: string;\n};\n\n// #endregion\n\n// #region Quota\n\n/**\n * Quota configuration for the storage service\n */\nexport type QuotaConfig = {\n\t/**\n\t * Maximum size in bytes per object\n\t */\n\tmaxObjectSize: number;\n\n\t/**\n\t * Maximum number of objects per user\n\t */\n\tmaxObjectsPerUser: number;\n\n\t/**\n\t * Maximum total storage in bytes per user\n\t */\n\tmaxStoragePerUser: number;\n\n\t/**\n\t * Maximum number of results per search request\n\t */\n\tmaxSearchLimit: number;\n\n\t/**\n\t * Maximum TTL in seconds for signed URLs\n\t */\n\tmaxSignedUrlTTL: number;\n};\n\n/**\n * Per-user quota limits.\n * Subset of QuotaConfig that can be overridden on a per-user basis.\n */\nexport type QuotaLimits = Pick<QuotaConfig, 'maxObjectsPerUser' | 'maxStoragePerUser' | 'maxObjectSize'>;\n\n/**\n * Current quota status for a user.\n * Backends must provide objectCount and totalSize.\n */\nexport type QuotaStatus = {\n\t/**\n\t * Current number of objects\n\t */\n\tobjectCount: number;\n\n\t/**\n\t * Current total size in bytes\n\t */\n\ttotalSize: number;\n\n\t/**\n\t * Remaining objects allowed (optional, server computes if absent)\n\t */\n\tremainingObjects?: number;\n\n\t/**\n\t * Remaining storage in bytes (optional, server computes if absent)\n\t */\n\tremainingSize?: number;\n};\n\n// #endregion\n\n// #region Request Type Helpers\n\n// #endregion\n\n// #region PUT Object\n\n/**\n * Client-side request to put (create/update) an object\n */\nexport type KeetaStorageAnchorPutClientRequest = {\n\taccount?: KeetaNetAccount;\n\tpath: string;\n\tdata: string; // Base64-encoded EncryptedContainer\n\ttags?: string[];\n\tvisibility?: StorageObjectVisibility;\n};\n\n/**\n * Server-side request to put an object\n */\nexport type KeetaStorageAnchorPutRequest = {\n\taccount?: string;\n\tsigned?: HTTPSignedField;\n\tpath: string;\n\tdata: string;\n\ttags?: string[];\n\tvisibility?: StorageObjectVisibility;\n};\n\n/**\n * Configuration for a contacts client.\n * Contacts are stored in a subdirectory of the account's working directory.\n */\nexport type ContactsClientConfig = {\n\t/**\n\t * The account to use for the contacts client.\n\t */\n\taccount: KeetaNetAccount;\n\t/**\n\t * The base path for the contacts client.\n\t */\n\tbasePath: string;\n};\n\n/**\n * Generic response type for storage operations.\n */\nexport type StorageResponse<T> = ({ ok: true } & T) | { ok: false; error: string };\n\nexport type KeetaStorageAnchorPutResponse = StorageResponse<{ object: StorageObjectMetadata }>;\n\nexport function getKeetaStorageAnchorPutRequestSigningData(\n\tinput: { path: string; visibility?: StorageObjectVisibility; tags?: string[] }\n): Signable {\n\tconst visibility = input.visibility ?? 'private';\n\tconst tags: string[] = input.tags ?? [];\n\tconst sortedTags = [...tags].sort();\n\treturn(['put', input.path, visibility, ...sortedTags]);\n}\n\n// #endregion\n\n// #region GET Object\n\n/**\n * Client-side request to get an object\n */\nexport type KeetaStorageAnchorGetClientRequest = {\n\taccount?: KeetaNetAccount;\n\tpath: string;\n};\n\n/**\n * Server-side request to get an object\n */\nexport type KeetaStorageAnchorGetRequest = {\n\taccount?: string;\n\tsigned?: HTTPSignedField;\n\tpath: string;\n};\n\nexport type KeetaStorageAnchorGetResponse = StorageResponse<{\n\tdata: string; // Base64-encoded EncryptedContainer\n\tobject: StorageObjectMetadata;\n}>;\n\nexport function getKeetaStorageAnchorGetRequestSigningData(\n\tinput: KeetaStorageAnchorGetRequest\n): Signable {\n\treturn(['get', input.path]);\n}\n\n// #endregion\n\n// #region DELETE Object\n\n/**\n * Client-side request to delete an object\n */\nexport type KeetaStorageAnchorDeleteClientRequest = {\n\taccount?: KeetaNetAccount;\n\t/**\n\t * Path to the object\n\t */\n\tpath: string;\n};\n\n/**\n * Server-side request to delete an object\n */\nexport type KeetaStorageAnchorDeleteRequest = {\n\taccount?: string;\n\tsigned?: HTTPSignedField;\n\t/**\n\t * Path to the object\n\t */\n\tpath: string;\n};\n\nexport type KeetaStorageAnchorDeleteResponse = StorageResponse<{ deleted: boolean }>;\n\nexport function getKeetaStorageAnchorDeleteRequestSigningData(\n\tinput: KeetaStorageAnchorDeleteRequest\n): Signable {\n\treturn(['delete', input.path]);\n}\n\n// #endregion\n\n// #region SEARCH\n\n/**\n * Client-side request to search objects\n */\nexport type KeetaStorageAnchorSearchClientRequest = {\n\taccount?: KeetaNetAccount;\n\tcriteria: SearchCriteria;\n\tpagination?: SearchPagination;\n};\n\n/**\n * Server-side request to search objects\n */\nexport type KeetaStorageAnchorSearchRequest = {\n\taccount?: string;\n\tsigned?: HTTPSignedField;\n\tcriteria: SearchCriteria;\n\tpagination?: SearchPagination;\n};\n\nexport type KeetaStorageAnchorSearchResponse = StorageResponse<{\n\tresults: StorageObjectMetadata[];\n\tnextCursor?: string;\n}>;\n\nexport function getKeetaStorageAnchorSearchRequestSigningData(\n\tinput: KeetaStorageAnchorSearchRequest\n): Signable {\n\tconst limit = input.pagination?.limit ?? 0;\n\tconst cursor = input.pagination?.cursor ?? '';\n\treturn(['search', JSON.stringify(input.criteria), limit, cursor]);\n}\n\n// #endregion\n\n// #region Quota\n\n/**\n * Client-side request to get quota status\n */\nexport type KeetaStorageAnchorQuotaClientRequest = {\n\taccount?: KeetaNetAccount;\n};\n\n/**\n * Server-side request to get quota status\n */\nexport type KeetaStorageAnchorQuotaRequest = {\n\taccount?: string;\n\tsigned?: HTTPSignedField;\n};\n\nexport type KeetaStorageAnchorQuotaResponse = StorageResponse<{ quota: QuotaStatus }>;\n\n/**\n * Get signing data for quota requests.\n * The input is unused because quota requests don't need request-specific signing -\n * authentication alone is sufficient.\n *\n * The parameter was kept for API consistency with other signing functions.\n */\nexport function getKeetaStorageAnchorQuotaRequestSigningData(\n\t_ignoreInput: KeetaStorageAnchorQuotaRequest\n): Signable {\n\treturn(['quota']);\n}\n\n// #endregion\n\n// #region Error Classes\n\nclass KeetaStorageAnchorDocumentNotFoundError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorDocumentNotFoundError';\n\tprivate readonly KeetaStorageAnchorDocumentNotFoundErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorDocumentNotFoundErrorObjectTypeID = 'ac137e18-2827-4542-a852-c650610899b5';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Document not found');\n\t\tthis.statusCode = 404;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorDocumentNotFoundErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorDocumentNotFoundError.KeetaStorageAnchorDocumentNotFoundErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorDocumentNotFoundError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorDocumentNotFoundErrorObjectTypeID', KeetaStorageAnchorDocumentNotFoundError.KeetaStorageAnchorDocumentNotFoundErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorDocumentNotFoundError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorAccessDeniedError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorAccessDeniedError';\n\tprivate readonly KeetaStorageAnchorAccessDeniedErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorAccessDeniedErrorObjectTypeID = 'fb75fa8c-6ef0-47cb-b767-3c2cfbb73617';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Access denied');\n\t\tthis.statusCode = 403;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorAccessDeniedErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorAccessDeniedError.KeetaStorageAnchorAccessDeniedErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorAccessDeniedError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorAccessDeniedErrorObjectTypeID', KeetaStorageAnchorAccessDeniedError.KeetaStorageAnchorAccessDeniedErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorAccessDeniedError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorInvalidPathError extends KeetaAnchorUserValidationError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorInvalidPathError';\n\tprivate readonly KeetaStorageAnchorInvalidPathErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorInvalidPathErrorObjectTypeID = 'eb0e1c0d-2281-4b93-9f78-87bf166a4829';\n\n\tconstructor(message?: string) {\n\t\tsuper({ fields: [{ path: 'path', message: message ?? 'Invalid path format' }] }, message ?? 'Invalid path format');\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorInvalidPathErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorInvalidPathError.KeetaStorageAnchorInvalidPathErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic override isInstance(input: unknown): input is KeetaStorageAnchorInvalidPathError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorInvalidPathErrorObjectTypeID', KeetaStorageAnchorInvalidPathError.KeetaStorageAnchorInvalidPathErrorObjectTypeID));\n\t}\n\n\tstatic override async fromJSON(input: unknown): Promise<KeetaStorageAnchorInvalidPathError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\ntype QuotaExceededType = 'maxObjectSize' | 'maxObjectsPerUser' | 'maxStoragePerUser';\n\nclass KeetaStorageAnchorQuotaExceededError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorQuotaExceededError';\n\tprivate readonly KeetaStorageAnchorQuotaExceededErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorQuotaExceededErrorObjectTypeID = 'c0b75028-644a-472b-8df4-b0a856814f99';\n\n\t/** Which quota limit was exceeded */\n\treadonly quotaType: QuotaExceededType;\n\n\t/** The configured maximum for the exceeded quota */\n\treadonly limit: number;\n\n\t/** The current or attempted value that exceeded the limit */\n\treadonly current: number;\n\n\tconstructor(options: { quotaType: QuotaExceededType; limit: number; current: number; message?: string }) {\n\t\tsuper(options.message ?? `Quota exceeded: ${options.quotaType} (${options.current} exceeds limit of ${options.limit})`);\n\t\tthis.statusCode = 413;\n\t\tthis.quotaType = options.quotaType;\n\t\tthis.limit = options.limit;\n\t\tthis.current = options.current;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorQuotaExceededErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorQuotaExceededError.KeetaStorageAnchorQuotaExceededErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorQuotaExceededError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorQuotaExceededErrorObjectTypeID', KeetaStorageAnchorQuotaExceededError.KeetaStorageAnchorQuotaExceededErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorQuotaExceededError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this({ quotaType: 'maxObjectSize', limit: 0, current: 0, message });\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorPrincipalRequiredError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorPrincipalRequiredError';\n\tprivate readonly KeetaStorageAnchorPrincipalRequiredErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorPrincipalRequiredErrorObjectTypeID = '12e42092-d4db-435e-8a01-798e26f653b4';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Validated path requires anchor as principal');\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorPrincipalRequiredErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorPrincipalRequiredError.KeetaStorageAnchorPrincipalRequiredErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorPrincipalRequiredError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorPrincipalRequiredErrorObjectTypeID', KeetaStorageAnchorPrincipalRequiredError.KeetaStorageAnchorPrincipalRequiredErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorPrincipalRequiredError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorValidationFailedError extends KeetaAnchorUserValidationError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorValidationFailedError';\n\tprivate readonly KeetaStorageAnchorValidationFailedErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorValidationFailedErrorObjectTypeID = '73cadd95-cf39-466b-b9b6-484e1ae1ca9c';\n\n\tconstructor(message?: string) {\n\t\tconst msg = message ?? 'Content validation failed';\n\t\tsuper({ fields: [{ path: 'content', message: msg }] }, msg);\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorValidationFailedErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorValidationFailedError.KeetaStorageAnchorValidationFailedErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\toverride get statusCode() {\n\t\treturn(422);\n\t}\n\n\tstatic override isInstance(input: unknown): input is KeetaStorageAnchorValidationFailedError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorValidationFailedErrorObjectTypeID', KeetaStorageAnchorValidationFailedError.KeetaStorageAnchorValidationFailedErrorObjectTypeID));\n\t}\n\n\tstatic override async fromJSON(input: unknown): Promise<KeetaStorageAnchorValidationFailedError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorSignatureExpiredError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorSignatureExpiredError';\n\tprivate readonly KeetaStorageAnchorSignatureExpiredErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorSignatureExpiredErrorObjectTypeID = '3a676e44-882b-4925-bf5f-bc5123cc0b20';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Pre-signed URL has expired');\n\t\tthis.statusCode = 401;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorSignatureExpiredErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorSignatureExpiredError.KeetaStorageAnchorSignatureExpiredErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorSignatureExpiredError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorSignatureExpiredErrorObjectTypeID', KeetaStorageAnchorSignatureExpiredError.KeetaStorageAnchorSignatureExpiredErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorSignatureExpiredError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorSignatureInvalidError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorSignatureInvalidError';\n\tprivate readonly KeetaStorageAnchorSignatureInvalidErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorSignatureInvalidErrorObjectTypeID = '91831c73-31e2-4f27-a9d1-4ab9a5ed5663';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Pre-signed URL signature verification failed');\n\t\tthis.statusCode = 401;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorSignatureInvalidErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorSignatureInvalidError.KeetaStorageAnchorSignatureInvalidErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorSignatureInvalidError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorSignatureInvalidErrorObjectTypeID', KeetaStorageAnchorSignatureInvalidError.KeetaStorageAnchorSignatureInvalidErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorSignatureInvalidError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorPrivateKeyRequiredError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorPrivateKeyRequiredError';\n\tprivate readonly KeetaStorageAnchorPrivateKeyRequiredErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorPrivateKeyRequiredErrorObjectTypeID = '36eaae98-1b1e-412b-ba5b-b9293cc37156';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Account with private key required for this operation');\n\t\tthis.statusCode = 401;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorPrivateKeyRequiredErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorPrivateKeyRequiredError.KeetaStorageAnchorPrivateKeyRequiredErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorPrivateKeyRequiredError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorPrivateKeyRequiredErrorObjectTypeID', KeetaStorageAnchorPrivateKeyRequiredError.KeetaStorageAnchorPrivateKeyRequiredErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorPrivateKeyRequiredError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorServiceUnavailableError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorServiceUnavailableError';\n\tprivate readonly KeetaStorageAnchorServiceUnavailableErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorServiceUnavailableErrorObjectTypeID = 'b2671cd1-6abb-4bd4-9be2-d8d111c17bcf';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Storage service not available');\n\t\tthis.statusCode = 503;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorServiceUnavailableErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorServiceUnavailableError.KeetaStorageAnchorServiceUnavailableErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorServiceUnavailableError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorServiceUnavailableErrorObjectTypeID', KeetaStorageAnchorServiceUnavailableError.KeetaStorageAnchorServiceUnavailableErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorServiceUnavailableError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorSignerRequiredError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorSignerRequiredError';\n\tprivate readonly KeetaStorageAnchorSignerRequiredErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorSignerRequiredErrorObjectTypeID = 'ce4a5581-1869-4656-88c6-63f0a29b46ca';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'A Signer or UserClient with an associated Signer is required');\n\t\tthis.statusCode = 401;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorSignerRequiredErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorSignerRequiredError.KeetaStorageAnchorSignerRequiredErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorSignerRequiredError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorSignerRequiredErrorObjectTypeID', KeetaStorageAnchorSignerRequiredError.KeetaStorageAnchorSignerRequiredErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorSignerRequiredError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorAccountRequiredError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorAccountRequiredError';\n\tprivate readonly KeetaStorageAnchorAccountRequiredErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorAccountRequiredErrorObjectTypeID = '496e5dbe-535f-4f24-acf4-a44d9d93fb75';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'An Account or UserClient with an associated Account is required');\n\t\tthis.statusCode = 401;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorAccountRequiredErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorAccountRequiredError.KeetaStorageAnchorAccountRequiredErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorAccountRequiredError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorAccountRequiredErrorObjectTypeID', KeetaStorageAnchorAccountRequiredError.KeetaStorageAnchorAccountRequiredErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorAccountRequiredError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorOperationNotSupportedError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorOperationNotSupportedError';\n\tprivate readonly KeetaStorageAnchorOperationNotSupportedErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorOperationNotSupportedErrorObjectTypeID = 'ac491ea6-f656-4eab-a430-051a0f201fff';\n\n\tconstructor(operation?: string) {\n\t\tsuper(operation ? `Storage service does not support '${operation}' operation` : 'Operation not supported');\n\t\tthis.statusCode = 501;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorOperationNotSupportedErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorOperationNotSupportedError.KeetaStorageAnchorOperationNotSupportedErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorOperationNotSupportedError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorOperationNotSupportedErrorObjectTypeID', KeetaStorageAnchorOperationNotSupportedError.KeetaStorageAnchorOperationNotSupportedErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorOperationNotSupportedError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorUnsupportedAuthMethodError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorUnsupportedAuthMethodError';\n\tprivate readonly KeetaStorageAnchorUnsupportedAuthMethodErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorUnsupportedAuthMethodErrorObjectTypeID = '46cfbab9-934f-44b0-9216-03d397fdd6b6';\n\n\tconstructor(method?: string) {\n\t\tsuper(method ? `Unsupported authentication method: ${method}` : 'Unsupported authentication method');\n\t\tthis.statusCode = 501;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorUnsupportedAuthMethodErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorUnsupportedAuthMethodError.KeetaStorageAnchorUnsupportedAuthMethodErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorUnsupportedAuthMethodError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorUnsupportedAuthMethodErrorObjectTypeID', KeetaStorageAnchorUnsupportedAuthMethodError.KeetaStorageAnchorUnsupportedAuthMethodErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorUnsupportedAuthMethodError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorInvalidResponseError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorInvalidResponseError';\n\tprivate readonly KeetaStorageAnchorInvalidResponseErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorInvalidResponseErrorObjectTypeID = '02480186-7bc3-4a80-b6a9-23c3a9f606c9';\n\n\tconstructor(details?: string) {\n\t\tsuper(details ? `Invalid response from storage service: ${details}` : 'Invalid response from storage service');\n\t\tthis.statusCode = 502;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorInvalidResponseErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorInvalidResponseError.KeetaStorageAnchorInvalidResponseErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorInvalidResponseError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorInvalidResponseErrorObjectTypeID', KeetaStorageAnchorInvalidResponseError.KeetaStorageAnchorInvalidResponseErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorInvalidResponseError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorInvalidAnchorAccountError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorInvalidAnchorAccountError';\n\tprivate readonly KeetaStorageAnchorInvalidAnchorAccountErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorInvalidAnchorAccountErrorObjectTypeID = '82bb0a94-0a5e-4e0a-b5c1-7532bbe09cd6';\n\n\tconstructor(publicKey?: string) {\n\t\tsuper(publicKey ? `Invalid anchor account public key: ${publicKey}` : 'Invalid anchor account public key');\n\t\tthis.statusCode = 502;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorInvalidAnchorAccountErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorInvalidAnchorAccountError.KeetaStorageAnchorInvalidAnchorAccountErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorInvalidAnchorAccountError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorInvalidAnchorAccountErrorObjectTypeID', KeetaStorageAnchorInvalidAnchorAccountError.KeetaStorageAnchorInvalidAnchorAccountErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorInvalidAnchorAccountError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorInvariantViolationError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorInvariantViolationError';\n\tprivate readonly KeetaStorageAnchorInvariantViolationErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorInvariantViolationErrorObjectTypeID = 'a7c5d3e1-8b9f-4c2a-b3d4-e5f6a7b8c9d0';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Internal invariant violation');\n\t\tthis.statusCode = 500;\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorInvariantViolationErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorInvariantViolationError.KeetaStorageAnchorInvariantViolationErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaStorageAnchorInvariantViolationError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorInvariantViolationErrorObjectTypeID', KeetaStorageAnchorInvariantViolationError.KeetaStorageAnchorInvariantViolationErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaStorageAnchorInvariantViolationError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorInvalidTagError extends KeetaAnchorUserValidationError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorInvalidTagError';\n\tprivate readonly KeetaStorageAnchorInvalidTagErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorInvalidTagErrorObjectTypeID = 'b8d6e4f2-9c0a-5d3b-c4e5-f6a7b8c9d0e1';\n\n\tconstructor(message?: string) {\n\t\tsuper({ fields: [{ path: 'tags', message: message ?? 'Invalid tag' }] }, message ?? 'Invalid tag');\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorInvalidTagErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorInvalidTagError.KeetaStorageAnchorInvalidTagErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic override isInstance(input: unknown): input is KeetaStorageAnchorInvalidTagError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorInvalidTagErrorObjectTypeID', KeetaStorageAnchorInvalidTagError.KeetaStorageAnchorInvalidTagErrorObjectTypeID));\n\t}\n\n\tstatic override async fromJSON(input: unknown): Promise<KeetaStorageAnchorInvalidTagError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaStorageAnchorInvalidMetadataError extends KeetaAnchorUserValidationError {\n\tstatic override readonly name: string = 'KeetaStorageAnchorInvalidMetadataError';\n\tprivate readonly KeetaStorageAnchorInvalidMetadataErrorObjectTypeID!: string;\n\tprivate static readonly KeetaStorageAnchorInvalidMetadataErrorObjectTypeID = 'c9e7f5a3-0d1b-6e4c-d5f6-a7b8c9d0e1f2';\n\n\tconstructor(reason?: string) {\n\t\tconst message = reason ? `Invalid metadata: ${reason}` : 'Invalid metadata';\n\t\tsuper({ fields: [{ path: 'metadata', message }] }, message);\n\n\t\tObject.defineProperty(this, 'KeetaStorageAnchorInvalidMetadataErrorObjectTypeID', {\n\t\t\tvalue: KeetaStorageAnchorInvalidMetadataError.KeetaStorageAnchorInvalidMetadataErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic override isInstance(input: unknown): input is KeetaStorageAnchorInvalidMetadataError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaStorageAnchorInvalidMetadataErrorObjectTypeID', KeetaStorageAnchorInvalidMetadataError.KeetaStorageAnchorInvalidMetadataErrorObjectTypeID));\n\t}\n\n\tstatic override async fromJSON(input: unknown): Promise<KeetaStorageAnchorInvalidMetadataError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nexport const Errors: {\n\tDocumentNotFound: typeof KeetaStorageAnchorDocumentNotFoundError;\n\tAccessDenied: typeof KeetaStorageAnchorAccessDeniedError;\n\tInvalidPath: typeof KeetaStorageAnchorInvalidPathError;\n\tQuotaExceeded: typeof KeetaStorageAnchorQuotaExceededError;\n\tAnchorPrincipalRequired: typeof KeetaStorageAnchorPrincipalRequiredError;\n\tValidationFailed: typeof KeetaStorageAnchorValidationFailedError;\n\tSignatureExpired: typeof KeetaStorageAnchorSignatureExpiredError;\n\tSignatureInvalid: typeof KeetaStorageAnchorSignatureInvalidError;\n\tPrivateKeyRequired: typeof KeetaStorageAnchorPrivateKeyRequiredError;\n\tServiceUnavailable: typeof KeetaStorageAnchorServiceUnavailableError;\n\tSignerRequired: typeof KeetaStorageAnchorSignerRequiredError;\n\tAccountRequired: typeof KeetaStorageAnchorAccountRequiredError;\n\tOperationNotSupported: typeof KeetaStorageAnchorOperationNotSupportedError;\n\tUnsupportedAuthMethod: typeof KeetaStorageAnchorUnsupportedAuthMethodError;\n\tInvalidResponse: typeof KeetaStorageAnchorInvalidResponseError;\n\tInvalidAnchorAccount: typeof KeetaStorageAnchorInvalidAnchorAccountError;\n\tInvariantViolation: typeof KeetaStorageAnchorInvariantViolationError;\n\tInvalidTag: typeof KeetaStorageAnchorInvalidTagError;\n\tInvalidMetadata: typeof KeetaStorageAnchorInvalidMetadataError;\n} = {\n\t/**\n\t * The requested document/object was not found\n\t */\n\tDocumentNotFound: KeetaStorageAnchorDocumentNotFoundError,\n\n\t/**\n\t * Access to the document/object was denied\n\t */\n\tAccessDenied: KeetaStorageAnchorAccessDeniedError,\n\n\t/**\n\t * Path doesn't match /user/<pubkey>/... format\n\t */\n\tInvalidPath: KeetaStorageAnchorInvalidPathError,\n\n\t/**\n\t * Object size, count, or total storage limit exceeded\n\t */\n\tQuotaExceeded: KeetaStorageAnchorQuotaExceededError,\n\n\t/**\n\t * Validated path requires anchor as principal\n\t */\n\tAnchorPrincipalRequired: KeetaStorageAnchorPrincipalRequiredError,\n\n\t/**\n\t * Namespace validator rejected content\n\t */\n\tValidationFailed: KeetaStorageAnchorValidationFailedError,\n\n\t/**\n\t * Pre-signed URL has expired\n\t */\n\tSignatureExpired: KeetaStorageAnchorSignatureExpiredError,\n\n\t/**\n\t * Pre-signed URL signature verification failed\n\t */\n\tSignatureInvalid: KeetaStorageAnchorSignatureInvalidError,\n\n\t/**\n\t * Account with private key required for this operation\n\t */\n\tPrivateKeyRequired: KeetaStorageAnchorPrivateKeyRequiredError,\n\n\t/**\n\t * Storage service is not available\n\t */\n\tServiceUnavailable: KeetaStorageAnchorServiceUnavailableError,\n\n\t/**\n\t * A Signer or UserClient with an associated Signer is required\n\t */\n\tSignerRequired: KeetaStorageAnchorSignerRequiredError,\n\n\t/**\n\t * An Account or UserClient with an associated Account is required\n\t */\n\tAccountRequired: KeetaStorageAnchorAccountRequiredError,\n\n\t/**\n\t * The requested operation is not supported by this storage service\n\t */\n\tOperationNotSupported: KeetaStorageAnchorOperationNotSupportedError,\n\n\t/**\n\t * The authentication method is not supported\n\t */\n\tUnsupportedAuthMethod: KeetaStorageAnchorUnsupportedAuthMethodError,\n\n\t/**\n\t * Invalid response received from storage service\n\t */\n\tInvalidResponse: KeetaStorageAnchorInvalidResponseError,\n\n\t/**\n\t * Anchor account public key from service metadata is invalid\n\t */\n\tInvalidAnchorAccount: KeetaStorageAnchorInvalidAnchorAccountError,\n\n\t/**\n\t * Internal invariant violation - indicates a bug in the code\n\t */\n\tInvariantViolation: KeetaStorageAnchorInvariantViolationError,\n\n\t/**\n\t * Tag validation failed (invalid format, too long, or too many tags)\n\t */\n\tInvalidTag: KeetaStorageAnchorInvalidTagError,\n\n\t/**\n\t * Metadata validation failed against path policy constraints\n\t */\n\tInvalidMetadata: KeetaStorageAnchorInvalidMetadataError\n};\n\n// #endregion\n\n// #region Storage Backend Interface\n\n/**\n * Metadata input for put operations.\n * Provided by the client when storing an object.\n */\nexport type StoragePutMetadata = {\n\t/** Owner's identifier */\n\towner: string;\n\t/** Tags for categorization and search */\n\ttags: string[];\n\t/** Access visibility setting */\n\tvisibility: StorageObjectVisibility;\n};\n\n/**\n * Result of a get operation.\n * Contains both the raw encrypted data and the object metadata.\n */\nexport type StorageGetResult = {\n\t/** Raw encrypted data (EncryptedContainer) */\n\tdata: Buffer;\n\t/** Object metadata */\n\tmetadata: StorageObjectMetadata;\n};\n\n/**\n * Represents a pending upload quota reservation.\n * Used to reserve quota before an upload and track in-flight uploads.\n */\nexport interface UploadReservation {\n\t/** Unique identifier for this reservation */\n\tid: string;\n\t/** Owner's identifier */\n\towner: string;\n\t/** Target path for the upload */\n\tpath: string;\n\t/** Reserved size in bytes */\n\tsize: number;\n\t/** When the reservation was created */\n\tcreatedAt: string;\n\t/** When the reservation expires - hint for stale cleanup */\n\texpiresAt: string;\n}\n\n/**\n * Core CRUD operations for storage.\n * All backends must implement these operations.\n */\nexport interface StorageBackend {\n\t/**\n\t * Store/update an object at the given path\n\t */\n\tput(path: string, data: Buffer, metadata: StoragePutMetadata): Promise<StorageObjectMetadata>;\n\n\t/**\n\t * Retrieve an object by path\n\t */\n\tget(path: string): Promise<StorageGetResult | null>;\n\n\t/**\n\t * Delete an object by path\n\t */\n\tdelete(path: string): Promise<boolean>;\n}\n\n/**\n * Search capability interface.\n * Optional for backends that don't support indexing (e.g., simple S3-only backends).\n */\nexport interface SearchableStorage {\n\t/**\n\t * Search for objects matching criteria\n\t */\n\tsearch(criteria: SearchCriteria, pagination: SearchPagination): Promise<SearchResults>;\n}\n\n/**\n * Quota management with upload reservations.\n * Handles quota tracking and reservation-based upload flow.\n */\nexport interface QuotaManagedStorage {\n\t/**\n\t * Get quota status for a user.\n\t * Includes both actual usage and pending reservations.\n\t */\n\tgetQuotaStatus(owner: string): Promise<QuotaStatus>;\n\n\t/**\n\t * Get per-user quota limits.\n\t * Return null to use global defaults.\n\t * @param owner - Owner's identifier\n\t */\n\tgetQuotaLimits?(owner: string): Promise<QuotaLimits | null>;\n\n\t/**\n\t * Reserve quota for an upcoming upload.\n\t *\n\t * @param owner - Owner's identifier\n\t * @param path - Target path for the upload\n\t * @param size - Size in bytes to reserve\n\t * @param options.ttlMs - Optional TTL in milliseconds for the reservation\n\t * @param options.quotaLimits - Optional quota limits to enforce (overrides backend defaults)\n\t *\n\t * @returns Reservation that must be committed or released\n\t *\n\t * @throws QuotaExceeded if reservation would exceed limits\n\t */\n\treserveUpload(owner: string, path: string, size: number, options?: {\n\t\tttlMs?: number;\n\t\tquotaLimits?: Pick<QuotaConfig, 'maxObjectsPerUser' | 'maxStoragePerUser'>;\n\t}): Promise<UploadReservation>;\n\n\t/**\n\t * Commit a reservation after successful upload.\n\t * Call after put() succeeds to finalize the quota usage.\n\t * @param reservationId - ID of the reservation to commit\n\t */\n\tcommitUpload(reservationId: string): Promise<void>;\n\n\t/**\n\t * Release a reservation (upload failed or cancelled).\n\t * Frees the reserved quota.\n\t * @param reservationId - ID of the reservation to release\n\t */\n\treleaseUpload(reservationId: string): Promise<void>;\n}\n\n/**\n * Full storage backend combining all capabilities.\n * Use this type when a backend supports CRUD, search, and quota management.\n */\nexport type FullStorageBackend = StorageBackend & SearchableStorage & QuotaManagedStorage;\n\n// #endregion\n\n// #region Path Policy\n\n/**\n * Generic interface for path policies.\n * Each implementation defines its own parsed type and access control logic.\n * Storage Anchors are free to implement whatever pathname structure they wish.\n */\nexport interface PathPolicy<TPathInfo> {\n\t/**\n\t * Parse a path into its components.\n\t * @returns TPathInfo if valid, null otherwise\n\t */\n\tparse(path: string): TPathInfo | null;\n\n\t/**\n\t * Validate a path and return its components.\n\t * @throws Errors.InvalidPath if the path is invalid\n\t */\n\tvalidate(path: string): TPathInfo;\n\n\t/**\n\t * Check if a path is valid.\n\t */\n\tisValid(path: string): boolean;\n\n\t/**\n\t * Check if the account has access to perform the operation on the parsed path.\n\t * @returns true if access is allowed, false otherwise\n\t */\n\tcheckAccess(account: KeetaNetAccount, parsed: TPathInfo, operation: 'get' | 'put' | 'delete' | 'search' | 'metadata'): boolean;\n\n\t/**\n\t * Get the account authorized to sign pre-signed URLs for this path.\n\t * Used for public object access verification.\n\t *\n\t * @returns The account if only that account can sign (owner-restricted), or `null` if any account can sign\n\t */\n\tgetAuthorizedSigner(parsed: TPathInfo): KeetaNetAccount | null;\n\n\t/**\n\t * Validate metadata for a path.\n\t * Called during PUT and metadata update operations.\n\t * @param parsed - The parsed path info\n\t * @param metadata - The metadata to validate\n\t * @throws Errors.InvalidMetadata if metadata violates path constraints\n\t */\n\tvalidateMetadata?(parsed: TPathInfo, metadata: StoragePutMetadata): void;\n}\n\n// #endregion\n\n// #region Container Payload Utilities\n\n/**\n * Parse the decrypted plaintext from an EncryptedContainer.\n * The payload is expected to be JSON with mimeType and base64-encoded data,\n * keeping the mimeType encrypted along with the content.\n *\n * @param plaintext - The decrypted plaintext from an EncryptedContainer\n *\n * @returns Object containing mimeType and content Buffer\n */\nexport function parseContainerPayload(plaintext: ArrayBuffer): { mimeType: string; content: Buffer } {\n\tconst payloadStr = Buffer.from(plaintext).toString('utf-8');\n\ttry {\n\t\tconst payload: unknown = JSON.parse(payloadStr);\n\t\tlet mimeType = CONTENT_TYPE_OCTET_STREAM;\n\t\tlet content: Buffer;\n\t\tif (typeof payload === 'object' && payload !== null && !Array.isArray(payload)) {\n\t\t\tconst payloadMime = 'mimeType' in payload ? payload.mimeType : undefined;\n\t\t\tconst payloadData = 'data' in payload ? payload.data : undefined;\n\t\t\tif (typeof payloadMime === 'string') {\n\t\t\t\tmimeType = payloadMime;\n\t\t\t}\n\t\t\tif (typeof payloadData === 'string') {\n\t\t\t\tcontent = arrayBufferLikeToBuffer(Buffer.from(payloadData, 'base64'));\n\t\t\t} else {\n\t\t\t\tcontent = arrayBufferLikeToBuffer(plaintext);\n\t\t\t}\n\t\t} else {\n\t\t\tcontent = arrayBufferLikeToBuffer(plaintext);\n\t\t}\n\t\treturn({ mimeType, content });\n\t} catch {\n\t\treturn({\n\t\t\tmimeType: CONTENT_TYPE_OCTET_STREAM,\n\t\t\tcontent: arrayBufferLikeToBuffer(plaintext)\n\t\t});\n\t}\n}\n\n// #endregion\n"]}
@@ -0,0 +1,64 @@
1
+ import type { Buffer } from '../../../lib/utils/buffer.js';
2
+ /**
3
+ * Result of a validation operation
4
+ */
5
+ export type ValidationResult = {
6
+ valid: true;
7
+ } | {
8
+ valid: false;
9
+ error: string;
10
+ };
11
+ /**
12
+ * Interface for namespace validators that validate content at specific paths
13
+ */
14
+ export interface NamespaceValidator {
15
+ /**
16
+ * Path pattern this validator applies to.
17
+ * Can be a glob pattern string or a RegExp.
18
+ *
19
+ * @example
20
+ * pathPattern: "/user/*" // Glob: matches paths under /user/
21
+ * @example
22
+ * pathPattern: /^\/user\/[^/]+\/icon$/ // RegExp: matches user icons
23
+ */
24
+ pathPattern: string | RegExp;
25
+ /**
26
+ * Validate decrypted content before storage.
27
+ * Called only when anchor can decrypt (i.e., anchor is a principal).
28
+ *
29
+ * @param path - The full storage path
30
+ * @param content - The decrypted content
31
+ * @param mimeType - The mime-type from inside the EncryptedContainer
32
+ * @returns ValidationResult indicating if the content is valid
33
+ */
34
+ validate(path: string, content: Buffer, mimeType: string): Promise<ValidationResult>;
35
+ }
36
+ /**
37
+ * Checks if a path matches a validator's pattern
38
+ */
39
+ export declare function matchesPattern(path: string, pattern: string | RegExp): boolean;
40
+ /**
41
+ * Finds all validators that match a given path
42
+ */
43
+ export declare function findMatchingValidators(path: string, validators: NamespaceValidator[]): NamespaceValidator[];
44
+ /**
45
+ * Checks if a path requires validation (matches any validator pattern)
46
+ */
47
+ export declare function requiresValidation(path: string, validators: NamespaceValidator[]): boolean;
48
+ /**
49
+ * Abstract base class for content validators.
50
+ * Provides common validation logic for mime type and size checking.
51
+ * Subclasses should override validateContent for custom validation.
52
+ */
53
+ export declare abstract class ContentValidator implements NamespaceValidator {
54
+ abstract readonly pathPattern: string | RegExp;
55
+ abstract readonly maxSize: number;
56
+ abstract readonly allowedMimeTypes: readonly string[];
57
+ validate(path: string, content: Buffer, mimeType: string): Promise<ValidationResult>;
58
+ /**
59
+ * Override to add custom content validation beyond mime type and size checks.
60
+ * Default implementation accepts all content that passes basic checks.
61
+ */
62
+ protected validateContent(_ignorePath: string, _ignoreContent: Buffer, _ignoreMimeType: string): Promise<ValidationResult>;
63
+ }
64
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../../src/services/storage/lib/validators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;;;;OAQG;IACH,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAE7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrF;AA2BD;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAS9E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,EAAE,CAI3G;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAI1F;AAED;;;;GAIG;AACH,8BAAsB,gBAAiB,YAAW,kBAAkB;IACnE,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/C,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAEhD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqB1F;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG1H"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Cache for compiled glob patterns to avoid recompiling on every match
3
+ */
4
+ const globPatternCache = new Map();
5
+ /**
6
+ * Convert a glob pattern to a RegExp
7
+ */
8
+ function compileGlobPattern(pattern) {
9
+ const cached = globPatternCache.get(pattern);
10
+ if (cached) {
11
+ return (cached);
12
+ }
13
+ // Convert glob pattern to regex
14
+ // Replace * with regex pattern for "anything except /"
15
+ const regexPattern = pattern
16
+ .replace(/[.+?^${}()|[\]\\]/g, '\\$&') // Escape special regex chars except *
17
+ .replace(/\*/g, '[^/]+'); // Replace * with "one or more non-slash chars"
18
+ const regex = new RegExp(`^${regexPattern}$`);
19
+ globPatternCache.set(pattern, regex);
20
+ return (regex);
21
+ }
22
+ /**
23
+ * Checks if a path matches a validator's pattern
24
+ */
25
+ export function matchesPattern(path, pattern) {
26
+ if (pattern instanceof RegExp) {
27
+ // Reset lastIndex to handle RegExps with global/sticky flags
28
+ pattern.lastIndex = 0;
29
+ return (pattern.test(path));
30
+ }
31
+ const regex = compileGlobPattern(pattern);
32
+ return (regex.test(path));
33
+ }
34
+ /**
35
+ * Finds all validators that match a given path
36
+ */
37
+ export function findMatchingValidators(path, validators) {
38
+ return (validators.filter(function (validator) {
39
+ return (matchesPattern(path, validator.pathPattern));
40
+ }));
41
+ }
42
+ /**
43
+ * Checks if a path requires validation (matches any validator pattern)
44
+ */
45
+ export function requiresValidation(path, validators) {
46
+ return (validators.some(function (validator) {
47
+ return (matchesPattern(path, validator.pathPattern));
48
+ }));
49
+ }
50
+ /**
51
+ * Abstract base class for content validators.
52
+ * Provides common validation logic for mime type and size checking.
53
+ * Subclasses should override validateContent for custom validation.
54
+ */
55
+ export class ContentValidator {
56
+ async validate(path, content, mimeType) {
57
+ // Check mime type
58
+ if (!this.allowedMimeTypes.includes(mimeType.toLowerCase())) {
59
+ return ({
60
+ valid: false,
61
+ error: `Invalid mime type: ${mimeType}. Allowed: ${this.allowedMimeTypes.join(', ')}`
62
+ });
63
+ }
64
+ // Check size
65
+ if (content.length > this.maxSize) {
66
+ return ({
67
+ valid: false,
68
+ error: `Content too large: ${content.length} bytes. Maximum: ${this.maxSize} bytes`
69
+ });
70
+ }
71
+ // Call subclass-specific validation
72
+ return (await this.validateContent(path, content, mimeType));
73
+ }
74
+ /**
75
+ * Override to add custom content validation beyond mime type and size checks.
76
+ * Default implementation accepts all content that passes basic checks.
77
+ */
78
+ validateContent(_ignorePath, _ignoreContent, _ignoreMimeType) {
79
+ return (Promise.resolve({ valid: true }));
80
+ }
81
+ }
82
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../src/services/storage/lib/validators.ts"],"names":[],"mappings":"AAkCA;;GAEG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEnD;;GAEG;AACH,SAAS,kBAAkB,CAAC,OAAe;IAC1C,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,MAAM,EAAE,CAAC;QACZ,OAAM,CAAC,MAAM,CAAC,CAAC;IAChB,CA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;AACH,MAAM,OAAgB,gBAAgB;IAKrC,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,OAAe,EAAE,QAAgB;QAC7D,kBAAkB;QAClB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAC7D,OAAM,CAAC;gBACN,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,sBAAsB,QAAQ,cAAc,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aACrF,CAAC,CAAC;QACJ,CAAC;QAED,aAAa;QACb,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;YACnC,OAAM,CAAC;gBACN,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,sBAAsB,OAAO,CAAC,MAAM,oBAAoB,IAAI,CAAC,OAAO,QAAQ;aACnF,CAAC,CAAC;QACJ,CAAC;QAED,oCAAoC;QACpC,OAAM,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACO,eAAe,CAAC,WAAmB,EAAE,cAAsB,EAAE,eAAuB;QAC7F,OAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;CACD","sourcesContent":["import type { Buffer } from '../../../lib/utils/buffer.js';\n\n/**\n * Result of a validation operation\n */\nexport type ValidationResult = { valid: true } | { valid: false; error: string };\n\n/**\n * Interface for namespace validators that validate content at specific paths\n */\nexport interface NamespaceValidator {\n\t/**\n\t * Path pattern this validator applies to.\n\t * Can be a glob pattern string or a RegExp.\n\t *\n\t * @example\n\t * pathPattern: \"/user/*\" // Glob: matches paths under /user/\n\t * @example\n\t * pathPattern: /^\\/user\\/[^/]+\\/icon$/ // RegExp: matches user icons\n\t */\n\tpathPattern: string | RegExp;\n\n\t/**\n\t * Validate decrypted content before storage.\n\t * Called only when anchor can decrypt (i.e., anchor is a principal).\n\t *\n\t * @param path - The full storage path\n\t * @param content - The decrypted content\n\t * @param mimeType - The mime-type from inside the EncryptedContainer\n\t * @returns ValidationResult indicating if the content is valid\n\t */\n\tvalidate(path: string, content: Buffer, mimeType: string): Promise<ValidationResult>;\n}\n\n/**\n * Cache for compiled glob patterns to avoid recompiling on every match\n */\nconst globPatternCache = new Map<string, RegExp>();\n\n/**\n * Convert a glob pattern to a RegExp\n */\nfunction compileGlobPattern(pattern: string): RegExp {\n\tconst cached = globPatternCache.get(pattern);\n\tif (cached) {\n\t\treturn(cached);\n\t}\n\n\t// Convert glob pattern to regex\n\t// Replace * with regex pattern for \"anything except /\"\n\tconst regexPattern = pattern\n\t\t.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&') // Escape special regex chars except *\n\t\t.replace(/\\*/g, '[^/]+'); // Replace * with \"one or more non-slash chars\"\n\n\tconst regex = new RegExp(`^${regexPattern}$`);\n\tglobPatternCache.set(pattern, regex);\n\treturn(regex);\n}\n\n/**\n * Checks if a path matches a validator's pattern\n */\nexport function matchesPattern(path: string, pattern: string | RegExp): boolean {\n\tif (pattern instanceof RegExp) {\n\t\t// Reset lastIndex to handle RegExps with global/sticky flags\n\t\tpattern.lastIndex = 0;\n\t\treturn(pattern.test(path));\n\t}\n\n\tconst regex = compileGlobPattern(pattern);\n\treturn(regex.test(path));\n}\n\n/**\n * Finds all validators that match a given path\n */\nexport function findMatchingValidators(path: string, validators: NamespaceValidator[]): NamespaceValidator[] {\n\treturn(validators.filter(function(validator) {\n\t\treturn(matchesPattern(path, validator.pathPattern));\n\t}));\n}\n\n/**\n * Checks if a path requires validation (matches any validator pattern)\n */\nexport function requiresValidation(path: string, validators: NamespaceValidator[]): boolean {\n\treturn(validators.some(function(validator) {\n\t\treturn(matchesPattern(path, validator.pathPattern));\n\t}));\n}\n\n/**\n * Abstract base class for content validators.\n * Provides common validation logic for mime type and size checking.\n * Subclasses should override validateContent for custom validation.\n */\nexport abstract class ContentValidator implements NamespaceValidator {\n\tabstract readonly pathPattern: string | RegExp;\n\tabstract readonly maxSize: number;\n\tabstract readonly allowedMimeTypes: readonly string[];\n\n\tasync validate(path: string, content: Buffer, mimeType: string): Promise<ValidationResult> {\n\t\t// Check mime type\n\t\tif (!this.allowedMimeTypes.includes(mimeType.toLowerCase())) {\n\t\t\treturn({\n\t\t\t\tvalid: false,\n\t\t\t\terror: `Invalid mime type: ${mimeType}. Allowed: ${this.allowedMimeTypes.join(', ')}`\n\t\t\t});\n\t\t}\n\n\t\t// Check size\n\t\tif (content.length > this.maxSize) {\n\t\t\treturn({\n\t\t\t\tvalid: false,\n\t\t\t\terror: `Content too large: ${content.length} bytes. Maximum: ${this.maxSize} bytes`\n\t\t\t});\n\t\t}\n\n\t\t// Call subclass-specific validation\n\t\treturn(await this.validateContent(path, content, mimeType));\n\t}\n\n\t/**\n\t * Override to add custom content validation beyond mime type and size checks.\n\t * Default implementation accepts all content that passes basic checks.\n\t */\n\tprotected validateContent(_ignorePath: string, _ignoreContent: Buffer, _ignoreMimeType: string): Promise<ValidationResult> {\n\t\treturn(Promise.resolve({ valid: true }));\n\t}\n}\n"]}
@@ -0,0 +1,127 @@
1
+ import type { ServiceMetadata } from '../../lib/resolver.ts';
2
+ import type { NamespaceValidator } from './lib/validators.js';
3
+ import * as KeetaAnchorHTTPServer from '../../lib/http-server/index.js';
4
+ import { KeetaNet } from '../../client/index.js';
5
+ import type { FullStorageBackend, QuotaConfig, PathPolicy } from './common.ts';
6
+ type Account = InstanceType<typeof KeetaNet.lib.Account>;
7
+ /**
8
+ * Configuration for the Storage Anchor
9
+ *
10
+ * The Storage Anchor provides encrypted object storage with the following operations:
11
+ *
12
+ * PUT (Create/Update):
13
+ * 1. Client creates EncryptedContainer with data, shares with anchor for public objects
14
+ * 2. Client signs request (path, visibility, tags) and sends to server
15
+ * 3. Server reserves quota, validates, stores object, commits reservation
16
+ *
17
+ * GET (Retrieve):
18
+ * 1. Client signs request (path) and sends to server
19
+ * 2. Server verifies access, returns EncryptedContainer
20
+ * 3. Client decrypts with their private key
21
+ *
22
+ * DELETE:
23
+ * 1. Client signs request (path) and sends to server
24
+ * 2. Server verifies ownership, removes object
25
+ *
26
+ * SEARCH:
27
+ * 1. Client signs request with criteria (tags, prefix, etc.)
28
+ * 2. Server returns matching metadata (scoped to user's namespace)
29
+ *
30
+ * PUBLIC ACCESS (Pre-signed URLs):
31
+ * 1. Client generates pre-signed URL with expiry, signed by owner
32
+ * 2. Anyone can fetch via URL (no auth headers)
33
+ * 3. Server verifies signature, expiry, and visibility
34
+ * 4. Server decrypts and returns plaintext content
35
+ *
36
+ *
37
+ * +-------------------+ +---------------------+ +------------------+
38
+ * | Client | | Storage Anchor | | Storage Backend |
39
+ * +-------------------+ +---------------------+ +------------------+
40
+ * | | |
41
+ * (PUT) Create EncryptedContainer | |
42
+ * | Sign(path, visibility, tags) | |
43
+ * |---------------------------------->| |
44
+ * | | reserveUpload() ---------------->|
45
+ * | | validate, put() ---------------->|
46
+ * | | commitUpload() ----------------->|
47
+ * |<--------------------------------- | { ok: true, object: metadata } |
48
+ * | | |
49
+ * (GET) Sign(path) ------------------------>| |
50
+ * | | get() -------------------------->|
51
+ * |<--------------------------------- | EncryptedContainer (binary) |
52
+ * | Decrypt with private key | |
53
+ * | | |
54
+ * (PUBLIC) Generate pre-signed URL | |
55
+ * | URL with expires, signature | |
56
+ * (Anyone) Fetch URL ---------------------->| |
57
+ * | | verify signature, expiry |
58
+ * | | get(), decrypt ----------------->|
59
+ * |<--------------------------------- | Plaintext content |
60
+ */
61
+ export interface KeetaAnchorStorageServerConfig extends KeetaAnchorHTTPServer.KeetaAnchorHTTPServerConfig {
62
+ /**
63
+ * The data to use for the index page (optional)
64
+ */
65
+ homepage?: string | (() => Promise<string> | string);
66
+ /**
67
+ * The storage backend to use for storing documents.
68
+ * Must implement full capabilities: CRUD, search, and quota management.
69
+ */
70
+ backend: FullStorageBackend;
71
+ /**
72
+ * The anchor's account for decrypting objects.
73
+ */
74
+ anchorAccount: Account;
75
+ /**
76
+ * Quota configuration for storage limits.
77
+ * Partial values are merged with defaults.
78
+ */
79
+ quotas?: Partial<QuotaConfig>;
80
+ /**
81
+ * Namespace validators for special paths
82
+ */
83
+ validators?: NamespaceValidator[];
84
+ /**
85
+ * Default TTL in seconds for pre-signed URLs (default: 3600)
86
+ */
87
+ signedUrlDefaultTTL?: number;
88
+ /**
89
+ * CORS origin for public endpoints (default: false).
90
+ * - '*' allows all origins
91
+ * - specific origin string restricts to that origin
92
+ * - false (default) disables CORS headers on public responses
93
+ */
94
+ publicCorsOrigin?: string | false;
95
+ /**
96
+ * Path policies for parsing, validating, and access control of storage paths.
97
+ * Each policy handles a specific path pattern. First matching policy wins.
98
+ */
99
+ pathPolicies: PathPolicy<unknown>[];
100
+ /**
101
+ * Tag validation configuration.
102
+ */
103
+ tagValidation?: {
104
+ /** Maximum number of tags per object (default: 10) */
105
+ maxTags?: number;
106
+ /** Maximum length of each tag (default: 50) */
107
+ maxTagLength?: number;
108
+ /** Pattern for valid tag characters (default: /^[a-zA-Z0-9_-]+$/) */
109
+ pattern?: RegExp;
110
+ };
111
+ }
112
+ export declare class KeetaNetStorageAnchorHTTPServer extends KeetaAnchorHTTPServer.KeetaNetAnchorHTTPServer<KeetaAnchorStorageServerConfig> {
113
+ readonly homepage: NonNullable<KeetaAnchorStorageServerConfig['homepage']>;
114
+ readonly backend: FullStorageBackend;
115
+ readonly anchorAccount: Account;
116
+ readonly quotas: QuotaConfig;
117
+ readonly validators: NamespaceValidator[];
118
+ readonly signedUrlDefaultTTL: number;
119
+ readonly publicCorsOrigin: string | false;
120
+ readonly pathPolicies: PathPolicy<unknown>[];
121
+ readonly tagValidation: Required<NonNullable<KeetaAnchorStorageServerConfig['tagValidation']>>;
122
+ constructor(config: KeetaAnchorStorageServerConfig);
123
+ protected initRoutes(_ignoreConfig: KeetaAnchorStorageServerConfig): Promise<KeetaAnchorHTTPServer.Routes>;
124
+ serviceMetadata(): Promise<NonNullable<ServiceMetadata['services']['storage']>[string]>;
125
+ }
126
+ export {};
127
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/services/storage/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,qBAAqB,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,OAAO,KAAK,EAKX,kBAAkB,EAClB,WAAW,EAGX,UAAU,EAIV,MAAM,aAAa,CAAC;AA2BrB,KAAK,OAAO,GAAG,YAAY,CAAC,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AA+MzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,WAAW,8BAA+B,SAAQ,qBAAqB,CAAC,2BAA2B;IACxG;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;IAErD;;;OAGG;IACH,OAAO,EAAE,kBAAkB,CAAC;IAE5B;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAE9B;;OAEG;IACH,UAAU,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAElC;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAElC;;;OAGG;IACH,YAAY,EA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