Exemplo n.º 1
0
def make_preauthd_device_with_pending(utoken, num_pending=1, tenant_token=''):
    dev = make_preauthd_device(utoken)

    for i in range(num_pending):
        priv, pub = util.crypto.rsa_get_keypair()
        aset = create_authset(dev.id_data, pub, priv, utoken, tenant_token=tenant_token)
        dev.authsets.append(Authset(aset.id, aset.did, dev.id_data, pub, priv, 'pending'))

    return dev
Exemplo n.º 2
0
def make_pending_device(utoken, num_auth_sets=1, tenant_token=''):
    id_data = rand_id_data()

    dev = None
    for i in range(num_auth_sets):
        priv, pub = util.crypto.rsa_get_keypair()
        new_set = create_authset(id_data, pub, priv, utoken, tenant_token=tenant_token)

        if dev is None:
            dev = Device(new_set.did, new_set.id_data, utoken, tenant_token)

        dev.authsets.append(new_set)

    dev.status = 'pending'

    return dev