当前位置: 首页>>代码示例>>Python>>正文


Python did.create_and_store_my_did方法代码示例

本文整理汇总了Python中indy.did.create_and_store_my_did方法的典型用法代码示例。如果您正苦于以下问题:Python did.create_and_store_my_did方法的具体用法?Python did.create_and_store_my_did怎么用?Python did.create_and_store_my_did使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在indy.did的用法示例。


在下文中一共展示了did.create_and_store_my_did方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_wallet_and_pool

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def get_wallet_and_pool():
    pool_name = 'pool' + randomString(3)
    wallet_name = 'wallet' + randomString(10)
    their_wallet_name = 'their_wallet' + randomString(10)
    seed_trustee1 = "000000000000000000000000Trustee1"

    await wallet.create_wallet(pool_name, wallet_name, None, None, None)
    my_wallet_handle = await wallet.open_wallet(wallet_name, None, None)

    await wallet.create_wallet(pool_name, their_wallet_name, None, None, None)
    their_wallet_handle = await wallet.open_wallet(their_wallet_name, None, None)

    await did.create_and_store_my_did(my_wallet_handle, "{}")

    (their_did, their_verkey) = await did.create_and_store_my_did(their_wallet_handle,
                                                                  json.dumps({"seed": seed_trustee1}))

    await did.store_their_did(my_wallet_handle, json.dumps({'did': their_did, 'verkey': their_verkey}))

    return their_wallet_handle, their_did 
开发者ID:hyperledger,项目名称:indy-plenum,代码行数:22,代码来源:generate_txns.py

示例2: init

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def init():
    me = input('Who are you? ').strip()
    wallet_config = '{"id": "%s-wallet"}' % me
    wallet_credentials = '{"key": "%s-wallet-key"}' % me

    try:
        await wallet.create_wallet(wallet_config, wallet_credentials)
    except:
        pass
    wallet_handle = await wallet.open_wallet(wallet_config, wallet_credentials)
    print('wallet = %s' % wallet_handle)

    (my_did, my_vk) = await did.create_and_store_my_did(wallet_handle, "{}")
    print('my_did and verkey = %s %s' % (my_did, my_vk))

    their = input("Other party's DID and verkey? ").strip().split(' ')
    return wallet_handle, my_did, my_vk, their[0], their[1] 
开发者ID:kdenhartog,项目名称:indy-dev,代码行数:19,代码来源:msgme.py

示例3: test_send_and_get_nym_positive

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def test_send_and_get_nym_positive(writer_role, reader_role):
    await pool.set_protocol_version(2)
    pool_handle, _ = await pool_helper()
    wallet_handle, _, _ = await wallet_helper()
    target_did, target_vk = await did.create_and_store_my_did(wallet_handle, '{}')
    writer_did, writer_vk = await did.create_and_store_my_did(wallet_handle, '{}')
    reader_did, reader_vk = await did.create_and_store_my_did(wallet_handle, '{}')
    trustee_did, trustee_vk = await did.create_and_store_my_did(wallet_handle, json.dumps(
        {'seed': '000000000000000000000000Trustee1'}))
    # Trustee adds NYM writer
    await nym_helper(pool_handle, wallet_handle, trustee_did, writer_did, writer_vk, None, writer_role)
    # Trustee adds NYM reader
    await nym_helper(pool_handle, wallet_handle, trustee_did, reader_did, reader_vk, None, reader_role)
    # Writer sends NYM
    res1 = json.loads(await nym_helper(pool_handle, wallet_handle, writer_did, target_did))
    time.sleep(1)
    # Reader gets NYM
    res2 = json.loads(await get_nym_helper(pool_handle, wallet_handle, target_did, target_did))

    assert res1['op'] == 'REPLY'
    assert res2['result']['seqNo'] is not None

    print(res1)
    print(res2) 
开发者ID:hyperledger,项目名称:indy-node,代码行数:26,代码来源:test_ledger.py

示例4: test_send_and_get_nym_negative

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def test_send_and_get_nym_negative(submitter_seed):
    await pool.set_protocol_version(2)
    pool_handle, _ = await pool_helper()
    wallet_handle, _, _ = await wallet_helper()
    target_did, target_vk = await did.create_and_store_my_did(wallet_handle, '{}')
    submitter_did, submitter_vk = await did.create_and_store_my_did(wallet_handle, submitter_seed)
    trustee_did, trustee_vk = await did.create_and_store_my_did(wallet_handle, json.dumps(
        {'seed': '000000000000000000000000Trustee1'}))
    # Trustee adds submitter
    await nym_helper(pool_handle, wallet_handle, trustee_did, submitter_did, submitter_vk)
    # None role submitter tries to send NYM (rejected) and gets no data about this NYM from ledger
    res1 = json.loads(await nym_helper(pool_handle, wallet_handle, submitter_did, target_did))
    res2 = json.loads(await get_nym_helper(pool_handle, wallet_handle, submitter_did, target_did))

    assert res1['op'] == 'REJECT'
    assert res2['result']['seqNo'] is None

    print(res1)
    print(res2) 
开发者ID:hyperledger,项目名称:indy-node,代码行数:21,代码来源:test_ledger.py

示例5: test_send_and_get_attrib_positive

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def test_send_and_get_attrib_positive(xhash, raw, enc):
    await pool.set_protocol_version(2)
    pool_handle, _ = await pool_helper()
    wallet_handle, _, _ = await wallet_helper()
    target_did, target_vk = await did.create_and_store_my_did(wallet_handle, '{}')
    submitter_did, submitter_vk = await did.create_and_store_my_did(wallet_handle, json.dumps(
        {'seed': '000000000000000000000000Trustee1'}))
    await nym_helper(pool_handle, wallet_handle, submitter_did, target_did, target_vk)
    res1 = json.loads(await attrib_helper(pool_handle, wallet_handle, target_did, target_did, xhash, raw, enc))
    res2 = json.loads(await get_attrib_helper(pool_handle, wallet_handle, target_did, target_did, xhash, raw, enc))

    assert res1['op'] == 'REPLY'
    assert res2['op'] == 'REPLY'

    print(res1)
    print(res2) 
开发者ID:hyperledger,项目名称:indy-node,代码行数:18,代码来源:test_ledger.py

示例6: test_send_and_get_attrib_negative

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def test_send_and_get_attrib_negative(xhash, raw, enc, error):
    await pool.set_protocol_version(2)
    pool_handle, _ = await pool_helper()
    wallet_handle, _, _ = await wallet_helper()
    target_did, target_vk = await did.create_and_store_my_did(wallet_handle, '{}')
    submitter_did, submitter_vk = await did.create_and_store_my_did(wallet_handle, json.dumps(
        {'seed': '000000000000000000000000Trustee1'}))
    await nym_helper(pool_handle, wallet_handle, submitter_did, target_did, target_vk)
    if error:
        with pytest.raises(error):
            await attrib_helper(pool_handle, wallet_handle, target_did, target_did, xhash, raw, enc)
            await get_attrib_helper(pool_handle, wallet_handle, target_did, target_did, xhash, raw, enc)
    else:
        res1 = json.loads(await attrib_helper(pool_handle, wallet_handle, target_did, target_did, xhash, raw, enc))
        res2 = json.loads(await get_attrib_helper(pool_handle, wallet_handle, target_did, target_did, xhash, raw, enc))

        assert res1['op'] == 'REQNACK'
        assert res2['op'] == 'REQNACK'

        print(res1)
        print(res2) 
开发者ID:hyperledger,项目名称:indy-node,代码行数:23,代码来源:test_ledger.py

示例7: test_send_and_get_schema_positive

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def test_send_and_get_schema_positive(writer_role, reader_role):
    await pool.set_protocol_version(2)
    pool_handle, _ = await pool_helper()
    wallet_handle, _, _ = await wallet_helper()
    writer_did, writer_vk = await did.create_and_store_my_did(wallet_handle, '{}')
    reader_did, reader_vk = await did.create_and_store_my_did(wallet_handle, '{}')
    trustee_did, trustee_vk = await did.create_and_store_my_did(wallet_handle, json.dumps(
        {'seed': '000000000000000000000000Trustee1'}))
    # Trustee adds SCHEMA writer
    await nym_helper(pool_handle, wallet_handle, trustee_did, writer_did, writer_vk, None, writer_role)
    # Trustee adds SCHEMA reader
    await nym_helper(pool_handle, wallet_handle, trustee_did, reader_did, reader_vk, None, reader_role)
    # Writer sends SCHEMA
    schema_id, res = await schema_helper(pool_handle, wallet_handle, writer_did,
                                         'schema1', '1.0', json.dumps(["age", "sex", "height", "name"]))
    res1 = json.loads(res)
    # Reader gets SCHEMA
    res2 = json.loads(await get_schema_helper(pool_handle, wallet_handle, reader_did, schema_id))

    assert res1['op'] == 'REPLY'
    assert res2['op'] == 'REPLY'

    print(res1)
    print(res2) 
开发者ID:hyperledger,项目名称:indy-node,代码行数:26,代码来源:test_ledger.py

示例8: test_network_monitor_suspension_by_itself

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def test_network_monitor_suspension_by_itself(looper,
                                              sdk_pool_handle,
                                              sdk_wallet_steward,
                                              sdk_wallet_handle,
                                              with_verkey):
    new_network_monitor_did, new_network_monitor_verkey = looper.loop.run_until_complete(
        did.create_and_store_my_did(sdk_wallet_steward[0], "{}"))

    """Adding NETWORK_MONITOR role by steward"""
    op = {'type': '1',
          'dest': new_network_monitor_did,
          'role': NETWORK_MONITOR,
          'verkey': new_network_monitor_verkey}
    req = sdk_sign_and_submit_op(looper, sdk_pool_handle, (sdk_wallet_handle, sdk_wallet_steward[1]), op)
    sdk_get_and_check_replies(looper, [req])

    """Blacklisting network_monitor by itself"""
    op = {'type': '1',
          'dest': new_network_monitor_did,
          'role': None}
    if with_verkey:
        op['verkey'] = new_network_monitor_verkey
    req = sdk_sign_and_submit_op(looper, sdk_pool_handle, (sdk_wallet_handle, new_network_monitor_did), op)
    with pytest.raises(RequestRejectedException):
        sdk_get_and_check_replies(looper, [req]) 
开发者ID:hyperledger,项目名称:indy-node,代码行数:27,代码来源:test_demote_network_monitor.py

示例9: new_client_request

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def new_client_request(role, name, looper, sdk_wallet):
    wh, did = sdk_wallet
    seed = randomString(32)
    (named_did, named_verkey) = looper.loop.run_until_complete(
        create_and_store_my_did(wh, json.dumps({'seed': seed})))
    nym_request = looper.loop.run_until_complete(
        build_nym_request(did, named_did, named_verkey,
                          name, role))

    return sdk_sign_request_strings(looper, sdk_wallet,
                                    [json.loads(nym_request)])[0] 
开发者ID:hyperledger,项目名称:indy-plenum,代码行数:13,代码来源:helper.py

示例10: prepare_nym_request

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def prepare_nym_request(wallet, named_seed, alias,
                              role, dest=None, verkey=None, skipverkey=False):
    wh, submitter_did = wallet
    (named_did, named_verkey) = \
        await create_and_store_my_did(wh, json.dumps({'seed': named_seed}))
    named_did = dest or named_did
    named_verkey = verkey or named_verkey
    named_verkey = None if skipverkey else named_verkey
    nym_request = await build_nym_request(submitter_did, named_did, named_verkey,
                                          alias, role)
    return nym_request, named_did 
开发者ID:hyperledger,项目名称:indy-plenum,代码行数:13,代码来源:helper.py

示例11: nym_on_ledger

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def nym_on_ledger(looper, sdk_pool_handle, sdk_wallet_client, sdk_wallet_steward, seed=None):
    did_future = create_and_store_my_did(sdk_wallet_client[0], json.dumps({"seed": seed}) if seed else "{}")
    did, vk = looper.loop.run_until_complete(did_future)
    nym_req_future = build_nym_request(sdk_wallet_steward[1], did, vk, None, None)
    nym_req = looper.loop.run_until_complete(nym_req_future)
    nym_resp_future = sign_and_submit_request(sdk_pool_handle, sdk_wallet_steward[0], sdk_wallet_steward[1], nym_req)
    nym_resp = looper.loop.run_until_complete(nym_resp_future)
    nym = json.loads(nym_resp)
    assert nym["result"]
    assert nym["result"][TXN_METADATA]
    assert nym["result"][TXN_METADATA][TXN_METADATA_SEQ_NO]
    return nym["result"][TXN_METADATA][TXN_METADATA_SEQ_NO] 
开发者ID:hyperledger,项目名称:indy-plenum,代码行数:14,代码来源:test_get_txn_state_proof.py

示例12: nym_txn_data

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def nym_txn_data(looper, sdk_wallet_client):
    seed = randomString(32)

    wh, _ = sdk_wallet_client
    sender_did, sender_verkey = \
        looper.loop.run_until_complete(create_and_store_my_did(wh, json.dumps({'seed': seed})))
    return wh, randomString(5), sender_did, sender_verkey 
开发者ID:hyperledger,项目名称:indy-plenum,代码行数:9,代码来源:test_create_did_without_endorser.py

示例13: setup

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def setup(self, config):
        if not 'ledger_name' in config:
            raise Exception(
                "The Indy provider requires a 'ledger_name' value in config.toml")
        self.pool_name = config['ledger_name']
        if not 'ledger_url' in config:
            raise Exception(
                "The Indy provider requires a 'ledger_url' value in config.toml")
        self.ledger_url = config['ledger_url']
        if not 'ledger_apts_seed' in config:
            raise Exception(
                "The Indy provider requires a 'ledger_apts_seed' value in config.toml")
        seed = config['ledger_apts_seed']
        id = config.get('name', 'test')
        key = config.get('pass', 'testpw')
        self.cfg = json.dumps({'id': id})
        self.creds = json.dumps({'key': key})
        self.seed = json.dumps({'seed': seed})
        try:
            await wallet.delete_wallet(self.cfg, self.creds)
        except Exception as e:
            pass
        await wallet.create_wallet(self.cfg, self.creds)
        self.wallet = await wallet.open_wallet(self.cfg, self.creds)
        self.master_secret_id = await anoncreds.prover_create_master_secret(self.wallet, None)
        (self.did, self.verkey) = await did.create_and_store_my_did(self.wallet, self.seed)
        # Download the genesis file
        resp = await aiohttp.ClientSession().get(self.ledger_url)
        genesis = await resp.read()
        genesisFileName = "genesis.apts"
        with open(genesisFileName, 'wb') as output:
            output.write(genesis)
        await self._open_pool({'genesis_txn': genesisFileName}) 
开发者ID:hyperledger,项目名称:aries-protocol-test-suite,代码行数:35,代码来源:indy_provider.py

示例14: get_verinym

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def get_verinym(pool_handle, _from, from_wallet, from_did, from_to_key,
                      to, to_wallet, to_from_did, to_from_key, role):
    logger.info("\"{}\" -> Create and store in Wallet \"{}\" new DID".format(to, to))
    (to_did, to_key) = await did.create_and_store_my_did(to_wallet, "{}")

    logger.info("\"{}\" -> Authcrypt \"{} DID info\" for \"{}\"".format(to, to, _from))
    did_info_json = json.dumps({
        'did': to_did,
        'verkey': to_key
    })
    authcrypted_did_info_json = \
        await crypto.auth_crypt(to_wallet, to_from_key, from_to_key, did_info_json.encode('utf-8'))

    logger.info("\"{}\" -> Send authcrypted \"{} DID info\" to {}".format(to, to, _from))

    logger.info("\"{}\" -> Authdecrypted \"{} DID info\" from {}".format(_from, to, to))
    sender_verkey, authdecrypted_did_info_json, authdecrypted_did_info = \
        await auth_decrypt(from_wallet, from_to_key, authcrypted_did_info_json)

    logger.info("\"{}\" -> Authenticate {} by comparision of Verkeys".format(_from, to, ))
    assert sender_verkey == await did.key_for_did(pool_handle, from_wallet, to_from_did)

    logger.info("\"{}\" -> Send Nym to Ledger for \"{} DID\" with {} Role".format(_from, to, role))
    await send_nym(pool_handle, from_wallet, from_did, authdecrypted_did_info['did'],
                   authdecrypted_did_info['verkey'], role)

    return to_did 
开发者ID:kdenhartog,项目名称:indy-dev,代码行数:29,代码来源:getting_started.py

示例15: create_and_store_my_did

# 需要导入模块: from indy import did [as 别名]
# 或者: from indy.did import create_and_store_my_did [as 别名]
def create_and_store_my_did(wallet_handle):
    """ Create and store my DID, adding a map from verkey to DID using the
        non_secrets API.
    """
    (my_did, my_vk) = await did.create_and_store_my_did(wallet_handle, '{}')

    await non_secrets.add_wallet_record(
        wallet_handle,
        'key-to-did',
        my_vk,
        my_did,
        '{}'
    )

    return my_did, my_vk 
开发者ID:hyperledger-archives,项目名称:indy-agent,代码行数:17,代码来源:indy_sdk_utils.py


注:本文中的indy.did.create_and_store_my_did方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。