-
Notifications
You must be signed in to change notification settings - Fork 132
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
Agent method identityManagerAddService fails upon validation (daf-cli) #275
Comments
it looks like the same issue observed while working around #255 |
@tscheckow can you try again using [daf-cli: 7.0.0-beta.47] and see if you make progress? |
Thank you so much for delivering a (potential) fix so fast. I tried to install beta.47 using npm: sudo npm i -g daf-cli@7.0.0-beta.47
npm ERR! code ETARGET
npm ERR! notarget No matching version found for daf-cli@7.0.0-beta.47.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist. Should I build it myself based on the last state of the beta repo or do you publish beta.47? |
It's probably my bad that the beta47 release is problematic. I'll relaunch today beta48. |
I built it from source (beta branch): martin@workhorse:~/git/daf-cli-test/daf-beta/packages/daf-cli/bin$ ./daf.js -v
7.0.0-beta.48 I still get the same error: martin@workhorse:~/git/daf-cli-test/daf-beta/packages/daf-cli/bin$ ./daf.js identity-manager -s
? Select DID did:ethr:rinkeby:0xb297e829f7175144981f1b07154abeebc2466486
? Service type Messaging
? Endpoint http://localhost:3332/messaging
? ID did:ethr:rinkeby:0xb297e829f7175144981f1b07154abeebc2466486#msg
{ PluginReturnTypeError: Expected type object but found type string; identityManagerAddService; #/; INVALID_TYPE; undefined
at new PluginReturnTypeError (/home/martin/git/daf-cli-test/daf-beta/packages/daf-core/build/validator.js:41:28)
at Object.exports.validateReturnType (/home/martin/git/daf-cli-test/daf-beta/packages/daf-core/build/validator.js:65:15)
at Agent.<anonymous> (/home/martin/git/daf-cli-test/daf-beta/packages/daf-core/build/agent.js:272:41)
at step (/home/martin/git/daf-cli-test/daf-beta/packages/daf-core/build/agent.js:44:23)
at Object.next (/home/martin/git/daf-cli-test/daf-beta/packages/daf-core/build/agent.js:25:53)
at fulfilled (/home/martin/git/daf-cli-test/daf-beta/packages/daf-core/build/agent.js:16:58)
name: 'PluginReturnTypeError',
method: 'identityManagerAddService',
description: undefined,
path: '#/',
code: 'INVALID_TYPE' } |
However, if I use the method martin@workhorse:~/Documents/daf-cli$ daf-beta48 execute -m identityManagerAddService -f messaging_service.json
{ argsFile: 'messaging_service.json' }
Method: identityManagerAddService
Arguments: {
"did": "did:ethr:rinkeby:0xb297e829f7175144981f1b07154abeebc2466486",
"service": {
"id": "did:ethr:rinkeby:0xb297e829f7175144981f1b07154abeebc2466486#msg",
"type": "Messaging",
"description": "Handles incoming POST messages",
"serviceEndpoint": "http://localhost:3332/messaging"
}
}
Result : "0x001364d7c812fe96221232f376f16819c49e90688ee2a688d1d6f477418c7d2f" The didDoc can be resolve without error: martin@workhorse:~/Documents/daf-cli$ daf-beta48 resolve did:ethr:rinkeby:0xb297e829f7175144981f1b07154abeebc2466486
{ '@context': 'https://w3id.org/did/v1',
id:
'did:ethr:rinkeby:0xb297e829f7175144981f1b07154abeebc2466486',
publicKey:
[ { id:
'did:ethr:rinkeby:0xb297e829f7175144981f1b07154abeebc2466486#controller',
type: 'Secp256k1VerificationKey2018',
controller:
'did:ethr:rinkeby:0xb297e829f7175144981f1b07154abeebc2466486',
ethereumAddress: '0xb297e829f7175144981f1b07154abeebc2466486' } ],
authentication:
[ { type: 'Secp256k1SignatureAuthentication2018',
publicKey:
'did:ethr:rinkeby:0xb297e829f7175144981f1b07154abeebc2466486#controller' } ],
service:
[ { type: 'Messaging',
serviceEndpoint: 'http://localhost:3332/messaging' } ] } |
Apologies for the failed releases, you can try The workaround is a new flag in the agent constructor options which can toggle schema validation off. The default config now looks something like this: #...
agent:
$require: daf-core#Agent
$args:
- schemaValidation: true # set this to false to work around PluginReturnTypeError
plugins:
- $require: daf-key-manager#KeyManager
#... |
When setting schemaValidation to false, adding a service works as expected: martin@workhorse:~/Documents/daf-cli$ daf-beta49 identity-manager -s
? Select DID did:ethr:rinkeby:0xd52591d784ac6c78a0d8e90be9c41238e6ad535c
? Service type Messaging
? Endpoint http://localhost:3332/messaging
? ID did:ethr:rinkeby:0xd52591d784ac6c78a0d8e90be9c41238e6ad535c#msg
Success: 0xc2a1968b11e69987a4e828d8b7b2d8535e37800c3a26cce54ef004cf47a0cf32 Resolving and looking the did up in the local database using data-explorer works too. I will upgrade my issuer and verifier components to beta49. Is there any recommended updating procedure? Thank you very much for everything. |
Ok, default CLI config will start with Thank you for reporting |
Describe the bug
When I execute the method "identityManagerAddService" in the CLI with the following input:
I receive the following Error:
I tried it with or without all optional fields.
If I try it with the CLI integrated function i get this:
After any of the two actions above, I can no longer resolve the DID:
I suspect, the document gets somehow destroyed by the addService function. However, I can still look it up in the local database and it looks like this, if I use the command
npx daf execute -m identityManagerAddKey -f messaging_service.json
:If I use the CLI integrated function
daf identity-manager -s
it breaks the local database:To Reproduce
Steps to reproduce the behaviour:
npx daf identity-manager -s
or withnpx daf execute -m identityManagerAddService
npx daf identity-manager -s
Expected behaviour
I expect a new messaging endpoint as service in the public DID document such that it is still resolvable. The CLI command
daf identity-manager -s
should not break the local database.Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: