@fgv/ts-web-extras 5.1.0-16 → 5.1.0-18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/{f0f00bdb97aeaff654977812289f006f012e92e2.tar.log → 680645452ebdb4d7f294f08d3b45f143d69c3f5d.tar.log} +2 -2
- package/.rush/temp/chunked-rush-logs/ts-web-extras.build.chunks.jsonl +12 -12
- package/.rush/temp/operation/build/all.log +12 -12
- package/.rush/temp/operation/build/log-chunks.jsonl +12 -12
- package/.rush/temp/operation/build/state.json +1 -1
- package/dist/packlets/crypto-utils/browserCryptoProvider.js +58 -17
- package/dist/packlets/crypto-utils/browserCryptoProvider.js.map +1 -1
- package/dist/packlets/file-tree/fileApiTreeAccessors.js +1 -1
- package/dist/packlets/file-tree/fileApiTreeAccessors.js.map +1 -1
- package/dist/ts-web-extras.d.ts +28 -7
- package/docs/CryptoUtils/classes/BrowserCryptoProvider.exportPublicKeyJwk.md +24 -0
- package/docs/CryptoUtils/classes/BrowserCryptoProvider.generateKeyPair.md +25 -0
- package/docs/CryptoUtils/classes/BrowserCryptoProvider.importPublicKeyJwk.md +25 -0
- package/docs/CryptoUtils/classes/BrowserCryptoProvider.md +39 -0
- package/docs/classes/BrowserCryptoProvider.exportPublicKeyJwk.md +24 -0
- package/docs/classes/BrowserCryptoProvider.generateKeyPair.md +25 -0
- package/docs/classes/BrowserCryptoProvider.importPublicKeyJwk.md +25 -0
- package/docs/classes/BrowserCryptoProvider.md +39 -0
- package/docs/classes/FileApiTreeAccessors.extractFileMetadata.md +1 -1
- package/docs/classes/FileSystemAccessTreeAccessors.md +10 -10
- package/docs/classes/HttpTreeAccessors.deleteFile.md +4 -2
- package/docs/classes/HttpTreeAccessors.md +11 -11
- package/docs/classes/LocalStorageTreeAccessors.md +10 -10
- package/etc/ts-web-extras.api.md +5 -5
- package/lib/packlets/crypto-utils/browserCryptoProvider.d.ts +27 -5
- package/lib/packlets/crypto-utils/browserCryptoProvider.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/browserCryptoProvider.js +57 -16
- package/lib/packlets/crypto-utils/browserCryptoProvider.js.map +1 -1
- package/lib/packlets/file-tree/fileApiTreeAccessors.d.ts +1 -1
- package/lib/packlets/file-tree/fileApiTreeAccessors.js +1 -1
- package/lib/packlets/file-tree/fileApiTreeAccessors.js.map +1 -1
- package/package.json +10 -10
- package/rush-logs/ts-web-extras.build.cache.log +1 -1
- package/rush-logs/ts-web-extras.build.log +12 -12
- package/src/packlets/crypto-utils/browserCryptoProvider.ts +76 -22
- package/src/packlets/file-tree/fileApiTreeAccessors.ts +1 -1
- package/temp/build/typescript/ts_8nwakTlr.json +1 -1
- package/temp/coverage/crypto-utils/browserCryptoProvider.ts.html +189 -27
- package/temp/coverage/crypto-utils/browserHashProvider.ts.html +1 -1
- package/temp/coverage/crypto-utils/index.html +7 -7
- package/temp/coverage/file-tree/directoryHandleStore.ts.html +1 -1
- package/temp/coverage/file-tree/fileApiTreeAccessors.ts.html +2 -2
- package/temp/coverage/file-tree/fileSystemAccessTreeAccessors.ts.html +1 -1
- package/temp/coverage/file-tree/httpTreeAccessors.ts.html +1 -1
- package/temp/coverage/file-tree/index.html +1 -1
- package/temp/coverage/file-tree/localStorageTreeAccessors.ts.html +1 -1
- package/temp/coverage/helpers/fileTreeHelpers.ts.html +1 -1
- package/temp/coverage/helpers/index.html +1 -1
- package/temp/coverage/index.html +7 -7
- package/temp/coverage/lcov-report/crypto-utils/browserCryptoProvider.ts.html +189 -27
- package/temp/coverage/lcov-report/crypto-utils/browserHashProvider.ts.html +1 -1
- package/temp/coverage/lcov-report/crypto-utils/index.html +7 -7
- package/temp/coverage/lcov-report/file-tree/directoryHandleStore.ts.html +1 -1
- package/temp/coverage/lcov-report/file-tree/fileApiTreeAccessors.ts.html +2 -2
- package/temp/coverage/lcov-report/file-tree/fileSystemAccessTreeAccessors.ts.html +1 -1
- package/temp/coverage/lcov-report/file-tree/httpTreeAccessors.ts.html +1 -1
- package/temp/coverage/lcov-report/file-tree/index.html +1 -1
- package/temp/coverage/lcov-report/file-tree/localStorageTreeAccessors.ts.html +1 -1
- package/temp/coverage/lcov-report/helpers/fileTreeHelpers.ts.html +1 -1
- package/temp/coverage/lcov-report/helpers/index.html +1 -1
- package/temp/coverage/lcov-report/index.html +7 -7
- package/temp/coverage/lcov-report/url-utils/index.html +1 -1
- package/temp/coverage/lcov-report/url-utils/urlParams.ts.html +1 -1
- package/temp/coverage/lcov.info +75 -15
- package/temp/coverage/url-utils/index.html +1 -1
- package/temp/coverage/url-utils/urlParams.ts.html +1 -1
- package/temp/test/jest/haste-map-7492f1b44480e0cdd1f220078fb3afd8-c8dd6c3430605adeb2f1cadf4f75e791-8c9336785555d572065b28c111982ba4 +0 -0
- package/temp/test/jest/perf-cache-7492f1b44480e0cdd1f220078fb3afd8-da39a3ee5e6b4b0d3255bfef95601890 +1 -1
- package/temp/ts-web-extras.api.json +254 -5
- package/temp/ts-web-extras.api.md +5 -5
package/dist/ts-web-extras.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import { Result } from '@fgv/ts-utils';
|
|
|
24
24
|
*
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
declare class BrowserCryptoProvider implements ICryptoProvider {
|
|
27
|
+
declare class BrowserCryptoProvider implements CryptoUtils_2.ICryptoProvider {
|
|
28
28
|
private readonly _crypto;
|
|
29
29
|
/**
|
|
30
30
|
* Creates a new {@link CryptoUtils.BrowserCryptoProvider | BrowserCryptoProvider}.
|
|
@@ -37,7 +37,7 @@ declare class BrowserCryptoProvider implements ICryptoProvider {
|
|
|
37
37
|
* @param key - 32-byte encryption key
|
|
38
38
|
* @returns `Success` with encryption result, or `Failure` with an error.
|
|
39
39
|
*/
|
|
40
|
-
encrypt(plaintext: string, key: Uint8Array): Promise<Result<IEncryptionResult>>;
|
|
40
|
+
encrypt(plaintext: string, key: Uint8Array): Promise<Result<CryptoUtils_2.IEncryptionResult>>;
|
|
41
41
|
/**
|
|
42
42
|
* Decrypts ciphertext using AES-256-GCM.
|
|
43
43
|
* @param encryptedData - Encrypted bytes
|
|
@@ -84,6 +84,31 @@ declare class BrowserCryptoProvider implements ICryptoProvider {
|
|
|
84
84
|
* @returns Success with decoded bytes, or Failure if invalid base64
|
|
85
85
|
*/
|
|
86
86
|
fromBase64(base64: string): Result<Uint8Array>;
|
|
87
|
+
/**
|
|
88
|
+
* Generates a new asymmetric keypair via Web Crypto.
|
|
89
|
+
* @param algorithm - The algorithm to use.
|
|
90
|
+
* @param extractable - Whether the resulting keys may be exported.
|
|
91
|
+
* @returns `Success` with the generated `CryptoKeyPair`, or `Failure` with an error.
|
|
92
|
+
*/
|
|
93
|
+
generateKeyPair(algorithm: CryptoUtils_2.KeyPairAlgorithm, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
94
|
+
/**
|
|
95
|
+
* Exports a public `CryptoKey` as a JSON Web Key.
|
|
96
|
+
* @remarks
|
|
97
|
+
* Rejects non-public keys at runtime. WebCrypto's `exportKey('jwk', ...)`
|
|
98
|
+
* does not enforce public-vs-private; without this guard a caller that
|
|
99
|
+
* passed an extractable private key would receive its private fields
|
|
100
|
+
* (`d`, `p`, `q`, ...) as JWK, defeating the method's name.
|
|
101
|
+
* @param publicKey - Extractable public key to export.
|
|
102
|
+
* @returns `Success` with the JWK, or `Failure` if not a public key or if export fails.
|
|
103
|
+
*/
|
|
104
|
+
exportPublicKeyJwk(publicKey: CryptoKey): Promise<Result<JsonWebKey>>;
|
|
105
|
+
/**
|
|
106
|
+
* Imports a public-key JWK as a `CryptoKey` for the requested algorithm.
|
|
107
|
+
* @param jwk - The JSON Web Key produced by a prior export.
|
|
108
|
+
* @param algorithm - The algorithm the key was generated for.
|
|
109
|
+
* @returns `Success` with the imported public `CryptoKey`, or `Failure` with an error.
|
|
110
|
+
*/
|
|
111
|
+
importPublicKeyJwk(jwk: JsonWebKey, algorithm: CryptoUtils_2.KeyPairAlgorithm): Promise<Result<CryptoKey>>;
|
|
87
112
|
}
|
|
88
113
|
|
|
89
114
|
/**
|
|
@@ -331,7 +356,7 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
|
|
|
331
356
|
static getOriginalFile(fileList: FileList, targetPath: string): Result<File>;
|
|
332
357
|
/**
|
|
333
358
|
* Extract file metadata from a File.
|
|
334
|
-
* @param
|
|
359
|
+
* @param file - The File to extract metadata from
|
|
335
360
|
* @returns The {@link IFileMetadata | file metadata}
|
|
336
361
|
*/
|
|
337
362
|
static extractFileMetadata(file: File): IFileMetadata;
|
|
@@ -751,8 +776,6 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
|
|
|
751
776
|
private static _requestWithParams;
|
|
752
777
|
}
|
|
753
778
|
|
|
754
|
-
declare type ICryptoProvider = CryptoUtils_2.ICryptoProvider;
|
|
755
|
-
|
|
756
779
|
/**
|
|
757
780
|
* Tree initializer for File System Access API directory handles.
|
|
758
781
|
* @public
|
|
@@ -763,8 +786,6 @@ declare function extractFileListMetadata(fileList: FileList): Array<IFileMetadat
|
|
|
763
786
|
readonly nonRecursive?: boolean;
|
|
764
787
|
}
|
|
765
788
|
|
|
766
|
-
declare type IEncryptionResult = CryptoUtils_2.IEncryptionResult;
|
|
767
|
-
|
|
768
789
|
/**
|
|
769
790
|
* Tree initializer for File System Access API file handles.
|
|
770
791
|
* @public
|
|
@@ -0,0 +1,24 @@
|
|
|
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<Result<JsonWebKey>>
|
|
23
|
+
|
|
24
|
+
`Success` with the JWK, or `Failure` if not a public key or if export fails.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[Home](../../README.md) > [CryptoUtils](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > generateKeyPair
|
|
2
|
+
|
|
3
|
+
## BrowserCryptoProvider.generateKeyPair() method
|
|
4
|
+
|
|
5
|
+
Generates a new asymmetric keypair via Web Crypto.
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
generateKeyPair(algorithm: KeyPairAlgorithm, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
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>algorithm</td><td>KeyPairAlgorithm</td><td>The algorithm to use.</td></tr>
|
|
18
|
+
<tr><td>extractable</td><td>boolean</td><td>Whether the resulting keys may be exported.</td></tr>
|
|
19
|
+
</tbody></table>
|
|
20
|
+
|
|
21
|
+
**Returns:**
|
|
22
|
+
|
|
23
|
+
Promise<Result<CryptoKeyPair>>
|
|
24
|
+
|
|
25
|
+
`Success` with the generated `CryptoKeyPair`, or `Failure` with an error.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[Home](../../README.md) > [CryptoUtils](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > importPublicKeyJwk
|
|
2
|
+
|
|
3
|
+
## BrowserCryptoProvider.importPublicKeyJwk() method
|
|
4
|
+
|
|
5
|
+
Imports a public-key JWK as a `CryptoKey` for the requested algorithm.
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
importPublicKeyJwk(jwk: JsonWebKey, algorithm: KeyPairAlgorithm): Promise<Result<CryptoKey>>;
|
|
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>jwk</td><td>JsonWebKey</td><td>The JSON Web Key produced by a prior export.</td></tr>
|
|
18
|
+
<tr><td>algorithm</td><td>KeyPairAlgorithm</td><td>The algorithm the key was generated for.</td></tr>
|
|
19
|
+
</tbody></table>
|
|
20
|
+
|
|
21
|
+
**Returns:**
|
|
22
|
+
|
|
23
|
+
Promise<Result<CryptoKey>>
|
|
24
|
+
|
|
25
|
+
`Success` with the imported public `CryptoKey`, or `Failure` with an error.
|
|
@@ -160,5 +160,44 @@ Encodes binary data to base64 string.
|
|
|
160
160
|
|
|
161
161
|
Decodes base64 string to binary data.
|
|
162
162
|
|
|
163
|
+
</td></tr>
|
|
164
|
+
<tr><td>
|
|
165
|
+
|
|
166
|
+
[generateKeyPair(algorithm, extractable)](./BrowserCryptoProvider.generateKeyPair.md)
|
|
167
|
+
|
|
168
|
+
</td><td>
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
</td><td>
|
|
173
|
+
|
|
174
|
+
Generates a new asymmetric keypair via Web Crypto.
|
|
175
|
+
|
|
176
|
+
</td></tr>
|
|
177
|
+
<tr><td>
|
|
178
|
+
|
|
179
|
+
[exportPublicKeyJwk(publicKey)](./BrowserCryptoProvider.exportPublicKeyJwk.md)
|
|
180
|
+
|
|
181
|
+
</td><td>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
</td><td>
|
|
186
|
+
|
|
187
|
+
Exports a public `CryptoKey` as a JSON Web Key.
|
|
188
|
+
|
|
189
|
+
</td></tr>
|
|
190
|
+
<tr><td>
|
|
191
|
+
|
|
192
|
+
[importPublicKeyJwk(jwk, algorithm)](./BrowserCryptoProvider.importPublicKeyJwk.md)
|
|
193
|
+
|
|
194
|
+
</td><td>
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
</td><td>
|
|
199
|
+
|
|
200
|
+
Imports a public-key JWK as a `CryptoKey` for the requested algorithm.
|
|
201
|
+
|
|
163
202
|
</td></tr>
|
|
164
203
|
</tbody></table>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[Home](../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<Result<JsonWebKey>>
|
|
23
|
+
|
|
24
|
+
`Success` with the JWK, or `Failure` if not a public key or if export fails.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[Home](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > generateKeyPair
|
|
2
|
+
|
|
3
|
+
## BrowserCryptoProvider.generateKeyPair() method
|
|
4
|
+
|
|
5
|
+
Generates a new asymmetric keypair via Web Crypto.
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
generateKeyPair(algorithm: KeyPairAlgorithm, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
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>algorithm</td><td>KeyPairAlgorithm</td><td>The algorithm to use.</td></tr>
|
|
18
|
+
<tr><td>extractable</td><td>boolean</td><td>Whether the resulting keys may be exported.</td></tr>
|
|
19
|
+
</tbody></table>
|
|
20
|
+
|
|
21
|
+
**Returns:**
|
|
22
|
+
|
|
23
|
+
Promise<Result<CryptoKeyPair>>
|
|
24
|
+
|
|
25
|
+
`Success` with the generated `CryptoKeyPair`, or `Failure` with an error.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[Home](../README.md) > [BrowserCryptoProvider](./BrowserCryptoProvider.md) > importPublicKeyJwk
|
|
2
|
+
|
|
3
|
+
## BrowserCryptoProvider.importPublicKeyJwk() method
|
|
4
|
+
|
|
5
|
+
Imports a public-key JWK as a `CryptoKey` for the requested algorithm.
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
importPublicKeyJwk(jwk: JsonWebKey, algorithm: KeyPairAlgorithm): Promise<Result<CryptoKey>>;
|
|
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>jwk</td><td>JsonWebKey</td><td>The JSON Web Key produced by a prior export.</td></tr>
|
|
18
|
+
<tr><td>algorithm</td><td>KeyPairAlgorithm</td><td>The algorithm the key was generated for.</td></tr>
|
|
19
|
+
</tbody></table>
|
|
20
|
+
|
|
21
|
+
**Returns:**
|
|
22
|
+
|
|
23
|
+
Promise<Result<CryptoKey>>
|
|
24
|
+
|
|
25
|
+
`Success` with the imported public `CryptoKey`, or `Failure` with an error.
|
|
@@ -160,5 +160,44 @@ Encodes binary data to base64 string.
|
|
|
160
160
|
|
|
161
161
|
Decodes base64 string to binary data.
|
|
162
162
|
|
|
163
|
+
</td></tr>
|
|
164
|
+
<tr><td>
|
|
165
|
+
|
|
166
|
+
[generateKeyPair(algorithm, extractable)](./BrowserCryptoProvider.generateKeyPair.md)
|
|
167
|
+
|
|
168
|
+
</td><td>
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
</td><td>
|
|
173
|
+
|
|
174
|
+
Generates a new asymmetric keypair via Web Crypto.
|
|
175
|
+
|
|
176
|
+
</td></tr>
|
|
177
|
+
<tr><td>
|
|
178
|
+
|
|
179
|
+
[exportPublicKeyJwk(publicKey)](./BrowserCryptoProvider.exportPublicKeyJwk.md)
|
|
180
|
+
|
|
181
|
+
</td><td>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
</td><td>
|
|
186
|
+
|
|
187
|
+
Exports a public `CryptoKey` as a JSON Web Key.
|
|
188
|
+
|
|
189
|
+
</td></tr>
|
|
190
|
+
<tr><td>
|
|
191
|
+
|
|
192
|
+
[importPublicKeyJwk(jwk, algorithm)](./BrowserCryptoProvider.importPublicKeyJwk.md)
|
|
193
|
+
|
|
194
|
+
</td><td>
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
</td><td>
|
|
199
|
+
|
|
200
|
+
Imports a public-key JWK as a `CryptoKey` for the requested algorithm.
|
|
201
|
+
|
|
163
202
|
</td></tr>
|
|
164
203
|
</tbody></table>
|
|
@@ -14,7 +14,7 @@ static extractFileMetadata(file: File): IFileMetadata;
|
|
|
14
14
|
|
|
15
15
|
<table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead>
|
|
16
16
|
<tbody>
|
|
17
|
-
<tr><td>file</td><td>File</td><td
|
|
17
|
+
<tr><td>file</td><td>File</td><td>The File to extract metadata from</td></tr>
|
|
18
18
|
</tbody></table>
|
|
19
19
|
|
|
20
20
|
**Returns:**
|
|
@@ -152,7 +152,7 @@ Implements `FileTree.IMutableFileTreeAccessors.fileIsMutable`
|
|
|
152
152
|
|
|
153
153
|
</td><td>
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
Resolves paths to an absolute path.
|
|
156
156
|
|
|
157
157
|
</td></tr>
|
|
158
158
|
<tr><td>
|
|
@@ -165,7 +165,7 @@ FileTree.IFileTreeAccessors.resolveAbsolutePath
|
|
|
165
165
|
|
|
166
166
|
</td><td>
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
Gets the extension of a path.
|
|
169
169
|
|
|
170
170
|
</td></tr>
|
|
171
171
|
<tr><td>
|
|
@@ -178,7 +178,7 @@ FileTree.IFileTreeAccessors.getExtension
|
|
|
178
178
|
|
|
179
179
|
</td><td>
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
Gets the base name of a path.
|
|
182
182
|
|
|
183
183
|
</td></tr>
|
|
184
184
|
<tr><td>
|
|
@@ -191,7 +191,7 @@ FileTree.IFileTreeAccessors.getBaseName
|
|
|
191
191
|
|
|
192
192
|
</td><td>
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
Joins paths together.
|
|
195
195
|
|
|
196
196
|
</td></tr>
|
|
197
197
|
<tr><td>
|
|
@@ -204,7 +204,7 @@ FileTree.IFileTreeAccessors.joinPaths
|
|
|
204
204
|
|
|
205
205
|
</td><td>
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
Gets an item from the file tree.
|
|
208
208
|
|
|
209
209
|
</td></tr>
|
|
210
210
|
<tr><td>
|
|
@@ -217,7 +217,7 @@ FileTree.IFileTreeAccessors.getItem
|
|
|
217
217
|
|
|
218
218
|
</td><td>
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
Gets the contents of a file in the file tree.
|
|
221
221
|
|
|
222
222
|
</td></tr>
|
|
223
223
|
<tr><td>
|
|
@@ -230,7 +230,7 @@ FileTree.IFileTreeAccessors.getFileContents
|
|
|
230
230
|
|
|
231
231
|
</td><td>
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
Gets the content type of a file in the file tree.
|
|
234
234
|
|
|
235
235
|
</td></tr>
|
|
236
236
|
<tr><td>
|
|
@@ -243,7 +243,7 @@ FileTree.IFileTreeAccessors.getFileContentType
|
|
|
243
243
|
|
|
244
244
|
</td><td>
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
Gets the children of a directory in the file tree.
|
|
247
247
|
|
|
248
248
|
</td></tr>
|
|
249
249
|
<tr><td>
|
|
@@ -256,7 +256,7 @@ FileTree.IFileTreeAccessors.getChildren
|
|
|
256
256
|
|
|
257
257
|
</td><td>
|
|
258
258
|
|
|
259
|
-
|
|
259
|
+
Creates a directory at the given path, including any missing parent directories.
|
|
260
260
|
|
|
261
261
|
</td></tr>
|
|
262
262
|
<tr><td>
|
|
@@ -269,7 +269,7 @@ FileTree.IMutableFileTreeAccessors.createDirectory
|
|
|
269
269
|
|
|
270
270
|
</td><td>
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
Deletes a directory at the given path.
|
|
273
273
|
|
|
274
274
|
</td></tr>
|
|
275
275
|
</tbody></table>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## HttpTreeAccessors.deleteFile() method
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Deletes a file at the given path.
|
|
6
6
|
|
|
7
7
|
**Signature:**
|
|
8
8
|
|
|
@@ -14,9 +14,11 @@ deleteFile(path: string): Result<boolean>;
|
|
|
14
14
|
|
|
15
15
|
<table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead>
|
|
16
16
|
<tbody>
|
|
17
|
-
<tr><td>path</td><td>string</td><td
|
|
17
|
+
<tr><td>path</td><td>string</td><td>The path of the file to delete.</td></tr>
|
|
18
18
|
</tbody></table>
|
|
19
19
|
|
|
20
20
|
**Returns:**
|
|
21
21
|
|
|
22
22
|
Result<boolean>
|
|
23
|
+
|
|
24
|
+
`Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
@@ -99,7 +99,7 @@ Gets the list of paths for all dirty files.
|
|
|
99
99
|
|
|
100
100
|
</td><td>
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
Deletes a file at the given path.
|
|
103
103
|
|
|
104
104
|
</td></tr>
|
|
105
105
|
<tr><td>
|
|
@@ -138,7 +138,7 @@ Checks if a file is mutable (can be modified).
|
|
|
138
138
|
|
|
139
139
|
</td><td>
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
Resolves paths to an absolute path.
|
|
142
142
|
|
|
143
143
|
</td></tr>
|
|
144
144
|
<tr><td>
|
|
@@ -151,7 +151,7 @@ FileTree.IFileTreeAccessors.resolveAbsolutePath
|
|
|
151
151
|
|
|
152
152
|
</td><td>
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
Gets the extension of a path.
|
|
155
155
|
|
|
156
156
|
</td></tr>
|
|
157
157
|
<tr><td>
|
|
@@ -164,7 +164,7 @@ FileTree.IFileTreeAccessors.getExtension
|
|
|
164
164
|
|
|
165
165
|
</td><td>
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
Gets the base name of a path.
|
|
168
168
|
|
|
169
169
|
</td></tr>
|
|
170
170
|
<tr><td>
|
|
@@ -177,7 +177,7 @@ FileTree.IFileTreeAccessors.getBaseName
|
|
|
177
177
|
|
|
178
178
|
</td><td>
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
Joins paths together.
|
|
181
181
|
|
|
182
182
|
</td></tr>
|
|
183
183
|
<tr><td>
|
|
@@ -190,7 +190,7 @@ FileTree.IFileTreeAccessors.joinPaths
|
|
|
190
190
|
|
|
191
191
|
</td><td>
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
Gets an item from the file tree.
|
|
194
194
|
|
|
195
195
|
</td></tr>
|
|
196
196
|
<tr><td>
|
|
@@ -203,7 +203,7 @@ FileTree.IFileTreeAccessors.getItem
|
|
|
203
203
|
|
|
204
204
|
</td><td>
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
Gets the contents of a file in the file tree.
|
|
207
207
|
|
|
208
208
|
</td></tr>
|
|
209
209
|
<tr><td>
|
|
@@ -216,7 +216,7 @@ FileTree.IFileTreeAccessors.getFileContents
|
|
|
216
216
|
|
|
217
217
|
</td><td>
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
Gets the content type of a file in the file tree.
|
|
220
220
|
|
|
221
221
|
</td></tr>
|
|
222
222
|
<tr><td>
|
|
@@ -229,7 +229,7 @@ FileTree.IFileTreeAccessors.getFileContentType
|
|
|
229
229
|
|
|
230
230
|
</td><td>
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
Gets the children of a directory in the file tree.
|
|
233
233
|
|
|
234
234
|
</td></tr>
|
|
235
235
|
<tr><td>
|
|
@@ -242,7 +242,7 @@ FileTree.IFileTreeAccessors.getChildren
|
|
|
242
242
|
|
|
243
243
|
</td><td>
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
Creates a directory at the given path, including any missing parent directories.
|
|
246
246
|
|
|
247
247
|
</td></tr>
|
|
248
248
|
<tr><td>
|
|
@@ -255,7 +255,7 @@ FileTree.IMutableFileTreeAccessors.createDirectory
|
|
|
255
255
|
|
|
256
256
|
</td><td>
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
Deletes a directory at the given path.
|
|
259
259
|
|
|
260
260
|
</td></tr>
|
|
261
261
|
</tbody></table>
|
|
@@ -147,7 +147,7 @@ Check if a file is mutable and return persistence detail.
|
|
|
147
147
|
|
|
148
148
|
</td><td>
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
Resolves paths to an absolute path.
|
|
151
151
|
|
|
152
152
|
</td></tr>
|
|
153
153
|
<tr><td>
|
|
@@ -160,7 +160,7 @@ FileTree.IFileTreeAccessors.resolveAbsolutePath
|
|
|
160
160
|
|
|
161
161
|
</td><td>
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
Gets the extension of a path.
|
|
164
164
|
|
|
165
165
|
</td></tr>
|
|
166
166
|
<tr><td>
|
|
@@ -173,7 +173,7 @@ FileTree.IFileTreeAccessors.getExtension
|
|
|
173
173
|
|
|
174
174
|
</td><td>
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
Gets the base name of a path.
|
|
177
177
|
|
|
178
178
|
</td></tr>
|
|
179
179
|
<tr><td>
|
|
@@ -186,7 +186,7 @@ FileTree.IFileTreeAccessors.getBaseName
|
|
|
186
186
|
|
|
187
187
|
</td><td>
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
Joins paths together.
|
|
190
190
|
|
|
191
191
|
</td></tr>
|
|
192
192
|
<tr><td>
|
|
@@ -199,7 +199,7 @@ FileTree.IFileTreeAccessors.joinPaths
|
|
|
199
199
|
|
|
200
200
|
</td><td>
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
Gets an item from the file tree.
|
|
203
203
|
|
|
204
204
|
</td></tr>
|
|
205
205
|
<tr><td>
|
|
@@ -212,7 +212,7 @@ FileTree.IFileTreeAccessors.getItem
|
|
|
212
212
|
|
|
213
213
|
</td><td>
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
Gets the contents of a file in the file tree.
|
|
216
216
|
|
|
217
217
|
</td></tr>
|
|
218
218
|
<tr><td>
|
|
@@ -225,7 +225,7 @@ FileTree.IFileTreeAccessors.getFileContents
|
|
|
225
225
|
|
|
226
226
|
</td><td>
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
Gets the content type of a file in the file tree.
|
|
229
229
|
|
|
230
230
|
</td></tr>
|
|
231
231
|
<tr><td>
|
|
@@ -238,7 +238,7 @@ FileTree.IFileTreeAccessors.getFileContentType
|
|
|
238
238
|
|
|
239
239
|
</td><td>
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
Gets the children of a directory in the file tree.
|
|
242
242
|
|
|
243
243
|
</td></tr>
|
|
244
244
|
<tr><td>
|
|
@@ -251,7 +251,7 @@ FileTree.IFileTreeAccessors.getChildren
|
|
|
251
251
|
|
|
252
252
|
</td><td>
|
|
253
253
|
|
|
254
|
-
|
|
254
|
+
Creates a directory at the given path, including any missing parent directories.
|
|
255
255
|
|
|
256
256
|
</td></tr>
|
|
257
257
|
<tr><td>
|
|
@@ -264,7 +264,7 @@ FileTree.IMutableFileTreeAccessors.createDirectory
|
|
|
264
264
|
|
|
265
265
|
</td><td>
|
|
266
266
|
|
|
267
|
-
|
|
267
|
+
Deletes a directory at the given path.
|
|
268
268
|
|
|
269
269
|
</td></tr>
|
|
270
270
|
</tbody></table>
|
package/etc/ts-web-extras.api.md
CHANGED
|
@@ -10,19 +10,19 @@ import { FileTree } from '@fgv/ts-json-base';
|
|
|
10
10
|
import { Logging } from '@fgv/ts-utils';
|
|
11
11
|
import { Result } from '@fgv/ts-utils';
|
|
12
12
|
|
|
13
|
-
// Warning: (ae-forgotten-export) The symbol "ICryptoProvider" needs to be exported by the entry point index.d.ts
|
|
14
|
-
//
|
|
15
13
|
// @public
|
|
16
|
-
class BrowserCryptoProvider implements ICryptoProvider {
|
|
14
|
+
class BrowserCryptoProvider implements CryptoUtils_2.ICryptoProvider {
|
|
17
15
|
// Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver
|
|
18
16
|
constructor(cryptoApi?: Crypto);
|
|
19
17
|
decrypt(encryptedData: Uint8Array, key: Uint8Array, iv: Uint8Array, authTag: Uint8Array): Promise<Result<string>>;
|
|
20
18
|
deriveKey(password: string, salt: Uint8Array, iterations: number): Promise<Result<Uint8Array>>;
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
encrypt(plaintext: string, key: Uint8Array): Promise<Result<CryptoUtils_2.IEncryptionResult>>;
|
|
20
|
+
exportPublicKeyJwk(publicKey: CryptoKey): Promise<Result<JsonWebKey>>;
|
|
23
21
|
fromBase64(base64: string): Result<Uint8Array>;
|
|
24
22
|
generateKey(): Promise<Result<Uint8Array>>;
|
|
23
|
+
generateKeyPair(algorithm: CryptoUtils_2.KeyPairAlgorithm, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
25
24
|
generateRandomBytes(length: number): Result<Uint8Array>;
|
|
25
|
+
importPublicKeyJwk(jwk: JsonWebKey, algorithm: CryptoUtils_2.KeyPairAlgorithm): Promise<Result<CryptoKey>>;
|
|
26
26
|
sha256(data: string): Promise<Result<string>>;
|
|
27
27
|
toBase64(data: Uint8Array): string;
|
|
28
28
|
}
|