@fgv/ts-web-extras 5.1.0-19 → 5.1.0-20

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 (393) hide show
  1. package/package.json +10 -10
  2. package/.rush/temp/42a7a953924ae898114e7b6231a2408228d92433.tar.log +0 -243
  3. package/.rush/temp/chunked-rush-logs/ts-web-extras.build.chunks.jsonl +0 -57
  4. package/.rush/temp/operation/build/all.log +0 -57
  5. package/.rush/temp/operation/build/log-chunks.jsonl +0 -57
  6. package/.rush/temp/operation/build/state.json +0 -3
  7. package/.rush/temp/shrinkwrap-deps.json +0 -692
  8. package/CHANGELOG.md +0 -23
  9. package/config/api-extractor.json +0 -343
  10. package/config/jest.config.json +0 -19
  11. package/config/rig.json +0 -16
  12. package/config/typedoc.json +0 -7
  13. package/dist/test/mocks/idb-keyval.js +0 -6
  14. package/dist/test/mocks/idb-keyval.js.map +0 -1
  15. package/dist/test/setupTests.js +0 -74
  16. package/dist/test/setupTests.js.map +0 -1
  17. package/dist/test/unit/browserCryptoProvider.wrapBytes.test.js +0 -221
  18. package/dist/test/unit/browserCryptoProvider.wrapBytes.test.js.map +0 -1
  19. package/dist/test/unit/browserHashProvider.test.js +0 -140
  20. package/dist/test/unit/browserHashProvider.test.js.map +0 -1
  21. package/dist/test/unit/directoryHandleStore.test.js +0 -190
  22. package/dist/test/unit/directoryHandleStore.test.js.map +0 -1
  23. package/dist/test/unit/fileApiTreeAccessors.test.js +0 -1188
  24. package/dist/test/unit/fileApiTreeAccessors.test.js.map +0 -1
  25. package/dist/test/unit/fileApiTypes.test.js +0 -472
  26. package/dist/test/unit/fileApiTypes.test.js.map +0 -1
  27. package/dist/test/unit/fileSystemAccessTreeAccessors.test.js +0 -622
  28. package/dist/test/unit/fileSystemAccessTreeAccessors.test.js.map +0 -1
  29. package/dist/test/unit/fileTreeHelpers.test.js +0 -590
  30. package/dist/test/unit/fileTreeHelpers.test.js.map +0 -1
  31. package/dist/test/unit/httpTreeAccessors.test.js +0 -1364
  32. package/dist/test/unit/httpTreeAccessors.test.js.map +0 -1
  33. package/dist/test/unit/localStorageTreeAccessors.test.js +0 -812
  34. package/dist/test/unit/localStorageTreeAccessors.test.js.map +0 -1
  35. package/dist/test/unit/urlParams.test.js +0 -393
  36. package/dist/test/unit/urlParams.test.js.map +0 -1
  37. package/dist/test/utils/fileSystemAccessMocks.js +0 -271
  38. package/dist/test/utils/fileSystemAccessMocks.js.map +0 -1
  39. package/dist/test/utils/testHelpers.js +0 -124
  40. package/dist/test/utils/testHelpers.js.map +0 -1
  41. package/docs/CryptoUtils/README.md +0 -60
  42. package/docs/CryptoUtils/classes/BrowserCryptoProvider.decrypt.md +0 -27
  43. package/docs/CryptoUtils/classes/BrowserCryptoProvider.deriveKey.md +0 -26
  44. package/docs/CryptoUtils/classes/BrowserCryptoProvider.encrypt.md +0 -25
  45. package/docs/CryptoUtils/classes/BrowserCryptoProvider.exportPublicKeyJwk.md +0 -24
  46. package/docs/CryptoUtils/classes/BrowserCryptoProvider.fromBase64.md +0 -24
  47. package/docs/CryptoUtils/classes/BrowserCryptoProvider.generateKey.md +0 -17
  48. package/docs/CryptoUtils/classes/BrowserCryptoProvider.generateKeyPair.md +0 -25
  49. package/docs/CryptoUtils/classes/BrowserCryptoProvider.generateRandomBytes.md +0 -24
  50. package/docs/CryptoUtils/classes/BrowserCryptoProvider.importPublicKeyJwk.md +0 -25
  51. package/docs/CryptoUtils/classes/BrowserCryptoProvider.md +0 -231
  52. package/docs/CryptoUtils/classes/BrowserCryptoProvider.sha256.md +0 -24
  53. package/docs/CryptoUtils/classes/BrowserCryptoProvider.toBase64.md +0 -24
  54. package/docs/CryptoUtils/classes/BrowserCryptoProvider.unwrapBytes.md +0 -27
  55. package/docs/CryptoUtils/classes/BrowserCryptoProvider.wrapBytes.md +0 -28
  56. package/docs/CryptoUtils/classes/BrowserHashProvider.hashParts.md +0 -26
  57. package/docs/CryptoUtils/classes/BrowserHashProvider.hashString.md +0 -25
  58. package/docs/CryptoUtils/classes/BrowserHashProvider.md +0 -81
  59. package/docs/CryptoUtils/functions/createBrowserCryptoProvider.md +0 -12
  60. package/docs/FileTreeHelpers/README.md +0 -85
  61. package/docs/FileTreeHelpers/functions/extractFileListMetadata.md +0 -11
  62. package/docs/FileTreeHelpers/functions/extractFileMetadata.md +0 -11
  63. package/docs/FileTreeHelpers/functions/fromDirectoryUpload.md +0 -12
  64. package/docs/FileTreeHelpers/functions/fromFileList.md +0 -12
  65. package/docs/FileTreeHelpers/functions/getOriginalFile.md +0 -11
  66. package/docs/FileTreeHelpers/variables/defaultFileApiTreeInitParams.md +0 -9
  67. package/docs/README.md +0 -524
  68. package/docs/classes/BrowserCryptoProvider.decrypt.md +0 -27
  69. package/docs/classes/BrowserCryptoProvider.deriveKey.md +0 -26
  70. package/docs/classes/BrowserCryptoProvider.encrypt.md +0 -25
  71. package/docs/classes/BrowserCryptoProvider.exportPublicKeyJwk.md +0 -24
  72. package/docs/classes/BrowserCryptoProvider.fromBase64.md +0 -24
  73. package/docs/classes/BrowserCryptoProvider.generateKey.md +0 -17
  74. package/docs/classes/BrowserCryptoProvider.generateKeyPair.md +0 -25
  75. package/docs/classes/BrowserCryptoProvider.generateRandomBytes.md +0 -24
  76. package/docs/classes/BrowserCryptoProvider.importPublicKeyJwk.md +0 -25
  77. package/docs/classes/BrowserCryptoProvider.md +0 -231
  78. package/docs/classes/BrowserCryptoProvider.sha256.md +0 -24
  79. package/docs/classes/BrowserCryptoProvider.toBase64.md +0 -24
  80. package/docs/classes/BrowserCryptoProvider.unwrapBytes.md +0 -27
  81. package/docs/classes/BrowserCryptoProvider.wrapBytes.md +0 -28
  82. package/docs/classes/BrowserHashProvider.hashParts.md +0 -26
  83. package/docs/classes/BrowserHashProvider.hashString.md +0 -25
  84. package/docs/classes/BrowserHashProvider.md +0 -81
  85. package/docs/classes/DirectoryHandleStore.getAll.md +0 -17
  86. package/docs/classes/DirectoryHandleStore.getAllLabels.md +0 -17
  87. package/docs/classes/DirectoryHandleStore.load.md +0 -24
  88. package/docs/classes/DirectoryHandleStore.md +0 -120
  89. package/docs/classes/DirectoryHandleStore.remove.md +0 -24
  90. package/docs/classes/DirectoryHandleStore.save.md +0 -25
  91. package/docs/classes/FileApiTreeAccessors.create.md +0 -25
  92. package/docs/classes/FileApiTreeAccessors.createFromHttp.md +0 -24
  93. package/docs/classes/FileApiTreeAccessors.createFromLocalStorage.md +0 -25
  94. package/docs/classes/FileApiTreeAccessors.createPersistent.md +0 -26
  95. package/docs/classes/FileApiTreeAccessors.createPersistentFromFile.md +0 -27
  96. package/docs/classes/FileApiTreeAccessors.extractFileMetadata.md +0 -24
  97. package/docs/classes/FileApiTreeAccessors.fromDirectoryUpload.md +0 -25
  98. package/docs/classes/FileApiTreeAccessors.fromFileList.md +0 -25
  99. package/docs/classes/FileApiTreeAccessors.getOriginalFile.md +0 -27
  100. package/docs/classes/FileApiTreeAccessors.md +0 -172
  101. package/docs/classes/FileSystemAccessTreeAccessors.deleteFile.md +0 -22
  102. package/docs/classes/FileSystemAccessTreeAccessors.fileIsMutable.md +0 -22
  103. package/docs/classes/FileSystemAccessTreeAccessors.fromDirectoryHandle.md +0 -25
  104. package/docs/classes/FileSystemAccessTreeAccessors.fromFileHandle.md +0 -29
  105. package/docs/classes/FileSystemAccessTreeAccessors.getDirtyPaths.md +0 -15
  106. package/docs/classes/FileSystemAccessTreeAccessors.isDirty.md +0 -15
  107. package/docs/classes/FileSystemAccessTreeAccessors.md +0 -275
  108. package/docs/classes/FileSystemAccessTreeAccessors.saveFileContents.md +0 -23
  109. package/docs/classes/FileSystemAccessTreeAccessors.syncToDisk.md +0 -15
  110. package/docs/classes/HttpTreeAccessors.deleteFile.md +0 -24
  111. package/docs/classes/HttpTreeAccessors.fileIsMutable.md +0 -24
  112. package/docs/classes/HttpTreeAccessors.fromHttp.md +0 -24
  113. package/docs/classes/HttpTreeAccessors.getDirtyPaths.md +0 -17
  114. package/docs/classes/HttpTreeAccessors.isDirty.md +0 -17
  115. package/docs/classes/HttpTreeAccessors.md +0 -261
  116. package/docs/classes/HttpTreeAccessors.saveFileContents.md +0 -25
  117. package/docs/classes/HttpTreeAccessors.syncToDisk.md +0 -22
  118. package/docs/classes/LocalStorageTreeAccessors.deleteFile.md +0 -24
  119. package/docs/classes/LocalStorageTreeAccessors.fileIsMutable.md +0 -24
  120. package/docs/classes/LocalStorageTreeAccessors.fromStorage.md +0 -25
  121. package/docs/classes/LocalStorageTreeAccessors.getDirtyPaths.md +0 -17
  122. package/docs/classes/LocalStorageTreeAccessors.isDirty.md +0 -17
  123. package/docs/classes/LocalStorageTreeAccessors.md +0 -270
  124. package/docs/classes/LocalStorageTreeAccessors.saveFileContents.md +0 -25
  125. package/docs/classes/LocalStorageTreeAccessors.syncToDisk.md +0 -17
  126. package/docs/functions/createBrowserCryptoProvider.md +0 -12
  127. package/docs/functions/exportAsJson.md +0 -12
  128. package/docs/functions/exportUsingFileSystemAPI.md +0 -11
  129. package/docs/functions/extractDirectoryPath.md +0 -13
  130. package/docs/functions/extractFileListMetadata.md +0 -11
  131. package/docs/functions/extractFileMetadata.md +0 -11
  132. package/docs/functions/fromDirectoryUpload.md +0 -12
  133. package/docs/functions/fromFileList.md +0 -12
  134. package/docs/functions/getOriginalFile.md +0 -11
  135. package/docs/functions/isDirectoryHandle.md +0 -11
  136. package/docs/functions/isFileHandle.md +0 -11
  137. package/docs/functions/isFilePath.md +0 -11
  138. package/docs/functions/parseContextFilter.md +0 -12
  139. package/docs/functions/parseQualifierDefaults.md +0 -12
  140. package/docs/functions/parseResourceTypes.md +0 -12
  141. package/docs/functions/parseUrlParameters.md +0 -11
  142. package/docs/functions/safeShowDirectoryPicker.md +0 -11
  143. package/docs/functions/safeShowOpenFilePicker.md +0 -11
  144. package/docs/functions/safeShowSaveFilePicker.md +0 -11
  145. package/docs/functions/supportsFileSystemAccess.md +0 -11
  146. package/docs/interfaces/FilePickerAcceptType.accept.md +0 -9
  147. package/docs/interfaces/FilePickerAcceptType.description.md +0 -9
  148. package/docs/interfaces/FilePickerAcceptType.md +0 -61
  149. package/docs/interfaces/FileSystemCreateWritableOptions.keepExistingData.md +0 -9
  150. package/docs/interfaces/FileSystemCreateWritableOptions.md +0 -44
  151. package/docs/interfaces/FileSystemDirectoryHandle._asyncIterator_.md +0 -13
  152. package/docs/interfaces/FileSystemDirectoryHandle.entries.md +0 -13
  153. package/docs/interfaces/FileSystemDirectoryHandle.getDirectoryHandle.md +0 -21
  154. package/docs/interfaces/FileSystemDirectoryHandle.getFileHandle.md +0 -21
  155. package/docs/interfaces/FileSystemDirectoryHandle.keys.md +0 -13
  156. package/docs/interfaces/FileSystemDirectoryHandle.kind.md +0 -9
  157. package/docs/interfaces/FileSystemDirectoryHandle.md +0 -224
  158. package/docs/interfaces/FileSystemDirectoryHandle.removeEntry.md +0 -21
  159. package/docs/interfaces/FileSystemDirectoryHandle.resolve.md +0 -20
  160. package/docs/interfaces/FileSystemDirectoryHandle.values.md +0 -13
  161. package/docs/interfaces/FileSystemFileHandle.createWritable.md +0 -20
  162. package/docs/interfaces/FileSystemFileHandle.getFile.md +0 -13
  163. package/docs/interfaces/FileSystemFileHandle.kind.md +0 -9
  164. package/docs/interfaces/FileSystemFileHandle.md +0 -146
  165. package/docs/interfaces/FileSystemGetDirectoryOptions.create.md +0 -9
  166. package/docs/interfaces/FileSystemGetDirectoryOptions.md +0 -44
  167. package/docs/interfaces/FileSystemGetFileOptions.create.md +0 -9
  168. package/docs/interfaces/FileSystemGetFileOptions.md +0 -44
  169. package/docs/interfaces/FileSystemHandle.isSameEntry.md +0 -20
  170. package/docs/interfaces/FileSystemHandle.kind.md +0 -9
  171. package/docs/interfaces/FileSystemHandle.md +0 -118
  172. package/docs/interfaces/FileSystemHandle.name.md +0 -9
  173. package/docs/interfaces/FileSystemHandle.queryPermission.md +0 -20
  174. package/docs/interfaces/FileSystemHandle.requestPermission.md +0 -20
  175. package/docs/interfaces/FileSystemHandlePermissionDescriptor.md +0 -44
  176. package/docs/interfaces/FileSystemHandlePermissionDescriptor.mode.md +0 -9
  177. package/docs/interfaces/FileSystemRemoveOptions.md +0 -44
  178. package/docs/interfaces/FileSystemRemoveOptions.recursive.md +0 -9
  179. package/docs/interfaces/FileSystemWritableFileStream.md +0 -142
  180. package/docs/interfaces/FileSystemWritableFileStream.seek.md +0 -20
  181. package/docs/interfaces/FileSystemWritableFileStream.truncate.md +0 -20
  182. package/docs/interfaces/FileSystemWritableFileStream.write.md +0 -20
  183. package/docs/interfaces/IDirectoryHandleTreeInitializer.dirHandles.md +0 -9
  184. package/docs/interfaces/IDirectoryHandleTreeInitializer.md +0 -78
  185. package/docs/interfaces/IDirectoryHandleTreeInitializer.nonRecursive.md +0 -9
  186. package/docs/interfaces/IDirectoryHandleTreeInitializer.prefix.md +0 -9
  187. package/docs/interfaces/IFileHandleTreeInitializer.fileHandles.md +0 -9
  188. package/docs/interfaces/IFileHandleTreeInitializer.md +0 -61
  189. package/docs/interfaces/IFileHandleTreeInitializer.prefix.md +0 -9
  190. package/docs/interfaces/IFileListTreeInitializer.fileList.md +0 -9
  191. package/docs/interfaces/IFileListTreeInitializer.md +0 -44
  192. package/docs/interfaces/IFileMetadata.lastModified.md +0 -9
  193. package/docs/interfaces/IFileMetadata.md +0 -112
  194. package/docs/interfaces/IFileMetadata.name.md +0 -9
  195. package/docs/interfaces/IFileMetadata.path.md +0 -9
  196. package/docs/interfaces/IFileMetadata.size.md +0 -9
  197. package/docs/interfaces/IFileMetadata.type.md +0 -9
  198. package/docs/interfaces/IFileSystemAccessTreeParams.autoSync.md +0 -12
  199. package/docs/interfaces/IFileSystemAccessTreeParams.filePath.md +0 -13
  200. package/docs/interfaces/IFileSystemAccessTreeParams.logger.md +0 -11
  201. package/docs/interfaces/IFileSystemAccessTreeParams.md +0 -148
  202. package/docs/interfaces/IFileSystemAccessTreeParams.requireWritePermission.md +0 -13
  203. package/docs/interfaces/IFsAccessApis.md +0 -62
  204. package/docs/interfaces/IFsAccessApis.showDirectoryPicker.md +0 -20
  205. package/docs/interfaces/IFsAccessApis.showOpenFilePicker.md +0 -20
  206. package/docs/interfaces/IFsAccessApis.showSaveFilePicker.md +0 -20
  207. package/docs/interfaces/IHttpTreeParams.autoSync.md +0 -9
  208. package/docs/interfaces/IHttpTreeParams.baseUrl.md +0 -9
  209. package/docs/interfaces/IHttpTreeParams.fetchImpl.md +0 -9
  210. package/docs/interfaces/IHttpTreeParams.logger.md +0 -9
  211. package/docs/interfaces/IHttpTreeParams.md +0 -182
  212. package/docs/interfaces/IHttpTreeParams.namespace.md +0 -9
  213. package/docs/interfaces/IHttpTreeParams.userId.md +0 -9
  214. package/docs/interfaces/ILocalStorageTreeParams.autoSync.md +0 -12
  215. package/docs/interfaces/ILocalStorageTreeParams.md +0 -131
  216. package/docs/interfaces/ILocalStorageTreeParams.pathToKeyMap.md +0 -13
  217. package/docs/interfaces/ILocalStorageTreeParams.storage.md +0 -12
  218. package/docs/interfaces/IUrlConfigOptions.config.md +0 -11
  219. package/docs/interfaces/IUrlConfigOptions.configStartDir.md +0 -11
  220. package/docs/interfaces/IUrlConfigOptions.contextFilter.md +0 -11
  221. package/docs/interfaces/IUrlConfigOptions.input.md +0 -11
  222. package/docs/interfaces/IUrlConfigOptions.inputStartDir.md +0 -11
  223. package/docs/interfaces/IUrlConfigOptions.interactive.md +0 -11
  224. package/docs/interfaces/IUrlConfigOptions.loadZip.md +0 -11
  225. package/docs/interfaces/IUrlConfigOptions.maxDistance.md +0 -11
  226. package/docs/interfaces/IUrlConfigOptions.md +0 -248
  227. package/docs/interfaces/IUrlConfigOptions.qualifierDefaults.md +0 -11
  228. package/docs/interfaces/IUrlConfigOptions.reduceQualifiers.md +0 -11
  229. package/docs/interfaces/IUrlConfigOptions.resourceTypes.md +0 -11
  230. package/docs/interfaces/IUrlConfigOptions.zipFile.md +0 -11
  231. package/docs/interfaces/IUrlConfigOptions.zipPath.md +0 -11
  232. package/docs/interfaces/ShowDirectoryPickerOptions.id.md +0 -9
  233. package/docs/interfaces/ShowDirectoryPickerOptions.md +0 -78
  234. package/docs/interfaces/ShowDirectoryPickerOptions.mode.md +0 -9
  235. package/docs/interfaces/ShowDirectoryPickerOptions.startIn.md +0 -9
  236. package/docs/interfaces/ShowOpenFilePickerOptions.excludeAcceptAllOption.md +0 -9
  237. package/docs/interfaces/ShowOpenFilePickerOptions.id.md +0 -9
  238. package/docs/interfaces/ShowOpenFilePickerOptions.md +0 -112
  239. package/docs/interfaces/ShowOpenFilePickerOptions.multiple.md +0 -9
  240. package/docs/interfaces/ShowOpenFilePickerOptions.startIn.md +0 -9
  241. package/docs/interfaces/ShowOpenFilePickerOptions.types.md +0 -9
  242. package/docs/interfaces/ShowSaveFilePickerOptions.excludeAcceptAllOption.md +0 -9
  243. package/docs/interfaces/ShowSaveFilePickerOptions.id.md +0 -9
  244. package/docs/interfaces/ShowSaveFilePickerOptions.md +0 -112
  245. package/docs/interfaces/ShowSaveFilePickerOptions.startIn.md +0 -9
  246. package/docs/interfaces/ShowSaveFilePickerOptions.suggestedName.md +0 -9
  247. package/docs/interfaces/ShowSaveFilePickerOptions.types.md +0 -9
  248. package/docs/type-aliases/TreeInitializer.md +0 -11
  249. package/docs/type-aliases/WellKnownDirectory.md +0 -11
  250. package/docs/type-aliases/WindowWithFsAccess.md +0 -11
  251. package/docs/variables/DEFAULT_DIRECTORY_HANDLE_DB.md +0 -9
  252. package/docs/variables/DEFAULT_DIRECTORY_HANDLE_STORE.md +0 -9
  253. package/docs/variables/defaultFileApiTreeInitParams.md +0 -9
  254. package/etc/ts-web-extras.api.md +0 -439
  255. package/lib/test/mocks/idb-keyval.d.ts +0 -6
  256. package/lib/test/mocks/idb-keyval.d.ts.map +0 -1
  257. package/lib/test/mocks/idb-keyval.js +0 -9
  258. package/lib/test/mocks/idb-keyval.js.map +0 -1
  259. package/lib/test/setupTests.d.ts +0 -2
  260. package/lib/test/setupTests.d.ts.map +0 -1
  261. package/lib/test/setupTests.js +0 -76
  262. package/lib/test/setupTests.js.map +0 -1
  263. package/lib/test/unit/browserCryptoProvider.wrapBytes.test.d.ts +0 -2
  264. package/lib/test/unit/browserCryptoProvider.wrapBytes.test.d.ts.map +0 -1
  265. package/lib/test/unit/browserCryptoProvider.wrapBytes.test.js +0 -223
  266. package/lib/test/unit/browserCryptoProvider.wrapBytes.test.js.map +0 -1
  267. package/lib/test/unit/browserHashProvider.test.d.ts +0 -2
  268. package/lib/test/unit/browserHashProvider.test.d.ts.map +0 -1
  269. package/lib/test/unit/browserHashProvider.test.js +0 -142
  270. package/lib/test/unit/browserHashProvider.test.js.map +0 -1
  271. package/lib/test/unit/directoryHandleStore.test.d.ts +0 -2
  272. package/lib/test/unit/directoryHandleStore.test.d.ts.map +0 -1
  273. package/lib/test/unit/directoryHandleStore.test.js +0 -192
  274. package/lib/test/unit/directoryHandleStore.test.js.map +0 -1
  275. package/lib/test/unit/fileApiTreeAccessors.test.d.ts +0 -2
  276. package/lib/test/unit/fileApiTreeAccessors.test.d.ts.map +0 -1
  277. package/lib/test/unit/fileApiTreeAccessors.test.js +0 -1190
  278. package/lib/test/unit/fileApiTreeAccessors.test.js.map +0 -1
  279. package/lib/test/unit/fileApiTypes.test.d.ts +0 -2
  280. package/lib/test/unit/fileApiTypes.test.d.ts.map +0 -1
  281. package/lib/test/unit/fileApiTypes.test.js +0 -474
  282. package/lib/test/unit/fileApiTypes.test.js.map +0 -1
  283. package/lib/test/unit/fileSystemAccessTreeAccessors.test.d.ts +0 -2
  284. package/lib/test/unit/fileSystemAccessTreeAccessors.test.d.ts.map +0 -1
  285. package/lib/test/unit/fileSystemAccessTreeAccessors.test.js +0 -624
  286. package/lib/test/unit/fileSystemAccessTreeAccessors.test.js.map +0 -1
  287. package/lib/test/unit/fileTreeHelpers.test.d.ts +0 -2
  288. package/lib/test/unit/fileTreeHelpers.test.d.ts.map +0 -1
  289. package/lib/test/unit/fileTreeHelpers.test.js +0 -592
  290. package/lib/test/unit/fileTreeHelpers.test.js.map +0 -1
  291. package/lib/test/unit/httpTreeAccessors.test.d.ts +0 -2
  292. package/lib/test/unit/httpTreeAccessors.test.d.ts.map +0 -1
  293. package/lib/test/unit/httpTreeAccessors.test.js +0 -1366
  294. package/lib/test/unit/httpTreeAccessors.test.js.map +0 -1
  295. package/lib/test/unit/localStorageTreeAccessors.test.d.ts +0 -2
  296. package/lib/test/unit/localStorageTreeAccessors.test.d.ts.map +0 -1
  297. package/lib/test/unit/localStorageTreeAccessors.test.js +0 -814
  298. package/lib/test/unit/localStorageTreeAccessors.test.js.map +0 -1
  299. package/lib/test/unit/urlParams.test.d.ts +0 -2
  300. package/lib/test/unit/urlParams.test.d.ts.map +0 -1
  301. package/lib/test/unit/urlParams.test.js +0 -395
  302. package/lib/test/unit/urlParams.test.js.map +0 -1
  303. package/lib/test/utils/fileSystemAccessMocks.d.ts +0 -53
  304. package/lib/test/utils/fileSystemAccessMocks.d.ts.map +0 -1
  305. package/lib/test/utils/fileSystemAccessMocks.js +0 -277
  306. package/lib/test/utils/fileSystemAccessMocks.js.map +0 -1
  307. package/lib/test/utils/testHelpers.d.ts +0 -51
  308. package/lib/test/utils/testHelpers.d.ts.map +0 -1
  309. package/lib/test/utils/testHelpers.js +0 -133
  310. package/lib/test/utils/testHelpers.js.map +0 -1
  311. package/rush-logs/ts-web-extras.build.cache.log +0 -3
  312. package/rush-logs/ts-web-extras.build.log +0 -57
  313. package/src/index.browser.ts +0 -24
  314. package/src/index.ts +0 -47
  315. package/src/packlets/crypto-utils/browserCryptoProvider.ts +0 -553
  316. package/src/packlets/crypto-utils/browserHashProvider.ts +0 -73
  317. package/src/packlets/crypto-utils/index.ts +0 -29
  318. package/src/packlets/file-api-types/index.ts +0 -366
  319. package/src/packlets/file-tree/directoryHandleStore.ts +0 -136
  320. package/src/packlets/file-tree/fileApiTreeAccessors.ts +0 -528
  321. package/src/packlets/file-tree/fileSystemAccessTreeAccessors.ts +0 -519
  322. package/src/packlets/file-tree/httpTreeAccessors.ts +0 -478
  323. package/src/packlets/file-tree/index.ts +0 -32
  324. package/src/packlets/file-tree/localStorageTreeAccessors.ts +0 -430
  325. package/src/packlets/helpers/fileTreeHelpers.ts +0 -107
  326. package/src/packlets/helpers/index.ts +0 -28
  327. package/src/packlets/url-utils/index.ts +0 -28
  328. package/src/packlets/url-utils/urlParams.ts +0 -245
  329. package/src/test/mocks/idb-keyval.ts +0 -5
  330. package/src/test/setupTests.ts +0 -87
  331. package/src/test/unit/browserCryptoProvider.wrapBytes.test.ts +0 -325
  332. package/src/test/unit/browserHashProvider.test.ts +0 -155
  333. package/src/test/unit/browserHashProvider.test.ts.bak +0 -376
  334. package/src/test/unit/directoryHandleStore.test.ts +0 -251
  335. package/src/test/unit/fileApiTreeAccessors.test.ts +0 -1387
  336. package/src/test/unit/fileApiTypes.test.ts +0 -587
  337. package/src/test/unit/fileSystemAccessTreeAccessors.test.ts +0 -885
  338. package/src/test/unit/fileTreeHelpers.test.ts +0 -694
  339. package/src/test/unit/httpTreeAccessors.test.ts +0 -1750
  340. package/src/test/unit/localStorageTreeAccessors.test.ts +0 -1014
  341. package/src/test/unit/urlParams.test.ts +0 -464
  342. package/src/test/utils/fileSystemAccessMocks.ts +0 -353
  343. package/src/test/utils/testHelpers.ts +0 -155
  344. package/temp/build/typescript/ts_8nwakTlr.json +0 -1
  345. package/temp/coverage/base.css +0 -224
  346. package/temp/coverage/block-navigation.js +0 -87
  347. package/temp/coverage/crypto-utils/browserCryptoProvider.ts.html +0 -1744
  348. package/temp/coverage/crypto-utils/browserHashProvider.ts.html +0 -304
  349. package/temp/coverage/crypto-utils/index.html +0 -131
  350. package/temp/coverage/favicon.png +0 -0
  351. package/temp/coverage/file-tree/directoryHandleStore.ts.html +0 -493
  352. package/temp/coverage/file-tree/fileApiTreeAccessors.ts.html +0 -1669
  353. package/temp/coverage/file-tree/fileSystemAccessTreeAccessors.ts.html +0 -1642
  354. package/temp/coverage/file-tree/httpTreeAccessors.ts.html +0 -1519
  355. package/temp/coverage/file-tree/index.html +0 -176
  356. package/temp/coverage/file-tree/localStorageTreeAccessors.ts.html +0 -1375
  357. package/temp/coverage/helpers/fileTreeHelpers.ts.html +0 -406
  358. package/temp/coverage/helpers/index.html +0 -116
  359. package/temp/coverage/index.html +0 -161
  360. package/temp/coverage/lcov-report/base.css +0 -224
  361. package/temp/coverage/lcov-report/block-navigation.js +0 -87
  362. package/temp/coverage/lcov-report/crypto-utils/browserCryptoProvider.ts.html +0 -1744
  363. package/temp/coverage/lcov-report/crypto-utils/browserHashProvider.ts.html +0 -304
  364. package/temp/coverage/lcov-report/crypto-utils/index.html +0 -131
  365. package/temp/coverage/lcov-report/favicon.png +0 -0
  366. package/temp/coverage/lcov-report/file-tree/directoryHandleStore.ts.html +0 -493
  367. package/temp/coverage/lcov-report/file-tree/fileApiTreeAccessors.ts.html +0 -1669
  368. package/temp/coverage/lcov-report/file-tree/fileSystemAccessTreeAccessors.ts.html +0 -1642
  369. package/temp/coverage/lcov-report/file-tree/httpTreeAccessors.ts.html +0 -1519
  370. package/temp/coverage/lcov-report/file-tree/index.html +0 -176
  371. package/temp/coverage/lcov-report/file-tree/localStorageTreeAccessors.ts.html +0 -1375
  372. package/temp/coverage/lcov-report/helpers/fileTreeHelpers.ts.html +0 -406
  373. package/temp/coverage/lcov-report/helpers/index.html +0 -116
  374. package/temp/coverage/lcov-report/index.html +0 -161
  375. package/temp/coverage/lcov-report/prettify.css +0 -1
  376. package/temp/coverage/lcov-report/prettify.js +0 -2
  377. package/temp/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  378. package/temp/coverage/lcov-report/sorter.js +0 -210
  379. package/temp/coverage/lcov-report/url-utils/index.html +0 -116
  380. package/temp/coverage/lcov-report/url-utils/urlParams.ts.html +0 -820
  381. package/temp/coverage/lcov.info +0 -3924
  382. package/temp/coverage/prettify.css +0 -1
  383. package/temp/coverage/prettify.js +0 -2
  384. package/temp/coverage/sort-arrow-sprite.png +0 -0
  385. package/temp/coverage/sorter.js +0 -210
  386. package/temp/coverage/url-utils/index.html +0 -116
  387. package/temp/coverage/url-utils/urlParams.ts.html +0 -820
  388. package/temp/test/jest/haste-map-7492f1b44480e0cdd1f220078fb3afd8-c8dd6c3430605adeb2f1cadf4f75e791-8c9336785555d572065b28c111982ba4 +0 -0
  389. package/temp/test/jest/jest-transform-cache-7492f1b44480e0cdd1f220078fb3afd8-79ef2876fae7ca75eedb2aa53dc48338/8a/package_8a7abbb163935a14e582220d11872de3 +0 -53
  390. package/temp/test/jest/perf-cache-7492f1b44480e0cdd1f220078fb3afd8-da39a3ee5e6b4b0d3255bfef95601890 +0 -1
  391. package/temp/ts-web-extras.api.json +0 -9373
  392. package/temp/ts-web-extras.api.md +0 -439
  393. package/tsconfig.json +0 -7
@@ -1,271 +0,0 @@
1
- /*
2
- * Copyright (c) 2026 Erik Fortune
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in all
12
- * copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
- var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
23
- var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
24
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
25
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
26
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
27
- function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
28
- function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
29
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
30
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
31
- function fulfill(value) { resume("next", value); }
32
- function reject(value) { resume("throw", value); }
33
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
34
- };
35
- import { createMockFile } from './testHelpers';
36
- /**
37
- * Mock implementation of FileSystemWritableFileStream
38
- */
39
- export class MockFileSystemWritableFileStream {
40
- constructor(onWrite, failOnWrite = false) {
41
- this._content = '';
42
- this._closed = false;
43
- this._onWrite = onWrite;
44
- this._failOnWrite = failOnWrite;
45
- }
46
- get locked() {
47
- return false;
48
- }
49
- async write(data) {
50
- if (this._closed) {
51
- throw new Error('Stream is closed');
52
- }
53
- if (this._failOnWrite) {
54
- throw new Error('Write operation failed');
55
- }
56
- if (typeof data === 'string') {
57
- this._content = data;
58
- }
59
- else if (data instanceof Blob) {
60
- this._content = await data.text();
61
- }
62
- else {
63
- const decoder = new TextDecoder();
64
- this._content = decoder.decode(data);
65
- }
66
- }
67
- async seek(position) {
68
- // Mock implementation - not used in our tests
69
- }
70
- async truncate(size) {
71
- // Mock implementation - not used in our tests
72
- }
73
- async close() {
74
- if (!this._closed) {
75
- this._closed = true;
76
- this._onWrite(this._content);
77
- }
78
- }
79
- async abort() {
80
- this._closed = true;
81
- }
82
- getWriter() {
83
- throw new Error('getWriter not implemented in mock');
84
- }
85
- }
86
- /**
87
- * Mock implementation of FileSystemFileHandle
88
- */
89
- export function createMockFileHandle(name, data, onWrite, options = {}) {
90
- let currentContent = data.content;
91
- const { hasWritePermission = true, permissionStatus, requestGranted = true } = options;
92
- const handle = {
93
- kind: 'file',
94
- name,
95
- async getFile() {
96
- if (data.failOnRead) {
97
- throw new Error('Failed to read file');
98
- }
99
- return createMockFile({
100
- name,
101
- content: currentContent,
102
- type: data.type
103
- });
104
- },
105
- async createWritable() {
106
- return new MockFileSystemWritableFileStream((content) => {
107
- currentContent = content;
108
- if (onWrite) {
109
- onWrite(content);
110
- }
111
- }, data.failOnWrite);
112
- },
113
- async queryPermission(descriptor) {
114
- if (permissionStatus) {
115
- return permissionStatus;
116
- }
117
- if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.mode) === 'readwrite' && !hasWritePermission) {
118
- return 'denied';
119
- }
120
- return 'granted';
121
- },
122
- async requestPermission(descriptor) {
123
- if (permissionStatus === 'prompt') {
124
- return requestGranted ? 'granted' : 'denied';
125
- }
126
- if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.mode) === 'readwrite' && !hasWritePermission) {
127
- return 'denied';
128
- }
129
- return 'granted';
130
- },
131
- isSameEntry: async (other) => {
132
- return other === handle;
133
- }
134
- };
135
- return handle;
136
- }
137
- /**
138
- * Parse file structure into nested map
139
- */
140
- function parseFileStructure(files) {
141
- const root = new Map();
142
- for (const [path, data] of Object.entries(files)) {
143
- const parts = path.split('/').filter((p) => p.length > 0);
144
- let current = root;
145
- for (let i = 0; i < parts.length - 1; i++) {
146
- const part = parts[i];
147
- if (!current.has(part)) {
148
- current.set(part, new Map());
149
- }
150
- current = current.get(part);
151
- }
152
- const filename = parts[parts.length - 1];
153
- current.set(filename, data);
154
- }
155
- return root;
156
- }
157
- /**
158
- * Mock implementation of FileSystemDirectoryHandle
159
- */
160
- export function createMockDirectoryHandle(name, files, options = {}) {
161
- const { hasWritePermission = true, permissionError = false, permissionStatus, requestGranted = true } = options;
162
- const structure = parseFileStructure(files);
163
- const fileHandles = new Map();
164
- const dirHandles = new Map();
165
- // Create file handles for all files
166
- for (const [path, data] of Object.entries(files)) {
167
- const handle = createMockFileHandle(path.split('/').pop() || '', data, (content) => {
168
- // Update the file content when written
169
- files[path] = Object.assign(Object.assign({}, data), { content });
170
- });
171
- fileHandles.set(path, handle);
172
- }
173
- function createSubDirectoryHandle(dirName, subStructure, parentPath) {
174
- // For root directory, currentPath should be empty string
175
- const currentPath = dirName === '/' ? '' : parentPath ? `${parentPath}/${dirName}` : dirName;
176
- const handle = {
177
- kind: 'directory',
178
- name: dirName,
179
- entries() {
180
- return __asyncGenerator(this, arguments, function* entries_1() {
181
- for (const [itemName, item] of subStructure.entries()) {
182
- if (item instanceof Map) {
183
- const subDirHandle = createSubDirectoryHandle(itemName, item, currentPath);
184
- yield yield __await([itemName, subDirHandle]);
185
- }
186
- else {
187
- const filePath = currentPath ? `${currentPath}/${itemName}` : itemName;
188
- const fileHandle = fileHandles.get(filePath);
189
- if (fileHandle) {
190
- yield yield __await([itemName, fileHandle]);
191
- }
192
- }
193
- }
194
- });
195
- },
196
- async getFileHandle(fileName, options) {
197
- const filePath = currentPath ? `${currentPath}/${fileName}` : fileName;
198
- let handle = fileHandles.get(filePath);
199
- if (!handle && (options === null || options === void 0 ? void 0 : options.create)) {
200
- const newData = { content: '', type: 'text/plain' };
201
- files[filePath] = newData;
202
- handle = createMockFileHandle(fileName, newData, (content) => {
203
- files[filePath] = Object.assign(Object.assign({}, newData), { content });
204
- });
205
- fileHandles.set(filePath, handle);
206
- // Add to structure
207
- subStructure.set(fileName, newData);
208
- }
209
- if (!handle) {
210
- throw new Error(`File not found: ${fileName}`);
211
- }
212
- return handle;
213
- },
214
- async getDirectoryHandle(dirName, options) {
215
- const dirPath = currentPath ? `${currentPath}/${dirName}` : dirName;
216
- let dirHandle = dirHandles.get(dirPath);
217
- if (!dirHandle) {
218
- let subDir = subStructure.get(dirName);
219
- if (!subDir && (options === null || options === void 0 ? void 0 : options.create)) {
220
- subDir = new Map();
221
- subStructure.set(dirName, subDir);
222
- }
223
- if (subDir instanceof Map) {
224
- dirHandle = createSubDirectoryHandle(dirName, subDir, currentPath);
225
- dirHandles.set(dirPath, dirHandle);
226
- }
227
- }
228
- if (!dirHandle) {
229
- throw new Error(`Directory not found: ${dirName}`);
230
- }
231
- return dirHandle;
232
- },
233
- async removeEntry(name, options) {
234
- subStructure.delete(name);
235
- },
236
- async queryPermission(descriptor) {
237
- if (permissionError) {
238
- throw new Error('Permission query failed');
239
- }
240
- if (permissionStatus) {
241
- return permissionStatus;
242
- }
243
- if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.mode) === 'readwrite' && !hasWritePermission) {
244
- return 'denied';
245
- }
246
- return 'granted';
247
- },
248
- async requestPermission(descriptor) {
249
- if (permissionError) {
250
- throw new Error('Permission request failed');
251
- }
252
- if (permissionStatus === 'prompt') {
253
- return requestGranted ? 'granted' : 'denied';
254
- }
255
- if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.mode) === 'readwrite' && !hasWritePermission) {
256
- return 'denied';
257
- }
258
- return 'granted';
259
- },
260
- async resolve(possibleDescendant) {
261
- return null;
262
- },
263
- isSameEntry: async (other) => {
264
- return other === handle;
265
- }
266
- };
267
- return handle;
268
- }
269
- return createSubDirectoryHandle(name, structure, '');
270
- }
271
- //# sourceMappingURL=fileSystemAccessMocks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fileSystemAccessMocks.js","sourceRoot":"","sources":["../../../src/test/utils/fileSystemAccessMocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAsB/C;;GAEG;AACH,MAAM,OAAO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EAAE;gBACxE,OAAO,KAAK,KAAK,MAAM,CAAC;YAC1B,CAAC;SACF,CAAC;QAEF,OAAO,MAAmC,CAAC;IAC7C,CAAC;IAED,OAAO,wBAAwB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;AACvD,CAAC","sourcesContent":["/*\n * Copyright (c) 2026 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { FileSystemDirectoryHandle, FileSystemFileHandle } from '../../packlets/file-api-types';\nimport { createMockFile } from './testHelpers';\n\n/**\n * Mock file data for File System Access API\n */\nexport interface MockFileData {\n content: string;\n type: string;\n failOnRead?: boolean;\n failOnWrite?: boolean;\n}\n\n/**\n * Options for mock directory handle\n */\nexport interface MockDirectoryOptions {\n hasWritePermission?: boolean;\n permissionError?: boolean;\n permissionStatus?: PermissionState;\n requestGranted?: boolean;\n}\n\n/**\n * Mock implementation of FileSystemWritableFileStream\n */\nexport class MockFileSystemWritableFileStream {\n private _content: string = '';\n private _closed: boolean = false;\n private readonly _onWrite: (content: string) => void;\n private readonly _failOnWrite: boolean;\n\n constructor(onWrite: (content: string) => void, failOnWrite: boolean = false) {\n this._onWrite = onWrite;\n this._failOnWrite = failOnWrite;\n }\n\n get locked(): boolean {\n return false;\n }\n\n async write(data: string | BufferSource | Blob): Promise<void> {\n if (this._closed) {\n throw new Error('Stream is closed');\n }\n if (this._failOnWrite) {\n throw new Error('Write operation failed');\n }\n\n if (typeof data === 'string') {\n this._content = data;\n } else if (data instanceof Blob) {\n this._content = await data.text();\n } else {\n const decoder = new TextDecoder();\n this._content = decoder.decode(data as BufferSource);\n }\n }\n\n async seek(position: number): Promise<void> {\n // Mock implementation - not used in our tests\n }\n\n async truncate(size: number): Promise<void> {\n // Mock implementation - not used in our tests\n }\n\n async close(): Promise<void> {\n if (!this._closed) {\n this._closed = true;\n this._onWrite(this._content);\n }\n }\n\n async abort(): Promise<void> {\n this._closed = true;\n }\n\n getWriter(): WritableStreamDefaultWriter {\n throw new Error('getWriter not implemented in mock');\n }\n}\n\n/**\n * Options for mock file handle\n */\nexport interface MockFileHandleOptions {\n hasWritePermission?: boolean;\n permissionStatus?: PermissionState;\n requestGranted?: boolean;\n}\n\n/**\n * Mock implementation of FileSystemFileHandle\n */\nexport function createMockFileHandle(\n name: string,\n data: MockFileData,\n onWrite?: (content: string) => void,\n options: MockFileHandleOptions = {}\n): FileSystemFileHandle {\n let currentContent = data.content;\n const { hasWritePermission = true, permissionStatus, requestGranted = true } = options;\n\n const handle = {\n kind: 'file' as const,\n name,\n\n async getFile(): Promise<File> {\n if (data.failOnRead) {\n throw new Error('Failed to read file');\n }\n return createMockFile({\n name,\n content: currentContent,\n type: data.type\n });\n },\n\n async createWritable(): Promise<MockFileSystemWritableFileStream> {\n return new MockFileSystemWritableFileStream((content) => {\n currentContent = content;\n if (onWrite) {\n onWrite(content);\n }\n }, data.failOnWrite);\n },\n\n async queryPermission(descriptor?: { mode?: 'read' | 'readwrite' }): Promise<PermissionState> {\n if (permissionStatus) {\n return permissionStatus;\n }\n if (descriptor?.mode === 'readwrite' && !hasWritePermission) {\n return 'denied';\n }\n return 'granted';\n },\n\n async requestPermission(descriptor?: { mode?: 'read' | 'readwrite' }): Promise<PermissionState> {\n if (permissionStatus === 'prompt') {\n return requestGranted ? 'granted' : 'denied';\n }\n if (descriptor?.mode === 'readwrite' && !hasWritePermission) {\n return 'denied';\n }\n return 'granted';\n },\n\n isSameEntry: async (other: FileSystemFileHandle): Promise<boolean> => {\n return other === handle;\n }\n };\n\n return handle as FileSystemFileHandle;\n}\n\n/**\n * Parse file structure into nested map\n */\nfunction parseFileStructure(\n files: Record<string, MockFileData>\n): Map<string, Map<string, MockFileData> | MockFileData> {\n const root = new Map<string, Map<string, MockFileData> | MockFileData>();\n\n for (const [path, data] of Object.entries(files)) {\n const parts = path.split('/').filter((p) => p.length > 0);\n let current = root;\n\n for (let i = 0; i < parts.length - 1; i++) {\n const part = parts[i];\n if (!current.has(part)) {\n current.set(part, new Map<string, MockFileData>());\n }\n current = current.get(part) as Map<string, MockFileData>;\n }\n\n const filename = parts[parts.length - 1];\n current.set(filename, data);\n }\n\n return root;\n}\n\n/**\n * Mock implementation of FileSystemDirectoryHandle\n */\nexport function createMockDirectoryHandle(\n name: string,\n files: Record<string, MockFileData>,\n options: MockDirectoryOptions = {}\n): FileSystemDirectoryHandle {\n const {\n hasWritePermission = true,\n permissionError = false,\n permissionStatus,\n requestGranted = true\n } = options;\n const structure = parseFileStructure(files);\n const fileHandles = new Map<string, FileSystemFileHandle>();\n const dirHandles = new Map<string, FileSystemDirectoryHandle>();\n\n // Create file handles for all files\n for (const [path, data] of Object.entries(files)) {\n const handle = createMockFileHandle(path.split('/').pop() || '', data, (content) => {\n // Update the file content when written\n files[path] = { ...data, content };\n });\n fileHandles.set(path, handle);\n }\n\n function createSubDirectoryHandle(\n dirName: string,\n subStructure: Map<string, Map<string, MockFileData> | MockFileData>,\n parentPath: string\n ): FileSystemDirectoryHandle {\n // For root directory, currentPath should be empty string\n const currentPath = dirName === '/' ? '' : parentPath ? `${parentPath}/${dirName}` : dirName;\n\n const handle = {\n kind: 'directory' as const,\n name: dirName,\n\n async *entries(): AsyncIterableIterator<[string, FileSystemFileHandle | FileSystemDirectoryHandle]> {\n for (const [itemName, item] of subStructure.entries()) {\n if (item instanceof Map) {\n const subDirHandle = createSubDirectoryHandle(itemName, item, currentPath);\n yield [itemName, subDirHandle];\n } else {\n const filePath = currentPath ? `${currentPath}/${itemName}` : itemName;\n const fileHandle = fileHandles.get(filePath);\n if (fileHandle) {\n yield [itemName, fileHandle];\n }\n }\n }\n },\n\n async getFileHandle(fileName: string, options?: { create?: boolean }): Promise<FileSystemFileHandle> {\n const filePath = currentPath ? `${currentPath}/${fileName}` : fileName;\n let handle = fileHandles.get(filePath);\n\n if (!handle && options?.create) {\n const newData: MockFileData = { content: '', type: 'text/plain' };\n files[filePath] = newData;\n handle = createMockFileHandle(fileName, newData, (content) => {\n files[filePath] = { ...newData, content };\n });\n fileHandles.set(filePath, handle);\n\n // Add to structure\n subStructure.set(fileName, newData);\n }\n\n if (!handle) {\n throw new Error(`File not found: ${fileName}`);\n }\n\n return handle;\n },\n\n async getDirectoryHandle(\n dirName: string,\n options?: { create?: boolean }\n ): Promise<FileSystemDirectoryHandle> {\n const dirPath = currentPath ? `${currentPath}/${dirName}` : dirName;\n let dirHandle = dirHandles.get(dirPath);\n\n if (!dirHandle) {\n let subDir = subStructure.get(dirName);\n if (!subDir && options?.create) {\n subDir = new Map<string, MockFileData>();\n subStructure.set(dirName, subDir);\n }\n\n if (subDir instanceof Map) {\n dirHandle = createSubDirectoryHandle(dirName, subDir, currentPath);\n dirHandles.set(dirPath, dirHandle);\n }\n }\n\n if (!dirHandle) {\n throw new Error(`Directory not found: ${dirName}`);\n }\n\n return dirHandle;\n },\n\n async removeEntry(name: string, options?: { recursive?: boolean }): Promise<void> {\n subStructure.delete(name);\n },\n\n async queryPermission(descriptor?: { mode?: 'read' | 'readwrite' }): Promise<PermissionState> {\n if (permissionError) {\n throw new Error('Permission query failed');\n }\n if (permissionStatus) {\n return permissionStatus;\n }\n if (descriptor?.mode === 'readwrite' && !hasWritePermission) {\n return 'denied';\n }\n return 'granted';\n },\n\n async requestPermission(descriptor?: { mode?: 'read' | 'readwrite' }): Promise<PermissionState> {\n if (permissionError) {\n throw new Error('Permission request failed');\n }\n if (permissionStatus === 'prompt') {\n return requestGranted ? 'granted' : 'denied';\n }\n if (descriptor?.mode === 'readwrite' && !hasWritePermission) {\n return 'denied';\n }\n return 'granted';\n },\n\n async resolve(possibleDescendant: FileSystemHandle): Promise<string[] | null> {\n return null;\n },\n\n isSameEntry: async (other: FileSystemDirectoryHandle): Promise<boolean> => {\n return other === handle;\n }\n };\n\n return handle as FileSystemDirectoryHandle;\n }\n\n return createSubDirectoryHandle(name, structure, '');\n}\n"]}
@@ -1,124 +0,0 @@
1
- /*
2
- * Copyright (c) 2025 Erik Fortune
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in all
12
- * copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
- /**
23
- * Create a mock File object with all necessary properties and methods
24
- */
25
- export function createMockFile(data) {
26
- const blob = new Blob([data.content], { type: data.type || 'text/plain' });
27
- const file = new File([blob], data.name, {
28
- type: data.type || 'text/plain',
29
- lastModified: data.lastModified || Date.now()
30
- });
31
- // Add webkitRelativePath if provided (for directory uploads)
32
- if (data.webkitRelativePath) {
33
- Object.defineProperty(file, 'webkitRelativePath', {
34
- value: data.webkitRelativePath,
35
- writable: false,
36
- configurable: true
37
- });
38
- }
39
- // Ensure text() method works properly
40
- if (!file.text || typeof file.text !== 'function') {
41
- Object.defineProperty(file, 'text', {
42
- value: () => Promise.resolve(data.content),
43
- writable: false,
44
- configurable: true
45
- });
46
- }
47
- return file;
48
- }
49
- /**
50
- * Create a mock FileList using DataTransfer API
51
- * This is the most reliable method for creating FileList objects in tests
52
- */
53
- export function createMockFileList(files) {
54
- // Use DataTransfer to create a proper FileList
55
- const dt = new DataTransfer();
56
- files.forEach((fileData) => {
57
- const file = createMockFile(fileData);
58
- dt.items.add(file);
59
- });
60
- return dt.files;
61
- }
62
- /**
63
- * Create a mock FileList for directory upload simulation
64
- * Includes webkitRelativePath for each file
65
- */
66
- export function createMockDirectoryFileList(directoryStructure) {
67
- const files = directoryStructure.map((item) => ({
68
- name: item.path.split('/').pop() || '',
69
- content: item.content,
70
- type: item.type,
71
- webkitRelativePath: item.path
72
- }));
73
- return createMockFileList(files);
74
- }
75
- /**
76
- * Helper to create a promise that resolves after a delay
77
- * Useful for testing async operations
78
- */
79
- export function delay(ms) {
80
- return new Promise((resolve) => setTimeout(resolve, ms));
81
- }
82
- /**
83
- * Helper to verify File API text() method works correctly
84
- * Since we're using Blob/File polyfills, this ensures they have the right methods
85
- */
86
- export async function verifyFileAPI(file) {
87
- try {
88
- // Check if text() method exists and works
89
- if (typeof file.text !== 'function') {
90
- throw new Error('File.text() method not available');
91
- }
92
- const text = await file.text();
93
- return typeof text === 'string';
94
- }
95
- catch (_a) {
96
- return false;
97
- }
98
- }
99
- /**
100
- * Mock Web Crypto digest result for testing
101
- * Creates a deterministic hash-like ArrayBuffer
102
- */
103
- export function createMockDigest(input, algorithm = 'SHA-256') {
104
- // Create a deterministic "hash" based on input for testing
105
- // This is not a real hash but good enough for testing
106
- const hashLength = algorithm.includes('256') ? 32 : algorithm.includes('512') ? 64 : 20;
107
- const buffer = new ArrayBuffer(hashLength);
108
- const view = new Uint8Array(buffer);
109
- // Fill with deterministic values based on input
110
- for (let i = 0; i < hashLength; i++) {
111
- view[i] = (input.charCodeAt(i % input.length) + i) % 256;
112
- }
113
- return buffer;
114
- }
115
- /**
116
- * Convert ArrayBuffer to hex string for comparison in tests
117
- */
118
- export function arrayBufferToHex(buffer) {
119
- const view = new Uint8Array(buffer);
120
- return Array.from(view)
121
- .map((b) => b.toString(16).padStart(2, '0'))
122
- .join('');
123
- }
124
- //# sourceMappingURL=testHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testHelpers.js","sourceRoot":"","sources":["../../../src/test/utils/testHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAiBH;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAkB;IAC/C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,YAAY,EAAE,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE;QACvC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,YAAY;QAC/B,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,GAAG,EAAE;KAC9C,CAAC,CAAC;IAEH,6DAA6D;IAC7D,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,IAAI,E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,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC3D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAClD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;SACpB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Test utilities for mocking browser APIs\n */\n\n/**\n * Mock file data structure\n */\nexport interface MockFileData {\n name: string;\n content: string;\n type?: string;\n lastModified?: number;\n webkitRelativePath?: string;\n}\n\n/**\n * Create a mock File object with all necessary properties and methods\n */\nexport function createMockFile(data: MockFileData): File {\n const blob = new Blob([data.content], { type: data.type || 'text/plain' });\n const file = new File([blob], data.name, {\n type: data.type || 'text/plain',\n lastModified: data.lastModified || Date.now()\n });\n\n // Add webkitRelativePath if provided (for directory uploads)\n if (data.webkitRelativePath) {\n Object.defineProperty(file, 'webkitRelativePath', {\n value: data.webkitRelativePath,\n writable: false,\n configurable: true\n });\n }\n\n // Ensure text() method works properly\n if (!file.text || typeof file.text !== 'function') {\n Object.defineProperty(file, 'text', {\n value: () => Promise.resolve(data.content),\n writable: false,\n configurable: true\n });\n }\n\n return file;\n}\n\n/**\n * Create a mock FileList using DataTransfer API\n * This is the most reliable method for creating FileList objects in tests\n */\nexport function createMockFileList(files: MockFileData[]): FileList {\n // Use DataTransfer to create a proper FileList\n const dt = new DataTransfer();\n\n files.forEach((fileData) => {\n const file = createMockFile(fileData);\n dt.items.add(file);\n });\n\n return dt.files;\n}\n\n/**\n * Create a mock FileList for directory upload simulation\n * Includes webkitRelativePath for each file\n */\nexport function createMockDirectoryFileList(\n directoryStructure: Array<{ path: string; content: string; type?: string }>\n): FileList {\n const files = directoryStructure.map((item) => ({\n name: item.path.split('/').pop() || '',\n content: item.content,\n type: item.type,\n webkitRelativePath: item.path\n }));\n\n return createMockFileList(files);\n}\n\n/**\n * Helper to create a promise that resolves after a delay\n * Useful for testing async operations\n */\nexport function delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Helper to verify File API text() method works correctly\n * Since we're using Blob/File polyfills, this ensures they have the right methods\n */\nexport async function verifyFileAPI(file: File): Promise<boolean> {\n try {\n // Check if text() method exists and works\n if (typeof file.text !== 'function') {\n throw new Error('File.text() method not available');\n }\n\n const text = await file.text();\n return typeof text === 'string';\n } catch {\n return false;\n }\n}\n\n/**\n * Mock Web Crypto digest result for testing\n * Creates a deterministic hash-like ArrayBuffer\n */\nexport function createMockDigest(input: string, algorithm: string = 'SHA-256'): ArrayBuffer {\n // Create a deterministic \"hash\" based on input for testing\n // This is not a real hash but good enough for testing\n const hashLength = algorithm.includes('256') ? 32 : algorithm.includes('512') ? 64 : 20;\n const buffer = new ArrayBuffer(hashLength);\n const view = new Uint8Array(buffer);\n\n // Fill with deterministic values based on input\n for (let i = 0; i < hashLength; i++) {\n view[i] = (input.charCodeAt(i % input.length) + i) % 256;\n }\n\n return buffer;\n}\n\n/**\n * Convert ArrayBuffer to hex string for comparison in tests\n */\nexport function arrayBufferToHex(buffer: ArrayBuffer): string {\n const view = new Uint8Array(buffer);\n return Array.from(view)\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('');\n}\n"]}
@@ -1,60 +0,0 @@
1
- [Home](../README.md) > CryptoUtils
2
-
3
- # Namespace: CryptoUtils
4
-
5
- Browser-compatible cryptographic utilities using the Web Crypto API.
6
-
7
- ## Classes
8
-
9
- <table><thead><tr><th>
10
-
11
- Name
12
-
13
- </th><th>
14
-
15
- Description
16
-
17
- </th></tr></thead>
18
- <tbody>
19
- <tr><td>
20
-
21
- [BrowserHashProvider](./classes/BrowserHashProvider.md)
22
-
23
- </td><td>
24
-
25
- Browser-compatible hash provider using the Web Crypto API.
26
-
27
- </td></tr>
28
- <tr><td>
29
-
30
- [BrowserCryptoProvider](./classes/BrowserCryptoProvider.md)
31
-
32
- </td><td>
33
-
34
- Browser implementation of `ICryptoProvider` using the Web Crypto API.
35
-
36
- </td></tr>
37
- </tbody></table>
38
-
39
- ## Functions
40
-
41
- <table><thead><tr><th>
42
-
43
- Name
44
-
45
- </th><th>
46
-
47
- Description
48
-
49
- </th></tr></thead>
50
- <tbody>
51
- <tr><td>
52
-
53
- [createBrowserCryptoProvider](./functions/createBrowserCryptoProvider.md)
54
-
55
- </td><td>
56
-
57
- Creates a CryptoUtils.BrowserCryptoProvider | BrowserCryptoProvider if Web
58
-
59
- </td></tr>
60
- </tbody></table>
@@ -1,27 +0,0 @@
1
- [Home](../../README.md) > [CryptoUtils](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > decrypt
2
-
3
- ## BrowserCryptoProvider.decrypt() method
4
-
5
- Decrypts ciphertext using AES-256-GCM.
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- decrypt(encryptedData: Uint8Array, key: Uint8Array, iv: Uint8Array, authTag: Uint8Array): Promise<Result<string>>;
11
- ```
12
-
13
- **Parameters:**
14
-
15
- <table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead>
16
- <tbody>
17
- <tr><td>encryptedData</td><td>Uint8Array</td><td>Encrypted bytes</td></tr>
18
- <tr><td>key</td><td>Uint8Array</td><td>32-byte decryption key</td></tr>
19
- <tr><td>iv</td><td>Uint8Array</td><td>Initialization vector (12 bytes)</td></tr>
20
- <tr><td>authTag</td><td>Uint8Array</td><td>GCM authentication tag (16 bytes)</td></tr>
21
- </tbody></table>
22
-
23
- **Returns:**
24
-
25
- Promise&lt;Result&lt;string&gt;&gt;
26
-
27
- `Success` with decrypted UTF-8 string, or `Failure` with an error.
@@ -1,26 +0,0 @@
1
- [Home](../../README.md) > [CryptoUtils](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > deriveKey
2
-
3
- ## BrowserCryptoProvider.deriveKey() method
4
-
5
- Derives a key from a password using PBKDF2.
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- deriveKey(password: string, salt: Uint8Array, iterations: number): Promise<Result<Uint8Array<ArrayBufferLike>>>;
11
- ```
12
-
13
- **Parameters:**
14
-
15
- <table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead>
16
- <tbody>
17
- <tr><td>password</td><td>string</td><td>Password string</td></tr>
18
- <tr><td>salt</td><td>Uint8Array</td><td>Salt bytes (should be at least 16 bytes)</td></tr>
19
- <tr><td>iterations</td><td>number</td><td>Number of iterations (recommend 100000+)</td></tr>
20
- </tbody></table>
21
-
22
- **Returns:**
23
-
24
- Promise&lt;Result&lt;Uint8Array&lt;ArrayBufferLike&gt;&gt;&gt;
25
-
26
- Success with derived 32-byte key, or Failure with error
@@ -1,25 +0,0 @@
1
- [Home](../../README.md) > [CryptoUtils](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > encrypt
2
-
3
- ## BrowserCryptoProvider.encrypt() method
4
-
5
- Encrypts plaintext using AES-256-GCM.
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- encrypt(plaintext: string, key: Uint8Array): Promise<Result<IEncryptionResult>>;
11
- ```
12
-
13
- **Parameters:**
14
-
15
- <table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead>
16
- <tbody>
17
- <tr><td>plaintext</td><td>string</td><td>UTF-8 string to encrypt</td></tr>
18
- <tr><td>key</td><td>Uint8Array</td><td>32-byte encryption key</td></tr>
19
- </tbody></table>
20
-
21
- **Returns:**
22
-
23
- Promise&lt;Result&lt;IEncryptionResult&gt;&gt;
24
-
25
- `Success` with encryption result, or `Failure` with an error.
@@ -1,24 +0,0 @@
1
- [Home](../../README.md) > [CryptoUtils](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > exportPublicKeyJwk
2
-
3
- ## BrowserCryptoProvider.exportPublicKeyJwk() method
4
-
5
- Exports a public `CryptoKey` as a JSON Web Key.
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- exportPublicKeyJwk(publicKey: CryptoKey): Promise<Result<JsonWebKey>>;
11
- ```
12
-
13
- **Parameters:**
14
-
15
- <table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead>
16
- <tbody>
17
- <tr><td>publicKey</td><td>CryptoKey</td><td>Extractable public key to export.</td></tr>
18
- </tbody></table>
19
-
20
- **Returns:**
21
-
22
- Promise&lt;Result&lt;JsonWebKey&gt;&gt;
23
-
24
- `Success` with the JWK, or `Failure` if not a public key or if export fails.
@@ -1,24 +0,0 @@
1
- [Home](../../README.md) > [CryptoUtils](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > fromBase64
2
-
3
- ## BrowserCryptoProvider.fromBase64() method
4
-
5
- Decodes base64 string to binary data.
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- fromBase64(base64: string): Result<Uint8Array<ArrayBufferLike>>;
11
- ```
12
-
13
- **Parameters:**
14
-
15
- <table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead>
16
- <tbody>
17
- <tr><td>base64</td><td>string</td><td>Base64-encoded string</td></tr>
18
- </tbody></table>
19
-
20
- **Returns:**
21
-
22
- Result&lt;Uint8Array&lt;ArrayBufferLike&gt;&gt;
23
-
24
- Success with decoded bytes, or Failure if invalid base64
@@ -1,17 +0,0 @@
1
- [Home](../../README.md) > [CryptoUtils](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > generateKey
2
-
3
- ## BrowserCryptoProvider.generateKey() method
4
-
5
- Generates a random 32-byte key suitable for AES-256.
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- generateKey(): Promise<Result<Uint8Array<ArrayBufferLike>>>;
11
- ```
12
-
13
- **Returns:**
14
-
15
- Promise&lt;Result&lt;Uint8Array&lt;ArrayBufferLike&gt;&gt;&gt;
16
-
17
- Success with generated key, or Failure with error