I’m trying to find a way to use the policy ID and script generated by CLI with cardano-serialization-lib. To my understanding, cardano-serialization-lib works in a different way than the CLI.
In Cardano CLI, I used to generate policy sKey and vKey using cardano-cli address key-gen and then use the vKey to generate keyHash with cardano-cli address key-hash and finally the policy script which looks something like this:-
The answers seem quite useful to me. The last one even contains the complete example code.
The policy ID is a hash of the policy – actually not of the JSON file, but of the CBOR generated from the JSON file (the thing you see at policyScript in your CSL example).