verifiablesoftware / vsw

Core project of VerifiableSoftware
Apache License 2.0
1 stars 0 forks source link

Incorrect behavior in creating a second credential definition #109

Closed wenjing closed 3 years ago

wenjing commented 3 years ago

v0.0.14

I created a new wallet, and went through initial setup steps correctly. Created the first creddef correctly with -s software-certificate. Then, I exited the wallet, reopened the same wallet, and tried to create a second creddef with -s test-certificate.

It reported success but the created creddef looks identical to the previous one. And "vsw list -cd" shows only one creddef. It's unclear what happened, but it seems that vsw does not recognize "test-certificate", when that happens, it defaults to softwareCertificate.

I tried again with "vsw setup creddef -s testCertificate". Then it is executed correctly.

So in summary, here is I think what needs to be done:

(1) use softwareCertificate and testCertificate as names, do not accept "software-certificate" nor "test-certificate". This is consistent with the display of "vsw list -sc".

(2) if you try to create a creddef with a schema-name that is unknown, report error rather than default to softwareCertificate.

(3) if you try to create a creddef that already exist (i.e. same DID, same schema name), report the creddef already exist, display the creddef, but don't try to create nor report a new creddef. root@77220f6dc3ad:/# vsw setup creddef -s software-certificate 2021-06-01 16:31:12 vsw.commands.init INFO /usr/local/lib/python3.6/dist-packages/vsw/commands/init.py Created credential definition id: 3EgDXzVZ2grXvYXp5MEBnV:3:CL:3733:default root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# vsw list Usage: vsw list -c: list all connections -w: list all DIDs in the wallet -sc: list all supported schema -s: show agent status -p: list all presentation proof records -cs: list all credentials issued by the current DID -cd: list all credential definitions registered by the current DID root@77220f6dc3ad:/# vsw list -cd {'credential_definition_ids': ['3EgDXzVZ2grXvYXp5MEBnV:3:CL:3733:default']} root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# vsw list -sc ======vsw software certificate schema_id: UyDtaEFuTySAV9VZDykHkh:2:softwareCertificate:0.3====== { 'schema': { 'ver': '1.0', 'id': 'UyDtaEFuTySAV9VZDykHkh:2:softwareCertificate:0.3', 'name': 'softwareCertificate', 'version': '0.3', 'attrNames': [ 'softwareDid', 'sourceUrl', 'developerDid', 'buildLog', 'dependencyDidList', 'softwareVersion', 'softwareUrl', 'builderDid', 'sourceDid', 'builderToolDidList', 'softwareHash', 'mediaType', 'sourceHash', 'softwareName' ], 'seqNo': 3733 } } ======vsw attest schema_id: UyDtaEFuTySAV9VZDykHkh:2:testCertificate:0.1====== { 'schema': { 'ver': '1.0', 'id': 'UyDtaEFuTySAV9VZDykHkh:2:testCertificate:0.1', 'name': 'testCertificate', 'version': '0.1', 'attrNames': [ 'testResultDetailUrl', 'testResultDetailDid', 'testSpecHash', 'comments', 'testSpecDid', 'ranking', 'softwareDid', 'testerDid', 'testResultDetailHash', 'testResult', 'testSpecUrl' ], 'seqNo': 3949 } } root@77220f6dc3ad:/# vsw list -s { 'version': '0.0.3', 'label': 'vsw-agent', 'conductor': { 'in_sessions': 0, 'out_encode': 0, 'out_deliver': 0, 'task_active': 1, 'task_done': 19, 'task_failed': 0, 'task_pending': 0 } } root@77220f6dc3ad:/# vsw list -cs {'results': []} root@77220f6dc3ad:/# vsw list -p {'results': []} root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# vsw pubish usage: vsw [-h] [-v] {exit,help,list,publish,revoke,setup,verify} vsw: error: argument command: invalid choice: 'pubish' (choose from 'exit', 'help', 'list', 'publish', 'revoke', 'setup', 'verify') root@77220f6dc3ad:/# vsw publish usage: vsw [-h] -c CRED_FILE [-s SCHEMA] vsw: error: the following arguments are required: -c/--cred-file root@77220f6dc3ad:/# vsw publish -c workspace/vsw-0-0-10.json 2021-06-01 16:37:05 vsw.commands.publish INFO /usr/local/lib/python3.6/dist-packages/vsw/commands/publish.py executing publish, please waiting for response 2021-06-01 16:37:10 vsw.commands.publish ERROR /usr/local/lib/python3.6/dist-packages/vsw/commands/publish.py Incorrect sourceHash value! root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# vsw publish -c workspace/vsw-0-0-10.json 2021-06-01 16:37:59 vsw.commands.publish INFO /usr/local/lib/python3.6/dist-packages/vsw/commands/publish.py executing publish, please waiting for response 2021-06-01 16:38:04 vsw.commands.publish ERROR /usr/local/lib/python3.6/dist-packages/vsw/commands/publish.py Incorrect sourceHash value! root@77220f6dc3ad:/# cat workspace/init

apt-get update apt install -y python3-pip pip3 install vsw apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 apt-get install -y software-properties-common add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable" apt-get update apt-get install -y libindy apt install curl -y

curl -sL https://deb.nodesource.com/setup_12.x | bash - apt install -y nodejs apt install -y wget apt-get install -y unzip vsw --version

root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# vsw exit root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# vsw setup wallet wallet1 -k 12345 success root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# vsw list -w { 'results': [ { 'did': '3EgDXzVZ2grXvYXp5MEBnV', 'verkey': '2DgKUApN78o1jZmoL9MeD9ZH6tfxdATPUQb7JChwSUaa', 'public': True }, { 'did': 'XDQBvc6b7B9y8xSbY1xsYj', 'verkey': 'HU7p7bwftjNtC3AmoffKDkf6dFb3nyh3TCmQSachQtBi', 'public': False } ] } root@77220f6dc3ad:/# vsw setup creddef -s test-certificate 2021-06-01 16:54:42 vsw.commands.init INFO /usr/local/lib/python3.6/dist-packages/vsw/commands/init.py Created credential definition id: 3EgDXzVZ2grXvYXp5MEBnV:3:CL:3733:default root@77220f6dc3ad:/# vsw list -cd {'credential_definition_ids': ['3EgDXzVZ2grXvYXp5MEBnV:3:CL:3733:default']} root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# root@77220f6dc3ad:/# vsw setup creddef -s testCertificate 2021-06-01 17:10:21 vsw.commands.init INFO /usr/local/lib/python3.6/dist-packages/vsw/commands/init.py Created credential definition id: 3EgDXzVZ2grXvYXp5MEBnV:3:CL:3949:default root@77220f6dc3ad:/# vsw list -cd { 'credential_definition_ids': [ '3EgDXzVZ2grXvYXp5MEBnV:3:CL:3949:default', '3EgDXzVZ2grXvYXp5MEBnV:3:CL:3733:default' ] } root@77220f6dc3ad:/# root@77220f6dc3ad:/# vsw setup creddef -s softwareCertificate 2021-06-01 17:12:44 vsw.commands.init INFO /usr/local/lib/python3.6/dist-packages/vsw/commands/init.py Created credential definition id: 3EgDXzVZ2grXvYXp5MEBnV:3:CL:3733:default root@77220f6dc3ad:/# vsw list -cd { 'credential_definition_ids': [ '3EgDXzVZ2grXvYXp5MEBnV:3:CL:3949:default', '3EgDXzVZ2grXvYXp5MEBnV:3:CL:3733:default' ] } root@77220f6dc3ad:/#

felixchen1023 commented 3 years ago

already fixed now. please verify

wenjing commented 3 years ago

There is still an issue with the name softwareCertificate. Please change software-certificate to softwareCertificate.

root@dbc35131571b:/# vsw setup creddef -s testCertificate2 vsw: error: the schema name must be either software-certificate or testCertificate root@dbc35131571b:/# vsw setup creddef -s software-certificate vsw: error: creddef already existed, NpVnd1VR2je1pmHA8uepfq:3:CL:3733:default root@dbc35131571b:/# vsw setup creddef -s softwareCertificate vsw: error: the schema name must be either software-certificate or testCertificate

felixchen1023 commented 3 years ago

changed software-certificate to softwareCertificate

wenjing commented 3 years ago

Verified in 0.0.18