Closed brunolune closed 6 months ago
Hey @brunolune!
I just checked that I'm able to encrypt and decrypt content on sepolia
and baseSepolia
with these access control conditions:
const client = new LitJsSdk.LitNodeClient({
litNetwork: "cayenne",
debug: true,
});
const chain = "sepolia"; // baseSepolia
const accessControlConditions = [
{
contractAddress: "",
standardContractType: "",
chain,
method: "eth_getBalance",
parameters: [":userAddress", "latest"],
returnValueTest: {
comparator: ">=",
value: "000000000000", // 0.000001 ETH
},
},
];
Can you try upgrading SDK to latest version 4.2.1? Also try debugging at your end.
If issue still persists, can you share your code via GitHub?
You can refer this code for the reference - https://github.com/Aaryan-R-S/LIT-Protocol-demo-reactjs/blob/master/src/components/EncryptAuthSig.jsx
const accessControlConditions = [ { contractAddress: "", standardContractType: "", chain, method: "eth_getBalance", parameters: [":userAddress", "latest"],
returnValueTest: {
comparator: ">=",
value: "000000000000", // 0.000001 ETH
},
},
];
const accessControlConditions = [ { contractAddress: tokenAddress, standardContractType: "", chain, method: "balanceOf", parameters: [":userAddress"], returnValueTest: { comparator: ">", value: "0", }, }, ];
lit.ts:70
POST https://cayenne.litgateway.com:7371/web/encryption/sign 401 (Unauthorized)
sendRequest @ misc.js:568
LitCore.sendCommandToNode @ lit-core.js:598
LitNodeClientNodeJs.getSigningShareForDecryption @ lit-node-client-nodejs.js:591
eval @ lit-node-client-nodejs.js:1516
LitCore.getNodePromises @ lit-core.js:613
wrapper @ lit-node-client-nodejs.js:1513
executeWithRetry @ misc.js:610
await in executeWithRetry (async)
LitNodeClientNodeJs.decrypt @ lit-node-client-nodejs.js:1530
await in LitNodeClientNodeJs.decrypt (async)
decryptToString @ encryption.js:200
decryptWithLit @ lit.ts:70
await in decryptWithLit (async)
handleDecrypt @ messagesDAOBox.tsx:21
onClick @ messagesDAOBox.tsx:143
callCallback @ react-dom.development.js:17629
invokeGuardedCallbackImpl @ react-dom.development.js:17667
invokeGuardedCallback @ react-dom.development.js:17729
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:17741
executeDispatch @ react-dom.development.js:27186
processDispatchQueueItemsInOrder @ react-dom.development.js:27206
processDispatchQueue @ react-dom.development.js:27215
dispatchEventsForPlugins @ react-dom.development.js:27223
eval @ react-dom.development.js:27378
batchedUpdates$1 @ react-dom.development.js:21180
batchedUpdates @ react-dom.development.js:24349
dispatchEventForPluginEventSystem @ react-dom.development.js:27377
dispatchEvent @ react-dom.development.js:25416
dispatchDiscreteEvent @ react-dom.development.js:25392
Show less
messagesDAOBox.tsx:31 Uncaught (in promise)
errConstructorFunc {message: 'The access control condition check returned that y…ons? Check the auth_sig and the other conditions', errorCode: 'NodeAccessControlConditionsReturnedNotAuthorized', errorKind: 'Validation', status: 401, details: Array(1), …}
handleDecrypt @ messagesDAOBox.tsx:31
await in handleDecrypt (async)
onClick @ messagesDAOBox.tsx:143
callCallback @ react-dom.development.js:17629
invokeGuardedCallbackImpl @ react-dom.development.js:17667
invokeGuardedCallback @ react-dom.development.js:17729
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:17741
executeDispatch @ react-dom.development.js:27186
processDispatchQueueItemsInOrder @ react-dom.development.js:27206
processDispatchQueue @ react-dom.development.js:27215
dispatchEventsForPlugins @ react-dom.development.js:27223
eval @ react-dom.development.js:27378
batchedUpdates$1 @ react-dom.development.js:21180
batchedUpdates @ react-dom.development.js:24349
dispatchEventForPluginEventSystem @ react-dom.development.js:27377
dispatchEvent @ react-dom.development.js:25416
dispatchDiscreteEvent @ react-dom.development.js:25392
Show less
I see, you are not setting standardContractType
field to ERC20
.
Use this ACC and it will work:
const client = new LitJsSdk.LitNodeClient({
litNetwork: "cayenne",
debug: true,
});
const chain = "sepolia";
const accessControlConditions = [
{
contractAddress: "0x8ac38927a379804823728f17633f27c1945a0695",
standardContractType: "ERC20",
chain,
method: "balanceOf",
parameters: [":userAddress", "latest"],
returnValueTest: {
comparator: ">=",
value: "000000000000", // 0.000001 ETH
},
},
];
Okay indeed great, I thought it was optional, thank you!
Okay indeed, it works with standardContractType: "ERC20", I thought it was optional, thank you! One question: what does "latest" mean in parameters? and also why using multiple zeros in the value field? Another point: I got many types errors after upgrading to 4.2.1 for "@lit-protocol/lit-node-client", "@lit-protocol/lit-node-client-nodejs", "@lit-protocol/types".
Would love documentation on the "magic" params also!
Hey @zach-is-my-name where exactly you saw that 'magic' keyword? Can you share link?
Hey @brunolune!
Hey @zach-is-my-name where exactly you saw that 'magic' keyword? Can you share link?
Hi Aaryan! yes! Sorry I mistook bruno's question about the "latest" param for a question about the ":userAddress" param, which while perhaps not "magical" is apparently "special" lol. https://github.com/LIT-Protocol/Node/blob/a4da3bff9fef4e8b0eea15604c7e26d0e8a45a5b/rust/lit-node/src/access_control/mod.rs#L1190
I think there's a few others besides ':userAddress'. Just discovered it's only documented in the Solana and Cosmos sections, which is why I originally missed it. https://github.com/search?q=repo%3ALIT-Protocol%2Fdocs+%22The+parameter+of%22&type=code
Hey @brunolune!
The parameter "latest" refers to the block identifier the balance for the account is retrieved at.
Oh I see. No issues @zach-is-my-name!
I'll submit a PR to docs so that Ethereum users see this as well "The parameter of ":userAddress" will be automatically substituted with the user's wallet address which was verified by checking the message signed by their wallet."
Lit-protocol types issues found with 4.2.1:
1) Type error encountered in :
let authSig = await checkAndSignAuthMessage({ chain, });
Before only chain was required now nonce is also required? What value to put? from js-sdk/packages/types/src/lib/interfaces.ts :
// The blockhash that the nodes return during the handshake
nonce: string;
What is the blockhash that the nodes return during the handshake?
When encrypting, It seems to work with :
let authSig = await checkAndSignAuthMessage({
chain,
nonce: aStringThatYouWishToEncrypt,
});
When decrypting it seems to work with:
let authSig = await checkAndSignAuthMessage({
chain,
nonce: dataToEncryptHash,
});
2) type error on accessControlConditions:
"... Type '{ contractAddress: string; standardContractType: string; chain: string; method: string; parameters: string[]; returnValueTest: { comparator: string; value: string; }; }' is not assignable to type 'AccessControlConditions | LPACC_EVM_BASIC | AccsOperatorParams'. Type '{ contractAddress: string; standardContractType: string; chain: string; method: string; parameters: string[]; returnValueTest: { comparator: string; value: string; }; }' is not assignable to type 'LPACC_EVM_BASIC'. Types of property 'chain' are incompatible. Type 'string' is not assignable to type '"sepolia" | "ethereum" | "polygon" | "fantom" | "xdai" | "bsc" | "arbitrum" | "avalanche" | "fuji" | "harmony" | "mumbai" | "goerli" | "cronos" | "optimism" | "celo" | "aurora" | ... 33 more ... | "verifyTestnet"'.ts(2345)..."
encountered in :
const { ciphertext, dataToEncryptHash } = await encryptWithLit(
lit,
data.message,
//@ts-ignore
accessControlConditions,
"sepolia"
);
even though I used "sepolia" as chain ...:
const accessControlConditions = [
{
contractAddress: tokenAddress,
standardContractType: "ERC20",
chain: "sepolia",
method: "balanceOf",
parameters: [":userAddress", "latest"],
returnValueTest: {
comparator: ">",
value: "0",
},
},
];
3) Type error with LitNodeClient encountered in:
console.log("Starting Lit Client...");
const litClient = new LitJsSdk.LitNodeClient({
//litNetwork: "cayenne",
url: window.location.origin,
});
litClient.connect();
setLit(litClient);
Error:
"Argument of type 'LitNodeClient' is not assignable to parameter of type 'SetStateAction<ILitNodeClient | undefined>'.
Type 'LitNodeClient' is not assignable to type 'ILitNodeClient'.
Types of property 'handleNodePromises' are incompatible.
Type '
solved with:
const litClient = new LitJsSdk.LitNodeClient({
//litNetwork: "cayenne",
url: window.location.origin,
});
litClient.connect();
setLit(litClient as unknown as ILitNodeClient);
Thanks @brunolune! We have addressed this here as mentioned by @MaximusHaximus !
Hey @brunolune! Apologies I missed above two type errors.
For Type Error 1 use:
const nonce = await litNodeClient.getLatestBlockhash();
For Type Error 2: I checked it. I'm not able to reproduce this error. Wanna share your code via GitHub?
For Type Error 3, it has been fixed in this PR
Thanks version 5.0.0 works for me! It also solved some issues I got with 4.2.1 when deploying my app on Vercel.
Is there an existing issue for this?
SDK version
"@lit-protocol/lit-node-client": "^3.0.5", "@lit-protocol/lit-node-client-nodejs": "^3.0.5", "@lit-protocol/types": "^3.0.5",
Lit Network
cayenne
Description of the bug/issue
Hi! I am developing an app using ceramic network and lit protocol for encrypting data. I actually was able to do encrypt/decrypt messages using mumbai. However, I needed to change of blockchain due to mumbai deprecation.
I tried base sepolia but cannot even encrypt data and got error message:
" index.esm.mjs:2114 Uncaught (in promise) errConstructorFunc {message: 'Unsupported chain selected. Please select one of:…evmosCosmosTestnet,cheqdMainnet,cheqdTestnet,juno', errorCode: 'UnsupportedChainException', errorKind: 'Validation', status: undefined, details: undefined} details : undefined errorCode : "UnsupportedChainException" errorKind : "Validation" message : "Unsupported chain selected. Please select one of: ethereum,polygon,fantom,xdai,bsc,arbitrum,avalanche,fuji,harmony,mumbai,goerli,cronos,optimism,celo,aurora,eluvio,alfajores,xdc,evmos,evmosTestnet,bscTestnet,baseGoerli,moonbeam,moonriver,moonbaseAlpha,filecoin,hyperspace,sepolia,scrollAlphaTestnet,zksync,zksyncTestnet,lineaGoerli,chronicleTestnet,chiado,zkEvm,mantleTestnet,mantle,klaytn,publicGoodsNetwork,optimismGoerli,waevEclipseTestnet,waevEclipseDevnet,solana,solanaDevnet,solanaTestnet,cosmos,kyve,evmosCosmos,evmosCosmosTestnet,cheqdMainnet,cheqdTestnet,juno" status : undefined [[Prototype]] : Object "
Looks like baseSepolia is not yet supported by lit? Although it is listed on https://developer.litprotocol.com/v3/resources/supported-chains.
I also tried Sepolia blockchain: encrypting worked but got issue decrypting, although Sepolia is in the above list of supported blockchain, I got the following error when decrypting data with Sepolia :
[Lit-JS-SDK v3.0.5] getting provider via lit connect modal misc.js:155 [Lit-JS-SDK v3.0.5] got provider Proxy(f) {_events: {…}, _eventsCount: 4, _maxListeners: 100, _log: d, _state: {…}, …} misc.js:155 [Lit-JS-SDK v3.0.5] @deprecated soon to be removed. - trying to enable provider. this will trigger the metamask popup. misc.js:155 [Lit-JS-SDK v3.0.5] listing accounts misc.js:155 [Lit-JS-SDK v3.0.5] accounts ['0x8a1fb49cB17ab6D1BF2CaC34E1F06451C8205605'] misc.js:155 [Lit-JS-SDK v3.0.5] got web3 and account: 0x8a1fb49cb17ab6d1bf2cac34e1f06451c8205605 misc.js:155 [Lit-JS-SDK v3.0.5] currentChainIdOrError: {type: 'SUCCESS', result: 11155111} misc.js:155 [Lit-JS-SDK v3.0.5] selectedChainId: 11155111 misc.js:155 [Lit-JS-SDK v3.0.5] selectedChainIdHex: 0xaa36a7 misc.js:155 [Lit-JS-SDK v3.0.5] authSigOrError: {type: 'SUCCESS', result: '{"sig":"0x6dce6e5b23b1a4c6639130ceb761a647df2e7c3e…ss":"0xe60930dd528485ba57f4a17b02209877c2a9bfac"}'} misc.js:155 [Lit-JS-SDK v3.0.5] chainId from web3 {type: 'SUCCESS', result: 11155111} misc.js:155 [Lit-JS-SDK v3.0.5] checkAndSignAuthMessage with chainId [object Object] and chain set to sepolia and selectedChain is {contractAddress: null, chainId: 11155111, name: 'Sepolia Testnet', symbol: 'ETH', decimals: 18, …} misc.js:155 [Lit-JS-SDK v3.0.5] checking if sig is in local storage misc.js:155 [Lit-JS-SDK v3.0.5] 6. authSig: {sig: '0x6dce6e5b23b1a4c6639130ceb761a647df2e7c3e26b9ce0a…c16dd54655859afa3b28618f2e3dfe49e6b8fee6d533ef01c', derivedVia: 'web3.eth.personal.sign', signedMessage: 'localhost:3000 wants you to sign in with your Ethe…05.081Z\nExpiration Time: 2024-04-16T21:33:05.056Z', address: '0xe60930dd528485ba57f4a17b02209877c2a9bfac'} misc.js:155 [Lit-JS-SDK v3.0.5] signing auth message because account is not the same as the address in the auth sig misc.js:155 [Lit-JS-SDK v3.0.5] pausing... misc.js:155 [Lit-JS-SDK v3.0.5] signing with 0x8a1fb49cB17ab6D1BF2CaC34E1F06451C8205605 misc.js:155 [Lit-JS-SDK v3.0.5] Signing with personal_sign misc.js:155 [Lit-JS-SDK v3.0.5] Signature: 0xa50d552559971c79d41c7a52b5c4f6ca25ea441029f2893e0f2f62041e350b1444a800505980d837e33345d831a96ec0759591e601123ef32c44b810da7c99511c misc.js:155 [Lit-JS-SDK v3.0.5] recovered address: 0x8a1fb49cb17ab6d1bf2cac34e1f06451c8205605 misc.js:155 [Lit-JS-SDK v3.0.5] generated and saved lit-comms-keypair misc.js:155 [Lit-JS-SDK v3.0.5] 7. authSig: {sig: '0xa50d552559971c79d41c7a52b5c4f6ca25ea441029f2893e…33345d831a96ec0759591e601123ef32c44b810da7c99511c', derivedVia: 'web3.eth.personal.sign', signedMessage: 'localhost:3000 wants you to sign in with your Ethe…20.185Z\nExpiration Time: 2024-04-17T13:05:20.159Z', address: '0x8a1fb49cb17ab6d1bf2cac34e1f06451c8205605'} lit.ts:70 [Lit-JS-SDK v3.0.5] checkIfAuthSigRequiresChainParam lit.ts:70 [Lit-JS-SDK v3.0.5] checkIfAuthSigRequiresChainParam lit.ts:70 [Lit-JS-SDK v3.0.5] Hashing access control conditions: [{"contractAddress":"0x8ac38927a379804823728f17633f27c1945a0695","chain":"sepolia","standardContractType":"","method":"balanceOf","parameters":[":userAddress"],"returnValueTest":{"comparator":">","value":"0"}}] misc.js:155 [Lit-JS-SDK v3.0.5] formattedAccessControlConditions [{"contractAddress":"0x8ac38927a379804823728f17633f27c1945a0695","chain":"sepolia","standardContractType":"","method":"balanceOf","parameters":[":userAddress"],"returnValueTest":{"comparator":">","value":"0"}}] misc.js:155 [Lit-JS-SDK v3.0.5] identityParam lit-accesscontrolcondition://222f3c4f55a7128bf88ce9223366afcf6e0804f2201f65c98563c865216d03a1/e0a4e7d4dddd90f3c9ba5c2a1a6c955538dd93cd80d3692756b631bc5d84734c misc.js:155 [Lit-JS-SDK v3.0.5] getSigningShareForDecryption misc.js:155 [Lit-JS-SDK v3.0.5] sendCommandToNode with url https://cayenne.litgateway.com:7371/web/encryption/sign and data {accessControlConditions: Array(1), evmContractConditions: undefined, solRpcConditions: undefined, unifiedAccessControlConditions: undefined, dataToEncryptHash: 'e0a4e7d4dddd90f3c9ba5c2a1a6c955538dd93cd80d3692756b631bc5d84734c', …}accessControlConditions: [{…}]authSig: {sig: '0xa50d552559971c79d41c7a52b5c4f6ca25ea441029f2893e…33345d831a96ec0759591e601123ef32c44b810da7c99511c', derivedVia: 'web3.eth.personal.sign', signedMessage: 'localhost:3000 wants you to sign in with your Ethe…20.185Z\nExpiration Time: 2024-04-17T13:05:20.159Z', address: '0x8a1fb49cb17ab6d1bf2cac34e1f06451c8205605'}chain: "ethereum"dataToEncryptHash: "e0a4e7d4dddd90f3c9ba5c2a1a6c955538dd93cd80d3692756b631bc5d84734c"evmContractConditions: undefinedsolRpcConditions: undefinedunifiedAccessControlConditions: undefined[[Prototype]]: Object misc.js:155 [Lit-JS-SDK v3.0.5] getSigningShareForDecryption misc.js:155 [Lit-JS-SDK v3.0.5] sendCommandToNode with url https://cayenne.litgateway.com:7370/web/encryption/sign and data {accessControlConditions: Array(1), evmContractConditions: undefined, solRpcConditions: undefined, unifiedAccessControlConditions: undefined, dataToEncryptHash: 'e0a4e7d4dddd90f3c9ba5c2a1a6c955538dd93cd80d3692756b631bc5d84734c', …} misc.js:155 [Lit-JS-SDK v3.0.5] getSigningShareForDecryption misc.js:155 [Lit-JS-SDK v3.0.5] sendCommandToNode with url https://cayenne.litgateway.com:7372/web/encryption/sign and data {accessControlConditions: Array(1), evmContractConditions: undefined, solRpcConditions: undefined, unifiedAccessControlConditions: undefined, dataToEncryptHash: 'e0a4e7d4dddd90f3c9ba5c2a1a6c955538dd93cd80d3692756b631bc5d84734c', …}accessControlConditions: [{…}]authSig: {sig: '0xa50d552559971c79d41c7a52b5c4f6ca25ea441029f2893e…33345d831a96ec0759591e601123ef32c44b810da7c99511c', derivedVia: 'web3.eth.personal.sign', signedMessage: 'localhost:3000 wants you to sign in with your Ethe…20.185Z\nExpiration Time: 2024-04-17T13:05:20.159Z', address: '0x8a1fb49cb17ab6d1bf2cac34e1f06451c8205605'}chain: "ethereum"dataToEncryptHash: "e0a4e7d4dddd90f3c9ba5c2a1a6c955538dd93cd80d3692756b631bc5d84734c"evmContractConditions: undefinedsolRpcConditions: undefinedunifiedAccessControlConditions: undefined[[Prototype]]: Object lit.ts:70
LitCore.sendCommandToNode @ lit-core.js:180 LitNodeClientNodeJs.getSigningShareForDecryption @ lit-node-client-nodejs.js:418 eval @ lit-node-client-nodejs.js:1203 LitCore.getNodePromises @ lit-core.js:206 LitNodeClientNodeJs.decrypt @ lit-node-client-nodejs.js:1200 await in LitNodeClientNodeJs.decrypt (async) decryptToString @ encryption.js:207 decryptWithLit @ lit.ts:70 await in decryptWithLit (async) handleDecrypt @ messagesDAOBox.tsx:21 onClick @ messagesDAOBox.tsx:143 callCallback @ react-dom.development.js:17629 invokeGuardedCallbackImpl @ react-dom.development.js:17667 invokeGuardedCallback @ react-dom.development.js:17729 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:17741 executeDispatch @ react-dom.development.js:27186 processDispatchQueueItemsInOrder @ react-dom.development.js:27206 processDispatchQueue @ react-dom.development.js:27215 dispatchEventsForPlugins @ react-dom.development.js:27223 eval @ react-dom.development.js:27378 batchedUpdates$1 @ react-dom.development.js:21180 batchedUpdates @ react-dom.development.js:24349 dispatchEventForPluginEventSystem @ react-dom.development.js:27377 dispatchEvent @ react-dom.development.js:25416 dispatchDiscreteEvent @ react-dom.development.js:25392 Show 20 more frames Show less lit.ts:70 Something went wrong, internal id for request: lit_80276a6930a97. Please provide this identifier with any support requests. Error is The access control condition check returned that you are not permitted to access this content. Are you sure you meet the conditions? Check the auth_sig and the other conditions - The access control condition check returned that you are not permitted to access this content. Are you sure you meet the conditions? Check the auth_sig and the other conditions window.console.error @ app-index.js:35 console.error @ hydration-error-info.js:41 eval @ lit-core.js:191 Promise.catch (async) LitCore.sendCommandToNode @ lit-core.js:190 LitNodeClientNodeJs.getSigningShareForDecryption @ lit-node-client-nodejs.js:418 eval @ lit-node-client-nodejs.js:1203 LitCore.getNodePromises @ lit-core.js:206 LitNodeClientNodeJs.decrypt @ lit-node-client-nodejs.js:1200 await in LitNodeClientNodeJs.decrypt (async) decryptToString @ encryption.js:207 decryptWithLit @ lit.ts:70 await in decryptWithLit (async) handleDecrypt @ messagesDAOBox.tsx:21 onClick @ messagesDAOBox.tsx:143 callCallback @ react-dom.development.js:17629 invokeGuardedCallbackImpl @ react-dom.development.js:17667 invokeGuardedCallback @ react-dom.development.js:17729 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:17741 executeDispatch @ react-dom.development.js:27186 processDispatchQueueItemsInOrder @ react-dom.development.js:27206 processDispatchQueue @ react-dom.development.js:27215 dispatchEventsForPlugins @ react-dom.development.js:27223 eval @ react-dom.development.js:27378 batchedUpdates$1 @ react-dom.development.js:21180 batchedUpdates @ react-dom.development.js:24349 dispatchEventForPluginEventSystem @ react-dom.development.js:27377 dispatchEvent @ react-dom.development.js:25416 dispatchDiscreteEvent @ react-dom.development.js:25392 Show 23 more frames Show less lit.ts:70
LitCore.sendCommandToNode @ lit-core.js:180 LitNodeClientNodeJs.getSigningShareForDecryption @ lit-node-client-nodejs.js:418 eval @ lit-node-client-nodejs.js:1203 LitCore.getNodePromises @ lit-core.js:206 LitNodeClientNodeJs.decrypt @ lit-node-client-nodejs.js:1200 await in LitNodeClientNodeJs.decrypt (async) decryptToString @ encryption.js:207 decryptWithLit @ lit.ts:70 await in decryptWithLit (async) handleDecrypt @ messagesDAOBox.tsx:21 onClick @ messagesDAOBox.tsx:143 callCallback @ react-dom.development.js:17629 invokeGuardedCallbackImpl @ react-dom.development.js:17667 invokeGuardedCallback @ react-dom.development.js:17729 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:17741 executeDispatch @ react-dom.development.js:27186 processDispatchQueueItemsInOrder @ react-dom.development.js:27206 processDispatchQueue @ react-dom.development.js:27215 dispatchEventsForPlugins @ react-dom.development.js:27223 eval @ react-dom.development.js:27378 batchedUpdates$1 @ react-dom.development.js:21180 batchedUpdates @ react-dom.development.js:24349 dispatchEventForPluginEventSystem @ react-dom.development.js:27377 dispatchEvent @ react-dom.development.js:25416 dispatchDiscreteEvent @ react-dom.development.js:25392 Show 20 more frames Show less lit.ts:70 Something went wrong, internal id for request: lit_80276a6930a97. Please provide this identifier with any support requests. Error is The access control condition check returned that you are not permitted to access this content. Are you sure you meet the conditions? Check the auth_sig and the other conditions - The access control condition check returned that you are not permitted to access this content. Are you sure you meet the conditions? Check the auth_sig and the other conditions window.console.error @ app-index.js:35 console.error @ hydration-error-info.js:41 eval @ lit-core.js:191 Promise.catch (async) LitCore.sendCommandToNode @ lit-core.js:190 LitNodeClientNodeJs.getSigningShareForDecryption @ lit-node-client-nodejs.js:418 eval @ lit-node-client-nodejs.js:1203 LitCore.getNodePromises @ lit-core.js:206 LitNodeClientNodeJs.decrypt @ lit-node-client-nodejs.js:1200 await in LitNodeClientNodeJs.decrypt (async) decryptToString @ encryption.js:207 decryptWithLit @ lit.ts:70 await in decryptWithLit (async) handleDecrypt @ messagesDAOBox.tsx:21 onClick @ messagesDAOBox.tsx:143 callCallback @ react-dom.development.js:17629 invokeGuardedCallbackImpl @ react-dom.development.js:17667 invokeGuardedCallback @ react-dom.development.js:17729 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:17741 executeDispatch @ react-dom.development.js:27186 processDispatchQueueItemsInOrder @ react-dom.development.js:27206 processDispatchQueue @ react-dom.development.js:27215 dispatchEventsForPlugins @ react-dom.development.js:27223 eval @ react-dom.development.js:27378 batchedUpdates$1 @ react-dom.development.js:21180 batchedUpdates @ react-dom.development.js:24349 dispatchEventForPluginEventSystem @ react-dom.development.js:27377 dispatchEvent @ react-dom.development.js:25416 dispatchDiscreteEvent @ react-dom.development.js:25392 Show 23 more frames Show less lit.ts:70
POST https://cayenne.litgateway.com:7372/web/encryption/sign 401 (Unauthorized) LitCore.sendCommandToNode @ lit-core.js:180 LitNodeClientNodeJs.getSigningShareForDecryption @ lit-node-client-nodejs.js:418 eval @ lit-node-client-nodejs.js:1203 LitCore.getNodePromises @ lit-core.js:206 LitNodeClientNodeJs.decrypt @ lit-node-client-nodejs.js:1200 await in LitNodeClientNodeJs.decrypt (async) decryptToString @ encryption.js:207 decryptWithLit @ lit.ts:70 await in decryptWithLit (async) handleDecrypt @ messagesDAOBox.tsx:21 onClick @ messagesDAOBox.tsx:143 callCallback @ react-dom.development.js:17629 invokeGuardedCallbackImpl @ react-dom.development.js:17667 invokeGuardedCallback @ react-dom.development.js:17729 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:17741 executeDispatch @ react-dom.development.js:27186 processDispatchQueueItemsInOrder @ react-dom.development.js:27206 processDispatchQueue @ react-dom.development.js:27215 dispatchEventsForPlugins @ react-dom.development.js:27223 eval @ react-dom.development.js:27378 batchedUpdates$1 @ react-dom.development.js:21180 batchedUpdates @ react-dom.development.js:24349 dispatchEventForPluginEventSystem @ react-dom.development.js:27377 dispatchEvent @ react-dom.development.js:25416 dispatchDiscreteEvent @ react-dom.development.js:25392 Show 20 more frames Show less lit.ts:70 Something went wrong, internal id for request: lit_80276a6930a97. Please provide this identifier with any support requests. Error is The access control condition check returned that you are not permitted to access this content. Are you sure you meet the conditions? Check the auth_sig and the other conditions - The access control condition check returned that you are not permitted to access this content. Are you sure you meet the conditions? Check the auth_sig and the other conditions window.console.error @ app-index.js:35 console.error @ hydration-error-info.js:41 eval @ lit-core.js:191 Promise.catch (async) LitCore.sendCommandToNode @ lit-core.js:190 LitNodeClientNodeJs.getSigningShareForDecryption @ lit-node-client-nodejs.js:418 eval @ lit-node-client-nodejs.js:1203 LitCore.getNodePromises @ lit-core.js:206 LitNodeClientNodeJs.decrypt @ lit-node-client-nodejs.js:1200 await in LitNodeClientNodeJs.decrypt (async) decryptToString @ encryption.js:207 decryptWithLit @ lit.ts:70 await in decryptWithLit (async) handleDecrypt @ messagesDAOBox.tsx:21 onClick @ messagesDAOBox.tsx:143 callCallback @ react-dom.development.js:17629 invokeGuardedCallbackImpl @ react-dom.development.js:17667 invokeGuardedCallback @ react-dom.development.js:17729 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:17741 executeDispatch @ react-dom.development.js:27186 processDispatchQueueItemsInOrder @ react-dom.development.js:27206 processDispatchQueue @ react-dom.development.js:27215 dispatchEventsForPlugins @ react-dom.development.js:27223 eval @ react-dom.development.js:27378 batchedUpdates$1 @ react-dom.development.js:21180 batchedUpdates @ react-dom.development.js:24349 dispatchEventForPluginEventSystem @ react-dom.development.js:27377 dispatchEvent @ react-dom.development.js:25416 dispatchDiscreteEvent @ react-dom.development.js:25392 Show 23 more frames Show less misc.js:155 [Lit-JS-SDK v3.0.5] most common error: {"errorKind":"Validation","errorCode":"NodeAccessControlConditionsReturnedNotAuthorized","status":401,"message":"The access control condition check returned that you are not permitted to access this content. Are you sure you meet the conditions? Check the auth_sig and the other conditions","correlationId":"lit_80276a6930a97","details":["The access control condition check returned that you are not permitted to access this content. Are you sure you meet the conditions? Check the auth_sig and the other conditions"]} messagesDAOBox.tsx:31 Uncaught (in promise) errConstructorFunc {message: 'The access control condition check returned that y…ons? Check the auth_sig and the other conditions', errorCode: 'NodeAccessControlConditionsReturnedNotAuthorized', errorKind: 'Validation', status: 401, details: Array(1)} handleDecrypt @ messagesDAOBox.tsx:31 await in handleDecrypt (async) onClick @ messagesDAOBox.tsx:143 callCallback @ react-dom.development.js:17629 invokeGuardedCallbackImpl @ react-dom.development.js:17667 invokeGuardedCallback @ react-dom.development.js:17729 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:17741 executeDispatch @ react-dom.development.js:27186 processDispatchQueueItemsInOrder @ react-dom.development.js:27206 processDispatchQueue @ react-dom.development.js:27215 dispatchEventsForPlugins @ react-dom.development.js:27223 eval @ react-dom.development.js:27378 batchedUpdates$1 @ react-dom.development.js:21180 batchedUpdates @ react-dom.development.js:24349 dispatchEventForPluginEventSystem @ react-dom.development.js:27377 dispatchEvent @ react-dom.development.js:25416 dispatchDiscreteEvent @ react-dom.development.js:25392 Show 14 more frames Show less
Severity of the bug
I wanna use lit-protocol to encrypt data related to different projects stored on ceramic network . I can work on something else while figuring out the bug...
Steps To Reproduce
I am using nextjs14 for the app.
I share lit client in a context provider:
console.log("Starting Lit Client..."); const litClient = new LitJsSdk.LitNodeClient({ //litNetwork: "cayenne", url: window.location.origin, }); litClient.connect(); setLit(litClient);
[...]
<CeramicContext.Provider value={{ ceramic, composeClient, isAuth, setAuth, accountId, setAccountId, didsession, setDidsession, lit, }}
Then I consume the context in a component for encrypting a message:
const processForm: SubmitHandler = async (data) => {
//setMessage(data.message);
if (lit && data.message && data.message.length > 0) {
const tokenDetails = await tokenVotingClient.methods.getToken(
selectedProject.aragonDaoTokenVotingPluginAddress
);
const tokenAddress = tokenDetails?.address ?? "";
console.log("tokenAddress in messageDAOModal:", tokenAddress);
// TODO here must give conditions to be a member of the selectedProject DAO
const accessControlConditions = [
{
contractAddress: tokenAddress,
standardContractType: "",
chain,
method: "balanceOf",
parameters: [":userAddress"],
returnValueTest: {
comparator: ">",
value: "0",
},
},
];
/ const accessControlConditions = [
{
contractAddress: "",
standardContractType: "",
chain,
method: "",
parameters: [":userAddress"],
returnValueTest: {
comparator: "=",
value: account.address as string,
},
},
]; /
};
And I use the lit client in another component to decrypt the message:
const handleDecrypt = async (event: any, message: MessageDAO) => { const encryptedMessage = message.body; const ciphertext = message.ciphertext; const accessControl = decodeb64(message.accessControlConditions); const decoded = new TextDecoder().decode(accessControl); if (lit) { const decodedMessage = await decryptWithLit( lit, ciphertext, encryptedMessage, JSON.parse(decoded), message.chain ); event.target.parentElement.children[1].innerText = decodedMessage; event.target.innerText = "Decoded!"; } };
Link to code
No response
Anything else?
No response