@storacha/encrypt-upload-client 1.1.76-rc.2 → 1.1.76-rc.4

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 (36) hide show
  1. package/dist/config/service.d.ts +13 -13
  2. package/dist/core/client.d.ts +41 -54
  3. package/dist/core/errors.d.ts +6 -6
  4. package/dist/core/metadata/kms-metadata.d.ts +36 -68
  5. package/dist/core/metadata/lit-metadata.d.ts +28 -63
  6. package/dist/crypto/factories.browser.d.ts +5 -9
  7. package/dist/crypto/factories.node.d.ts +5 -1
  8. package/dist/crypto/factories.node.d.ts.map +1 -1
  9. package/dist/crypto/factories.node.js +4 -2
  10. package/dist/crypto/index.d.ts +5 -5
  11. package/dist/crypto/symmetric/generic-aes-ctr-streaming-crypto.d.ts +54 -58
  12. package/dist/crypto/symmetric/node-aes-cbc-crypto.d.ts +32 -36
  13. package/dist/examples/decrypt-test.d.ts +2 -2
  14. package/dist/handlers/encrypt-handler.d.ts +3 -9
  15. package/dist/index.d.ts +2 -2
  16. package/dist/test/cid-verification.spec.d.ts +2 -2
  17. package/dist/test/crypto-compatibility.spec.d.ts +2 -2
  18. package/dist/test/crypto-counter-security.spec.d.ts +2 -2
  19. package/dist/test/crypto-streaming.spec.d.ts +2 -2
  20. package/dist/test/encrypted-metadata.spec.d.ts +2 -2
  21. package/dist/test/factories.spec.d.ts +2 -2
  22. package/dist/test/file-metadata.spec.d.ts +2 -2
  23. package/dist/test/fixtures/test-fixtures.d.ts +20 -25
  24. package/dist/test/helpers/test-file-utils.d.ts +14 -19
  25. package/dist/test/https-enforcement.spec.d.ts +2 -2
  26. package/dist/test/kms-crypto-adapter.spec.d.ts +2 -2
  27. package/dist/test/lit-crypto-adapter.spec.d.ts +2 -2
  28. package/dist/test/memory-efficiency.spec.d.ts +2 -2
  29. package/dist/test/mocks/key-manager.d.ts +38 -71
  30. package/dist/test/node-crypto-adapter.spec.d.ts +2 -2
  31. package/dist/test/node-generic-crypto-adapter.spec.d.ts +2 -2
  32. package/dist/test/setup.d.ts +2 -2
  33. package/dist/tsconfig.spec.tsbuildinfo +1 -1
  34. package/dist/utils/file-metadata.d.ts +13 -19
  35. package/dist/utils.d.ts +5 -14
  36. package/package.json +3 -3
@@ -1,14 +1,14 @@
1
- export const accessServiceURL: URL
2
- export const accessServicePrincipal: client.PrincipalView<'did:web:web3.storage'>
3
- export const accessServiceConnection: client.ConnectionView<any>
4
- export const uploadServiceURL: URL
5
- export const uploadServicePrincipal: client.PrincipalView<'did:web:web3.storage'>
6
- export const uploadServiceConnection: client.ConnectionView<any>
7
- export const filecoinServiceURL: URL
8
- export const filecoinServicePrincipal: client.PrincipalView<'did:web:web3.storage'>
9
- export const filecoinServiceConnection: client.ConnectionView<any>
1
+ export const accessServiceURL: URL;
2
+ export const accessServicePrincipal: client.PrincipalView<"did:web:web3.storage">;
3
+ export const accessServiceConnection: client.ConnectionView<any>;
4
+ export const uploadServiceURL: URL;
5
+ export const uploadServicePrincipal: client.PrincipalView<"did:web:web3.storage">;
6
+ export const uploadServiceConnection: client.ConnectionView<any>;
7
+ export const filecoinServiceURL: URL;
8
+ export const filecoinServicePrincipal: client.PrincipalView<"did:web:web3.storage">;
9
+ export const filecoinServiceConnection: client.ConnectionView<any>;
10
10
  /** @type {import('@storacha/client/types').ServiceConf} */
11
- export const serviceConf: import('@storacha/client/types').ServiceConf
12
- export const receiptsEndpoint: URL
13
- import * as client from '@ucanto/client'
14
- //# sourceMappingURL=service.d.ts.map
11
+ export const serviceConf: import("@storacha/client/types").ServiceConf;
12
+ export const receiptsEndpoint: URL;
13
+ import * as client from '@ucanto/client';
14
+ //# sourceMappingURL=service.d.ts.map
@@ -1,57 +1,44 @@
1
1
  /** @implements {Type.EncryptedClient} */
2
2
  export class EncryptedClient implements Type.EncryptedClient {
3
- /**
4
- * @param {import('@storacha/client').Client} storachaClient
5
- * @param {Type.CryptoAdapter} cryptoAdapter
6
- * @param {URL} gatewayURL
7
- */
8
- constructor(
9
- storachaClient: import('@storacha/client').Client,
10
- cryptoAdapter: Type.CryptoAdapter,
11
- gatewayURL: URL
12
- )
13
- /**
14
- * @type {Type.CryptoAdapter}
15
- * @protected
16
- */
17
- protected _cryptoAdapter: Type.CryptoAdapter
18
- /**
19
- * @type {import('@storacha/client').Client}
20
- * @protected
21
- */
22
- protected _storachaClient: import('@storacha/client').Client
23
- /**
24
- * @type {URL}
25
- * @protected
26
- */
27
- protected _gatewayURL: URL
28
- /**
29
- * Encrypt and upload a file to the Storacha network
30
- *
31
- * @param {Type.BlobLike} file - The file to upload
32
- * @param {Type.EncryptionConfig} encryptionConfig - User-provided encryption configuration
33
- * @param {Type.UploadOptions} [uploadOptions] - User-provided upload options
34
- * @returns {Promise<Type.AnyLink>} - The link to the uploaded file
35
- */
36
- encryptAndUploadFile(
37
- file: Type.BlobLike,
38
- encryptionConfig: Type.EncryptionConfig,
39
- uploadOptions?: Type.UploadOptions
40
- ): Promise<Type.AnyLink>
41
- /**
42
- * Retrieve and decrypt a file from the Storacha network
43
- *
44
- * @param {Type.AnyLink} cid - The link to the file to retrieve
45
- * @param {Type.DecryptionConfig} decryptionConfig - User-provided decryption config
46
- * @returns {Promise<Type.DecryptionResult>} - The decrypted file with metadata
47
- */
48
- retrieveAndDecryptFile(
49
- cid: Type.AnyLink,
50
- decryptionConfig: Type.DecryptionConfig
51
- ): Promise<Type.DecryptionResult>
3
+ /**
4
+ * @param {import('@storacha/client').Client} storachaClient
5
+ * @param {Type.CryptoAdapter} cryptoAdapter
6
+ * @param {URL} gatewayURL
7
+ */
8
+ constructor(storachaClient: import("@storacha/client").Client, cryptoAdapter: Type.CryptoAdapter, gatewayURL: URL);
9
+ /**
10
+ * @type {Type.CryptoAdapter}
11
+ * @protected
12
+ */
13
+ protected _cryptoAdapter: Type.CryptoAdapter;
14
+ /**
15
+ * @type {import('@storacha/client').Client}
16
+ * @protected
17
+ */
18
+ protected _storachaClient: import("@storacha/client").Client;
19
+ /**
20
+ * @type {URL}
21
+ * @protected
22
+ */
23
+ protected _gatewayURL: URL;
24
+ /**
25
+ * Encrypt and upload a file to the Storacha network
26
+ *
27
+ * @param {Type.BlobLike} file - The file to upload
28
+ * @param {Type.EncryptionConfig} encryptionConfig - User-provided encryption configuration
29
+ * @param {Type.UploadOptions} [uploadOptions] - User-provided upload options
30
+ * @returns {Promise<Type.AnyLink>} - The link to the uploaded file
31
+ */
32
+ encryptAndUploadFile(file: Type.BlobLike, encryptionConfig: Type.EncryptionConfig, uploadOptions?: Type.UploadOptions): Promise<Type.AnyLink>;
33
+ /**
34
+ * Retrieve and decrypt a file from the Storacha network
35
+ *
36
+ * @param {Type.AnyLink} cid - The link to the file to retrieve
37
+ * @param {Type.DecryptionConfig} decryptionConfig - User-provided decryption config
38
+ * @returns {Promise<Type.DecryptionResult>} - The decrypted file with metadata
39
+ */
40
+ retrieveAndDecryptFile(cid: Type.AnyLink, decryptionConfig: Type.DecryptionConfig): Promise<Type.DecryptionResult>;
52
41
  }
53
- export function create(
54
- options: Type.EncryptedClientOptions
55
- ): Promise<EncryptedClient>
56
- import * as Type from '../types.js'
57
- //# sourceMappingURL=client.d.ts.map
42
+ export function create(options: Type.EncryptedClientOptions): Promise<EncryptedClient>;
43
+ import * as Type from '../types.js';
44
+ //# sourceMappingURL=client.d.ts.map
@@ -1,8 +1,8 @@
1
1
  export class UnknownFormat extends Failure {
2
- /** @param {string} [reason] */
3
- constructor(reason?: string)
4
- name: 'UnknownFormat'
5
- #private
2
+ /** @param {string} [reason] */
3
+ constructor(reason?: string);
4
+ name: "UnknownFormat";
5
+ #private;
6
6
  }
7
- import { Failure } from '@ucanto/core'
8
- //# sourceMappingURL=errors.d.ts.map
7
+ import { Failure } from '@ucanto/core';
8
+ //# sourceMappingURL=errors.d.ts.map
@@ -1,68 +1,36 @@
1
- export const version: 'encrypted-metadata@0.2'
2
- export const KMSMetadataSchema: Schema.VariantSchema<
3
- {
4
- 'encrypted-metadata@0.2': Schema.StructSchema<
5
- {
6
- encryptedDataCID: Schema.Schema<
7
- Link.Link<unknown, number, number, 0 | 1>,
8
- any
9
- >
10
- encryptedSymmetricKey: Schema.StringSchema<string, unknown>
11
- space: Schema.StringSchema<string, unknown>
12
- kms: Schema.StructSchema<
13
- {
14
- provider: Schema.StringSchema<string, unknown>
15
- keyId: Schema.StringSchema<string, unknown>
16
- algorithm: Schema.StringSchema<string, unknown>
17
- },
18
- any
19
- >
20
- },
21
- unknown
22
- >
23
- },
24
- unknown
25
- >
26
- export const KMSMetadataInputSchema: Schema.StructSchema<
27
- {
28
- encryptedDataCID: Schema.StringSchema<string, unknown>
29
- encryptedSymmetricKey: Schema.StringSchema<string, unknown>
30
- space: Schema.StringSchema<string, unknown>
31
- kms: Schema.StructSchema<
32
- {
33
- provider: Schema.StringSchema<string, unknown>
34
- keyId: Schema.StringSchema<string, unknown>
35
- algorithm: Schema.StringSchema<string, unknown>
36
- },
37
- any
38
- >
39
- },
40
- unknown
41
- >
42
- export function create(
43
- kmsMetadataInput: Types.KMSMetadata | Types.KMSMetadataInput
44
- ): Types.KMSMetadataView
45
- export function toJSON(
46
- kmsMetadata: Types.KMSMetadataView
47
- ): Types.KMSMetadataInput
48
- export function parse(
49
- kmsMetadataInput: Types.KMSMetadataInput
50
- ): Types.KMSMetadata
51
- export function archiveBlock(
52
- kmsMetadataInput: Types.KMSMetadata
53
- ): Promise<import('@ucanto/interface').Block>
54
- export function archive(
55
- kmsMetadata: Types.KMSMetadata
56
- ): Promise<Types.Result<Uint8Array>>
57
- export function extract(
58
- archive: Uint8Array
59
- ): Types.Result<Types.KMSMetadataView, Types.UnknownFormat>
60
- export function view({
61
- root,
62
- }: {
63
- root: Types.IPLDBlock
64
- }): Types.Result<Types.KMSMetadataView, Types.UnknownFormat>
65
- import * as Link from 'multiformats/link'
66
- import { Schema } from '@ucanto/core'
67
- import * as Types from '../../types.js'
68
- //# sourceMappingURL=kms-metadata.d.ts.map
1
+ export const version: "encrypted-metadata@0.2";
2
+ export const KMSMetadataSchema: Schema.VariantSchema<{
3
+ "encrypted-metadata@0.2": Schema.StructSchema<{
4
+ encryptedDataCID: Schema.Schema<Link.Link<unknown, number, number, 0 | 1>, any>;
5
+ encryptedSymmetricKey: Schema.StringSchema<string, unknown>;
6
+ space: Schema.StringSchema<string, unknown>;
7
+ kms: Schema.StructSchema<{
8
+ provider: Schema.StringSchema<string, unknown>;
9
+ keyId: Schema.StringSchema<string, unknown>;
10
+ algorithm: Schema.StringSchema<string, unknown>;
11
+ }, any>;
12
+ }, unknown>;
13
+ }, unknown>;
14
+ export const KMSMetadataInputSchema: Schema.StructSchema<{
15
+ encryptedDataCID: Schema.StringSchema<string, unknown>;
16
+ encryptedSymmetricKey: Schema.StringSchema<string, unknown>;
17
+ space: Schema.StringSchema<string, unknown>;
18
+ kms: Schema.StructSchema<{
19
+ provider: Schema.StringSchema<string, unknown>;
20
+ keyId: Schema.StringSchema<string, unknown>;
21
+ algorithm: Schema.StringSchema<string, unknown>;
22
+ }, any>;
23
+ }, unknown>;
24
+ export function create(kmsMetadataInput: Types.KMSMetadata | Types.KMSMetadataInput): Types.KMSMetadataView;
25
+ export function toJSON(kmsMetadata: Types.KMSMetadataView): Types.KMSMetadataInput;
26
+ export function parse(kmsMetadataInput: Types.KMSMetadataInput): Types.KMSMetadata;
27
+ export function archiveBlock(kmsMetadataInput: Types.KMSMetadata): Promise<import("@ucanto/interface").Block>;
28
+ export function archive(kmsMetadata: Types.KMSMetadata): Promise<Types.Result<Uint8Array>>;
29
+ export function extract(archive: Uint8Array): Types.Result<Types.KMSMetadataView, Types.UnknownFormat>;
30
+ export function view({ root }: {
31
+ root: Types.IPLDBlock;
32
+ }): Types.Result<Types.KMSMetadataView, Types.UnknownFormat>;
33
+ import * as Link from 'multiformats/link';
34
+ import { Schema } from '@ucanto/core';
35
+ import * as Types from '../../types.js';
36
+ //# sourceMappingURL=kms-metadata.d.ts.map
@@ -1,63 +1,28 @@
1
- export const version: 'encrypted-metadata@0.1'
2
- export const LitMetadataSchema: Schema.VariantSchema<
3
- {
4
- 'encrypted-metadata@0.1': Schema.StructSchema<
5
- {
6
- encryptedDataCID: Schema.Schema<
7
- Link.Link<unknown, number, number, 0 | 1>,
8
- any
9
- >
10
- identityBoundCiphertext: Schema.Schema<
11
- Uint8Array<ArrayBufferLike>,
12
- unknown
13
- >
14
- plaintextKeyHash: Schema.Schema<Uint8Array<ArrayBufferLike>, unknown>
15
- accessControlConditions: Schema.Schema<
16
- Schema.Dictionary<string, unknown>[],
17
- unknown
18
- >
19
- },
20
- unknown
21
- >
22
- },
23
- unknown
24
- >
25
- export const LitMetadataInputSchema: Schema.StructSchema<
26
- {
27
- encryptedDataCID: Schema.StringSchema<string, unknown>
28
- identityBoundCiphertext: Schema.StringSchema<string, unknown>
29
- plaintextKeyHash: Schema.StringSchema<string, unknown>
30
- accessControlConditions: Schema.Schema<
31
- Schema.Dictionary<string, unknown>[],
32
- unknown
33
- >
34
- },
35
- unknown
36
- >
37
- export function create(
38
- encryptedMetadataInput: Types.LitMetadata | Types.LitMetadataInput
39
- ): Types.LitMetadataView
40
- export function toJSON(
41
- encryptedMetadata: Types.LitMetadataView
42
- ): Types.LitMetadataInput
43
- export function parse(
44
- encryptedMetadataInput: Types.LitMetadataInput
45
- ): Types.LitMetadata
46
- export function archiveBlock(
47
- encryptedMetadataInput: Types.LitMetadata
48
- ): Promise<import('@ucanto/interface').Block>
49
- export function archive(
50
- encryptedMetadata: Types.LitMetadata
51
- ): Promise<Types.Result<Uint8Array>>
52
- export function extract(
53
- archive: Uint8Array
54
- ): Types.Result<Types.LitMetadataView, Types.UnknownFormat>
55
- export function view({
56
- root,
57
- }: {
58
- root: Types.IPLDBlock
59
- }): Types.Result<Types.LitMetadataView, Types.UnknownFormat>
60
- import * as Link from 'multiformats/link'
61
- import { Schema } from '@ucanto/core'
62
- import * as Types from '../../types.js'
63
- //# sourceMappingURL=lit-metadata.d.ts.map
1
+ export const version: "encrypted-metadata@0.1";
2
+ export const LitMetadataSchema: Schema.VariantSchema<{
3
+ "encrypted-metadata@0.1": Schema.StructSchema<{
4
+ encryptedDataCID: Schema.Schema<Link.Link<unknown, number, number, 0 | 1>, any>;
5
+ identityBoundCiphertext: Schema.Schema<Uint8Array<ArrayBufferLike>, unknown>;
6
+ plaintextKeyHash: Schema.Schema<Uint8Array<ArrayBufferLike>, unknown>;
7
+ accessControlConditions: Schema.Schema<Schema.Dictionary<string, unknown>[], unknown>;
8
+ }, unknown>;
9
+ }, unknown>;
10
+ export const LitMetadataInputSchema: Schema.StructSchema<{
11
+ encryptedDataCID: Schema.StringSchema<string, unknown>;
12
+ identityBoundCiphertext: Schema.StringSchema<string, unknown>;
13
+ plaintextKeyHash: Schema.StringSchema<string, unknown>;
14
+ accessControlConditions: Schema.Schema<Schema.Dictionary<string, unknown>[], unknown>;
15
+ }, unknown>;
16
+ export function create(encryptedMetadataInput: Types.LitMetadata | Types.LitMetadataInput): Types.LitMetadataView;
17
+ export function toJSON(encryptedMetadata: Types.LitMetadataView): Types.LitMetadataInput;
18
+ export function parse(encryptedMetadataInput: Types.LitMetadataInput): Types.LitMetadata;
19
+ export function archiveBlock(encryptedMetadataInput: Types.LitMetadata): Promise<import("@ucanto/interface").Block>;
20
+ export function archive(encryptedMetadata: Types.LitMetadata): Promise<Types.Result<Uint8Array>>;
21
+ export function extract(archive: Uint8Array): Types.Result<Types.LitMetadataView, Types.UnknownFormat>;
22
+ export function view({ root }: {
23
+ root: Types.IPLDBlock;
24
+ }): Types.Result<Types.LitMetadataView, Types.UnknownFormat>;
25
+ import * as Link from 'multiformats/link';
26
+ import { Schema } from '@ucanto/core';
27
+ import * as Types from '../../types.js';
28
+ //# sourceMappingURL=lit-metadata.d.ts.map
@@ -8,12 +8,8 @@
8
8
  * @param {object} [options] - Optional configuration
9
9
  * @param {boolean} [options.allowInsecureHttp] - Allow HTTP for testing (NOT for production)
10
10
  */
11
- export function createGenericKMSAdapter(
12
- keyManagerServiceURL: URL | string,
13
- keyManagerServiceDID: string,
14
- options?: {
15
- allowInsecureHttp?: boolean | undefined
16
- }
17
- ): KMSCryptoAdapter
18
- import { KMSCryptoAdapter } from './adapters/kms-crypto-adapter.js'
19
- //# sourceMappingURL=factories.browser.d.ts.map
11
+ export function createGenericKMSAdapter(keyManagerServiceURL: URL | string, keyManagerServiceDID: string, options?: {
12
+ allowInsecureHttp?: boolean | undefined;
13
+ }): KMSCryptoAdapter;
14
+ import { KMSCryptoAdapter } from './adapters/kms-crypto-adapter.js';
15
+ //# sourceMappingURL=factories.browser.d.ts.map
@@ -4,8 +4,12 @@
4
4
  *
5
5
  * @param {URL|string} keyManagerServiceURL
6
6
  * @param {string} keyManagerServiceDID
7
+ * @param {object} [options] - Optional configuration
8
+ * @param {boolean} [options.allowInsecureHttp] - Allow HTTP for testing (NOT for production)
7
9
  */
8
- export function createGenericKMSAdapter(keyManagerServiceURL: URL | string, keyManagerServiceDID: string): KMSCryptoAdapter;
10
+ export function createGenericKMSAdapter(keyManagerServiceURL: URL | string, keyManagerServiceDID: string, options?: {
11
+ allowInsecureHttp?: boolean | undefined;
12
+ }): KMSCryptoAdapter;
9
13
  /**
10
14
  * Create a Lit crypto adapter for Node.js using the generic AES-CTR streaming crypto.
11
15
  * Works in Node.js & browser environments.
@@ -1 +1 @@
1
- {"version":3,"file":"factories.node.d.ts","sourceRoot":"","sources":["../../src/crypto/factories.node.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,8DAHW,GAAG,GAAC,MAAM,wBACV,MAAM,oBAYhB;AAED;;;;;;GAMG;AACH,mDAHW,OAAO,0BAA0B,EAAE,aAAa,eAChD,IAAI,CAAC,WAAW,oBAK1B;iCAjCgC,kCAAkC;sBAE7C,aAAa;iCADF,kCAAkC"}
1
+ {"version":3,"file":"factories.node.d.ts","sourceRoot":"","sources":["../../src/crypto/factories.node.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,8DALW,GAAG,GAAC,MAAM,wBACV,MAAM,YAEd;IAA0B,iBAAiB;CAC7C,oBAaA;AAED;;;;;;GAMG;AACH,mDAHW,OAAO,0BAA0B,EAAE,aAAa,eAChD,IAAI,CAAC,WAAW,oBAK1B;iCArCgC,kCAAkC;sBAE7C,aAAa;iCADF,kCAAkC"}
@@ -8,11 +8,13 @@ import * as Type from '../types.js';
8
8
  *
9
9
  * @param {URL|string} keyManagerServiceURL
10
10
  * @param {string} keyManagerServiceDID
11
+ * @param {object} [options] - Optional configuration
12
+ * @param {boolean} [options.allowInsecureHttp] - Allow HTTP for testing (NOT for production)
11
13
  */
12
- export function createGenericKMSAdapter(keyManagerServiceURL, keyManagerServiceDID) {
14
+ export function createGenericKMSAdapter(keyManagerServiceURL, keyManagerServiceDID, options = {}) {
13
15
  const symmetricCrypto = new GenericAesCtrStreamingCrypto();
14
16
  return new KMSCryptoAdapter(symmetricCrypto, keyManagerServiceURL,
15
- /** @type {`did:${string}:${string}`} */ (keyManagerServiceDID));
17
+ /** @type {`did:${string}:${string}`} */ (keyManagerServiceDID), options);
16
18
  }
17
19
  /**
18
20
  * Create a Lit crypto adapter for Node.js using the generic AES-CTR streaming crypto.
@@ -1,5 +1,5 @@
1
- export { GenericAesCtrStreamingCrypto } from './symmetric/generic-aes-ctr-streaming-crypto.js'
2
- export { NodeAesCbcCrypto } from './symmetric/node-aes-cbc-crypto.js'
3
- export { LitCryptoAdapter } from './adapters/lit-crypto-adapter.js'
4
- export { KMSCryptoAdapter } from './adapters/kms-crypto-adapter.js'
5
- //# sourceMappingURL=index.d.ts.map
1
+ export { GenericAesCtrStreamingCrypto } from "./symmetric/generic-aes-ctr-streaming-crypto.js";
2
+ export { NodeAesCbcCrypto } from "./symmetric/node-aes-cbc-crypto.js";
3
+ export { LitCryptoAdapter } from "./adapters/lit-crypto-adapter.js";
4
+ export { KMSCryptoAdapter } from "./adapters/kms-crypto-adapter.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -19,62 +19,58 @@
19
19
  * @implements {Type.SymmetricCrypto}
20
20
  */
21
21
  export class GenericAesCtrStreamingCrypto implements Type.SymmetricCrypto {
22
- /**
23
- * Generate a random AES key
24
- *
25
- * @returns {Promise<Uint8Array>} A random AES key
26
- */
27
- generateKey(): Promise<Uint8Array>
28
- /**
29
- * Properly increment AES-CTR counter with 128-bit arithmetic
30
- *
31
- * @param {Uint8Array} counter - The base counter (16 bytes)
32
- * @param {number} increment - The value to add
33
- * @returns {Uint8Array} - New counter with proper carry propagation
34
- */
35
- incrementCounter(counter: Uint8Array, increment: number): Uint8Array
36
- /**
37
- * Encrypt a stream of data using AES-CTR with TRUE streaming (no buffering).
38
- *
39
- * @param {Blob} data The data to encrypt.
40
- * @returns {Promise<{ key: Uint8Array, iv: Uint8Array, encryptedStream: ReadableStream }>}
41
- */
42
- encryptStream(data: Blob): Promise<{
43
- key: Uint8Array
44
- iv: Uint8Array
45
- encryptedStream: ReadableStream
46
- }>
47
- /**
48
- * Decrypt a stream of data using AES-CTR with TRUE streaming (no buffering).
49
- *
50
- * @param {ReadableStream} encryptedData The encrypted data stream.
51
- * @param {Uint8Array} key The encryption key.
52
- * @param {Uint8Array} iv The initialization vector (counter).
53
- * @returns {Promise<ReadableStream>} A stream of decrypted data.
54
- */
55
- decryptStream(
56
- encryptedData: ReadableStream,
57
- key: Uint8Array,
58
- iv: Uint8Array
59
- ): Promise<ReadableStream>
60
- /**
61
- * Combine key and IV into a single array for AES-CTR
62
- *
63
- * @param {Uint8Array} key - The AES key (KEY_LENGTH/8 bytes)
64
- * @param {Uint8Array} iv - The AES-CTR IV (IV_LENGTH bytes)
65
- * @returns {Uint8Array} Combined key and IV (KEY_LENGTH/8 + IV_LENGTH bytes)
66
- */
67
- combineKeyAndIV(key: Uint8Array, iv: Uint8Array): Uint8Array
68
- /**
69
- * Split combined key and IV for AES-CTR
70
- *
71
- * @param {Uint8Array} combined - Combined key and IV (KEY_LENGTH/8 + IV_LENGTH bytes)
72
- * @returns {{ key: Uint8Array, iv: Uint8Array }} Separated key and IV
73
- */
74
- splitKeyAndIV(combined: Uint8Array): {
75
- key: Uint8Array
76
- iv: Uint8Array
77
- }
22
+ /**
23
+ * Generate a random AES key
24
+ *
25
+ * @returns {Promise<Uint8Array>} A random AES key
26
+ */
27
+ generateKey(): Promise<Uint8Array>;
28
+ /**
29
+ * Properly increment AES-CTR counter with 128-bit arithmetic
30
+ *
31
+ * @param {Uint8Array} counter - The base counter (16 bytes)
32
+ * @param {number} increment - The value to add
33
+ * @returns {Uint8Array} - New counter with proper carry propagation
34
+ */
35
+ incrementCounter(counter: Uint8Array, increment: number): Uint8Array;
36
+ /**
37
+ * Encrypt a stream of data using AES-CTR with TRUE streaming (no buffering).
38
+ *
39
+ * @param {Blob} data The data to encrypt.
40
+ * @returns {Promise<{ key: Uint8Array, iv: Uint8Array, encryptedStream: ReadableStream }>}
41
+ */
42
+ encryptStream(data: Blob): Promise<{
43
+ key: Uint8Array;
44
+ iv: Uint8Array;
45
+ encryptedStream: ReadableStream;
46
+ }>;
47
+ /**
48
+ * Decrypt a stream of data using AES-CTR with TRUE streaming (no buffering).
49
+ *
50
+ * @param {ReadableStream} encryptedData The encrypted data stream.
51
+ * @param {Uint8Array} key The encryption key.
52
+ * @param {Uint8Array} iv The initialization vector (counter).
53
+ * @returns {Promise<ReadableStream>} A stream of decrypted data.
54
+ */
55
+ decryptStream(encryptedData: ReadableStream, key: Uint8Array, iv: Uint8Array): Promise<ReadableStream>;
56
+ /**
57
+ * Combine key and IV into a single array for AES-CTR
58
+ *
59
+ * @param {Uint8Array} key - The AES key (KEY_LENGTH/8 bytes)
60
+ * @param {Uint8Array} iv - The AES-CTR IV (IV_LENGTH bytes)
61
+ * @returns {Uint8Array} Combined key and IV (KEY_LENGTH/8 + IV_LENGTH bytes)
62
+ */
63
+ combineKeyAndIV(key: Uint8Array, iv: Uint8Array): Uint8Array;
64
+ /**
65
+ * Split combined key and IV for AES-CTR
66
+ *
67
+ * @param {Uint8Array} combined - Combined key and IV (KEY_LENGTH/8 + IV_LENGTH bytes)
68
+ * @returns {{ key: Uint8Array, iv: Uint8Array }} Separated key and IV
69
+ */
70
+ splitKeyAndIV(combined: Uint8Array): {
71
+ key: Uint8Array;
72
+ iv: Uint8Array;
73
+ };
78
74
  }
79
- import * as Type from '../../types.js'
80
- //# sourceMappingURL=generic-aes-ctr-streaming-crypto.d.ts.map
75
+ import * as Type from '../../types.js';
76
+ //# sourceMappingURL=generic-aes-ctr-streaming-crypto.d.ts.map
@@ -8,40 +8,36 @@
8
8
  * @implements {Type.SymmetricCrypto}
9
9
  */
10
10
  export class NodeAesCbcCrypto implements Type.SymmetricCrypto {
11
- /** @param {Type.BlobLike} data */
12
- encryptStream(data: Type.BlobLike): Promise<{
13
- key: Buffer<ArrayBufferLike>
14
- iv: Buffer<ArrayBufferLike>
15
- encryptedStream: ReadableStream<any>
16
- }>
17
- /**
18
- * @param {ReadableStream} encryptedData
19
- * @param {Uint8Array} key
20
- * @param {Uint8Array} iv
21
- */
22
- decryptStream(
23
- encryptedData: ReadableStream,
24
- key: Uint8Array,
25
- iv: Uint8Array
26
- ): Promise<ReadableStream<any>>
27
- /**
28
- * Combine key and IV into a single array for AES-CBC
29
- *
30
- * @param {Uint8Array} key - The AES key (KEY_LENGTH/8 bytes)
31
- * @param {Uint8Array} iv - The AES-CBC IV (IV_LENGTH bytes)
32
- * @returns {Uint8Array} Combined key and IV (KEY_LENGTH/8 + IV_LENGTH bytes)
33
- */
34
- combineKeyAndIV(key: Uint8Array, iv: Uint8Array): Uint8Array
35
- /**
36
- * Split combined key and IV for AES-CBC
37
- *
38
- * @param {Uint8Array} combined - Combined key and IV (KEY_LENGTH/8 + IV_LENGTH bytes)
39
- * @returns {{ key: Uint8Array, iv: Uint8Array }} Separated key and IV
40
- */
41
- splitKeyAndIV(combined: Uint8Array): {
42
- key: Uint8Array
43
- iv: Uint8Array
44
- }
11
+ /** @param {Type.BlobLike} data */
12
+ encryptStream(data: Type.BlobLike): Promise<{
13
+ key: Buffer<ArrayBufferLike>;
14
+ iv: Buffer<ArrayBufferLike>;
15
+ encryptedStream: ReadableStream<any>;
16
+ }>;
17
+ /**
18
+ * @param {ReadableStream} encryptedData
19
+ * @param {Uint8Array} key
20
+ * @param {Uint8Array} iv
21
+ */
22
+ decryptStream(encryptedData: ReadableStream, key: Uint8Array, iv: Uint8Array): Promise<ReadableStream<any>>;
23
+ /**
24
+ * Combine key and IV into a single array for AES-CBC
25
+ *
26
+ * @param {Uint8Array} key - The AES key (KEY_LENGTH/8 bytes)
27
+ * @param {Uint8Array} iv - The AES-CBC IV (IV_LENGTH bytes)
28
+ * @returns {Uint8Array} Combined key and IV (KEY_LENGTH/8 + IV_LENGTH bytes)
29
+ */
30
+ combineKeyAndIV(key: Uint8Array, iv: Uint8Array): Uint8Array;
31
+ /**
32
+ * Split combined key and IV for AES-CBC
33
+ *
34
+ * @param {Uint8Array} combined - Combined key and IV (KEY_LENGTH/8 + IV_LENGTH bytes)
35
+ * @returns {{ key: Uint8Array, iv: Uint8Array }} Separated key and IV
36
+ */
37
+ splitKeyAndIV(combined: Uint8Array): {
38
+ key: Uint8Array;
39
+ iv: Uint8Array;
40
+ };
45
41
  }
46
- import * as Type from '../../types.js'
47
- //# sourceMappingURL=node-aes-cbc-crypto.d.ts.map
42
+ import * as Type from '../../types.js';
43
+ //# sourceMappingURL=node-aes-cbc-crypto.d.ts.map
@@ -1,2 +1,2 @@
1
- export {}
2
- //# sourceMappingURL=decrypt-test.d.ts.map
1
+ export {};
2
+ //# sourceMappingURL=decrypt-test.d.ts.map
@@ -1,9 +1,3 @@
1
- export function encryptAndUpload(
2
- storachaClient: import('@storacha/client').Client,
3
- cryptoAdapter: Type.CryptoAdapter,
4
- file: Type.BlobLike,
5
- encryptionConfig: Type.EncryptionConfig,
6
- uploadOptions?: Type.UploadOptions
7
- ): Promise<Type.AnyLink>
8
- import * as Type from '../types.js'
9
- //# sourceMappingURL=encrypt-handler.d.ts.map
1
+ export function encryptAndUpload(storachaClient: import("@storacha/client").Client, cryptoAdapter: Type.CryptoAdapter, file: Type.BlobLike, encryptionConfig: Type.EncryptionConfig, uploadOptions?: Type.UploadOptions): Promise<Type.AnyLink>;
2
+ import * as Type from '../types.js';
3
+ //# sourceMappingURL=encrypt-handler.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { create } from './core/client.js'
2
- //# sourceMappingURL=index.d.ts.map
1
+ export { create } from "./core/client.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export {}
2
- //# sourceMappingURL=cid-verification.spec.d.ts.map
1
+ export {};
2
+ //# sourceMappingURL=cid-verification.spec.d.ts.map