@storacha/encrypt-upload-client 1.1.58 → 1.1.60

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 (72) hide show
  1. package/dist/config/constants.d.ts +3 -3
  2. package/dist/config/constants.js +3 -4
  3. package/dist/config/env.d.ts +6 -9
  4. package/dist/config/service.d.ts +13 -13
  5. package/dist/core/client.d.ts +41 -54
  6. package/dist/core/client.js +56 -68
  7. package/dist/core/errors.d.ts +6 -6
  8. package/dist/core/metadata/encrypted-metadata.d.ts +8 -13
  9. package/dist/core/metadata/kms-metadata.d.ts +36 -68
  10. package/dist/core/metadata/lit-metadata.d.ts +28 -63
  11. package/dist/crypto/adapters/kms-crypto-adapter.d.ts +137 -172
  12. package/dist/crypto/adapters/lit-crypto-adapter.d.ts +86 -107
  13. package/dist/crypto/factories.browser.d.ts +5 -9
  14. package/dist/crypto/factories.browser.js +7 -15
  15. package/dist/crypto/factories.node.d.ts +6 -13
  16. package/dist/crypto/factories.node.js +13 -19
  17. package/dist/crypto/index.d.ts +5 -5
  18. package/dist/crypto/index.js +5 -5
  19. package/dist/crypto/symmetric/generic-aes-ctr-streaming-crypto.d.ts +54 -58
  20. package/dist/crypto/symmetric/generic-aes-ctr-streaming-crypto.js +146 -174
  21. package/dist/crypto/symmetric/node-aes-cbc-crypto.d.ts +32 -36
  22. package/dist/crypto/symmetric/node-aes-cbc-crypto.js +95 -101
  23. package/dist/examples/decrypt-test.d.ts +2 -2
  24. package/dist/examples/decrypt-test.js +69 -78
  25. package/dist/examples/encrypt-test.d.ts +3 -5
  26. package/dist/examples/encrypt-test.js +55 -58
  27. package/dist/handlers/decrypt-handler.d.ts +5 -19
  28. package/dist/handlers/encrypt-handler.d.ts +3 -9
  29. package/dist/handlers/encrypt-handler.js +57 -93
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +2 -2
  32. package/dist/protocols/lit.d.ts +9 -33
  33. package/dist/protocols/lit.js +98 -134
  34. package/dist/test/cid-verification.spec.d.ts +2 -2
  35. package/dist/test/cid-verification.spec.js +313 -341
  36. package/dist/test/crypto-compatibility.spec.d.ts +2 -2
  37. package/dist/test/crypto-compatibility.spec.js +120 -184
  38. package/dist/test/crypto-counter-security.spec.d.ts +2 -2
  39. package/dist/test/crypto-counter-security.spec.js +138 -177
  40. package/dist/test/crypto-streaming.spec.d.ts +2 -2
  41. package/dist/test/crypto-streaming.spec.js +126 -208
  42. package/dist/test/encrypted-metadata.spec.d.ts +2 -2
  43. package/dist/test/encrypted-metadata.spec.js +62 -89
  44. package/dist/test/factories.spec.d.ts +2 -2
  45. package/dist/test/factories.spec.js +139 -275
  46. package/dist/test/file-metadata.spec.d.ts +2 -2
  47. package/dist/test/file-metadata.spec.js +416 -472
  48. package/dist/test/fixtures/test-fixtures.d.ts +20 -25
  49. package/dist/test/fixtures/test-fixtures.js +53 -61
  50. package/dist/test/helpers/test-file-utils.d.ts +14 -19
  51. package/dist/test/helpers/test-file-utils.js +76 -78
  52. package/dist/test/https-enforcement.spec.d.ts +2 -2
  53. package/dist/test/https-enforcement.spec.js +124 -278
  54. package/dist/test/kms-crypto-adapter.spec.d.ts +2 -2
  55. package/dist/test/kms-crypto-adapter.spec.js +304 -473
  56. package/dist/test/lit-crypto-adapter.spec.d.ts +2 -2
  57. package/dist/test/lit-crypto-adapter.spec.js +118 -206
  58. package/dist/test/memory-efficiency.spec.d.ts +2 -2
  59. package/dist/test/memory-efficiency.spec.js +87 -100
  60. package/dist/test/mocks/key-manager.d.ts +38 -71
  61. package/dist/test/mocks/key-manager.js +113 -129
  62. package/dist/test/node-crypto-adapter.spec.d.ts +2 -2
  63. package/dist/test/node-crypto-adapter.spec.js +102 -155
  64. package/dist/test/node-generic-crypto-adapter.spec.d.ts +2 -2
  65. package/dist/test/node-generic-crypto-adapter.spec.js +94 -134
  66. package/dist/test/setup.d.ts +2 -2
  67. package/dist/test/setup.js +9 -8
  68. package/dist/tsconfig.spec.tsbuildinfo +1 -1
  69. package/dist/types.d.ts +181 -219
  70. package/dist/utils/file-metadata.d.ts +13 -19
  71. package/dist/utils.d.ts +5 -14
  72. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
- import { CARWriterStream } from 'carstream'
2
- import { createFileEncoderStream } from '@storacha/upload-client/unixfs'
3
- import * as Type from '../types.js'
4
- import { createFileWithMetadata } from '../utils/file-metadata.js'
1
+ import { CARWriterStream } from 'carstream';
2
+ import { createFileEncoderStream } from '@storacha/upload-client/unixfs';
3
+ import * as Type from '../types.js';
4
+ import { createFileWithMetadata } from '../utils/file-metadata.js';
5
5
  /**
6
6
  * Encrypt and upload a file to the Storacha network
7
7
  *
@@ -13,31 +13,17 @@ import { createFileWithMetadata } from '../utils/file-metadata.js'
13
13
  * @param {Type.UploadOptions} [uploadOptions] - User-provided upload options
14
14
  * @returns {Promise<Type.AnyLink>} - The link to the uploaded file
15
15
  */
16
- export const encryptAndUpload = async (
17
- storachaClient,
18
- cryptoAdapter,
19
- file,
20
- encryptionConfig,
21
- uploadOptions = {}
22
- ) => {
23
- // Step 1: Validate required configuration
24
- if (!encryptionConfig.spaceDID) throw new Error('No space selected!')
25
- // Step 2: Encrypt the file using the crypto adapter
26
- const encryptedPayload = await encryptFile(
27
- cryptoAdapter,
28
- file,
29
- encryptionConfig
30
- )
31
- // Step 3: Build and upload the encrypted metadata to the Storacha network
32
- const rootCid = await buildAndUploadEncryptedMetadata(
33
- storachaClient,
34
- encryptedPayload,
35
- cryptoAdapter,
36
- uploadOptions
37
- )
38
- // Step 4: Return the root CID of the encrypted metadata
39
- return rootCid
40
- }
16
+ export const encryptAndUpload = async (storachaClient, cryptoAdapter, file, encryptionConfig, uploadOptions = {}) => {
17
+ // Step 1: Validate required configuration
18
+ if (!encryptionConfig.spaceDID)
19
+ throw new Error('No space selected!');
20
+ // Step 2: Encrypt the file using the crypto adapter
21
+ const encryptedPayload = await encryptFile(cryptoAdapter, file, encryptionConfig);
22
+ // Step 3: Build and upload the encrypted metadata to the Storacha network
23
+ const rootCid = await buildAndUploadEncryptedMetadata(storachaClient, encryptedPayload, cryptoAdapter, uploadOptions);
24
+ // Step 4: Return the root CID of the encrypted metadata
25
+ return rootCid;
26
+ };
41
27
  /**
42
28
  * Upload encrypted metadata to the Storacha network
43
29
  *
@@ -47,46 +33,33 @@ export const encryptAndUpload = async (
47
33
  * @param {Type.UploadOptions} [uploadOptions] - The upload options
48
34
  * @returns {Promise<Type.AnyLink>} - The link to the uploaded metadata
49
35
  */
50
- const buildAndUploadEncryptedMetadata = async (
51
- storachaClient,
52
- encryptedPayload,
53
- cryptoAdapter,
54
- uploadOptions
55
- ) => {
56
- const { encryptedKey, metadata, encryptedBlobLike } = encryptedPayload
57
- return storachaClient.uploadCAR(
58
- {
59
- stream() {
60
- /** @type {any} */
61
- let root
62
- return createFileEncoderStream(encryptedBlobLike)
63
- .pipeThrough(
64
- new TransformStream({
65
- transform(block, controller) {
66
- root = block
67
- controller.enqueue(block)
68
- },
69
- async flush(controller) {
70
- if (!root) throw new Error('missing root block')
71
- const { cid, bytes } = await cryptoAdapter.encodeMetadata(
72
- root.cid.toString(),
73
- encryptedKey,
74
- metadata
75
- )
76
- controller.enqueue({ cid, bytes })
77
- },
78
- })
79
- )
80
- .pipeThrough(new CARWriterStream())
81
- },
82
- },
83
- {
84
- ...uploadOptions,
85
- // the encrypted data won't be published to Filecoin, so we need to set pieceHasher to undefined
86
- pieceHasher: undefined,
87
- }
88
- )
89
- }
36
+ const buildAndUploadEncryptedMetadata = async (storachaClient, encryptedPayload, cryptoAdapter, uploadOptions) => {
37
+ const { encryptedKey, metadata, encryptedBlobLike } = encryptedPayload;
38
+ return storachaClient.uploadCAR({
39
+ stream() {
40
+ /** @type {any} */
41
+ let root;
42
+ return createFileEncoderStream(encryptedBlobLike)
43
+ .pipeThrough(new TransformStream({
44
+ transform(block, controller) {
45
+ root = block;
46
+ controller.enqueue(block);
47
+ },
48
+ async flush(controller) {
49
+ if (!root)
50
+ throw new Error('missing root block');
51
+ const { cid, bytes } = await cryptoAdapter.encodeMetadata(root.cid.toString(), encryptedKey, metadata);
52
+ controller.enqueue({ cid, bytes });
53
+ },
54
+ }))
55
+ .pipeThrough(new CARWriterStream());
56
+ },
57
+ }, {
58
+ ...uploadOptions,
59
+ // the encrypted data won't be published to Filecoin, so we need to set pieceHasher to undefined
60
+ pieceHasher: undefined,
61
+ });
62
+ };
90
63
  /**
91
64
  * Encrypt a file with embedded metadata using the crypto adapter and return the encrypted payload.
92
65
  * The encrypted payload contains the encrypted file, the encrypted symmetric key, and the metadata.
@@ -98,27 +71,18 @@ const buildAndUploadEncryptedMetadata = async (
98
71
  * @returns {Promise<Type.EncryptionPayload>} - The encrypted file
99
72
  */
100
73
  const encryptFile = async (cryptoAdapter, file, encryptionConfig) => {
101
- // Step 1: Embed metadata in file content if provided
102
- const fileWithMetadata = createFileWithMetadata(
103
- file,
104
- encryptionConfig.fileMetadata
105
- )
106
- // Step 2: Encrypt the file (with embedded metadata) using the crypto adapter
107
- const { key, iv, encryptedStream } = await cryptoAdapter.encryptStream(
108
- fileWithMetadata
109
- )
110
- // Step 3: Use crypto adapter to encrypt the symmetric key
111
- const keyResult = await cryptoAdapter.encryptSymmetricKey(
112
- key,
113
- iv,
114
- encryptionConfig
115
- )
116
- // Step 4: Return the encrypted payload (no separate metadata needed)
117
- return {
118
- strategy: keyResult.strategy,
119
- encryptedKey: keyResult.encryptedKey,
120
- metadata: keyResult.metadata,
121
- encryptedBlobLike: { stream: () => encryptedStream },
122
- }
123
- }
124
- //# sourceMappingURL=encrypt-handler.js.map
74
+ // Step 1: Embed metadata in file content if provided
75
+ const fileWithMetadata = createFileWithMetadata(file, encryptionConfig.fileMetadata);
76
+ // Step 2: Encrypt the file (with embedded metadata) using the crypto adapter
77
+ const { key, iv, encryptedStream } = await cryptoAdapter.encryptStream(fileWithMetadata);
78
+ // Step 3: Use crypto adapter to encrypt the symmetric key
79
+ const keyResult = await cryptoAdapter.encryptSymmetricKey(key, iv, encryptionConfig);
80
+ // Step 4: Return the encrypted payload (no separate metadata needed)
81
+ return {
82
+ strategy: keyResult.strategy,
83
+ encryptedKey: keyResult.encryptedKey,
84
+ metadata: keyResult.metadata,
85
+ encryptedBlobLike: { stream: () => encryptedStream },
86
+ };
87
+ };
88
+ //# sourceMappingURL=encrypt-handler.js.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
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { create } from './core/client.js'
2
- //# sourceMappingURL=index.js.map
1
+ export { create } from './core/client.js';
2
+ //# sourceMappingURL=index.js.map
@@ -1,22 +1,13 @@
1
1
  /**
2
2
  * Get a LitClient instance.
3
3
  */
4
- export function getLitClient(): Promise<LitNodeClient>
4
+ export function getLitClient(): Promise<LitNodeClient>;
5
5
  /**
6
6
  * @param {LitNodeClient} litClient
7
7
  * @param {Type.SessionSignatureOptions} param0
8
8
  * @returns {Promise<import('@lit-protocol/types').SessionSigsMap>}
9
9
  */
10
- export function getSessionSigs(
11
- litClient: LitNodeClient,
12
- {
13
- wallet,
14
- accessControlConditions,
15
- dataToEncryptHash,
16
- expiration,
17
- capabilityAuthSigs,
18
- }: Type.SessionSignatureOptions
19
- ): Promise<import('@lit-protocol/types').SessionSigsMap>
10
+ export function getSessionSigs(litClient: LitNodeClient, { wallet, accessControlConditions, dataToEncryptHash, expiration, capabilityAuthSigs, }: Type.SessionSignatureOptions): Promise<import("@lit-protocol/types").SessionSigsMap>;
20
11
  /**
21
12
  * Get session signatures for a PKP key and auth method.
22
13
  * There is not need to execute the auth callback for this function, because the auth method provided.
@@ -25,25 +16,10 @@ export function getSessionSigs(
25
16
  * @param {Type.PkpSessionSignatureOptions} options
26
17
  * @returns {Promise<import('@lit-protocol/types').SessionSigsMap>}
27
18
  */
28
- export function getPkpSessionSigs(
29
- litClient: LitNodeClient,
30
- {
31
- pkpPublicKey,
32
- authMethod,
33
- accessControlConditions,
34
- dataToEncryptHash,
35
- expiration,
36
- capabilityAuthSigs,
37
- }: Type.PkpSessionSignatureOptions
38
- ): Promise<import('@lit-protocol/types').SessionSigsMap>
39
- export { encryptString } from '@lit-protocol/encryption'
40
- export function getAccessControlConditions(
41
- spaceDID: Type.SpaceDID
42
- ): import('@lit-protocol/types').AccessControlConditions
43
- export function executeUcanValidationAction(
44
- litClient: LitNodeClient,
45
- options: Type.ExecuteUcanValidationOptions
46
- ): Promise<any>
47
- import { LitNodeClient } from '@lit-protocol/lit-node-client'
48
- import * as Type from '../types.js'
49
- //# sourceMappingURL=lit.d.ts.map
19
+ export function getPkpSessionSigs(litClient: LitNodeClient, { pkpPublicKey, authMethod, accessControlConditions, dataToEncryptHash, expiration, capabilityAuthSigs, }: Type.PkpSessionSignatureOptions): Promise<import("@lit-protocol/types").SessionSigsMap>;
20
+ export { encryptString } from "@lit-protocol/encryption";
21
+ export function getAccessControlConditions(spaceDID: Type.SpaceDID): import("@lit-protocol/types").AccessControlConditions;
22
+ export function executeUcanValidationAction(litClient: LitNodeClient, options: Type.ExecuteUcanValidationOptions): Promise<any>;
23
+ import { LitNodeClient } from '@lit-protocol/lit-node-client';
24
+ import * as Type from '../types.js';
25
+ //# sourceMappingURL=lit.d.ts.map
@@ -1,15 +1,10 @@
1
- import { LitNodeClient } from '@lit-protocol/lit-node-client'
2
- import { LIT_ABILITY } from '@lit-protocol/constants'
3
- import {
4
- generateAuthSig,
5
- LitActionResource,
6
- createSiweMessage,
7
- LitAccessControlConditionResource,
8
- } from '@lit-protocol/auth-helpers'
9
- import env from '../config/env.js'
10
- import * as Type from '../types.js'
11
- import { STORACHA_LIT_ACTION_CID } from '../config/constants.js'
12
- export { encryptString } from '@lit-protocol/encryption'
1
+ import { LitNodeClient } from '@lit-protocol/lit-node-client';
2
+ import { LIT_ABILITY } from '@lit-protocol/constants';
3
+ import { generateAuthSig, LitActionResource, createSiweMessage, LitAccessControlConditionResource, } from '@lit-protocol/auth-helpers';
4
+ import env from '../config/env.js';
5
+ import * as Type from '../types.js';
6
+ import { STORACHA_LIT_ACTION_CID } from '../config/constants.js';
7
+ export { encryptString } from '@lit-protocol/encryption';
13
8
  /**
14
9
  * Create access control conditions required to use Lit Protocol.
15
10
  * This ensures that the Storacha Lit Action is used to validate decryption permissions for the specified space DID.
@@ -18,85 +13,68 @@ export { encryptString } from '@lit-protocol/encryption'
18
13
  * @returns {import('@lit-protocol/types').AccessControlConditions} - The access control conditions
19
14
  */
20
15
  export const getAccessControlConditions = (spaceDID) => {
21
- return [
22
- {
23
- contractAddress: '',
24
- standardContractType: '',
25
- chain: 'ethereum',
26
- method: '',
27
- parameters: [':currentActionIpfsId', spaceDID],
28
- returnValueTest: {
29
- comparator: '=',
30
- value: STORACHA_LIT_ACTION_CID,
31
- },
32
- },
33
- ]
34
- }
16
+ return [
17
+ {
18
+ contractAddress: '',
19
+ standardContractType: '',
20
+ chain: 'ethereum',
21
+ method: '',
22
+ parameters: [':currentActionIpfsId', spaceDID],
23
+ returnValueTest: {
24
+ comparator: '=',
25
+ value: STORACHA_LIT_ACTION_CID,
26
+ },
27
+ },
28
+ ];
29
+ };
35
30
  /**
36
31
  * Get a LitClient instance.
37
32
  */
38
33
  export async function getLitClient() {
39
- const litNodeClient = new LitNodeClient({
40
- litNetwork: env.LIT_NETWORK,
41
- debug: env.LIT_DEBUG,
42
- })
43
- await litNodeClient.connect()
44
- return litNodeClient
34
+ const litNodeClient = new LitNodeClient({
35
+ litNetwork: env.LIT_NETWORK,
36
+ debug: env.LIT_DEBUG,
37
+ });
38
+ await litNodeClient.connect();
39
+ return litNodeClient;
45
40
  }
46
41
  /**
47
42
  * @param {LitNodeClient} litClient
48
43
  * @param {Type.SessionSignatureOptions} param0
49
44
  * @returns {Promise<import('@lit-protocol/types').SessionSigsMap>}
50
45
  */
51
- export async function getSessionSigs(
52
- litClient,
53
- {
54
- wallet,
55
- accessControlConditions,
56
- dataToEncryptHash,
57
- expiration,
58
- capabilityAuthSigs,
59
- }
60
- ) {
61
- const accsResourceString =
62
- await LitAccessControlConditionResource.generateResourceString(
63
- accessControlConditions,
64
- dataToEncryptHash
65
- )
66
- const sessionSigs = await litClient.getSessionSigs({
67
- chain: 'ethereum',
68
- capabilityAuthSigs,
69
- expiration,
70
- resourceAbilityRequests: [
71
- {
72
- resource: new LitAccessControlConditionResource(accsResourceString),
73
- ability: LIT_ABILITY.AccessControlConditionDecryption,
74
- },
75
- {
76
- resource: new LitActionResource('*'),
77
- ability: LIT_ABILITY.LitActionExecution,
78
- },
79
- ],
80
- authNeededCallback: async ({
81
- uri,
82
- expiration,
83
- resourceAbilityRequests,
84
- }) => {
85
- const toSign = await createSiweMessage({
86
- uri,
46
+ export async function getSessionSigs(litClient, { wallet, accessControlConditions, dataToEncryptHash, expiration, capabilityAuthSigs, }) {
47
+ const accsResourceString = await LitAccessControlConditionResource.generateResourceString(accessControlConditions, dataToEncryptHash);
48
+ const sessionSigs = await litClient.getSessionSigs({
49
+ chain: 'ethereum',
50
+ capabilityAuthSigs,
87
51
  expiration,
88
- resources: resourceAbilityRequests,
89
- walletAddress: wallet.address,
90
- nonce: await litClient.getLatestBlockhash(),
91
- litNodeClient: litClient,
92
- })
93
- return await generateAuthSig({
94
- signer: wallet,
95
- toSign,
96
- })
97
- },
98
- })
99
- return sessionSigs
52
+ resourceAbilityRequests: [
53
+ {
54
+ resource: new LitAccessControlConditionResource(accsResourceString),
55
+ ability: LIT_ABILITY.AccessControlConditionDecryption,
56
+ },
57
+ {
58
+ resource: new LitActionResource('*'),
59
+ ability: LIT_ABILITY.LitActionExecution,
60
+ },
61
+ ],
62
+ authNeededCallback: async ({ uri, expiration, resourceAbilityRequests, }) => {
63
+ const toSign = await createSiweMessage({
64
+ uri,
65
+ expiration,
66
+ resources: resourceAbilityRequests,
67
+ walletAddress: wallet.address,
68
+ nonce: await litClient.getLatestBlockhash(),
69
+ litNodeClient: litClient,
70
+ });
71
+ return await generateAuthSig({
72
+ signer: wallet,
73
+ toSign,
74
+ });
75
+ },
76
+ });
77
+ return sessionSigs;
100
78
  }
101
79
  /**
102
80
  * Get session signatures for a PKP key and auth method.
@@ -106,39 +84,25 @@ export async function getSessionSigs(
106
84
  * @param {Type.PkpSessionSignatureOptions} options
107
85
  * @returns {Promise<import('@lit-protocol/types').SessionSigsMap>}
108
86
  */
109
- export async function getPkpSessionSigs(
110
- litClient,
111
- {
112
- pkpPublicKey,
113
- authMethod,
114
- accessControlConditions,
115
- dataToEncryptHash,
116
- expiration,
117
- capabilityAuthSigs,
118
- }
119
- ) {
120
- const accsResourceString =
121
- await LitAccessControlConditionResource.generateResourceString(
122
- accessControlConditions,
123
- dataToEncryptHash
124
- )
125
- const sessionSigs = await litClient.getPkpSessionSigs({
126
- pkpPublicKey,
127
- authMethods: [authMethod],
128
- resourceAbilityRequests: [
129
- {
130
- resource: new LitAccessControlConditionResource(accsResourceString),
131
- ability: LIT_ABILITY.AccessControlConditionDecryption,
132
- },
133
- {
134
- resource: new LitActionResource('*'),
135
- ability: LIT_ABILITY.LitActionExecution,
136
- },
137
- ],
138
- expiration,
139
- capabilityAuthSigs,
140
- })
141
- return sessionSigs
87
+ export async function getPkpSessionSigs(litClient, { pkpPublicKey, authMethod, accessControlConditions, dataToEncryptHash, expiration, capabilityAuthSigs, }) {
88
+ const accsResourceString = await LitAccessControlConditionResource.generateResourceString(accessControlConditions, dataToEncryptHash);
89
+ const sessionSigs = await litClient.getPkpSessionSigs({
90
+ pkpPublicKey,
91
+ authMethods: [authMethod],
92
+ resourceAbilityRequests: [
93
+ {
94
+ resource: new LitAccessControlConditionResource(accsResourceString),
95
+ ability: LIT_ABILITY.AccessControlConditionDecryption,
96
+ },
97
+ {
98
+ resource: new LitActionResource('*'),
99
+ ability: LIT_ABILITY.LitActionExecution,
100
+ },
101
+ ],
102
+ expiration,
103
+ capabilityAuthSigs,
104
+ });
105
+ return sessionSigs;
142
106
  }
143
107
  /**
144
108
  *
@@ -147,24 +111,24 @@ export async function getPkpSessionSigs(
147
111
  * @returns
148
112
  */
149
113
  export const executeUcanValidationAction = async (litClient, options) => {
150
- const { sessionSigs, ...jsParams } = options
151
- const litActionResponse = await litClient.executeJs({
152
- ipfsId: STORACHA_LIT_ACTION_CID,
153
- sessionSigs,
154
- jsParams,
155
- })
156
- if (!litActionResponse.response) {
157
- throw new Error('Error getting lit action response.')
158
- }
159
- const parsedResponse = JSON.parse(
160
- /** @type string*/ (litActionResponse.response)
161
- )
162
- const decryptedData = parsedResponse.decryptedString
163
- if (!decryptedData) {
164
- let errorMsg
165
- if (parsedResponse.error) errorMsg = parsedResponse.error
166
- throw new Error(`Decrypted data does not exist! Error message: ${errorMsg}`)
167
- }
168
- return decryptedData
169
- }
170
- //# sourceMappingURL=lit.js.map
114
+ const { sessionSigs, ...jsParams } = options;
115
+ const litActionResponse = await litClient.executeJs({
116
+ ipfsId: STORACHA_LIT_ACTION_CID,
117
+ sessionSigs,
118
+ jsParams,
119
+ });
120
+ if (!litActionResponse.response) {
121
+ throw new Error('Error getting lit action response.');
122
+ }
123
+ const parsedResponse = JSON.parse(
124
+ /** @type string*/ (litActionResponse.response));
125
+ const decryptedData = parsedResponse.decryptedString;
126
+ if (!decryptedData) {
127
+ let errorMsg;
128
+ if (parsedResponse.error)
129
+ errorMsg = parsedResponse.error;
130
+ throw new Error(`Decrypted data does not exist! Error message: ${errorMsg}`);
131
+ }
132
+ return decryptedData;
133
+ };
134
+ //# sourceMappingURL=lit.js.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