@learncard/ceramic-plugin 1.0.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.
- package/LICENSE +21 -0
- package/README.md +140 -0
- package/dist/ceramic-plugin.cjs.development.js +52215 -0
- package/dist/ceramic-plugin.cjs.development.js.map +7 -0
- package/dist/ceramic-plugin.cjs.production.min.js +844 -0
- package/dist/ceramic-plugin.cjs.production.min.js.map +7 -0
- package/dist/ceramic-plugin.esm.js +52217 -0
- package/dist/ceramic-plugin.esm.js.map +7 -0
- package/dist/ceramic.d.ts +6 -0
- package/dist/helpers.d.ts +3 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +7 -0
- package/dist/types.d.ts +42 -0
- package/package.json +55 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LearnCard } from '@learncard/core';
|
|
2
|
+
import type { CeramicPlugin, CeramicPluginDependentMethods, CeramicArgs } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @group Plugins
|
|
5
|
+
*/
|
|
6
|
+
export declare const getCeramicPlugin: (learnCard: LearnCard<any, any, CeramicPluginDependentMethods>, { ceramicEndpoint, defaultContentFamily }: CeramicArgs) => Promise<CeramicPlugin>;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DID, CreateJWEOptions, DIDResolutionResult } from 'dids';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CeramicClient } from '@ceramicnetwork/http-client';
|
|
4
|
+
import { Plugin } from '@learncard/core';
|
|
5
|
+
import { InputMetadata } from '@learncard/didkit-plugin';
|
|
6
|
+
/** @group CeramicPlugin */
|
|
7
|
+
export type CeramicArgs = {
|
|
8
|
+
ceramicEndpoint: string;
|
|
9
|
+
defaultContentFamily: string;
|
|
10
|
+
};
|
|
11
|
+
/** @group CeramicPlugin */
|
|
12
|
+
export type CeramicURI = `lc:ceramic:${string}`;
|
|
13
|
+
/** @group CeramicPlugin */
|
|
14
|
+
export declare const CeramicURIValidator: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Settings for toggling JWE Encryption before uploading to Ceramic.
|
|
17
|
+
* @group CeramicPlugin
|
|
18
|
+
* @param encrypt enable JWE encryption on upload.
|
|
19
|
+
* @param controllersCanDecrypt helper to add Ceramic controller DIDs to recipients who can decrypt the JWE credential.
|
|
20
|
+
* @param recipients DIDs who can decrypt the JWE credential.
|
|
21
|
+
* @param options additional CreateJWEOptions for encryption.
|
|
22
|
+
*/
|
|
23
|
+
export type CeramicEncryptionParams = {
|
|
24
|
+
encrypt: boolean;
|
|
25
|
+
controllersCanDecrypt?: boolean;
|
|
26
|
+
recipients?: string[] | undefined;
|
|
27
|
+
options?: CreateJWEOptions | undefined;
|
|
28
|
+
};
|
|
29
|
+
/** @group CeramicPlugin */
|
|
30
|
+
export type CeramicPluginMethods = {
|
|
31
|
+
publishContentToCeramic: (cred: any, encryption: CeramicEncryptionParams | undefined) => Promise<CeramicURI>;
|
|
32
|
+
readContentFromCeramic: (streamId: string) => Promise<any>;
|
|
33
|
+
getCeramicClient: () => CeramicClient;
|
|
34
|
+
getDIDObject: () => DID;
|
|
35
|
+
};
|
|
36
|
+
/** @group CeramicPlugin */
|
|
37
|
+
export type CeramicPluginDependentMethods = {
|
|
38
|
+
getKey: () => string;
|
|
39
|
+
didResolver: (did: string, inputMetadata?: InputMetadata) => Promise<DIDResolutionResult>;
|
|
40
|
+
};
|
|
41
|
+
/** @group CeramicPlugin */
|
|
42
|
+
export type CeramicPlugin = Plugin<'Ceramic', 'read' | 'store', CeramicPluginMethods>;
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@learncard/ceramic-plugin",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/ceramic-plugin.esm.js",
|
|
7
|
+
"private": false,
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"author": "Learning Economy Foundation (www.learningeconomy.io)",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "https://github.com/WeLibraryOS/LearnCard#readme",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/WeLibraryOS/LearnCard.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/WeLibraryOS/LearnCard/issues"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/jest": "^29.2.2",
|
|
23
|
+
"@types/lodash": "^4.14.191",
|
|
24
|
+
"@types/node": "^17.0.31",
|
|
25
|
+
"aqu": "0.4.3",
|
|
26
|
+
"esbuild": "^0.14.38",
|
|
27
|
+
"esbuild-jest": "^0.5.0",
|
|
28
|
+
"esbuild-plugin-copy": "^1.3.0",
|
|
29
|
+
"jest": "^29.3.0",
|
|
30
|
+
"shx": "^0.3.4",
|
|
31
|
+
"ts-jest": "^29.0.3",
|
|
32
|
+
"@learncard/didkit-plugin": "1.0.0"
|
|
33
|
+
},
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@ceramicnetwork/common": "2.13.0",
|
|
37
|
+
"@ceramicnetwork/http-client": "2.7.0",
|
|
38
|
+
"@ceramicnetwork/stream-tile": "2.9.0",
|
|
39
|
+
"@glazed/tile-loader": "0.2.1",
|
|
40
|
+
"did-jwt": "5.9.0",
|
|
41
|
+
"dids": "^3.2.0",
|
|
42
|
+
"hex-lite": "^1.5.0",
|
|
43
|
+
"key-did-provider-ed25519": "^2.0.0",
|
|
44
|
+
"key-did-resolver": "2.3.0",
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"@learncard/types": "5.3.0",
|
|
47
|
+
"@learncard/core": "9.0.0"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.json",
|
|
51
|
+
"test": "jest --passWithNoTests",
|
|
52
|
+
"test:watch": "jest --watch",
|
|
53
|
+
"test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""
|
|
54
|
+
}
|
|
55
|
+
}
|