from indy import wallet, signus from ..utils import storage from ..utils.wallet import create_and_open_wallet import json import pytest import logging logging.basicConfig(level=logging.DEBUG) @pytest.fixture(autouse=True) def before_after_each(): storage.cleanup() yield storage.cleanup() @pytest.fixture async def wallet_handle(): handle = await create_and_open_wallet() yield handle await wallet.close_wallet(handle) @pytest.mark.asyncio async def test_sign_works(wallet_handle): (did, _, _) = await signus.create_and_store_my_did(wallet_handle, '{"seed":"000000000000000000000000Trustee1"}') message = { "reqId": 1496822211362017764, "identifier": "GJ1SzoWzavQYfNL9XkaJdrQejfztN4XqdsiV4ct3LXKL", "operation": { "type": "1", "dest": "VsKV7grR1BUE29mG2Fm2kX", "verkey": "GjZWsBLgZCR18aL468JAT7w9CZRiBnpxUPPgyQxh4voa" } } expected_signature = "65hzs4nsdQsTUqLCLy2qisbKLfwYKZSWoyh1C6CU59p5pfG3EHQXGAsjW4Qw4QdwkrvjSgQuyv8qyABcXRBznFKW" result = json.loads(await signus.sign(wallet_handle, did, json.dumps(message))) assert result['signature'] == expected_signature