shifro 0.1.1 → 0.2.0

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/dist/shifro.d.cts CHANGED
@@ -7,7 +7,6 @@ type TransformSampleParams = {
7
7
  timestamp: number;
8
8
  };
9
9
  type TransformSampleFn = (params: TransformSampleParams) => Promise<Uint8Array | null>;
10
-
11
10
  //#endregion
12
11
  //#region lib/stream.d.ts
13
12
  interface ProcessStreamOptions {
@@ -15,7 +14,70 @@ interface ProcessStreamOptions {
15
14
  onProgress?: (bytesProcessed: number) => void;
16
15
  preventClose?: boolean;
17
16
  }
18
-
17
+ //#endregion
18
+ //#region lib/api.d.ts
19
+ declare class FilePathSource {
20
+ filePath: string;
21
+ readable: ReadableStream;
22
+ constructor(filePath: string);
23
+ }
24
+ declare class FilePathTarget {
25
+ filePath: string;
26
+ writable: WritableStream;
27
+ constructor(filePath: string);
28
+ }
29
+ declare class StreamSource {
30
+ readable: ReadableStream;
31
+ constructor(readable: ReadableStream);
32
+ }
33
+ declare class StreamTarget {
34
+ writable: WritableStream;
35
+ constructor(writable: WritableStream);
36
+ }
37
+ declare class BufferSource {
38
+ buffer: Uint8Array;
39
+ readable: ReadableStream;
40
+ constructor(buffer: Uint8Array);
41
+ }
42
+ declare class BufferTarget {
43
+ writable: WritableStream;
44
+ buffer: Uint8Array | null;
45
+ constructor();
46
+ }
47
+ type InputSource = FilePathSource | StreamSource | BufferSource;
48
+ type InputOptions = {
49
+ source: InputSource;
50
+ };
51
+ declare class Input {
52
+ source: InputSource;
53
+ constructor(options: InputOptions);
54
+ }
55
+ type OutputTarget = FilePathTarget | StreamTarget | BufferTarget;
56
+ type OutputOptions = {
57
+ target: OutputTarget;
58
+ };
59
+ declare class Output {
60
+ target: OutputTarget;
61
+ constructor(options: OutputOptions);
62
+ }
63
+ type DecryptionOptions = {
64
+ input: Input;
65
+ output: Output;
66
+ keys: {
67
+ kid?: string;
68
+ key: string;
69
+ }[];
70
+ onProgress?: (bytesProcessed: number) => void;
71
+ };
72
+ declare class Decryption {
73
+ #private;
74
+ private decrypt;
75
+ input: Input;
76
+ output: Output;
77
+ static init(options: DecryptionOptions): Promise<Decryption>;
78
+ constructor(options: DecryptionOptions);
79
+ execute(): Promise<void>;
80
+ }
19
81
  //#endregion
20
82
  //#region shifro.d.ts
21
83
  declare const decryptWithKey: (key: Uint8Array, params: TransformSampleParams) => Promise<Uint8Array<ArrayBuffer>>;
@@ -35,6 +97,5 @@ declare const decryptStream: (readable: ReadableStream, writable: WritableStream
35
97
  onProgress,
36
98
  ...params
37
99
  }: DecryptParams & Omit<ProcessStreamOptions, "transformSample">) => Promise<void>;
38
-
39
100
  //#endregion
40
- export { DecryptParams, ProcessStreamOptions, TransformSampleParams, decryptSegment, decryptStream, decryptWithKey };
101
+ export { BufferSource, BufferTarget, DecryptParams, Decryption, DecryptionOptions, FilePathSource, FilePathTarget, Input, InputOptions, InputSource, Output, OutputOptions, OutputTarget, type ProcessStreamOptions, StreamSource, StreamTarget, type TransformSampleParams, decryptSegment, decryptStream, decryptWithKey };
package/dist/shifro.d.ts CHANGED
@@ -7,7 +7,6 @@ type TransformSampleParams = {
7
7
  timestamp: number;
8
8
  };
9
9
  type TransformSampleFn = (params: TransformSampleParams) => Promise<Uint8Array | null>;
10
-
11
10
  //#endregion
12
11
  //#region lib/stream.d.ts
13
12
  interface ProcessStreamOptions {
@@ -15,7 +14,70 @@ interface ProcessStreamOptions {
15
14
  onProgress?: (bytesProcessed: number) => void;
16
15
  preventClose?: boolean;
17
16
  }
18
-
17
+ //#endregion
18
+ //#region lib/api.d.ts
19
+ declare class FilePathSource {
20
+ filePath: string;
21
+ readable: ReadableStream;
22
+ constructor(filePath: string);
23
+ }
24
+ declare class FilePathTarget {
25
+ filePath: string;
26
+ writable: WritableStream;
27
+ constructor(filePath: string);
28
+ }
29
+ declare class StreamSource {
30
+ readable: ReadableStream;
31
+ constructor(readable: ReadableStream);
32
+ }
33
+ declare class StreamTarget {
34
+ writable: WritableStream;
35
+ constructor(writable: WritableStream);
36
+ }
37
+ declare class BufferSource {
38
+ buffer: Uint8Array;
39
+ readable: ReadableStream;
40
+ constructor(buffer: Uint8Array);
41
+ }
42
+ declare class BufferTarget {
43
+ writable: WritableStream;
44
+ buffer: Uint8Array | null;
45
+ constructor();
46
+ }
47
+ type InputSource = FilePathSource | StreamSource | BufferSource;
48
+ type InputOptions = {
49
+ source: InputSource;
50
+ };
51
+ declare class Input {
52
+ source: InputSource;
53
+ constructor(options: InputOptions);
54
+ }
55
+ type OutputTarget = FilePathTarget | StreamTarget | BufferTarget;
56
+ type OutputOptions = {
57
+ target: OutputTarget;
58
+ };
59
+ declare class Output {
60
+ target: OutputTarget;
61
+ constructor(options: OutputOptions);
62
+ }
63
+ type DecryptionOptions = {
64
+ input: Input;
65
+ output: Output;
66
+ keys: {
67
+ kid?: string;
68
+ key: string;
69
+ }[];
70
+ onProgress?: (bytesProcessed: number) => void;
71
+ };
72
+ declare class Decryption {
73
+ #private;
74
+ private decrypt;
75
+ input: Input;
76
+ output: Output;
77
+ static init(options: DecryptionOptions): Promise<Decryption>;
78
+ constructor(options: DecryptionOptions);
79
+ execute(): Promise<void>;
80
+ }
19
81
  //#endregion
20
82
  //#region shifro.d.ts
21
83
  declare const decryptWithKey: (key: Uint8Array, params: TransformSampleParams) => Promise<Uint8Array<ArrayBuffer>>;
@@ -35,6 +97,5 @@ declare const decryptStream: (readable: ReadableStream, writable: WritableStream
35
97
  onProgress,
36
98
  ...params
37
99
  }: DecryptParams & Omit<ProcessStreamOptions, "transformSample">) => Promise<void>;
38
-
39
100
  //#endregion
40
- export { DecryptParams, ProcessStreamOptions, TransformSampleParams, decryptSegment, decryptStream, decryptWithKey };
101
+ export { BufferSource, BufferTarget, DecryptParams, Decryption, DecryptionOptions, FilePathSource, FilePathTarget, Input, InputOptions, InputSource, Output, OutputOptions, OutputTarget, type ProcessStreamOptions, StreamSource, StreamTarget, type TransformSampleParams, decryptSegment, decryptStream, decryptWithKey };