Skip to content

Commit 5762df2

Browse files
Merge pull request #109 from LIT-Protocol/chore/update-decrypt-within-la
Update Decrypting within LA example
2 parents 7a0ecd0 + b11a91f commit 5762df2

File tree

4 files changed

+1104
-187
lines changed

4 files changed

+1104
-187
lines changed

decrypt-api-key-in-action/nodejs/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
},
2323
"dependencies": {
2424
"@dotenvx/dotenvx": "^0.44.1",
25-
"@lit-protocol/auth-helpers": "^7.0.4",
26-
"@lit-protocol/constants": "^7.0.4",
27-
"@lit-protocol/contracts-sdk": "^7.0.4",
28-
"@lit-protocol/encryption": "^7.0.4",
29-
"@lit-protocol/lit-node-client": "^7.0.4"
25+
"@lit-protocol/auth-helpers": "^7.3.1",
26+
"@lit-protocol/constants": "^7.3.1",
27+
"@lit-protocol/contracts-sdk": "^7.3.1",
28+
"@lit-protocol/encryption": "^7.3.1",
29+
"@lit-protocol/lit-node-client": "^7.3.1",
30+
"typestub-ipfs-only-hash": "^4.0.0"
3031
}
3132
}

decrypt-api-key-in-action/nodejs/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { LitContracts } from "@lit-protocol/contracts-sdk";
1111
import { AccessControlConditions } from "@lit-protocol/types";
1212
import * as ethers from "ethers";
13+
import IpfsHash from "typestub-ipfs-only-hash";
1314

1415
import { litActionCode } from "./litAction";
1516
import { getEnv } from "./utils";
@@ -118,7 +119,9 @@ export const decryptApiKey = async (alchemyUrl: string, key: string) => {
118119
ability: LIT_ABILITY.AccessControlConditionDecryption,
119120
},
120121
{
121-
resource: new LitActionResource("*"),
122+
resource: new LitActionResource(
123+
await IpfsHash.of(litActionCode)
124+
),
122125
ability: LIT_ABILITY.LitActionExecution,
123126
},
124127
],

decrypt-api-key-in-action/nodejs/test/decryptApiKeyInActionTest.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ describe("decryptApiKey", () => {
1212
it("should decrypt API key successfully", async () => {
1313
const url = "https://base-mainnet.g.alchemy.com/v2/";
1414
const result = await decryptApiKey(url, ALCHEMY_API_KEY);
15+
console.log(result);
16+
1517
const expectedSchema = {
1618
type: "object",
1719
required: [

0 commit comments

Comments
 (0)