forked from hyperledger-archives/indy-sdk
-
Notifications
You must be signed in to change notification settings - Fork 3
/
template.py
55 lines (39 loc) · 1.49 KB
/
template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Example demonstrating Proof Verification.
First Issuer creates Claim Definition for existing Schema.
After that, it issues a Claim to Prover (as in issue_credential.py example)
Once Prover has successfully stored its Claim, it uses Proof Request that he
received, to get Claims which satisfy the Proof Request from his wallet.
Prover uses the output to create Proof, using its Master Secret.
After that, Proof is verified against the Proof Request
"""
import asyncio
import json
import pprint
from indy import pool, ledger, wallet, did, anoncreds
from indy.error import ErrorCode, IndyError
from utils import open_wallet, get_pool_genesis_txn_path, PROTOCOL_VERSION
pool_name = 'pool'
issuer_wallet_config = json.dumps({"id": "issuer_wallet"})
issuer_wallet_credentials = json.dumps({"key": "issuer_wallet_key"})
genesis_file_path = get_pool_genesis_txn_path(pool_name)
def print_log(value_color="", value_noncolor=""):
"""set the colors for text."""
HEADER = '\033[92m'
ENDC = '\033[0m'
print(HEADER + value_color + ENDC + str(value_noncolor))
async def proof_negotiation():
try:
await pool.set_protocol_version(PROTOCOL_VERSION)
# Step 2 code goes here.
# Step 3 code goes here.
# Step 4 code goes here.
# Step 5 code goes here.
except IndyError as e:
print('Error occurred: %s' % e)
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(proof_negotiation())
loop.close()
if __name__ == '__main__':
main()