@storacha/encrypt-upload-client 1.1.74 → 1.1.76-rc.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/README.md +1 -0
- package/dist/config/service.d.ts +13 -13
- package/dist/core/client.d.ts +54 -41
- package/dist/core/errors.d.ts +6 -6
- package/dist/core/metadata/encrypted-metadata.d.ts +13 -8
- package/dist/core/metadata/kms-metadata.d.ts +68 -36
- package/dist/core/metadata/lit-metadata.d.ts +63 -28
- package/dist/crypto/adapters/kms-crypto-adapter.d.ts +172 -137
- package/dist/crypto/factories.browser.d.ts +9 -5
- package/dist/crypto/index.d.ts +5 -5
- package/dist/crypto/symmetric/generic-aes-ctr-streaming-crypto.d.ts +58 -54
- package/dist/crypto/symmetric/node-aes-cbc-crypto.d.ts +36 -32
- package/dist/examples/decrypt-test.d.ts +2 -0
- package/dist/examples/decrypt-test.d.ts.map +1 -0
- package/dist/examples/decrypt-test.js +102 -0
- package/dist/examples/encrypt-test.d.ts +2 -0
- package/dist/examples/encrypt-test.d.ts.map +1 -0
- package/dist/examples/encrypt-test.js +93 -0
- package/dist/handlers/decrypt-handler.d.ts +19 -5
- package/dist/handlers/decrypt-handler.js +10 -5
- package/dist/handlers/encrypt-handler.d.ts +9 -3
- package/dist/handlers/encrypt-handler.d.ts.map +1 -1
- package/dist/handlers/encrypt-handler.js +2 -44
- package/dist/index.d.ts +2 -2
- package/dist/test/cid-verification.spec.d.ts +2 -0
- package/dist/test/cid-verification.spec.d.ts.map +1 -0
- package/dist/test/cid-verification.spec.js +314 -0
- package/dist/test/crypto-compatibility.spec.d.ts +2 -0
- package/dist/test/crypto-compatibility.spec.d.ts.map +1 -0
- package/dist/test/crypto-compatibility.spec.js +124 -0
- package/dist/test/crypto-counter-security.spec.d.ts +2 -0
- package/dist/test/crypto-counter-security.spec.d.ts.map +1 -0
- package/dist/test/crypto-counter-security.spec.js +147 -0
- package/dist/test/crypto-streaming.spec.d.ts +2 -0
- package/dist/test/crypto-streaming.spec.d.ts.map +1 -0
- package/dist/test/crypto-streaming.spec.js +129 -0
- package/dist/test/encrypted-metadata.spec.d.ts +2 -0
- package/dist/test/encrypted-metadata.spec.d.ts.map +1 -0
- package/dist/test/encrypted-metadata.spec.js +68 -0
- package/dist/test/factories.spec.d.ts +2 -0
- package/dist/test/factories.spec.d.ts.map +1 -0
- package/dist/test/factories.spec.js +129 -0
- package/dist/test/file-metadata.spec.d.ts +2 -0
- package/dist/test/file-metadata.spec.d.ts.map +1 -0
- package/dist/test/file-metadata.spec.js +433 -0
- package/dist/test/fixtures/test-fixtures.d.ts +33 -0
- package/dist/test/fixtures/test-fixtures.d.ts.map +1 -0
- package/dist/test/fixtures/test-fixtures.js +63 -0
- package/dist/test/helpers/test-file-utils.d.ts +65 -0
- package/dist/test/helpers/test-file-utils.d.ts.map +1 -0
- package/dist/test/helpers/test-file-utils.js +139 -0
- package/dist/test/https-enforcement.spec.d.ts +2 -0
- package/dist/test/https-enforcement.spec.d.ts.map +1 -0
- package/dist/test/https-enforcement.spec.js +125 -0
- package/dist/test/kms-crypto-adapter.spec.d.ts +2 -0
- package/dist/test/kms-crypto-adapter.spec.d.ts.map +1 -0
- package/dist/test/kms-crypto-adapter.spec.js +305 -0
- package/dist/test/lit-crypto-adapter.spec.d.ts +2 -0
- package/dist/test/lit-crypto-adapter.spec.d.ts.map +1 -0
- package/dist/test/lit-crypto-adapter.spec.js +76 -0
- package/dist/test/memory-efficiency.spec.d.ts +2 -0
- package/dist/test/memory-efficiency.spec.d.ts.map +1 -0
- package/dist/test/memory-efficiency.spec.js +93 -0
- package/dist/test/mocks/key-manager.d.ts +91 -0
- package/dist/test/mocks/key-manager.d.ts.map +1 -0
- package/dist/test/mocks/key-manager.js +137 -0
- package/dist/test/node-crypto-adapter.spec.d.ts +2 -0
- package/dist/test/node-crypto-adapter.spec.d.ts.map +1 -0
- package/dist/test/node-crypto-adapter.spec.js +103 -0
- package/dist/test/node-generic-crypto-adapter.spec.d.ts +2 -0
- package/dist/test/node-generic-crypto-adapter.spec.d.ts.map +1 -0
- package/dist/test/node-generic-crypto-adapter.spec.js +95 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +12 -0
- package/dist/tsconfig.spec.tsbuildinfo +1 -0
- package/dist/utils/encrypt.d.ts +5 -0
- package/dist/utils/encrypt.d.ts.map +1 -0
- package/dist/utils/encrypt.js +53 -0
- package/dist/utils/file-metadata.d.ts +19 -13
- package/dist/utils.d.ts +14 -5
- package/package.json +6 -2
package/README.md
CHANGED
package/dist/config/service.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export const accessServiceURL: URL
|
|
2
|
-
export const accessServicePrincipal: client.PrincipalView<
|
|
3
|
-
export const accessServiceConnection: client.ConnectionView<any
|
|
4
|
-
export const uploadServiceURL: URL
|
|
5
|
-
export const uploadServicePrincipal: client.PrincipalView<
|
|
6
|
-
export const uploadServiceConnection: client.ConnectionView<any
|
|
7
|
-
export const filecoinServiceURL: URL
|
|
8
|
-
export const filecoinServicePrincipal: client.PrincipalView<
|
|
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(
|
|
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
|
package/dist/core/client.d.ts
CHANGED
|
@@ -1,44 +1,57 @@
|
|
|
1
1
|
/** @implements {Type.EncryptedClient} */
|
|
2
2
|
export class EncryptedClient implements Type.EncryptedClient {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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>
|
|
41
52
|
}
|
|
42
|
-
export function create(
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
export function create(
|
|
54
|
+
options: Type.EncryptedClientOptions
|
|
55
|
+
): Promise<EncryptedClient>
|
|
56
|
+
import * as Type from '../types.js'
|
|
57
|
+
//# sourceMappingURL=client.d.ts.map
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export class UnknownFormat extends Failure {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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,8 +1,13 @@
|
|
|
1
|
-
export function extract(archive: Uint8Array): any
|
|
2
|
-
export function create(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
export function extract(archive: Uint8Array): any
|
|
2
|
+
export function create(
|
|
3
|
+
strategy: 'lit' | 'kms',
|
|
4
|
+
data: any
|
|
5
|
+
):
|
|
6
|
+
| import('../../types.js').LitMetadataView
|
|
7
|
+
| import('../../types.js').KMSMetadataView
|
|
8
|
+
export function getSupportedVersions(): string[]
|
|
9
|
+
export function isVersionSupported(version: string): boolean
|
|
10
|
+
import * as LitMetadata from './lit-metadata.js'
|
|
11
|
+
import * as KMSMetadata from './kms-metadata.js'
|
|
12
|
+
export { LitMetadata, KMSMetadata }
|
|
13
|
+
//# sourceMappingURL=encrypted-metadata.d.ts.map
|
|
@@ -1,36 +1,68 @@
|
|
|
1
|
-
export const version:
|
|
2
|
-
export const KMSMetadataSchema: Schema.VariantSchema<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,28 +1,63 @@
|
|
|
1
|
-
export const version:
|
|
2
|
-
export const LitMetadataSchema: Schema.VariantSchema<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|