diff --git a/README.md b/README.md index cc1625e..a3615a8 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,10 @@ $ veramo config check -f agent.yml Your Veramo configuration seems fine. An agent can be created and the 'agent.execute()' method can be called on it. ``` +### 5. Environment setup + +1. `LIT_PROTOCOL_DEBUG` - Set this to `true` to enable debug logging for the LIT protocol. By default it is set to `false`. + ## 📖 Documentation [Tutorials, advanced configuration, and architecture for cheqd's Veramo plugin](https://docs.cheqd.io/identity/guides/sdk/veramo-sdk-for-cheqd) can be found on our [Identity Docs site](https://docs.cheqd.io/identity/). diff --git a/src/dkg-threshold/lit-protocol/v2.ts b/src/dkg-threshold/lit-protocol/v2.ts index 63b6a6b..0982122 100644 --- a/src/dkg-threshold/lit-protocol/v2.ts +++ b/src/dkg-threshold/lit-protocol/v2.ts @@ -7,6 +7,7 @@ import { JsonSaveEncryptionKeyRequest } from '@lit-protocol/types-v2'; import { randomBytes } from '../../utils/helpers.js'; import { isBrowser, isNode } from '../../utils/env.js'; import { v4 } from 'uuid'; +import { LitProtocolDebugEnabled } from '../../utils/constants.js'; export type EncryptionResultV2 = { encryptedString: Blob; @@ -96,8 +97,8 @@ export class LitProtocolV2 { // set client as per environment this.client = (function (that: LitProtocolV2) { - if (isNode) return new LitNodeClientNodeJs({ litNetwork: that.litNetwork }); - if (isBrowser) return new LitNodeClient({ litNetwork: that.litNetwork }); + if (isNode) return new LitNodeClientNodeJs({ litNetwork: that.litNetwork, debug: LitProtocolDebugEnabled }); + if (isBrowser) return new LitNodeClient({ litNetwork: that.litNetwork, debug: LitProtocolDebugEnabled }); throw new Error('[did-provider-cheqd]: lit-protocol: Unsupported runtime environment'); })(this); } diff --git a/src/dkg-threshold/lit-protocol/v3.ts b/src/dkg-threshold/lit-protocol/v3.ts index 7a69f5b..41f40dc 100644 --- a/src/dkg-threshold/lit-protocol/v3.ts +++ b/src/dkg-threshold/lit-protocol/v3.ts @@ -7,6 +7,7 @@ import { generateSymmetricKey, randomBytes } from '../../utils/helpers.js'; import { isBrowser, isNode } from '../../utils/env.js'; import { v4 } from 'uuid'; import { fromString } from 'uint8arrays'; +import { LitProtocolDebugEnabled } from '../../utils/constants.js'; export type ThresholdEncryptionResult = { encryptedString: Uint8Array; @@ -99,8 +100,8 @@ export class LitProtocol { // set client as per environment this.client = (function (that: LitProtocol) { - if (isNode) return new LitNodeClientNodeJs({ litNetwork: that.litNetwork }); - if (isBrowser) return new LitNodeClient({ litNetwork: that.litNetwork }); + if (isNode) return new LitNodeClientNodeJs({ litNetwork: that.litNetwork, debug: LitProtocolDebugEnabled }); + if (isBrowser) return new LitNodeClient({ litNetwork: that.litNetwork, debug: LitProtocolDebugEnabled }); throw new Error('[did-provider-cheqd]: lit-protocol: Unsupported runtime environment'); })(this); } diff --git a/src/utils/constants.ts b/src/utils/constants.ts new file mode 100644 index 0000000..ffbb345 --- /dev/null +++ b/src/utils/constants.ts @@ -0,0 +1 @@ +export const LitProtocolDebugEnabled = process.env.LIT_PROTOCOL_DEBUG === 'true'; \ No newline at end of file