Skip to content

Instantly share code, notes, and snippets.

@irzhywau
Created August 21, 2025 19:12
Show Gist options
  • Select an option

  • Save irzhywau/505e978f7c2118d67dca98763ed7c7b0 to your computer and use it in GitHub Desktop.

Select an option

Save irzhywau/505e978f7c2118d67dca98763ed7c7b0 to your computer and use it in GitHub Desktop.
Lit - Encryption process (backend)
// KID and CEK are parameters
const { ciphertext, dataToEncryptHash, ...rest } = await lit.encrypt({
unifiedAccessControlConditions: [
{
conditionType: "evmContract",
chain: 'arbitrumSepolia',
contractAddress: '0x4Ba1151B5bc5B39500ff8D3B277eC6d217cB33ee',
functionName: 'hasAccessByContentId',
functionParams: [':userAddress', KID],
functionAbi: {
inputs: [
{ name: 'userAddress', type: 'address' },
{ name: 'contentId', type: 'bytes16' }
],
name: 'hasAccessByContentId',
outputs: [{ name: 'hasAccess', type: 'bool' }],
stateMutability: 'view',
type: 'function'
},
returnValueTest: { key: 'hasAccess', comparator: '=', value: 'true' }
}
],
dataToEncrypt: CEK
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment