Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sample code in decrypt-api-key-in-action #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

financegeek-org
Copy link

@financegeek-org financegeek-org commented Jun 2, 2024

encryptString() first param of EncryptStringRequest requires chain. Otherwise error.

In genSession(), the authNeededCallback function calls authSig with params.resourceAbilityRequests

  1. params doesn't provide resourceAbilityRequests, it provides resources
  2. the resources it provides is the URN result, not the request

Therefore it should be resources from parent scoped variable.

@spacesailor24
Copy link
Contributor

Hi there @financegeek-org , thank you for your contribution! Were you getting a specific error when calling encryptString without chain? EncryptStringRequest doesn't accept chain as a property (see API docs). Additionally, we tests that use encryptString without specifying chain

@joshLong145
Copy link
Contributor

Hey @financegeek-org
If you look here you can see that resourceAbilityRequests is part of AuthNeededCallbackParams could this be an issue with the library versions you have locally?

@financegeek-org
Copy link
Author

Hi there @financegeek-org , thank you for your contribution! Were you getting a specific error when calling encryptString without chain? EncryptStringRequest doesn't accept chain as a property (see API docs). Additionally, we tests that use encryptString without specifying chain

export interface EncryptStringRequest extends EncryptRequestBase {
    dataToEncrypt: string;
}

export interface EncryptRequestBase extends MultipleAccessControlConditions {
    chain: Chain;
    authSig?: AuthSig;
    sessionSigs?: SessionSigsMap;
}

developer-guides-code\lit-action-using-fetch\nodejs\node_modules@lit-protocol\encryption\src\lib\encryption.d.ts

@financegeek-org
Copy link
Author

Hey @financegeek-org If you look here you can see that resourceAbilityRequests is part of AuthNeededCallbackParams could this be an issue with the library versions you have locally?

Doing a console.log on the callback params:

resourceAbilityRequests: {
  chain: 'ethereum',
  statement: 'I further authorize the stated URI to perform the following actions on my behalf:',
  resources: [ 'urn:recap:eyJhdHQiOnt9LCJwcmYiOltdfQ' ],
  expiration: '2024-06-03T04:10:56.799Z',
  uri: 'lit:session:f5b06735af8442d4b98082b8b30c7797eb3d5aa8575c1c04c5e3683f03d25241',
  nonce: '0xba12f5e7823451147e52e698057be38f1bcf0330becda853e89c4bb2c36d3322'
}

Would any typing differences be due to @ts-nocheck?

Regarding local packages, I think this should be:

    "@lit-protocol/auth-helpers": "^6.0.0-alpha.4",
    "@lit-protocol/constants": "^6.0.0-alpha.4",
    "@lit-protocol/contracts-sdk": "^6.0.0-alpha.4",
    "@lit-protocol/lit-node-client": "^5.1.0",
    "@lit-protocol/lit-node-client-nodejs": "^5.1.0",

Let me know if those are out of date. It could be differing versions :O

@Ansonhkg
Copy link
Contributor

Ansonhkg commented Jun 4, 2024

Hey @financegeek-org If you look here you can see that resourceAbilityRequests is part of AuthNeededCallbackParams could this be an issue with the library versions you have locally?

Doing a console.log on the callback params:

resourceAbilityRequests: {
  chain: 'ethereum',
  statement: 'I further authorize the stated URI to perform the following actions on my behalf:',
  resources: [ 'urn:recap:eyJhdHQiOnt9LCJwcmYiOltdfQ' ],
  expiration: '2024-06-03T04:10:56.799Z',
  uri: 'lit:session:f5b06735af8442d4b98082b8b30c7797eb3d5aa8575c1c04c5e3683f03d25241',
  nonce: '0xba12f5e7823451147e52e698057be38f1bcf0330becda853e89c4bb2c36d3322'
}

Would any typing differences be due to @ts-nocheck?

Regarding local packages, I think this should be:

    "@lit-protocol/auth-helpers": "^6.0.0-alpha.4",
    "@lit-protocol/constants": "^6.0.0-alpha.4",
    "@lit-protocol/contracts-sdk": "^6.0.0-alpha.4",
    "@lit-protocol/lit-node-client": "^5.1.0",
    "@lit-protocol/lit-node-client-nodejs": "^5.1.0",

Let me know if those are out of date. It could be differing versions :O

hey, could you try version ^6.0.1 we just released yesterday :)

@spacesailor24
Copy link
Contributor

@financegeek-org Also please make sure all the installed versions for each Lit package are the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants