Skip to content

Commit 49fafb8

Browse files
committed
fix(app, database-client): remove headers and add did to cacheClient
1 parent 6ef25db commit 49fafb8

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

database-client/src/ceramicCacheClient.ts

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import axios from "axios";
22
import { Logger } from "./ceramicClient";
33
import { DataStorageBase } from "./types";
4+
import type { DID as CeramicDID } from "dids";
45
import {
56
PROVIDER_ID,
67
Stamp,
@@ -14,13 +15,15 @@ export class CeramicCacheDatabase implements DataStorageBase {
1415
ceramicCacheUrl: string;
1516
ceramicCacheApiKey: string;
1617
address: string;
18+
did: string;
1719
logger: Logger;
1820

19-
constructor(ceramicCacheUrl: string, ceramicCacheApiKey: string, address: string, logger?: Logger) {
21+
constructor(ceramicCacheUrl: string, ceramicCacheApiKey: string, address: string, logger?: Logger, did?: CeramicDID) {
2022
this.ceramicCacheUrl = ceramicCacheUrl;
2123
this.ceramicCacheApiKey = ceramicCacheApiKey;
2224
this.address = address;
2325
this.logger = logger;
26+
this.did = (did.hasParent ? did.parent : did.id).toLowerCase();
2427
}
2528

2629
async createPassport(): Promise<string> {
@@ -34,11 +37,6 @@ export class CeramicCacheDatabase implements DataStorageBase {
3437
try {
3538
const response = await axios.get(
3639
`${this.ceramicCacheUrl}/ceramic-cache/stamp?address=${this.address}`,
37-
{
38-
headers: {
39-
"X-API-Key": this.ceramicCacheApiKey,
40-
},
41-
}
4240
)
4341
const { data } = response;
4442
if (data && data.success === 200) {
@@ -70,13 +68,6 @@ export class CeramicCacheDatabase implements DataStorageBase {
7068
provider: stamp.provider,
7169
stamp: stamp.credential,
7270
},
73-
{
74-
headers: {
75-
"X-API-Key": this.ceramicCacheApiKey,
76-
accept: "application/json",
77-
'Content-Type': 'application/json',
78-
},
79-
}
8071
)
8172
} catch (e) {
8273
this.logger.error(`Error saving stamp to ceramicCache address: ${this.address}:` + e.toString());
@@ -86,9 +77,6 @@ export class CeramicCacheDatabase implements DataStorageBase {
8677
this.logger.info(`deleting stamp from ceramicCache for ${provider} on ${this.address}`);
8778
try {
8879
await axios.delete(`${this.ceramicCacheUrl}/ceramic-cache/stamp`, {
89-
headers: {
90-
'Content-Type': 'application/json',
91-
},
9280
data: {
9381
address: this.address,
9482
provider: provider,

0 commit comments

Comments
 (0)