@learncard/network-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/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/lcn-plugin.cjs.development.js +102339 -0
- package/dist/lcn-plugin.cjs.development.js.map +7 -0
- package/dist/lcn-plugin.cjs.production.min.js +952 -0
- package/dist/lcn-plugin.cjs.production.min.js.map +7 -0
- package/dist/lcn-plugin.esm.js +102339 -0
- package/dist/lcn-plugin.esm.js.map +7 -0
- package/dist/learnCard.d.ts +6 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/types.d.ts +57 -0
- package/package.json +41 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LearnCardFromSeed, AddPlugin } from '@learncard/core';
|
|
2
|
+
import { LearnCardNetworkPlugin } from './types';
|
|
3
|
+
export type NetworkLearnCard = AddPlugin<LearnCardFromSeed['returnValue'], LearnCardNetworkPlugin>;
|
|
4
|
+
export declare const initNetworkLearnCard: (_config: LearnCardFromSeed['args'] & {
|
|
5
|
+
network?: string;
|
|
6
|
+
}) => Promise<NetworkLearnCard>;
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LearnCard } from '@learncard/core';
|
|
2
|
+
import { LearnCardNetworkPluginDependentMethods, LearnCardNetworkPlugin } from './types';
|
|
3
|
+
export * from './types';
|
|
4
|
+
/**
|
|
5
|
+
* @group Plugins
|
|
6
|
+
*/
|
|
7
|
+
export declare const getLearnCardNetworkPlugin: (learnCard: LearnCard<any, 'id', LearnCardNetworkPluginDependentMethods>, url: string) => Promise<LearnCardNetworkPlugin>;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { DID } from 'dids';
|
|
2
|
+
import { LCNProfile, UnsignedVC, VC, VP, SentCredentialInfo, JWE, Boost } from '@learncard/types';
|
|
3
|
+
import { Plugin, ProofOptions } from '@learncard/core';
|
|
4
|
+
/** @group LearnCardNetwork Plugin */
|
|
5
|
+
export type LearnCardNetworkPluginDependentMethods = {
|
|
6
|
+
getDIDObject: () => DID;
|
|
7
|
+
getDidAuthVp: (options?: ProofOptions) => Promise<VP | string>;
|
|
8
|
+
issueCredential: (credential: UnsignedVC, signingOptions?: Partial<ProofOptions>) => Promise<VC>;
|
|
9
|
+
};
|
|
10
|
+
/** @group LearnCardNetwork Plugin */
|
|
11
|
+
export type LearnCardNetworkPluginMethods = {
|
|
12
|
+
createProfile: (profile: Omit<LCNProfile, 'did' | 'isServiceProfile'>) => Promise<string>;
|
|
13
|
+
createServiceProfile: (profile: Omit<LCNProfile, 'did' | 'isServiceProfile'>) => Promise<string>;
|
|
14
|
+
updateProfile: (profile: Partial<Omit<LCNProfile, 'did' | 'isServiceProfile'>>) => Promise<boolean>;
|
|
15
|
+
deleteProfile: () => Promise<boolean>;
|
|
16
|
+
getProfile: (profileId?: string) => Promise<LCNProfile | undefined>;
|
|
17
|
+
searchProfiles: (profileId?: string, options?: {
|
|
18
|
+
limit?: number;
|
|
19
|
+
includeSelf?: boolean;
|
|
20
|
+
}) => Promise<LCNProfile[]>;
|
|
21
|
+
connectWith: (profileId: string) => Promise<boolean>;
|
|
22
|
+
connectWithInvite: (profileId: string, challenge: string) => Promise<boolean>;
|
|
23
|
+
cancelConnectionRequest: (profileId: string) => Promise<boolean>;
|
|
24
|
+
disconnectWith: (profileId: string) => Promise<boolean>;
|
|
25
|
+
acceptConnectionRequest: (id: string) => Promise<boolean>;
|
|
26
|
+
getConnections: () => Promise<LCNProfile[]>;
|
|
27
|
+
getPendingConnections: () => Promise<LCNProfile[]>;
|
|
28
|
+
getConnectionRequests: () => Promise<LCNProfile[]>;
|
|
29
|
+
generateInvite: (challenge?: string) => Promise<{
|
|
30
|
+
profileId: string;
|
|
31
|
+
challenge: string;
|
|
32
|
+
}>;
|
|
33
|
+
sendCredential: (profileId: string, vc: UnsignedVC | VC, encrypt?: boolean) => Promise<string>;
|
|
34
|
+
acceptCredential: (uri: string) => Promise<boolean>;
|
|
35
|
+
getReceivedCredentials: (from?: string) => Promise<SentCredentialInfo[]>;
|
|
36
|
+
getSentCredentials: (to?: string) => Promise<SentCredentialInfo[]>;
|
|
37
|
+
getIncomingCredentials: (from?: string) => Promise<SentCredentialInfo[]>;
|
|
38
|
+
deleteCredential: (uri: string) => Promise<boolean>;
|
|
39
|
+
sendPresentation: (profileId: string, vp: VP, encrypt?: boolean) => Promise<string>;
|
|
40
|
+
acceptPresentation: (uri: string) => Promise<boolean>;
|
|
41
|
+
getReceivedPresentations: (from?: string) => Promise<SentCredentialInfo[]>;
|
|
42
|
+
getSentPresentations: (to?: string) => Promise<SentCredentialInfo[]>;
|
|
43
|
+
getIncomingPresentations: (from?: string) => Promise<SentCredentialInfo[]>;
|
|
44
|
+
deletePresentation: (uri: string) => Promise<boolean>;
|
|
45
|
+
createBoost: (credential: VC | UnsignedVC, metadata?: Partial<Omit<Boost, 'uri'>>) => Promise<string>;
|
|
46
|
+
getBoosts: () => Promise<{
|
|
47
|
+
name?: string;
|
|
48
|
+
uri: string;
|
|
49
|
+
}[]>;
|
|
50
|
+
updateBoost: (uri: string, updates: Partial<Omit<Boost, 'uri'>>) => Promise<boolean>;
|
|
51
|
+
deleteBoost: (uri: string) => Promise<boolean>;
|
|
52
|
+
sendBoost: (profileId: string, boostUri: string, encrypt?: boolean) => Promise<string>;
|
|
53
|
+
registerSigningAuthority: (uri: string) => Promise<boolean>;
|
|
54
|
+
resolveFromLCN: (uri: string) => Promise<VC | UnsignedVC | VP | JWE>;
|
|
55
|
+
};
|
|
56
|
+
/** @group LearnCardNetwork Plugin */
|
|
57
|
+
export type LearnCardNetworkPlugin = Plugin<'LearnCard Network', 'id' | 'read' | 'store', LearnCardNetworkPluginMethods, 'id', LearnCardNetworkPluginDependentMethods>;
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@learncard/network-plugin",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/lcn-plugin.esm.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"author": "Learning Economy Foundation (www.learningeconomy.io)",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"homepage": "https://github.com/WeLibraryOS/LearnCard#readme",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/WeLibraryOS/LearnCard.git"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/WeLibraryOS/LearnCard/issues"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/jest": "^29.2.2",
|
|
22
|
+
"@types/node": "^17.0.31",
|
|
23
|
+
"aqu": "0.4.3",
|
|
24
|
+
"dids": "^3.2.0",
|
|
25
|
+
"esbuild": "^0.14.38",
|
|
26
|
+
"esbuild-jest": "^0.5.0",
|
|
27
|
+
"esbuild-plugin-copy": "^1.3.0",
|
|
28
|
+
"jest": "^29.3.0",
|
|
29
|
+
"shx": "^0.3.4",
|
|
30
|
+
"ts-jest": "^29.0.3",
|
|
31
|
+
"@learncard/types": "5.2.0"
|
|
32
|
+
},
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@learncard/network-brain-client": "1.0.0",
|
|
36
|
+
"@learncard/core": "8.5.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.json"
|
|
40
|
+
}
|
|
41
|
+
}
|