-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): add DID discovery plugin to @veramo/cli (#600)
- Loading branch information
1 parent
78321a9
commit a484f4c
Showing
6 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { getAgent } from './setup' | ||
import program from 'commander' | ||
import { printTable } from 'console-table-printer' | ||
|
||
const discover = program.command('discover').description('Discovery') | ||
|
||
discover | ||
.command('did') | ||
.description('did discovery') | ||
.option('-q, --query <string>', 'Query string') | ||
|
||
.action(async (cmd) => { | ||
const agent = getAgent(program.opts().config) | ||
|
||
const response = await agent.discoverDid({ query: cmd.query }) | ||
const list: any = [] | ||
|
||
response.results.forEach(r => { | ||
r.matches.forEach(m => { | ||
list.push({ | ||
provider: r.provider, | ||
did: m.did | ||
}) | ||
}) | ||
}) | ||
|
||
if (list.length > 0) { | ||
printTable(list) | ||
} else { | ||
console.log('No dids discovered') | ||
} | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters