@canton-network/core-wallet-store 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,eAAe;;;;;;;;;EAG1B,CAAA;AAOF,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWtB,CAAA;AAEF,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAStB,CAAA;AAEF,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU9B,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIrB,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOxB,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA;AAC7C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAC7E,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA"}
@@ -0,0 +1,75 @@
1
+ import { z } from 'zod';
2
+ export const ledgerApiSchema = z.object({
3
+ baseUrl: z.string().url(),
4
+ adminGrpcUrl: z.string().url(), // TODO(#180): remove after grpc is gone
5
+ });
6
+ const clientCredentials = z.object({
7
+ clientId: z.string(),
8
+ clientSecret: z.string(),
9
+ });
10
+ const passwordAuthSchema = z.object({
11
+ identityProviderId: z.string(),
12
+ type: z.literal('password'),
13
+ issuer: z.string(),
14
+ configUrl: z.string(),
15
+ audience: z.string(),
16
+ tokenUrl: z.string(),
17
+ grantType: z.string(),
18
+ scope: z.string(),
19
+ clientId: z.string(),
20
+ admin: z.optional(clientCredentials),
21
+ });
22
+ const implicitAuthSchema = z.object({
23
+ identityProviderId: z.string(),
24
+ type: z.literal('implicit'),
25
+ issuer: z.string(),
26
+ configUrl: z.string(),
27
+ audience: z.string(),
28
+ scope: z.string(),
29
+ clientId: z.string(),
30
+ admin: z.optional(clientCredentials),
31
+ });
32
+ const clientCredentialAuthSchema = z.object({
33
+ identityProviderId: z.string(),
34
+ type: z.literal('client_credentials'),
35
+ issuer: z.string(),
36
+ configUrl: z.string(),
37
+ audience: z.string(),
38
+ scope: z.string(),
39
+ clientId: z.string(),
40
+ clientSecret: z.string(),
41
+ admin: z.optional(clientCredentials),
42
+ });
43
+ export const authSchema = z.discriminatedUnion('type', [
44
+ passwordAuthSchema,
45
+ implicitAuthSchema,
46
+ clientCredentialAuthSchema,
47
+ ]);
48
+ export const networkSchema = z.object({
49
+ name: z.string(),
50
+ chainId: z.string(),
51
+ synchronizerId: z.string(),
52
+ description: z.string(),
53
+ ledgerApi: ledgerApiSchema,
54
+ auth: authSchema,
55
+ });
56
+ export const storeConfigSchema = z.object({
57
+ connection: z.discriminatedUnion('type', [
58
+ z.object({
59
+ type: z.literal('memory'),
60
+ }),
61
+ z.object({
62
+ type: z.literal('sqlite'),
63
+ database: z.string(),
64
+ }),
65
+ z.object({
66
+ type: z.literal('postgres'),
67
+ host: z.string(),
68
+ port: z.number(),
69
+ user: z.string(),
70
+ password: z.string(),
71
+ database: z.string(),
72
+ }),
73
+ ]),
74
+ networks: z.array(networkSchema),
75
+ });
@@ -0,0 +1,3 @@
1
+ export * from './Store.js';
2
+ export * from './config/schema.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './Store.js';
2
+ export * from './config/schema.js';
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@canton-network/core-wallet-store",
3
+ "version": "0.1.0",
4
+ "description": "The Store API provides persistency for the wallet kernel.",
5
+ "author": "Marc Juchli <marc.juchli@digitalasset.com>",
6
+ "license": "Apache-2.0",
7
+ "packageManager": "yarn@4.9.2",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "type": "module",
11
+ "scripts": {
12
+ "build": "tsc -b",
13
+ "dev": "tsc -b --watch",
14
+ "clean": "tsc -b --clean; rm -rf dist",
15
+ "test": "yarn node --experimental-vm-modules $(yarn bin jest) --passWithNoTests"
16
+ },
17
+ "dependencies": {
18
+ "zod": "^3.25.64"
19
+ },
20
+ "devDependencies": {
21
+ "@jest/globals": "^29.0.0",
22
+ "@swc/core": "^1.11.31",
23
+ "@swc/jest": "^0.2.38",
24
+ "@types/jest": "^30.0.0",
25
+ "jest": "^30.0.0",
26
+ "ts-jest": "^29.4.0",
27
+ "ts-jest-resolver": "^2.0.1",
28
+ "typescript": "^5.8.3"
29
+ },
30
+ "files": [
31
+ "dist/*"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ }
36
+ }