shifro 0.2.0 → 1.1.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 DELETED
@@ -1,101 +0,0 @@
1
- //#region lib/process.d.ts
2
- type EncryptionScheme = 'cenc' | 'cbcs';
3
- type TransformSampleParams = {
4
- encryptionScheme?: EncryptionScheme;
5
- data: Uint8Array;
6
- iv: Uint8Array;
7
- timestamp: number;
8
- };
9
- type TransformSampleFn = (params: TransformSampleParams) => Promise<Uint8Array | null>;
10
- //#endregion
11
- //#region lib/stream.d.ts
12
- interface ProcessStreamOptions {
13
- transformSample: TransformSampleFn;
14
- onProgress?: (bytesProcessed: number) => void;
15
- preventClose?: boolean;
16
- }
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
- }
81
- //#endregion
82
- //#region shifro.d.ts
83
- declare const decryptWithKey: (key: Uint8Array, params: TransformSampleParams) => Promise<Uint8Array<ArrayBuffer>>;
84
- type DecryptWithKey = {
85
- key: string;
86
- keyId?: string;
87
- encryptionScheme?: EncryptionScheme;
88
- };
89
- type DecryptWithCallback = {
90
- keyId?: string;
91
- transformSample: (params: TransformSampleParams) => Promise<Uint8Array | null>;
92
- };
93
- type DecryptParams = DecryptWithKey | DecryptWithCallback;
94
- declare const decryptSegment: (segment: Uint8Array, params: DecryptParams) => Promise<Uint8Array<ArrayBufferLike>>;
95
- declare const decryptStream: (readable: ReadableStream, writable: WritableStream, {
96
- preventClose,
97
- onProgress,
98
- ...params
99
- }: DecryptParams & Omit<ProcessStreamOptions, "transformSample">) => Promise<void>;
100
- //#endregion
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 DELETED
@@ -1,101 +0,0 @@
1
- //#region lib/process.d.ts
2
- type EncryptionScheme = 'cenc' | 'cbcs';
3
- type TransformSampleParams = {
4
- encryptionScheme?: EncryptionScheme;
5
- data: Uint8Array;
6
- iv: Uint8Array;
7
- timestamp: number;
8
- };
9
- type TransformSampleFn = (params: TransformSampleParams) => Promise<Uint8Array | null>;
10
- //#endregion
11
- //#region lib/stream.d.ts
12
- interface ProcessStreamOptions {
13
- transformSample: TransformSampleFn;
14
- onProgress?: (bytesProcessed: number) => void;
15
- preventClose?: boolean;
16
- }
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
- }
81
- //#endregion
82
- //#region shifro.d.ts
83
- declare const decryptWithKey: (key: Uint8Array, params: TransformSampleParams) => Promise<Uint8Array<ArrayBuffer>>;
84
- type DecryptWithKey = {
85
- key: string;
86
- keyId?: string;
87
- encryptionScheme?: EncryptionScheme;
88
- };
89
- type DecryptWithCallback = {
90
- keyId?: string;
91
- transformSample: (params: TransformSampleParams) => Promise<Uint8Array | null>;
92
- };
93
- type DecryptParams = DecryptWithKey | DecryptWithCallback;
94
- declare const decryptSegment: (segment: Uint8Array, params: DecryptParams) => Promise<Uint8Array<ArrayBufferLike>>;
95
- declare const decryptStream: (readable: ReadableStream, writable: WritableStream, {
96
- preventClose,
97
- onProgress,
98
- ...params
99
- }: DecryptParams & Omit<ProcessStreamOptions, "transformSample">) => Promise<void>;
100
- //#endregion
101
- export { BufferSource, BufferTarget, DecryptParams, Decryption, DecryptionOptions, FilePathSource, FilePathTarget, Input, InputOptions, InputSource, Output, OutputOptions, OutputTarget, type ProcessStreamOptions, StreamSource, StreamTarget, type TransformSampleParams, decryptSegment, decryptStream, decryptWithKey };