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 request vc cli tool #2595

Merged
merged 2 commits into from
Mar 20, 2024
Merged

fix request vc cli tool #2595

merged 2 commits into from
Mar 20, 2024

Conversation

BillyWooo
Copy link
Collaborator

Minor fix. Just ignore the first response message. Not a perfect solution.
Need to refactor together with Struct RequestVcResultOrError.

link-identity:

user@parachain-dev-server-01:~/repo/litentry-parachain/tee-worker$ ./bin/litentry-cli trusted -d link-identity did:litentry:substrate:0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 did:litentry:evm:0x0D9bFD1f18f5f4FD08247DC54aD3528909c4b3E9 bsc,ethereum

request-batch-vc test result:

user@parachain-dev-server-01:~/repo/litentry-parachain/tee-worker$ ./bin/litentry-cli trusted -d request-batch-vc did:litentry:substrate:0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 a a8 litentry,litmus  a a8 polkadot
Commands: [("a8", ["litentry,litmus"]), ("a8", ["polkadot"])]
command: "a8", param: ["litentry,litmus"]
command: "a8", param: ["polkadot"]
assertions: [A8(BoundedVec([Litentry, Litmus], 128)), A8(BoundedVec([Polkadot], 128))]
>>>id: Substrate(Address32([142, 175, 4, 21, 22, 135, 115, 99, 38, 201, 254, 161, 126, 37, 252, 82, 135, 97, 54, 147, 201, 18, 144, 156, 178, 38, 170, 71, 148, 242, 106, 72]))
>>>nonce: 1
----Generated VC-----
{"@context":["https://www.w3.org/2018/credentials/v1","https://w3id.org/security/suites/ed25519-2020/v1"],"id":"0x6c45606426aa65e22ccc79c4a10c9463cd09b73f7eac8b6752206896b8080b77","type":["VerifiableCredential"],"credentialSubject":{"id":"did:litentry:substrate:0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48","description":"Gets the range of number of transactions a user has made for a specific token on all supported networks (invalid transactions are also counted)","type":"EVM/Substrate Transaction Count","assertionText":"A8(BoundedVec([Litentry, Litmus], 128))","assertions":[{"and":[{"src":"$total_txs","op":">=","dst":"50"},{"src":"$total_txs","op":"<","dst":"100"},{"or":[{"src":"$network","op":"==","dst":"Litentry"},{"src":"$network","op":"==","dst":"Litmus"}]}]}],"values":[true],"endpoint":"http://localhost:9933"},"issuer":{"id":"did:litentry:substrate:0xfe35ab76dbbf477507549b9eaa86f92dafabccc0fa36204a3c455dbfc403efa0","name":"Litentry TEE Worker","mrenclave":"C8shwnsR2vsatkdVfDq6Nk2A7dYHYgmGxsr7tVSVbM2S"},"issuanceDate":"2024-03-18T23:23:27.563942593+00:00","parachainBlockNumber":147,"sidechainBlockNumber":287,"proof":{"created":"2024-03-18T23:23:27.564230941+00:00","type":"Ed25519Signature2020","proofPurpose":"assertionMethod","proofValue":"fe388237801ef6e01a7582913aa88919b9a35e75b475210ee6fc13c9725100f16d5e23bd01362cb0dd1f4b6d1645e66599027c339224c949a2d92bce2132c50a","verificationMethod":"0xfe35ab76dbbf477507549b9eaa86f92dafabccc0fa36204a3c455dbfc403efa0"},"credentialSchema":{"id":"https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/7-evm-substrate-transaction-count/1-0-0.json","type":"JsonSchemaValidator2018"}}
----Generated VC-----
{"@context":["https://www.w3.org/2018/credentials/v1","https://w3id.org/security/suites/ed25519-2020/v1"],"id":"0x61faf765895beface72ab94b8779401c832c873f8f30d3892825bbdc9c275c7f","type":["VerifiableCredential"],"credentialSubject":{"id":"did:litentry:substrate:0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48","description":"Gets the range of number of transactions a user has made for a specific token on all supported networks (invalid transactions are also counted)","type":"EVM/Substrate Transaction Count","assertionText":"A8(BoundedVec([Polkadot], 128))","assertions":[{"and":[{"src":"$total_txs","op":">=","dst":"20"},{"src":"$total_txs","op":"<","dst":"50"},{"or":[{"src":"$network","op":"==","dst":"Polkadot"}]}]}],"values":[true],"endpoint":"http://localhost:9933"},"issuer":{"id":"did:litentry:substrate:0xfe35ab76dbbf477507549b9eaa86f92dafabccc0fa36204a3c455dbfc403efa0","name":"Litentry TEE Worker","mrenclave":"C8shwnsR2vsatkdVfDq6Nk2A7dYHYgmGxsr7tVSVbM2S"},"issuanceDate":"2024-03-18T23:23:27.578265366+00:00","parachainBlockNumber":147,"sidechainBlockNumber":287,"proof":{"created":"2024-03-18T23:23:27.578498366+00:00","type":"Ed25519Signature2020","proofPurpose":"assertionMethod","proofValue":"ced5f16e351ae110b711b17545c28fed4b202f0888d76d08d7a7e21e0b9a773e3d1997c87ce784504ddb04c532ac79d28ca229417f75ee24fd28d2a341e0a500","verificationMethod":"0xfe35ab76dbbf477507549b9eaa86f92dafabccc0fa36204a3c455dbfc403efa0"},"credentialSchema":{"id":"https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/7-evm-substrate-transaction-count/1-0-0.json","type":"JsonSchemaValidator2018"}}
user@parachain-dev-server-01:~/repo/litentry-parachain/tee-worker$ 

request-vc test result:

user@parachain-dev-server-01:~/repo/litentry-parachain/tee-worker$ ./bin/litentry-cli trusted -d request-vc did:litentry:substrate:0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 a8 litentry,litmus
>>>id: Substrate(Address32([142, 175, 4, 21, 22, 135, 115, 99, 38, 201, 254, 161, 126, 37, 252, 82, 135, 97, 54, 147, 201, 18, 144, 156, 178, 38, 170, 71, 148, 242, 106, 72]))
>>>nonce: 1
>>>command: A8(
    A8Arg {
        networks: [
            "litentry",
            "litmus",
        ],
    },
)
----Generated VC-----
{"@context":["https://www.w3.org/2018/credentials/v1","https://w3id.org/security/suites/ed25519-2020/v1"],"id":"0x0219d62307e8cd404f2234551d5fa6010213c92410ad16c372e7f0093d408b12","type":["VerifiableCredential"],"credentialSubject":{"id":"did:litentry:substrate:0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48","description":"Gets the range of number of transactions a user has made for a specific token on all supported networks (invalid transactions are also counted)","type":"EVM/Substrate Transaction Count","assertionText":"A8(BoundedVec([Litentry, Litmus], 128))","assertions":[{"and":[{"src":"$total_txs","op":">=","dst":"50"},{"src":"$total_txs","op":"<","dst":"100"},{"or":[{"src":"$network","op":"==","dst":"Litentry"},{"src":"$network","op":"==","dst":"Litmus"}]}]}],"values":[true],"endpoint":"http://localhost:9933"},"issuer":{"id":"did:litentry:substrate:0xfe35ab76dbbf477507549b9eaa86f92dafabccc0fa36204a3c455dbfc403efa0","name":"Litentry TEE Worker","mrenclave":"C8shwnsR2vsatkdVfDq6Nk2A7dYHYgmGxsr7tVSVbM2S"},"issuanceDate":"2024-03-18T22:56:21.016420218+00:00","parachainBlockNumber":12,"sidechainBlockNumber":16,"proof":{"created":"2024-03-18T22:56:21.016704055+00:00","type":"Ed25519Signature2020","proofPurpose":"assertionMethod","proofValue":"141c5881c566ae117709faff8acfe4674e58a8093a751612cb1f6dc3335658d874a74cc8d9c9dcb1cebbdf7fa9b16819d753c6bca46271b700164fd12294810a","verificationMethod":"0xfe35ab76dbbf477507549b9eaa86f92dafabccc0fa36204a3c455dbfc403efa0"},"credentialSchema":{"id":"https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/7-evm-substrate-transaction-count/1-0-0.json","type":"JsonSchemaValidator2018"}}
user@parachain-dev-server-01:~/repo/litentry-parachain/tee-worker$ 

Copy link
Collaborator

@Kailai-Wang Kailai-Wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - needs @felixfaisal 's review too

nitpicky, the sole letter a seems to be unconventional - can we use -a or --assertion?

@BillyWooo
Copy link
Collaborator Author

Thanks - needs @felixfaisal 's review too

nitpicky, the sole letter a seems to be unconventional - can we use -a or --assertion?

Regarding -a, actually I tried. But -a will be treated as a command argument. Then it requires -- -a. That makes it too verbose. So I simply ignored it.

Copy link
Member

@felixfaisal felixfaisal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I haven't ran it locally but looks good.

@BillyWooo BillyWooo merged commit 8147791 into dev Mar 20, 2024
25 of 26 checks passed
@BillyWooo BillyWooo deleted the request-batch-vc-cli branch March 20, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants