diff --git a/src/components/authManager.js b/src/components/authManager.js index 35b28d4..ba2b211 100644 --- a/src/components/authManager.js +++ b/src/components/authManager.js @@ -85,16 +85,18 @@ class AuthManager { if (!didDocument) { if (!didClient) { - const { DID_SERVER_URL } = process.env - didClient = new DIDClient(DID_SERVER_URL) + const didClientConfig = { + network: process.env.DID_NETWORK ? process.env.DID_NETWORK : 'testnet', + rpcUrl: process.env.DID_RPC_URL + } + + didClient = new DIDClient(didClientConfig); } didDocument = await didClient.get(did) - - if (!didDocument) { - return false - } - + + // @todo: check if the doc was auto-generated or actually + // stored on chain? if not on chain, don't cache if (didDocument) { const { DID_CACHE_DURATION } = process.env mcache.put(cacheKey, didDocument, DID_CACHE_DURATION * 1000)