Skip to content

Commit

Permalink
fix(app): prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianHymer committed Jun 27, 2024
1 parent 892fc65 commit 5b974ca
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions app/context/datastoreConnectionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,19 @@ export const useDatastoreConnection = () => {
let dbCacheTokenKey = "";

try {
console.log("debug - 1")
console.log("debug - 1");
const accountId = new AccountId({
// We always use chain id 1 for now for all sessions, to avoid users
// switching networks and not see their stamps any more
chainId: "eip155:1",
address,
});
console.log("debug - 2")
console.log("debug - 2");
// Unfortunate workaround due to dependency issues
const authMethod = (await EthereumWebAuth.getAuthMethod(provider, accountId)) as any;
// Sessions will be serialized and stored in localhost
// The sessions are bound to an ETH address, this is why we use the address in the session key
console.log("debug - 3")
console.log("debug - 3");
sessionKey = `didsession-${address}`;
dbCacheTokenKey = `dbcache-token-${address}`;
// const sessionStr = window.localStorage.getItem(sessionKey);
Expand Down Expand Up @@ -171,42 +171,42 @@ export const useDatastoreConnection = () => {
// // window.localStorage.setItem(sessionKey, session.serialize());
// }

console.log("debug - 4")
console.log("debug - 4");

// Extensions which inject the Buffer library break the
// did-session library, so we need to remove it
if (globalThis.Buffer) {
console.log("debug - 5")
console.log("debug - 5");
datadogLogs.logger.warn("Buffer library is injected, setting to undefined", {
buffer: `${globalThis.Buffer}`,
});
globalThis.Buffer = undefined as any;
console.log("debug - 6")
console.log("debug - 6");
console.log(
"Warning: Buffer library is injected! This will be overwritten in order to avoid conflicts with did-session."
);
} else {
console.log("Buffer library is not injected` (this is good)");
}
console.log("debug - 7")
console.log("debug - 7");
let session: DIDSession = await DIDSession.get(accountId, authMethod, { resources: ["ceramic://*"] });
console.log("debug - 8")
console.log("debug - 8");

if (session) {
console.log("debug - 9")
console.log("debug - 9");
await loadDbAccessToken(address, session.did);
console.log("debug - 10")
console.log("debug - 10");
setDid(session.did);
console.log("debug - 11")
console.log("debug - 11");

// session.isExpired looks like a static variable so this looks like a bug,
// but isExpired is a getter, so it's actually checking the current status
// whenever checkSessionIsValid is called
setCheckSessionIsValid(() => () => !session.isExpired);
console.log("debug - 12")
console.log("debug - 12");
}
} catch (error) {
console.error("debug - 1", error)
console.error("debug - 1", error);
await handleConnectionError(sessionKey, dbCacheTokenKey);
toast({
duration: 6000,
Expand Down

0 comments on commit 5b974ca

Please sign in to comment.