diff --git a/api/src/controllers/index.js b/api/src/controllers/index.js index a8a2fd46..353120ad 100644 --- a/api/src/controllers/index.js +++ b/api/src/controllers/index.js @@ -12,11 +12,10 @@ export const getIndexById = async (req, res, next) => { } } export const createIndex = async (req, res, next) => { - - try { - const pkpSession = getPKPSession(req.session, req.body); + const pkpSession = await getPKPSession(req.session, req.body); + const indexService = new IndexService().setSession(pkpSession); //PKP const newIndex = await indexService.createIndex(req.body); diff --git a/api/src/libs/lit/index.js b/api/src/libs/lit/index.js index fb3a1383..4c36f3d6 100644 --- a/api/src/libs/lit/index.js +++ b/api/src/libs/lit/index.js @@ -159,6 +159,7 @@ export const getPKPSession = async (session, index) => { try{ const litNodeClient = new LitJsSdk.LitNodeClientNodeJs({ litNetwork: 'cayenne', + debug: false, }); await litNodeClient.connect(); const signerFunctionV0 = CID.parse(index.signerFunction).toV0().toString(); @@ -178,7 +179,7 @@ export const getPKPSession = async (session, index) => { const { error } = resp.response; // TODO Handle. if (error) { - console.log(error) + console.log("LIT Node Client Error", error); return null; } @@ -195,7 +196,7 @@ export const getPKPSession = async (session, index) => { const did = await createDIDCacao(didKey, cacao); const pkpSession = new DIDSession({ cacao, keySeed, did }); - await redis.hSet("sessions", sessionCacheKey, session.serialize()); + await redis.hSet("sessions", sessionCacheKey, pkpSession.serialize()); await pkpSession.did.authenticate() return pkpSession diff --git a/api/src/services/index.js b/api/src/services/index.js index c8da7a68..8b227627 100644 --- a/api/src/services/index.js +++ b/api/src/services/index.js @@ -186,7 +186,6 @@ export class IndexService { try { const content = { - ...params, updatedAt: getCurrentDateTime(), deletedAt: getCurrentDateTime(), };