Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ services:
networks:
- internal

ceramic:
image: ceramicnetwork/js-ceramic:2.7.0-rc.2
ports:
- 7007:7007
volumes:
- ./.ceramic/config/daemon.config.json:/root/.ceramic/daemon.config.json
- ./.ceramic/logs:/root/.ceramic/logs
- ./.ceramic/statestore:/root/.ceramic/statestore
env_file: docker-compose.env
networks:
- internal
depends_on:
- ipfs

networks:
internal:

Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"resolutions": {
"@types/react": "^17.0.38",
"ethereumjs-abi": "^0.6.8",
"web-worker": "1.2.0"
"web-worker": "1.2.0",
"@ceramicnetwork/streamid": "5.0.0"
},
"devDependencies": {
"@babel/core": "^7.22",
Expand All @@ -80,9 +81,14 @@
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.22.5",
"@babel/runtime": "^7.8.4",
"@ceramicnetwork/http-client": "^5.8.0",
"@cucumber/cucumber": "^8.8.0",
"@cucumber/pretty-formatter": "^1.0.0",
"@glazed/datamodel": "^0.3.1",
"@glazed/devtools": "^0.2.0",
"@glazed/did-datastore": "^0.3.2",
"@glazed/tile-loader": "^0.2.1",
"@glazed/types": "^0.2.0",
"@google-cloud/storage": "^6.7.0",
"@jest/types": "^29.0.3",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
Expand Down Expand Up @@ -147,6 +153,7 @@
"copyfiles": "^2.3.0",
"css-loader": "^5.0.1",
"cucumber-tsflow": "^4.0.0-rc.7",
"dids": "^5.0.2",
"env-cmd": "^10.1.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^7.2.0",
Expand Down Expand Up @@ -180,6 +187,8 @@
"jest": "^29.0.3",
"jest-when": "^3.0.1",
"jsonschema": "^1.4.1",
"key-did-provider-ed25519": "^4.0.2",
"key-did-resolver": "^4.0.0",
"lint-staged": ">=10",
"merge-jsons-webpack-plugin": "^2.0.1",
"metro-react-native-babel-preset": "^0.59.0",
Expand Down Expand Up @@ -215,6 +224,7 @@
"typechain": "^8.3.0",
"typedoc": "^0.20.16",
"typescript": "^5.2.2",
"uint8arrays": "^5.0.3",
"url-loader": "3.0.0",
"wait-on": "^5.2.0",
"webpack": "^5.68.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ import {
IPersistenceContextProviderType,
NullCloudStorage,
INullCloudStorageType,
ICeramicCloudStorageType,
CeramicCloudStorage,
} from "@snickerdoodlelabs/persistence";
import {
IQueryObjectFactory,
Expand Down Expand Up @@ -553,6 +555,10 @@ export const snickerdoodleCoreModule = new ContainerModule(
.to(DropboxCloudStorage)
.inSingletonScope();

bind<ICloudStorage>(ICeramicCloudStorageType)
.to(CeramicCloudStorage)
.inSingletonScope();

// ZK Circuits -------------------------------------------------------
bind<IMembershipWrapper>(IMembershipWrapperType)
.to(CircomMembershipWrapper)
Expand Down
21 changes: 21 additions & 0 deletions packages/core/src/implementations/utilities/ConfigProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ export class ConfigProvider
);
}

const modelAliases = {
definitions: {
backupIndex:
"kjzl6cwe1jw147v87ik1jkkhit8o20z8o3gdua5n65g3gyc6umsfmz80vphpl6k",
},
schemas: {
DataWalletBackup:
"ceramic://k3y52l7qbv1fryeqpnu3xx9st37h6soh7cosvpskp59r6wj8ag4zl2n3u3283xrsw",
BackupIndex:
"ceramic://k3y52l7qbv1fryk2h9xhsf2mai9wsiga2eld67pn8vgo3845yad3bn9plleei53pc",
},
tiles: {},
};
const discordConfig = {
clientId: "1089994449830027344",
clientSecret: TokenSecret("uqIyeAezm9gkqdudoPm9QB-Dec7ZylWQ"),
Expand Down Expand Up @@ -187,6 +200,8 @@ export class ConfigProvider
LanguageCode("en"), // passwordLanguageCode
100, // sets the size for query performance events, e.g. how many errors and durations will be stored, main metric object will not be effected
URLString("https://ipfs-gateway.snickerdoodle.com/ipfs/"),
modelAliases, // ceramicModelAliases
URLString("https://ceramic.snickerdoodle.dev/"), // ceramicNodeURL
);
}

Expand Down Expand Up @@ -380,5 +395,11 @@ export class ConfigProvider
this.config.queryPerformanceMetricsLimit =
overrides.queryPerformanceMetricsLimit ??
this.config.queryPerformanceMetricsLimit;

//Ceramic
this.config.ceramicNodeURL =
overrides.ceramicNodeURL ?? this.config.ceramicNodeURL;
this.config.ceramicModelAliases =
overrides.ceramicModelAliases ?? this.config.ceramicModelAliases;
}
}
5 changes: 5 additions & 0 deletions packages/core/src/interfaces/objects/CoreConfig.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { MapModelTypes } from "@glazed/types";
import { ICircuitsSDKConfig } from "@snickerdoodlelabs/circuits-sdk";
import { IIndexerConfig } from "@snickerdoodlelabs/indexers";
import {
Expand All @@ -10,6 +11,7 @@ import {
ProviderUrl,
LanguageCode,
IApiKeys,
ModelTypes,
} from "@snickerdoodlelabs/objects";
import { IPersistenceConfig } from "@snickerdoodlelabs/persistence";

Expand Down Expand Up @@ -55,5 +57,8 @@ export class CoreConfig
public passwordLanguageCode: LanguageCode,
public queryPerformanceMetricsLimit: number,
public circuitsIpfsFetchBaseUrl: URLString,

public ceramicModelAliases: MapModelTypes<ModelTypes, string>,
public ceramicNodeURL: URLString,
) {}
}
16 changes: 16 additions & 0 deletions packages/core/test/mock/mocks/commonValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ const testDiscordConfig = {
pollInterval: 2 * 1000, // days * hours * seconds * milliseconds
};

export const modelAliases = {
definitions: {
backupIndex:
"kjzl6cwe1jw149f06c8o6hgro45rerad83swxqn5nrijb4i271uc1g5dybjjk22",
},
schemas: {
BackupIndex:
"ceramic://k3y52l7qbv1frxm8elgkbtatgwkukhh7f3he8h6jarqy8szuq39x96heksob9hqtc",
DataWalletBackup:
"ceramic://k3y52l7qbv1frxmf8dp0byvefkkj7j9f4hztn82r85lmpsrln5195njzlaw6zq680",
},
tiles: {},
};

const testTwitterConfig = {
apiKey: "IksHLFQGjifiBzswDKpdjtyqW",
apiSecretKey: TokenSecret(
Expand Down Expand Up @@ -228,6 +242,8 @@ export const testCoreConfig = new CoreConfig(
LanguageCode("en-pw"), // passwordLanguageCode
100,
URLString("https://ipfs-gateway.snickerdoodle.com/ipfs/"),
modelAliases, // ceramicModelAliases
URLString("http://ceramicNodeURL"), // ceramicNodeURL
);

const adContent1: AdContent = new AdContent(
Expand Down
7 changes: 6 additions & 1 deletion packages/objects/src/interfaces/IConfigOverrides.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { MapModelTypes } from "@glazed/types";

import {
DiscordConfig,
SpaceAndTimeConfig,
TwitterConfig,
} from "@objects/businessObjects/index.js";
import { EChain } from "@objects/enum/index.js";
import { ModelTypes } from "@objects/interfaces";
import { ProviderUrl, URLString } from "@objects/primitives/index.js";

export interface IConfigOverrides {
controlChainId?: EChain;
ipfsFetchBaseUrl?: URLString;
Expand Down Expand Up @@ -70,4 +72,7 @@ export interface IConfigOverrides {
iframeURL?: URLString;
debug?: boolean;
queryPerformanceMetricsLimit?: number;

ceramicModelAliases?: MapModelTypes<ModelTypes, string>;
ceramicNodeURL?: URLString;
}
36 changes: 36 additions & 0 deletions packages/objects/src/interfaces/IDataWalletBackup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Brand, make } from "ts-brand";

import { AESEncryptedString } from "@objects/businessObjects";
import { UnixTimestamp } from "@objects/primitives";

export interface IDataWalletBackupHeader {
hash: string;
timestamp: UnixTimestamp;
signature: string;
}

export interface IDataWalletBackup {
header: IDataWalletBackupHeader;
blob: AESEncryptedString;
}

export type FieldMap = { [key: string]: [object, number] };
export type TableMap = { [key: string]: object[] };

export class BackupBlob {
public constructor(public fields: FieldMap, public records: TableMap) {}
}

export type BackupIndexEntry = { id: string; timestamp: number };
export type BackupIndex = { backups: { [key: string]: BackupIndexEntry } };

export type ModelTypes = {
schemas: {
DataWalletBackup: IDataWalletBackup;
BackupIndex: AESEncryptedString;
};
definitions: {
backupIndex: "BackupIndex";
};
tiles: Record<string, never>;
};
1 change: 1 addition & 0 deletions packages/objects/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from "@objects/interfaces/IConfigOverrides.js";
export * from "@objects/interfaces/IBrandInformation.js";
export * from "@objects/interfaces/IConsentCapacity.js";
export * from "@objects/interfaces/ICrumbContent.js";
export * from "@objects/interfaces/IDataWalletBackup.js";
export * from "@objects/interfaces/IERC721Metadata.js";
export * from "@objects/interfaces/IExtensionConfigOverrides.js";
export * from "@objects/interfaces/IExtensionSdkConfigOverrides.js";
Expand Down
7 changes: 5 additions & 2 deletions packages/persistence/src/IPersistenceConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { URLString } from "@snickerdoodlelabs/objects";

import { ModelAliases } from "@glazed/types";
import { ModelTypes, URLString } from "@snickerdoodlelabs/objects";
export interface IPersistenceConfig {
accountBalancePollingIntervalMS: number;
accountNFTPollingIntervalMS: number;
Expand All @@ -14,4 +14,7 @@ export interface IPersistenceConfig {
dropboxAppKey: string;
dropboxAppSecret: string;
dropboxRedirectUri: string;

ceramicModelAliases: ModelAliases<ModelTypes>;
ceramicNodeURL: URLString;
}
Loading