22import json
33from os .path import abspath , join , dirname
44
5- from trinsic .proto .services .universalwallet .v1 import WalletProfile
6- from trinsic .services import WalletService
5+ from trinsic .proto .services .account .v1 import AccountProfile , AccountDetails
6+ from trinsic .services import WalletService , AccountService , CredentialsService
77from trinsic .trinsic_util import trinsic_test_config
88
99# pathData() {
@@ -22,14 +22,22 @@ def _vaccine_cert_frame_path() -> str:
2222
2323async def vaccine_demo ():
2424 # createService() {
25- wallet_service = WalletService ( trinsic_test_config ())
25+ account_service = AccountService ( server_config = trinsic_test_config ())
2626 # }
2727
2828 # setupActors() {
2929 # Create 3 different profiles for each participant in the scenario
30- allison = await wallet_service .create_wallet ()
31- clinic = await wallet_service .create_wallet ()
32- airline = await wallet_service .create_wallet ()
30+ allison , _ = await account_service .sign_in ()
31+ clinic , _ = await account_service .sign_in ()
32+ airline , _ = await account_service .sign_in ()
33+ # }
34+
35+ account_service .profile = clinic
36+ info = await account_service .get_info ()
37+
38+ # createService() {
39+ wallet_service = WalletService (allison , trinsic_test_config ())
40+ credentials_service = CredentialsService (clinic , trinsic_test_config ())
3341 # }
3442
3543 # storeAndRecallProfile() {
@@ -38,18 +46,17 @@ async def vaccine_demo():
3846 fid .write (bytes (allison ))
3947
4048 # Create profile from existing data
41- allison = WalletProfile ()
49+ allison = AccountProfile ()
4250 with open ("allison.bin" , "rb" ) as fid :
4351 allison .parse (fid .read ())
4452 # }
4553
4654 # issueCredential() {
4755 # Sign a credential as the clinic and send it to Allison
48- wallet_service .profile = clinic
4956 with open (_vaccine_cert_unsigned_path (), "r" ) as fid :
5057 credential_json = json .load (fid )
5158
52- credential = await wallet_service .issue_credential (credential_json )
59+ credential = await credentials_service .issue_credential (credential_json )
5360 print (f"Credential: { credential } " )
5461 # }
5562
@@ -64,18 +71,18 @@ async def vaccine_demo():
6471 # Allison shares the credential with the venue.
6572 # The venue has communicated with Allison the details of the credential
6673 # that they require expressed as a JSON-LD frame.
67- wallet_service .profile = allison
74+ credentials_service .profile = allison
6875 with open (_vaccine_cert_frame_path (), "r" ) as fid2 :
6976 proof_request_json = json .load (fid2 )
7077
71- credential_proof = await wallet_service .create_proof (document_id = item_id , reveal_document = proof_request_json )
78+ credential_proof = await credentials_service .create_proof (document_id = item_id , reveal_document = proof_request_json )
7279 print (f"Proof: { credential_proof } " )
7380 # }
7481
7582 # verifyCredential() {
7683 # The airline verifies the credential
77- wallet_service .profile = airline
78- valid = await wallet_service .verify_proof (credential_proof )
84+ credentials_service .profile = airline
85+ valid = await credentials_service .verify_proof (credential_proof )
7986
8087 print (f"Verification result: { valid } " )
8188 assert valid
0 commit comments