@learncard/core 8.5.5 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/dist/core.cjs.development.js +843 -68975
  2. package/dist/core.cjs.development.js.map +4 -4
  3. package/dist/core.cjs.production.min.js +1 -948
  4. package/dist/core.cjs.production.min.js.map +4 -4
  5. package/dist/core.esm.js +1059 -69202
  6. package/dist/core.esm.js.map +4 -4
  7. package/dist/index.d.ts +0 -1
  8. package/dist/types/LearnCard.d.ts +0 -57
  9. package/dist/types/helpers.d.ts +0 -15
  10. package/dist/types/planes.d.ts +36 -5
  11. package/dist/types/utilities.d.ts +4 -0
  12. package/dist/wallet/plugins/index.d.ts +1 -13
  13. package/package.json +4 -24
  14. package/dist/didkit/didkit_wasm.d.ts +0 -251
  15. package/dist/didkit/didkit_wasm.js +0 -1135
  16. package/dist/didkit/didkit_wasm_bg.wasm +0 -0
  17. package/dist/didkit/didkit_wasm_bg.wasm.d.ts +0 -43
  18. package/dist/didkit/index.d.ts +0 -4
  19. package/dist/didkit_wasm.d.ts +0 -251
  20. package/dist/didkit_wasm.js +0 -1135
  21. package/dist/didkit_wasm_bg.wasm +0 -0
  22. package/dist/didkit_wasm_bg.wasm.d.ts +0 -43
  23. package/dist/wallet/defaults.d.ts +0 -5
  24. package/dist/wallet/init.d.ts +0 -29
  25. package/dist/wallet/initializers/apiLearnCard.d.ts +0 -14
  26. package/dist/wallet/initializers/customLearnCard.d.ts +0 -7
  27. package/dist/wallet/initializers/emptyLearnCard.d.ts +0 -7
  28. package/dist/wallet/initializers/learnCardFromSeed.d.ts +0 -7
  29. package/dist/wallet/plugins/EthereumPlugin/hardcodedTokens.d.ts +0 -22
  30. package/dist/wallet/plugins/EthereumPlugin/helpers.d.ts +0 -7
  31. package/dist/wallet/plugins/EthereumPlugin/index.d.ts +0 -7
  32. package/dist/wallet/plugins/EthereumPlugin/types.d.ts +0 -32
  33. package/dist/wallet/plugins/ceramic/ceramic.d.ts +0 -215
  34. package/dist/wallet/plugins/ceramic/helpers.d.ts +0 -3
  35. package/dist/wallet/plugins/ceramic/index.d.ts +0 -4
  36. package/dist/wallet/plugins/ceramic/types.d.ts +0 -43
  37. package/dist/wallet/plugins/chapi/chapi.d.ts +0 -5
  38. package/dist/wallet/plugins/chapi/index.d.ts +0 -2
  39. package/dist/wallet/plugins/chapi/types.d.ts +0 -88
  40. package/dist/wallet/plugins/didkey/helpers.d.ts +0 -4
  41. package/dist/wallet/plugins/didkey/index.d.ts +0 -217
  42. package/dist/wallet/plugins/didkey/types.d.ts +0 -18
  43. package/dist/wallet/plugins/didkit/index.d.ts +0 -8
  44. package/dist/wallet/plugins/didkit/types.d.ts +0 -40
  45. package/dist/wallet/plugins/expiration/index.d.ts +0 -7
  46. package/dist/wallet/plugins/expiration/types.d.ts +0 -3
  47. package/dist/wallet/plugins/idx/idx.d.ts +0 -6
  48. package/dist/wallet/plugins/idx/index.d.ts +0 -4
  49. package/dist/wallet/plugins/idx/types.d.ts +0 -54
  50. package/dist/wallet/plugins/learn-card/index.d.ts +0 -7
  51. package/dist/wallet/plugins/learn-card/types.d.ts +0 -17
  52. package/dist/wallet/plugins/learn-card/verify.d.ts +0 -215
  53. package/dist/wallet/plugins/vc/index.d.ts +0 -2
  54. package/dist/wallet/plugins/vc/issueCredential.d.ts +0 -98
  55. package/dist/wallet/plugins/vc/issuePresentation.d.ts +0 -220
  56. package/dist/wallet/plugins/vc/types.d.ts +0 -35
  57. package/dist/wallet/plugins/vc/vc.d.ts +0 -5
  58. package/dist/wallet/plugins/vc/verifyCredential.d.ts +0 -8
  59. package/dist/wallet/plugins/vc/verifyPresentation.d.ts +0 -8
  60. package/dist/wallet/plugins/vc-api/helpers.d.ts +0 -8
  61. package/dist/wallet/plugins/vc-api/index.d.ts +0 -8
  62. package/dist/wallet/plugins/vc-api/types.d.ts +0 -20
  63. package/dist/wallet/plugins/vc-resolution/index.d.ts +0 -6
  64. package/dist/wallet/plugins/vc-resolution/types.d.ts +0 -13
  65. package/dist/wallet/plugins/vc-templates/index.d.ts +0 -2
  66. package/dist/wallet/plugins/vc-templates/templates.d.ts +0 -6
  67. package/dist/wallet/plugins/vc-templates/types.d.ts +0 -68
  68. package/dist/wallet/plugins/vc-templates/vc-templates.d.ts +0 -5
  69. package/dist/wallet/plugins/vpqr/index.d.ts +0 -7
  70. package/dist/wallet/plugins/vpqr/types.d.ts +0 -12
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /// <reference types="types/global" />
2
2
  import './polyfills';
3
- export * from './wallet/init';
4
3
  export { LearnCard, Plugin } from './types/wallet';
5
4
  export * from './types/LearnCard';
6
5
  export * from './wallet/base';
@@ -1,61 +1,4 @@
1
- import { InitInput } from '../didkit/index';
2
- import { DIDKitPlugin, DidMethod } from '../wallet/plugins/didkit/types';
3
- import { DidKeyPlugin } from '../wallet/plugins/didkey/types';
4
- import { VCPlugin } from '../wallet/plugins/vc/types';
5
- import { VCTemplatePlugin } from '../wallet/plugins/vc-templates';
6
- import { VCResolutionPluginType } from '../wallet/plugins/vc-resolution';
7
- import { CeramicPlugin, CeramicArgs } from '../wallet/plugins/ceramic/types';
8
- import { IDXPlugin, IDXArgs } from '../wallet/plugins/idx/types';
9
- import { ExpirationPlugin } from '../wallet/plugins/expiration/types';
10
- import { EthereumPlugin, EthereumConfig } from '../wallet/plugins/EthereumPlugin/types';
11
- import { VpqrPlugin } from '../wallet/plugins/vpqr/types';
12
- import { CHAPIPlugin } from '../wallet/plugins/chapi';
13
- import { VCAPIPlugin } from '../wallet/plugins/vc-api/types';
14
- import { LearnCardPlugin } from '../wallet/plugins/learn-card';
15
- import { InitFunction, GenericInitFunction } from './helpers';
16
1
  import { LearnCard, Plugin } from './wallet';
17
- /** @group LearnCard */
18
- export type LearnCardConfig = {
19
- ceramicIdx: CeramicArgs & IDXArgs;
20
- didkit: InitInput | Promise<InitInput>;
21
- ethereumConfig: EthereumConfig;
22
- debug?: typeof console.log;
23
- };
24
- /** @group Init Functions */
25
- export type EmptyLearnCard = InitFunction<{}, 'didkit' | 'debug', LearnCard<[DIDKitPlugin, ExpirationPlugin, VCTemplatePlugin, CHAPIPlugin, LearnCardPlugin]>>;
26
- /** @group Init Functions */
27
- export type LearnCardFromSeed = InitFunction<{
28
- seed: string;
29
- }, keyof LearnCardConfig, LearnCard<[
30
- DIDKitPlugin,
31
- DidKeyPlugin<DidMethod>,
32
- VCPlugin,
33
- VCTemplatePlugin,
34
- VCResolutionPluginType,
35
- CeramicPlugin,
36
- IDXPlugin,
37
- ExpirationPlugin,
38
- EthereumPlugin,
39
- VpqrPlugin,
40
- CHAPIPlugin,
41
- LearnCardPlugin
42
- ]>>;
43
- /** @group Init Functions */
44
- export type LearnCardFromVcApi = InitFunction<{
45
- vcApi: true | string;
46
- did?: string;
47
- }, 'debug', LearnCard<[VCAPIPlugin, ExpirationPlugin, VCTemplatePlugin, CHAPIPlugin, LearnCardPlugin]>>;
48
- /** @group Init Functions */
49
- export type CustomLearnCard = InitFunction<{
50
- custom: true;
51
- }, 'debug', LearnCard<[]>>;
52
- /** @group Init Functions */
53
- export type InitLearnCard = GenericInitFunction<[
54
- EmptyLearnCard,
55
- LearnCardFromSeed,
56
- LearnCardFromVcApi,
57
- CustomLearnCard
58
- ]>;
59
2
  export type GetPlugins<LC extends LearnCard<any, any, any>> = LC['plugins'];
60
3
  export type AddPlugin<LC extends LearnCard<any, any, any>, P extends Plugin> = LearnCard<[
61
4
  ...GetPlugins<LC>,
@@ -1,18 +1,3 @@
1
- import { LearnCardConfig } from './LearnCard';
2
- import { LearnCard } from './wallet';
3
- export type InitFunction<Args extends Record<string, any> = Record<string, any>, Config extends keyof LearnCardConfig | undefined = keyof LearnCardConfig, ReturnValue extends LearnCard<any, any> = LearnCard<any, any>> = {
4
- args: Args & (undefined extends Config ? {} : Partial<Pick<LearnCardConfig, NonNullable<Config>>>);
5
- returnValue: ReturnValue;
6
- };
7
- export type GenericInitFunction<InitFunctions extends InitFunction<any, any, any>[]> = {
8
- args: InitFunctions[number]['args'];
9
- returnValue: Promise<InitFunctions[number]['returnValue']>;
10
- };
11
- export type DiscriminatedUnionize<T extends object = {}, K extends string = 'type'> = {
12
- [Key in keyof T]: {
13
- [Key2 in K]: Key;
14
- } & T[Key];
15
- }[keyof T];
16
1
  export type OmitNevers<T extends Record<string, any>> = Omit<T, {
17
2
  [Index in keyof T]: [T[Index]] extends [never] ? Index : never;
18
3
  }[keyof T]>;
@@ -1,12 +1,16 @@
1
1
  import { CredentialRecord, VC, VP, JWK } from '@learncard/types';
2
+ import { Query } from 'sift';
2
3
  import { Plugin } from './wallet';
3
4
  import { OmitNevers } from './helpers';
5
+ import { DeepPartial } from './utilities';
4
6
  export type CacheStrategy = 'cache-only' | 'cache-first' | 'skip-cache';
5
7
  export type PlaneOptions = {
6
8
  cache?: CacheStrategy;
7
9
  };
8
10
  export type ControlPlane = 'read' | 'store' | 'index' | 'cache' | 'id';
9
- export type FilterForPlane<Plugins extends Plugin[], Plane extends ControlPlane> = {
11
+ export type FilterForPlane<Plugins extends Plugin[], Plane extends ControlPlane> = [
12
+ Plugins
13
+ ] extends [1 & Plugins] ? any : {
10
14
  [Index in keyof Plugins]: undefined extends Plugins[Index][Plane] ? never : Plugins[Index]['name'];
11
15
  }[number];
12
16
  export type GetPlanesForPlugins<Plugins extends Plugin[]> = any[] extends Plugins ? never : {
@@ -43,10 +47,19 @@ export type LearnCardStorePlane<Plugins extends Plugin[]> = Record<FilterForPlan
43
47
  providers: GetPlaneProviders<Plugins, 'store'>;
44
48
  };
45
49
  export type IndexPlane = {
46
- get: <Metadata extends Record<string, any> = Record<never, never>>(query?: Record<string, any>, options?: PlaneOptions) => Promise<CredentialRecord<Metadata>[]>;
50
+ get: <Metadata extends Record<string, any> = Record<never, never>>(query?: Partial<Query<CredentialRecord<Metadata>>>, options?: PlaneOptions) => Promise<CredentialRecord<Metadata>[]>;
51
+ getPage?: <Metadata extends Record<string, any> = Record<never, never>>(query?: Partial<Query<CredentialRecord<Metadata>>>, paginationOptions?: {
52
+ limit?: number;
53
+ cursor?: string;
54
+ }, options?: PlaneOptions) => Promise<{
55
+ records: CredentialRecord<Metadata>[];
56
+ hasMore: boolean;
57
+ cursor?: string;
58
+ }>;
59
+ getCount?: <Metadata extends Record<string, any> = Record<never, never>>(query?: Partial<Query<CredentialRecord<Metadata>>>, options?: PlaneOptions) => Promise<number>;
47
60
  add: <Metadata extends Record<string, any> = Record<never, never>>(record: CredentialRecord<Metadata>, options?: PlaneOptions) => Promise<boolean>;
48
61
  addMany?: <Metadata extends Record<string, any> = Record<never, never>>(records: CredentialRecord<Metadata>[], options?: PlaneOptions) => Promise<boolean>;
49
- update: (id: string, updates: Record<string, any>, options?: PlaneOptions) => Promise<boolean>;
62
+ update: <Metadata extends Record<string, any> = Record<never, never>>(id: string, updates: DeepPartial<CredentialRecord<Metadata>>, options?: PlaneOptions) => Promise<boolean>;
50
63
  remove: (id: string, options?: PlaneOptions) => Promise<boolean>;
51
64
  removeAll?: (options?: PlaneOptions) => Promise<boolean>;
52
65
  };
@@ -56,8 +69,26 @@ export type LearnCardIndexPlane<Plugins extends Plugin[]> = {
56
69
  providers: GetPlaneProviders<Plugins, 'index'>;
57
70
  } & Record<FilterForPlane<Plugins, 'index'>, IndexPlane>;
58
71
  export type CachePlane = {
59
- getIndex: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Record<string, any>) => Promise<CredentialRecord<Metadata>[] | undefined>;
60
- setIndex: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Record<string, any>, value: CredentialRecord<Metadata>[]) => Promise<boolean>;
72
+ getIndex: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Partial<Query<CredentialRecord<Metadata>>>) => Promise<CredentialRecord<Metadata>[] | undefined>;
73
+ setIndex: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Partial<Query<CredentialRecord<Metadata>>>, value: CredentialRecord<Metadata>[]) => Promise<boolean>;
74
+ getIndexPage: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Partial<Query<CredentialRecord<Metadata>>>, paginationOptions?: {
75
+ limit?: number;
76
+ cursor?: string;
77
+ }) => Promise<{
78
+ records: CredentialRecord<Metadata>[];
79
+ hasMore: boolean;
80
+ cursor?: string;
81
+ } | undefined>;
82
+ setIndexPage: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Partial<Query<CredentialRecord<Metadata>>>, value: {
83
+ records: CredentialRecord<Metadata>[];
84
+ hasMore: boolean;
85
+ cursor?: string;
86
+ }, paginationOptions?: {
87
+ limit?: number;
88
+ cursor?: string;
89
+ }) => Promise<boolean>;
90
+ getIndexCount?: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Partial<Query<CredentialRecord<Metadata>>>) => Promise<number | undefined>;
91
+ setIndexCount?: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Partial<Query<CredentialRecord<Metadata>>>, value: number) => Promise<boolean>;
61
92
  flushIndex: () => Promise<boolean>;
62
93
  getVc: (uri: string) => Promise<VC | VP | undefined>;
63
94
  setVc: (uri: string, value: VC | VP | undefined) => Promise<boolean>;
@@ -12,3 +12,7 @@ export type RemoveLastArg<T extends (...args: any[]) => any> = (args: RemoveLast
12
12
  export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
13
13
  /** @group Utility Types */
14
14
  export type MergeObjects<Objects extends Record<string, any>[]> = undefined extends Objects[2] ? Omit<Objects[0], keyof Objects[1]> & Objects[1] : Omit<MergeObjects<RemoveLast<Objects>>, keyof Last<Objects>> & Last<Objects>;
15
+ /** @group Utility Types */
16
+ export type DeepPartial<T> = T extends object ? {
17
+ [P in keyof T]?: DeepPartial<T[P]>;
18
+ } : T;
@@ -1,15 +1,3 @@
1
- export * from './ceramic';
2
- export * from './chapi';
3
- export * from './didkey';
4
- export * from './didkit';
5
- export * from './EthereumPlugin';
6
- export * from './expiration';
7
- export * from './idx';
8
- export * from './learn-card';
9
1
  export * from './test-cache';
2
+ export * from './test-index';
10
3
  export * from './test-storage';
11
- export * from './vc';
12
- export * from './vc-api';
13
- export * from './vc-resolution';
14
- export * from './vc-templates';
15
- export * from './vpqr';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/core",
3
- "version": "8.5.5",
3
+ "version": "9.0.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/core.esm.js",
@@ -18,49 +18,29 @@
18
18
  "url": "https://github.com/WeLibraryOS/LearnCard/issues"
19
19
  },
20
20
  "devDependencies": {
21
- "@glazed/types": "^0.2.0",
22
21
  "@types/jest": "^29.2.2",
23
22
  "@types/node": "^17.0.31",
24
23
  "aqu": "0.4.3",
25
24
  "esbuild": "^0.14.38",
26
25
  "esbuild-jest": "^0.5.0",
27
- "esbuild-plugin-copy": "^1.3.0",
28
26
  "jest": "^29.3.0",
29
27
  "jest-resolver-enhanced": "^1.1.0",
30
- "jimp": "^0.16.1",
31
- "multiformats": "^11.0.1",
32
- "qrcode-reader": "^1.0.4",
33
28
  "shx": "^0.3.4",
29
+ "sift": "^17.0.1",
34
30
  "ts-jest": "^29.0.3",
35
31
  "tsc-alias": "^1.6.9",
36
32
  "typescript": "^4.6.4",
37
- "@learncard/types": "5.2.7"
33
+ "@learncard/types": "5.3.0"
38
34
  },
39
35
  "types": "./dist/index.d.ts",
40
36
  "dependencies": {
41
- "@ceramicnetwork/common": "2.13.0",
42
- "@ceramicnetwork/http-client": "2.7.0",
43
- "@ceramicnetwork/stream-tile": "2.9.0",
44
- "@ceramicnetwork/streamid": "2.7.0",
45
- "@digitalbazaar/vpqr": "^3.0.0",
46
- "@glazed/did-datastore": "0.3.2",
47
- "@glazed/tile-loader": "0.2.1",
48
- "@uniswap/default-token-list": "^4.1.0",
49
37
  "abort-controller": "^3.0.0",
50
38
  "core-js": "^3.25.5",
51
- "credential-handler-polyfill": "^3.0.0",
52
39
  "cross-fetch": "^3.1.5",
53
- "date-fns": "^2.28.0",
54
- "dids": "3.4.0",
55
- "ethers": "^5.6.9",
56
- "hex-lite": "^1.5.0",
57
40
  "isomorphic-fetch": "^3.0.0",
58
41
  "isomorphic-webcrypto": "^2.3.8",
59
- "key-did-provider-ed25519": "^2.0.0",
60
- "key-did-resolver": "2.3.0",
61
- "web-credential-handler": "^2.0.0",
62
42
  "zod": "^3.20.2",
63
- "@learncard/helpers": "1.0.3"
43
+ "@learncard/helpers": "1.0.4"
64
44
  },
65
45
  "scripts": {
66
46
  "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.build.json && tsc-alias",
@@ -1,251 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * @returns {string}
5
- */
6
- export function getVersion(): string;
7
- /**
8
- * @param {string} did
9
- * @param {string} input_metadata
10
- * @returns {Promise<any>}
11
- */
12
- export function didResolver(did: string, input_metadata: string): Promise<any>;
13
- /**
14
- * @param {string} did
15
- * @param {string} input_metadata
16
- * @returns {Promise<any>}
17
- */
18
- export function resolveDID(did: string, input_metadata: string): Promise<any>;
19
- /**
20
- * @returns {string}
21
- */
22
- export function generateEd25519Key(): string;
23
- /**
24
- * @param {Uint8Array} bytes
25
- * @returns {string}
26
- */
27
- export function generateEd25519KeyFromBytes(bytes: Uint8Array): string;
28
- /**
29
- * @returns {string}
30
- */
31
- export function generateSecp256k1Key(): string;
32
- /**
33
- * @param {Uint8Array} bytes
34
- * @returns {string}
35
- */
36
- export function generateSecp256k1KeyFromBytes(bytes: Uint8Array): string;
37
- /**
38
- * @param {string} method_pattern
39
- * @param {string} jwk
40
- * @returns {string}
41
- */
42
- export function keyToDID(method_pattern: string, jwk: string): string;
43
- /**
44
- * @param {string} method_pattern
45
- * @param {string} jwk
46
- * @returns {Promise<any>}
47
- */
48
- export function keyToVerificationMethod(method_pattern: string, jwk: string): Promise<any>;
49
- /**
50
- * @param {string} did
51
- * @returns {Promise<any>}
52
- */
53
- export function didToVerificationMethod(did: string): Promise<any>;
54
- /**
55
- * @param {string} credential
56
- * @param {string} proof_options
57
- * @param {string} key
58
- * @returns {Promise<any>}
59
- */
60
- export function issueCredential(credential: string, proof_options: string, key: string): Promise<any>;
61
- /**
62
- * @param {string} credential
63
- * @param {string} linked_data_proof_options
64
- * @param {string} public_key
65
- * @returns {Promise<any>}
66
- */
67
- export function prepareIssueCredential(credential: string, linked_data_proof_options: string, public_key: string): Promise<any>;
68
- /**
69
- * @param {string} credential
70
- * @param {string} preparation
71
- * @param {string} signature
72
- * @returns {Promise<any>}
73
- */
74
- export function completeIssueCredential(credential: string, preparation: string, signature: string): Promise<any>;
75
- /**
76
- * @param {string} vc
77
- * @param {string} proof_options
78
- * @returns {Promise<any>}
79
- */
80
- export function verifyCredential(vc: string, proof_options: string): Promise<any>;
81
- /**
82
- * @param {string} presentation
83
- * @param {string} proof_options
84
- * @param {string} key
85
- * @returns {Promise<any>}
86
- */
87
- export function issuePresentation(presentation: string, proof_options: string, key: string): Promise<any>;
88
- /**
89
- * @param {string} presentation
90
- * @param {string} linked_data_proof_options
91
- * @param {string} public_key
92
- * @returns {Promise<any>}
93
- */
94
- export function prepareIssuePresentation(presentation: string, linked_data_proof_options: string, public_key: string): Promise<any>;
95
- /**
96
- * @param {string} presentation
97
- * @param {string} preparation
98
- * @param {string} signature
99
- * @returns {Promise<any>}
100
- */
101
- export function completeIssuePresentation(presentation: string, preparation: string, signature: string): Promise<any>;
102
- /**
103
- * @param {string} vp
104
- * @param {string} proof_options
105
- * @returns {Promise<any>}
106
- */
107
- export function verifyPresentation(vp: string, proof_options: string): Promise<any>;
108
- /**
109
- * @param {string} holder
110
- * @param {string} linked_data_proof_options
111
- * @param {string} key
112
- * @returns {Promise<any>}
113
- */
114
- export function DIDAuth(holder: string, linked_data_proof_options: string, key: string): Promise<any>;
115
- /**
116
- * @param {string} tz
117
- * @returns {Promise<any>}
118
- */
119
- export function JWKFromTezos(tz: string): Promise<any>;
120
- /**
121
- * @param {string} capability
122
- * @param {string} linked_data_proof_options
123
- * @param {string} parents
124
- * @param {string} key
125
- * @returns {Promise<any>}
126
- */
127
- export function delegateCapability(capability: string, linked_data_proof_options: string, parents: string, key: string): Promise<any>;
128
- /**
129
- * @param {string} capability
130
- * @param {string} linked_data_proof_options
131
- * @param {string} parents
132
- * @param {string} public_key
133
- * @returns {Promise<any>}
134
- */
135
- export function prepareDelegateCapability(capability: string, linked_data_proof_options: string, parents: string, public_key: string): Promise<any>;
136
- /**
137
- * @param {string} capability
138
- * @param {string} preparation
139
- * @param {string} signature
140
- * @returns {Promise<any>}
141
- */
142
- export function completeDelegateCapability(capability: string, preparation: string, signature: string): Promise<any>;
143
- /**
144
- * @param {string} delegation
145
- * @returns {Promise<any>}
146
- */
147
- export function verifyDelegation(delegation: string): Promise<any>;
148
- /**
149
- * @param {string} invocation
150
- * @param {string} target_id
151
- * @param {string} linked_data_proof_options
152
- * @param {string} key
153
- * @returns {Promise<any>}
154
- */
155
- export function invokeCapability(invocation: string, target_id: string, linked_data_proof_options: string, key: string): Promise<any>;
156
- /**
157
- * @param {string} invocation
158
- * @param {string} target_id
159
- * @param {string} linked_data_proof_options
160
- * @param {string} public_key
161
- * @returns {Promise<any>}
162
- */
163
- export function prepareInvokeCapability(invocation: string, target_id: string, linked_data_proof_options: string, public_key: string): Promise<any>;
164
- /**
165
- * @param {string} invocation
166
- * @param {string} preparation
167
- * @param {string} signature
168
- * @returns {Promise<any>}
169
- */
170
- export function completeInvokeCapability(invocation: string, preparation: string, signature: string): Promise<any>;
171
- /**
172
- * @param {string} invocation
173
- * @returns {Promise<any>}
174
- */
175
- export function verifyInvocationSignature(invocation: string): Promise<any>;
176
- /**
177
- * @param {string} invocation
178
- * @param {string} delegation
179
- * @returns {Promise<any>}
180
- */
181
- export function verifyInvocation(invocation: string, delegation: string): Promise<any>;
182
- /**
183
- * @param {string} url
184
- * @returns {Promise<any>}
185
- */
186
- export function contextLoader(url: string): Promise<any>;
187
-
188
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
189
-
190
- export interface InitOutput {
191
- readonly memory: WebAssembly.Memory;
192
- readonly getVersion: (a: number) => void;
193
- readonly didResolver: (a: number, b: number, c: number, d: number) => number;
194
- readonly resolveDID: (a: number, b: number, c: number, d: number) => number;
195
- readonly generateEd25519Key: (a: number) => void;
196
- readonly generateEd25519KeyFromBytes: (a: number, b: number, c: number) => void;
197
- readonly generateSecp256k1Key: (a: number) => void;
198
- readonly generateSecp256k1KeyFromBytes: (a: number, b: number, c: number) => void;
199
- readonly keyToDID: (a: number, b: number, c: number, d: number, e: number) => void;
200
- readonly keyToVerificationMethod: (a: number, b: number, c: number, d: number) => number;
201
- readonly didToVerificationMethod: (a: number, b: number) => number;
202
- readonly issueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
203
- readonly prepareIssueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
204
- readonly completeIssueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
205
- readonly verifyCredential: (a: number, b: number, c: number, d: number) => number;
206
- readonly issuePresentation: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
207
- readonly prepareIssuePresentation: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
208
- readonly completeIssuePresentation: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
209
- readonly verifyPresentation: (a: number, b: number, c: number, d: number) => number;
210
- readonly DIDAuth: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
211
- readonly JWKFromTezos: (a: number, b: number) => number;
212
- readonly delegateCapability: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
213
- readonly prepareDelegateCapability: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
214
- readonly completeDelegateCapability: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
215
- readonly verifyDelegation: (a: number, b: number) => number;
216
- readonly invokeCapability: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
217
- readonly prepareInvokeCapability: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
218
- readonly completeInvokeCapability: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
219
- readonly verifyInvocationSignature: (a: number, b: number) => number;
220
- readonly verifyInvocation: (a: number, b: number, c: number, d: number) => number;
221
- readonly contextLoader: (a: number, b: number) => number;
222
- readonly didkit_error_message: () => number;
223
- readonly didkit_error_code: () => number;
224
- readonly __wbindgen_malloc: (a: number) => number;
225
- readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
226
- readonly __wbindgen_export_2: WebAssembly.Table;
227
- readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf6251ee6687a20b8: (a: number, b: number, c: number) => void;
228
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
229
- readonly __wbindgen_free: (a: number, b: number) => void;
230
- readonly __wbindgen_exn_store: (a: number) => void;
231
- readonly wasm_bindgen__convert__closures__invoke2_mut__h63ffd509f6690aab: (a: number, b: number, c: number, d: number) => void;
232
- }
233
-
234
- /**
235
- * Synchronously compiles the given `bytes` and instantiates the WebAssembly module.
236
- *
237
- * @param {BufferSource} bytes
238
- *
239
- * @returns {InitOutput}
240
- */
241
- export function initSync(bytes: BufferSource): InitOutput;
242
-
243
- /**
244
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
245
- * for everything else, calls `WebAssembly.instantiate` directly.
246
- *
247
- * @param {InitInput | Promise<InitInput>} module_or_path
248
- *
249
- * @returns {Promise<InitOutput>}
250
- */
251
- export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;