Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: integration tests and CLI config for did:key #498

Merged
merged 2 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions __tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { JwtMessageHandler } from '../packages/did-jwt/src'
import { CredentialIssuer, ICredentialIssuer, W3cMessageHandler } from '../packages/credential-w3c/src'
import { EthrDIDProvider } from '../packages/did-provider-ethr/src'
import { WebDIDProvider } from '../packages/did-provider-web/src'
import { KeyDIDProvider } from '../packages/did-provider-key/src'
import { DIDComm, DIDCommMessageHandler, IDIDComm } from '../packages/did-comm/src'
import {
SelectiveDisclosure,
Expand Down Expand Up @@ -120,6 +121,9 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
'did:web': new WebDIDProvider({
defaultKms: 'local',
}),
'did:key': new KeyDIDProvider({
defaultKms: 'local',
}),
},
}),
new DIDResolverPlugin({
Expand Down
4 changes: 4 additions & 0 deletions __tests__/localMemoryStoreAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { JwtMessageHandler } from '../packages/did-jwt/src'
import { CredentialIssuer, ICredentialIssuer, W3cMessageHandler } from '../packages/credential-w3c/src'
import { EthrDIDProvider } from '../packages/did-provider-ethr/src'
import { WebDIDProvider } from '../packages/did-provider-web/src'
import { KeyDIDProvider } from '../packages/did-provider-key/src'
import { DIDComm, DIDCommMessageHandler, IDIDComm } from '../packages/did-comm/src'
import {
SelectiveDisclosure,
Expand Down Expand Up @@ -113,6 +114,9 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
'did:web': new WebDIDProvider({
defaultKms: 'local',
}),
'did:key': new KeyDIDProvider({
defaultKms: 'local',
}),
},
}),
new DIDResolverPlugin({
Expand Down
4 changes: 4 additions & 0 deletions __tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { JwtMessageHandler } from '../packages/did-jwt/src'
import { CredentialIssuer, ICredentialIssuer, W3cMessageHandler } from '../packages/credential-w3c/src'
import { EthrDIDProvider } from '../packages/did-provider-ethr/src'
import { WebDIDProvider } from '../packages/did-provider-web/src'
import { KeyDIDProvider } from '../packages/did-provider-key/src'
import { DIDComm, DIDCommMessageHandler, IDIDComm } from '../packages/did-comm/src'
import {
SelectiveDisclosure,
Expand Down Expand Up @@ -127,6 +128,9 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
'did:web': new WebDIDProvider({
defaultKms: 'local',
}),
'did:key': new KeyDIDProvider({
defaultKms: 'local',
}),
},
}),
new DIDResolverPlugin({
Expand Down
16 changes: 14 additions & 2 deletions __tests__/shared/didManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default (testContext: {

it('should get providers', async () => {
const providers = await agent.didManagerGetProviders()
expect(providers).toEqual(['did:ethr', 'did:ethr:rinkeby', 'did:web'])
expect(providers).toEqual(['did:ethr', 'did:ethr:rinkeby', 'did:web', 'did:key'])
})

let identifier: IIdentifier
Expand Down Expand Up @@ -73,6 +73,18 @@ export default (testContext: {

expect(identifier3).toEqual(identifier4)

const identifierKey1 = await agent.didManagerGetOrCreate({
alias: 'carol',
provider: 'did:key',
})

const identifierKey2 = await agent.didManagerGetOrCreate({
alias: 'carol',
provider: 'did:key',
})

expect(identifierKey1).toEqual(identifierKey2)

const identifier5 = await agent.didManagerGetOrCreate({
alias: 'alice',
provider: 'did:ethr',
Expand All @@ -97,7 +109,7 @@ export default (testContext: {

it('should get identifiers', async () => {
const allIdentifiers = await agent.didManagerFind()
expect(allIdentifiers.length).toEqual(3)
expect(allIdentifiers.length).toEqual(4)

const aliceIdentifiers = await agent.didManagerFind({
alias: 'alice',
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/default/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ didManager:
$require: '@veramo/did-provider-web#WebDIDProvider'
$args:
- defaultKms: local
did:key:
$require: '@veramo/did-provider-key#KeyDIDProvider'
$args:
- defaultKms: local

# Agent
agent:
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"scripts": {
"build": "tsc",
"watch": "tsc -b --watch",
"update-veramo-next": "yarn add @veramo/core@next @veramo/did-resolver@next @veramo/did-jwt@next @veramo/credential-w3c@next @veramo/did-provider-ethr@next @veramo/did-provider-web@next @veramo/did-comm@next @veramo/kms-local@next @veramo/selective-disclosure@next @veramo/data-store@next @veramo/key-manager@next @veramo/message-handler@next @veramo/did-manager@next @veramo/url-handler@next",
"update-veramo-latest": "yarn add @veramo/core@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"
"update-veramo-next": "yarn add @veramo/core@next @veramo/remote-client@next @veramo/remote-server@next @veramo/did-provider-key@next @veramo/did-resolver@next @veramo/did-jwt@next @veramo/credential-w3c@next @veramo/did-provider-ethr@next @veramo/did-provider-web@next @veramo/did-comm@next @veramo/kms-local@next @veramo/selective-disclosure@next @veramo/data-store@next @veramo/key-manager@next @veramo/message-handler@next @veramo/did-manager@next @veramo/url-handler@next",
"update-veramo-latest": "yarn add @veramo/core@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"
},
"dependencies": {
"@microsoft/api-extractor": "7.14.0",
Expand All @@ -25,6 +25,7 @@
"@veramo/did-jwt": "^1.2.0",
"@veramo/did-manager": "^1.2.0",
"@veramo/did-provider-ethr": "^1.2.0",
"@veramo/did-provider-key": "^1.2.0",
"@veramo/did-provider-web": "^1.2.0",
"@veramo/did-resolver": "^1.2.0",
"@veramo/key-manager": "^1.2.0",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
{ "path": "../did-jwt" },
{ "path": "../did-manager" },
{ "path": "../did-provider-ethr" },
{ "path": "../did-provider-key" },
{ "path": "../did-provider-web" },
{ "path": "../did-resolver" },
{ "path": "../key-manager" },
Expand Down