@veramo/cli 4.2.1-unstable.9 → 4.3.1-next.4
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/bin/veramo.js +1 -1
- package/build/cli.d.ts +13 -13
- package/build/cli.d.ts.map +1 -1
- package/build/cli.js +23 -19
- package/build/cli.js.map +1 -1
- package/build/config.d.ts +1 -1
- package/build/config.d.ts.map +1 -1
- package/build/config.js +27 -17
- package/build/config.js.map +1 -1
- package/build/credential.js +69 -32
- package/build/credential.js.map +1 -1
- package/build/dev.js +62 -40
- package/build/dev.js.map +1 -1
- package/build/did.js +84 -70
- package/build/did.js.map +1 -1
- package/build/discover.js +20 -9
- package/build/discover.js.map +1 -1
- package/build/execute.js +30 -16
- package/build/execute.js.map +1 -1
- package/build/explore/credentials.d.ts +1 -1
- package/build/explore/credentials.d.ts.map +1 -1
- package/build/explore/credentials.js +37 -19
- package/build/explore/credentials.js.map +1 -1
- package/build/explore/index.js +19 -9
- package/build/explore/index.js.map +1 -1
- package/build/explore/main.d.ts +1 -1
- package/build/explore/main.d.ts.map +1 -1
- package/build/explore/main.js +42 -24
- package/build/explore/main.js.map +1 -1
- package/build/explore/managed-identifiers.d.ts +1 -1
- package/build/explore/managed-identifiers.d.ts.map +1 -1
- package/build/explore/managed-identifiers.js +32 -14
- package/build/explore/managed-identifiers.js.map +1 -1
- package/build/explore/messages.d.ts +1 -1
- package/build/explore/messages.d.ts.map +1 -1
- package/build/explore/messages.js +31 -13
- package/build/explore/messages.js.map +1 -1
- package/build/explore/presentations.d.ts +1 -1
- package/build/explore/presentations.d.ts.map +1 -1
- package/build/explore/presentations.js +37 -19
- package/build/explore/presentations.js.map +1 -1
- package/build/explore/styles.js +4 -1
- package/build/explore/styles.js.map +1 -1
- package/build/explore/utils.js +17 -8
- package/build/explore/utils.js.map +1 -1
- package/build/lib/agentCreator.js +7 -3
- package/build/lib/agentCreator.js.map +1 -1
- package/build/lib/objectCreator.d.ts +1 -1
- package/build/lib/objectCreator.d.ts.map +1 -1
- package/build/lib/objectCreator.js +28 -21
- package/build/lib/objectCreator.js.map +1 -1
- package/build/message.js +19 -8
- package/build/message.js.map +1 -1
- package/build/presentation.js +71 -34
- package/build/presentation.js.map +1 -1
- package/build/sdr.js +68 -50
- package/build/sdr.js.map +1 -1
- package/build/server.js +25 -11
- package/build/server.js.map +1 -1
- package/build/setup.d.ts +1 -0
- package/build/setup.d.ts.map +1 -1
- package/build/setup.js +17 -8
- package/build/setup.js.map +1 -1
- package/build/util.js +32 -17
- package/build/util.js.map +1 -1
- package/build/version.d.ts.map +1 -1
- package/build/version.js +5 -6
- package/build/version.js.map +1 -1
- package/default/default.yml +1 -1
- package/package.json +30 -37
- package/src/cli.ts +14 -15
- package/src/config.ts +4 -5
- package/src/credential.ts +3 -3
- package/src/dev.ts +3 -8
- package/src/did.ts +1 -1
- package/src/discover.ts +1 -1
- package/src/execute.ts +4 -4
- package/src/explore/credentials.ts +3 -3
- package/src/explore/index.ts +3 -4
- package/src/explore/main.ts +6 -6
- package/src/explore/managed-identifiers.ts +3 -3
- package/src/explore/messages.ts +3 -3
- package/src/explore/presentations.ts +3 -3
- package/src/lib/agentCreator.ts +1 -1
- package/src/lib/objectCreator.ts +14 -14
- package/src/message.ts +2 -2
- package/src/presentation.ts +2 -2
- package/src/sdr.ts +3 -3
- package/src/server.ts +3 -3
- package/src/setup.ts +3 -2
- package/src/version.ts +2 -6
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veramo/cli",
|
|
3
3
|
"description": "Veramo command line application.",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.3.1-next.4+1c521a67",
|
|
5
5
|
"main": "build/cli.js",
|
|
6
|
-
"exports": "./build/cli.js",
|
|
7
6
|
"types": "build/cli.d.ts",
|
|
8
7
|
"bin": {
|
|
9
8
|
"veramo": "bin/veramo.js"
|
|
@@ -15,32 +14,31 @@
|
|
|
15
14
|
"update-veramo-latest": "pnpm add @veramo/core@latest @veramo/discovery@latest @veramo/remote-client@latest @veramo/remote-server@latest @veramo/did-provider-key@latest @veramo/did-resolver@latest @veramo/did-jwt@latest @veramo/credential-w3c@latest @veramo/did-provider-ethr@latest @veramo/did-provider-web@latest @veramo/did-comm@latest @veramo/kms-local@latest @veramo/selective-disclosure@latest @veramo/data-store@latest @veramo/key-manager@latest @veramo/message-handler@latest @veramo/did-manager@latest @veramo/url-handler@latest @veramo/credential-eip712@latest @veramo/utils@latest"
|
|
16
15
|
},
|
|
17
16
|
"dependencies": {
|
|
18
|
-
"@microsoft/api-extractor": "^7.33.
|
|
19
|
-
"@microsoft/api-extractor-model": "^7.25.
|
|
20
|
-
"@transmute/credentials-context": "^0.7.0-unstable.79",
|
|
17
|
+
"@microsoft/api-extractor": "^7.33.6",
|
|
18
|
+
"@microsoft/api-extractor-model": "^7.25.2",
|
|
21
19
|
"@types/blessed": "^0.1.19",
|
|
22
20
|
"@types/swagger-ui-express": "^4.1.3",
|
|
23
|
-
"@veramo/core": "^4.
|
|
24
|
-
"@veramo/credential-eip712": "^4.
|
|
25
|
-
"@veramo/credential-ld": "^4.
|
|
26
|
-
"@veramo/credential-w3c": "^4.
|
|
27
|
-
"@veramo/data-store": "^4.
|
|
28
|
-
"@veramo/did-comm": "^4.
|
|
29
|
-
"@veramo/did-discovery": "^4.
|
|
30
|
-
"@veramo/did-jwt": "^4.
|
|
31
|
-
"@veramo/did-manager": "^4.
|
|
32
|
-
"@veramo/did-provider-ethr": "^4.
|
|
33
|
-
"@veramo/did-provider-key": "^4.
|
|
34
|
-
"@veramo/did-provider-web": "^4.
|
|
35
|
-
"@veramo/did-resolver": "^4.
|
|
36
|
-
"@veramo/key-manager": "^4.
|
|
37
|
-
"@veramo/kms-local": "^4.
|
|
38
|
-
"@veramo/message-handler": "^4.
|
|
39
|
-
"@veramo/remote-client": "^4.
|
|
40
|
-
"@veramo/remote-server": "^4.
|
|
41
|
-
"@veramo/selective-disclosure": "^4.
|
|
42
|
-
"@veramo/url-handler": "^4.
|
|
43
|
-
"@veramo/utils": "^4.
|
|
21
|
+
"@veramo/core": "^4.3.1-next.4+1c521a67",
|
|
22
|
+
"@veramo/credential-eip712": "^4.3.1-next.4+1c521a67",
|
|
23
|
+
"@veramo/credential-ld": "^4.3.1-next.4+1c521a67",
|
|
24
|
+
"@veramo/credential-w3c": "^4.3.1-next.4+1c521a67",
|
|
25
|
+
"@veramo/data-store": "^4.3.1-next.4+1c521a67",
|
|
26
|
+
"@veramo/did-comm": "^4.3.1-next.4+1c521a67",
|
|
27
|
+
"@veramo/did-discovery": "^4.3.1-next.4+1c521a67",
|
|
28
|
+
"@veramo/did-jwt": "^4.3.1-next.4+1c521a67",
|
|
29
|
+
"@veramo/did-manager": "^4.3.1-next.4+1c521a67",
|
|
30
|
+
"@veramo/did-provider-ethr": "^4.3.1-next.4+1c521a67",
|
|
31
|
+
"@veramo/did-provider-key": "^4.3.1-next.4+1c521a67",
|
|
32
|
+
"@veramo/did-provider-web": "^4.3.1-next.4+1c521a67",
|
|
33
|
+
"@veramo/did-resolver": "^4.3.1-next.4+1c521a67",
|
|
34
|
+
"@veramo/key-manager": "^4.3.1-next.4+1c521a67",
|
|
35
|
+
"@veramo/kms-local": "^4.3.1-next.4+1c521a67",
|
|
36
|
+
"@veramo/message-handler": "^4.3.1-next.4+1c521a67",
|
|
37
|
+
"@veramo/remote-client": "^4.3.1-next.4+1c521a67",
|
|
38
|
+
"@veramo/remote-server": "^4.3.1-next.4+1c521a67",
|
|
39
|
+
"@veramo/selective-disclosure": "^4.3.1-next.4+1c521a67",
|
|
40
|
+
"@veramo/url-handler": "^4.3.1-next.4+1c521a67",
|
|
41
|
+
"@veramo/utils": "^4.3.1-next.4+1c521a67",
|
|
44
42
|
"blessed": "^0.1.81",
|
|
45
43
|
"commander": "^9.0.0",
|
|
46
44
|
"console-table-printer": "^2.10.0",
|
|
@@ -55,8 +53,8 @@
|
|
|
55
53
|
"express-handlebars": "^6.0.2",
|
|
56
54
|
"fuzzy": "^0.1.3",
|
|
57
55
|
"handlebars": "^4.7.6",
|
|
58
|
-
"inquirer": "^
|
|
59
|
-
"inquirer-autocomplete-prompt": "^
|
|
56
|
+
"inquirer": "^8.2.0",
|
|
57
|
+
"inquirer-autocomplete-prompt": "^2.0.0",
|
|
60
58
|
"json-schema": "^0.4.0",
|
|
61
59
|
"json5": "^2.2.0",
|
|
62
60
|
"jsonpointer": "^5.0.0",
|
|
@@ -68,7 +66,7 @@
|
|
|
68
66
|
"qrcode-terminal": "^0.12.0",
|
|
69
67
|
"sqlite3": "^5.0.8",
|
|
70
68
|
"swagger-ui-express": "^4.6.0",
|
|
71
|
-
"ts-json-schema-generator": "^1.2
|
|
69
|
+
"ts-json-schema-generator": "^1.1.2",
|
|
72
70
|
"typeorm": "^0.3.10",
|
|
73
71
|
"url-parse": "^1.5.4",
|
|
74
72
|
"web-did-resolver": "^2.0.21",
|
|
@@ -78,8 +76,8 @@
|
|
|
78
76
|
"devDependencies": {
|
|
79
77
|
"@types/debug": "4.1.7",
|
|
80
78
|
"@types/express": "4.17.15",
|
|
81
|
-
"@types/inquirer": "
|
|
82
|
-
"@types/node-fetch": "
|
|
79
|
+
"@types/inquirer": "8.2.5",
|
|
80
|
+
"@types/node-fetch": "2.6.2",
|
|
83
81
|
"@types/passport-http-bearer": "1.0.37",
|
|
84
82
|
"@types/url-parse": "1.4.8",
|
|
85
83
|
"@types/ws": "8.5.4",
|
|
@@ -107,10 +105,5 @@
|
|
|
107
105
|
],
|
|
108
106
|
"license": "Apache-2.0",
|
|
109
107
|
"keywords": [],
|
|
110
|
-
"
|
|
111
|
-
"moduleDirectories": [
|
|
112
|
-
"node_modules",
|
|
113
|
-
"src"
|
|
114
|
-
],
|
|
115
|
-
"gitHead": "ba3e5435dc7a09599f6c9af311b40d92162e810a"
|
|
108
|
+
"gitHead": "1c521a6745756649028504ab239e3458462dfe37"
|
|
116
109
|
}
|
package/src/cli.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { program } from 'commander'
|
|
2
2
|
import inquirer from 'inquirer'
|
|
3
|
-
import inquirerAutoPrompt from 'inquirer-autocomplete-prompt'
|
|
4
3
|
|
|
5
|
-
inquirer.registerPrompt('autocomplete',
|
|
4
|
+
inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'))
|
|
6
5
|
|
|
7
|
-
import './did
|
|
8
|
-
import './credential
|
|
9
|
-
import './presentation
|
|
10
|
-
import './explore
|
|
11
|
-
import './sdr
|
|
12
|
-
import './message
|
|
13
|
-
import './discover
|
|
14
|
-
import './version
|
|
15
|
-
import './execute
|
|
16
|
-
import './server
|
|
17
|
-
import './setup
|
|
18
|
-
import './config
|
|
19
|
-
import './dev
|
|
6
|
+
import './did'
|
|
7
|
+
import './credential'
|
|
8
|
+
import './presentation'
|
|
9
|
+
import './explore'
|
|
10
|
+
import './sdr'
|
|
11
|
+
import './message'
|
|
12
|
+
import './discover'
|
|
13
|
+
import './version'
|
|
14
|
+
import './execute'
|
|
15
|
+
import './server'
|
|
16
|
+
import './setup'
|
|
17
|
+
import './config'
|
|
18
|
+
import './dev'
|
|
20
19
|
|
|
21
20
|
if (!process.argv.slice(2).length) {
|
|
22
21
|
program.outputHelp()
|
package/src/config.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import 'cross-fetch/polyfill'
|
|
1
2
|
import { program } from 'commander'
|
|
2
3
|
import { SecretBox } from '@veramo/kms-local'
|
|
3
|
-
import { getAgent } from './setup
|
|
4
|
-
import fs from "fs"
|
|
5
|
-
import { dirname } from 'path'
|
|
4
|
+
import { getAgent } from './setup'
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
const
|
|
6
|
+
const fs = require('fs')
|
|
7
|
+
const { dirname } = require('path')
|
|
9
8
|
|
|
10
9
|
program.option('--config <path>', 'Configuration file', './agent.yml')
|
|
11
10
|
|
package/src/credential.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { getAgent } from './setup
|
|
1
|
+
import { getAgent } from './setup'
|
|
2
2
|
import { program } from 'commander'
|
|
3
3
|
import inquirer from 'inquirer'
|
|
4
4
|
import qrcode from 'qrcode-terminal'
|
|
5
5
|
import * as fs from 'fs'
|
|
6
6
|
import * as json5 from 'json5'
|
|
7
|
-
import { readStdin } from './util
|
|
7
|
+
import { readStdin } from './util'
|
|
8
8
|
import { CredentialPayload } from '@veramo/core'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const fuzzy = require('fuzzy')
|
|
11
11
|
|
|
12
12
|
const credential = program.command('credential').description('W3C Verifiable Credential')
|
|
13
13
|
|
package/src/dev.ts
CHANGED
|
@@ -10,11 +10,7 @@ import { writeFileSync } from 'fs'
|
|
|
10
10
|
import { OpenAPIV3 } from 'openapi-types'
|
|
11
11
|
import { resolve } from 'path'
|
|
12
12
|
import * as TJS from 'ts-json-schema-generator'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import module from "module"
|
|
16
|
-
const requireCjs = module.createRequire(import.meta.url);
|
|
17
|
-
|
|
13
|
+
const fs = require('fs')
|
|
18
14
|
|
|
19
15
|
interface Method {
|
|
20
16
|
packageName: string
|
|
@@ -113,7 +109,7 @@ dev
|
|
|
113
109
|
process.exitCode = 1
|
|
114
110
|
}
|
|
115
111
|
|
|
116
|
-
const packageConfig =
|
|
112
|
+
const packageConfig = require(resolve(options.packageConfig))
|
|
117
113
|
const interfaces: any = {}
|
|
118
114
|
|
|
119
115
|
for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {
|
|
@@ -129,7 +125,6 @@ dev
|
|
|
129
125
|
path: resolve(entryFile),
|
|
130
126
|
encodeRefs: false,
|
|
131
127
|
additionalProperties: true,
|
|
132
|
-
skipTypeCheck: true
|
|
133
128
|
})
|
|
134
129
|
|
|
135
130
|
const apiModel: ApiModel = new ApiModel()
|
|
@@ -184,7 +179,7 @@ dev
|
|
|
184
179
|
interfaces[pluginInterfaceName] = api
|
|
185
180
|
}
|
|
186
181
|
|
|
187
|
-
writeFileSync(resolve('./
|
|
182
|
+
writeFileSync(resolve('./plugin.schema.json'), JSON.stringify(interfaces, null, 2))
|
|
188
183
|
})
|
|
189
184
|
|
|
190
185
|
dev
|
package/src/did.ts
CHANGED
package/src/discover.ts
CHANGED
package/src/execute.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { program } from 'commander'
|
|
2
2
|
import inquirer from 'inquirer'
|
|
3
|
-
import { getAgent } from './setup
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { getAgent } from './setup'
|
|
4
|
+
const fs = require('fs')
|
|
5
|
+
const OasResolver = require('oas-resolver')
|
|
6
|
+
const fuzzy = require('fuzzy')
|
|
7
7
|
|
|
8
8
|
program
|
|
9
9
|
.command('execute')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import blessed, { Widgets } from 'blessed'
|
|
2
2
|
import { UniqueVerifiableCredential } from '@veramo/core'
|
|
3
|
-
import { shortDate, shortDid, copyToClipboard } from './utils
|
|
4
|
-
import { ConfiguredAgent } from '../setup
|
|
5
|
-
import { styles } from './styles
|
|
3
|
+
import { shortDate, shortDid, copyToClipboard } from './utils'
|
|
4
|
+
import { ConfiguredAgent } from '../setup'
|
|
5
|
+
import { styles } from './styles'
|
|
6
6
|
import { asArray, extractIssuer } from '@veramo/utils'
|
|
7
7
|
|
|
8
8
|
export const getCredentialsTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {
|
package/src/explore/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { getAgent } from '../setup
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { renderMainScreen } from './main.js'
|
|
1
|
+
import { getAgent } from '../setup'
|
|
2
|
+
import { program } from 'commander'
|
|
3
|
+
import { renderMainScreen } from './main'
|
|
5
4
|
|
|
6
5
|
program
|
|
7
6
|
.command('explore')
|
package/src/explore/main.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import blessed from 'blessed'
|
|
2
|
-
import { ConfiguredAgent } from '../setup
|
|
3
|
-
import { styles } from './styles
|
|
2
|
+
import { ConfiguredAgent } from '../setup'
|
|
3
|
+
import { styles } from './styles'
|
|
4
4
|
|
|
5
|
-
import { getManagedIdentifiersTable } from './managed-identifiers
|
|
6
|
-
import { getMessagesTable } from './messages
|
|
7
|
-
import { getCredentialsTable } from './credentials
|
|
8
|
-
import { getPresentationsTable } from './presentations
|
|
5
|
+
import { getManagedIdentifiersTable } from './managed-identifiers'
|
|
6
|
+
import { getMessagesTable } from './messages'
|
|
7
|
+
import { getCredentialsTable } from './credentials'
|
|
8
|
+
import { getPresentationsTable } from './presentations'
|
|
9
9
|
|
|
10
10
|
const defaultScreenTitle = 'Agent'
|
|
11
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import blessed, { Widgets } from 'blessed'
|
|
2
2
|
import { IIdentifier } from '@veramo/core'
|
|
3
|
-
import { copyToClipboard } from './utils
|
|
4
|
-
import { ConfiguredAgent } from '../setup
|
|
5
|
-
import { styles } from './styles
|
|
3
|
+
import { copyToClipboard } from './utils'
|
|
4
|
+
import { ConfiguredAgent } from '../setup'
|
|
5
|
+
import { styles } from './styles'
|
|
6
6
|
|
|
7
7
|
export const getManagedIdentifiersTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {
|
|
8
8
|
screen.title = 'Managed identifiers'
|
package/src/explore/messages.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import blessed, { Widgets } from 'blessed'
|
|
2
2
|
import { IMessage } from '@veramo/core'
|
|
3
|
-
import { shortDate, shortDid } from './utils
|
|
4
|
-
import { ConfiguredAgent } from '../setup
|
|
5
|
-
import { styles } from './styles
|
|
3
|
+
import { shortDate, shortDid } from './utils'
|
|
4
|
+
import { ConfiguredAgent } from '../setup'
|
|
5
|
+
import { styles } from './styles'
|
|
6
6
|
|
|
7
7
|
export const getMessagesTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {
|
|
8
8
|
screen.title = 'Messages'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import blessed, { Widgets } from 'blessed'
|
|
2
2
|
import { UniqueVerifiablePresentation } from '@veramo/core'
|
|
3
|
-
import { shortDate, shortDid, copyToClipboard } from './utils
|
|
4
|
-
import { ConfiguredAgent } from '../setup
|
|
5
|
-
import { styles } from './styles
|
|
3
|
+
import { shortDate, shortDid, copyToClipboard } from './utils'
|
|
4
|
+
import { ConfiguredAgent } from '../setup'
|
|
5
|
+
import { styles } from './styles'
|
|
6
6
|
import { asArray } from '@veramo/utils'
|
|
7
7
|
|
|
8
8
|
export const getPresentationsTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {
|
package/src/lib/agentCreator.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TAgent, IPluginMethodMap } from '@veramo/core'
|
|
2
|
-
import { createObjects } from './objectCreator
|
|
2
|
+
import { createObjects } from './objectCreator'
|
|
3
3
|
|
|
4
4
|
export function createAgentFromConfig<T extends IPluginMethodMap>(config: object): TAgent<T> {
|
|
5
5
|
//@ts-ignore
|
package/src/lib/objectCreator.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { set, get } from 'jsonpointer'
|
|
2
2
|
import parse from 'url-parse'
|
|
3
|
-
|
|
3
|
+
const { resolve } = require('path')
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function createObjects(config: object, pointers: Record<string, string>): any {
|
|
6
6
|
const objects = {}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function resolveRefs(input: any): any {
|
|
9
9
|
if (Array.isArray(input)) {
|
|
10
10
|
const resolved = []
|
|
11
11
|
for (const item of input) {
|
|
12
|
-
resolved.push(
|
|
12
|
+
resolved.push(resolveRefs(item))
|
|
13
13
|
}
|
|
14
14
|
return resolved
|
|
15
15
|
}
|
|
@@ -20,13 +20,13 @@ export async function createObjects(config: object, pointers: Record<string, str
|
|
|
20
20
|
if (input.hasOwnProperty(property)) {
|
|
21
21
|
if (property === '$ref') {
|
|
22
22
|
const pointer = input[property]
|
|
23
|
-
return
|
|
23
|
+
return objectFromPointer(pointer)
|
|
24
24
|
} else if (property === '$require') {
|
|
25
|
-
return
|
|
25
|
+
return objectFromConfig(input)
|
|
26
26
|
} else if (property === '$env') {
|
|
27
27
|
return process.env[input[property]]
|
|
28
28
|
} else {
|
|
29
|
-
resolved[property] =
|
|
29
|
+
resolved[property] = resolveRefs(input[property])
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -36,7 +36,7 @@ export async function createObjects(config: object, pointers: Record<string, str
|
|
|
36
36
|
return input
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
function objectFromConfig(objectConfig: any) {
|
|
40
40
|
let object
|
|
41
41
|
// console.log('Requiring', objectConfig['$require'])
|
|
42
42
|
const parsed = parse(objectConfig['$require'], {}, true)
|
|
@@ -51,9 +51,9 @@ export async function createObjects(config: object, pointers: Record<string, str
|
|
|
51
51
|
module = resolve(module)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const resolvedArgs = args !== undefined ?
|
|
54
|
+
const resolvedArgs = args !== undefined ? resolveRefs(args) : []
|
|
55
55
|
try {
|
|
56
|
-
let required = member ? (
|
|
56
|
+
let required = member ? require(module)[member] : require(module)
|
|
57
57
|
if (type === 'class') {
|
|
58
58
|
object = new required(...resolvedArgs)
|
|
59
59
|
} else if (type === 'function') {
|
|
@@ -70,7 +70,7 @@ export async function createObjects(config: object, pointers: Record<string, str
|
|
|
70
70
|
return object
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
function objectFromPointer(pointer: string) {
|
|
74
74
|
const existingObject = get(objects, pointer)
|
|
75
75
|
if (existingObject) {
|
|
76
76
|
// console.log('Existing', pointer)
|
|
@@ -82,11 +82,11 @@ export async function createObjects(config: object, pointers: Record<string, str
|
|
|
82
82
|
try {
|
|
83
83
|
let object
|
|
84
84
|
if (objectConfig['$require']) {
|
|
85
|
-
object =
|
|
85
|
+
object = objectFromConfig(objectConfig)
|
|
86
86
|
} else if (objectConfig['$env']) {
|
|
87
87
|
object = process.env[objectConfig['$env']]
|
|
88
88
|
} else {
|
|
89
|
-
object =
|
|
89
|
+
object = resolveRefs(objectConfig)
|
|
90
90
|
}
|
|
91
91
|
set(objects, pointer, object)
|
|
92
92
|
return object
|
|
@@ -99,7 +99,7 @@ export async function createObjects(config: object, pointers: Record<string, str
|
|
|
99
99
|
const result: any = {}
|
|
100
100
|
for (const key of Object.keys(pointers)) {
|
|
101
101
|
if (pointers.hasOwnProperty(key)) {
|
|
102
|
-
result[key] =
|
|
102
|
+
result[key] = objectFromPointer(pointers[key])
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
return result
|
package/src/message.ts
CHANGED
package/src/presentation.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getAgent } from './setup
|
|
1
|
+
import { getAgent } from './setup'
|
|
2
2
|
import { program } from 'commander'
|
|
3
3
|
import inquirer from 'inquirer'
|
|
4
4
|
import qrcode from 'qrcode-terminal'
|
|
5
|
-
import { readStdin } from './util
|
|
5
|
+
import { readStdin } from './util'
|
|
6
6
|
import * as fs from 'fs'
|
|
7
7
|
import * as json5 from 'json5'
|
|
8
8
|
import { extractIssuer } from '@veramo/utils'
|
package/src/sdr.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ICredentialRequestInput } from '@veramo/selective-disclosure'
|
|
2
|
-
import { getAgent } from './setup
|
|
2
|
+
import { getAgent } from './setup'
|
|
3
3
|
import { program } from 'commander'
|
|
4
4
|
import inquirer from 'inquirer'
|
|
5
5
|
import qrcode from 'qrcode-terminal'
|
|
6
|
-
import { shortDate, shortDid } from './explore/utils
|
|
6
|
+
import { shortDate, shortDid } from './explore/utils'
|
|
7
7
|
import { VerifiableCredential } from '@veramo/core'
|
|
8
8
|
import { asArray, extractIssuer } from '@veramo/utils'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const fuzzy = require('fuzzy')
|
|
11
11
|
|
|
12
12
|
const sdr = program.command('sdr').description('Selective Disclosure Request')
|
|
13
13
|
|
package/src/server.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import express from 'express'
|
|
2
2
|
import { program } from 'commander'
|
|
3
|
-
import { getConfig } from './setup
|
|
4
|
-
import { createObjects } from './lib/objectCreator
|
|
3
|
+
import { getConfig } from './setup'
|
|
4
|
+
import { createObjects } from './lib/objectCreator'
|
|
5
5
|
|
|
6
6
|
program
|
|
7
7
|
.command('server')
|
|
@@ -13,7 +13,7 @@ program
|
|
|
13
13
|
let server: any
|
|
14
14
|
|
|
15
15
|
try {
|
|
16
|
-
const config =
|
|
16
|
+
const config = createObjects(getConfig(program.opts().config), { server: '/server' })
|
|
17
17
|
server = config.server
|
|
18
18
|
} catch (e: any) {
|
|
19
19
|
console.log(e.message)
|
package/src/setup.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'cross-fetch/polyfill'
|
|
1
2
|
import yaml from 'yaml'
|
|
2
3
|
import {
|
|
3
4
|
ICredentialPlugin,
|
|
@@ -12,9 +13,9 @@ import {
|
|
|
12
13
|
import { ISelectiveDisclosure } from '@veramo/selective-disclosure'
|
|
13
14
|
import { IDIDComm } from '@veramo/did-comm'
|
|
14
15
|
import { IDIDDiscovery } from '@veramo/did-discovery'
|
|
15
|
-
import { createAgentFromConfig } from './lib/agentCreator
|
|
16
|
+
import { createAgentFromConfig } from './lib/agentCreator'
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
const fs = require('fs')
|
|
18
19
|
|
|
19
20
|
export const getConfig = (fileName: string): any => {
|
|
20
21
|
if (!fs.existsSync(fileName)) {
|
package/src/version.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { program } from 'commander'
|
|
2
|
-
import module from "module";
|
|
3
|
-
const requireCjs = module.createRequire(import.meta.url);
|
|
4
|
-
const data = requireCjs("../package.json");
|
|
5
|
-
const { version } = data
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
const { version } = require('../package.json')
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
program.version(version, '-v, --version')
|