def testDidGen64WithMethod(): vk = "nxESHveBmK9RsEkgaZi-cNPvW0zO-ujOWEW7oKb7EYI=" method = "dad" did = didering.didGen64(vk, method) assert did == "did:dad:nxESHveBmK9RsEkgaZi-cNPvW0zO-ujOWEW7oKb7EYI=" method = "igo" did = didering.didGen64(vk, method) assert did == "did:igo:nxESHveBmK9RsEkgaZi-cNPvW0zO-ujOWEW7oKb7EYI="
def historyGen(initial_key_pair_seed=None, rotation_key_pair_seed=None): """ historyGen generates a new key history dictionary and returns the history along with all generated keys. If a seed is not provided libnacl's randombytes() function will be used to generate a seed. :param initial_key_pair_seed: The seed value used during key generation for the initial key pair. :param rotation_key_pair_seed: The seed value used during key generation for the pre-rotated key pair. :return: a history dictionary with an "id", "signer" and "signers" field, url-file safe base64 verifier/public key string, url-file safe base64 signing/private key, url-file safe base64 pre-rotated verifier/public key, url-file safe base64 pre-rotated signing/private key """ vk, sk, did = keyGen(initial_key_pair_seed) pre_rotated_vk, pre_rotated_sk, did = keyGen(rotation_key_pair_seed) history = { "id": didering.didGen64(vk), "signer": 0, "signers": [vk, pre_rotated_vk] } return history, vk, sk, pre_rotated_vk, pre_rotated_sk
def testDidGen64(): vk = "nxESHveBmK9RsEkgaZi-cNPvW0zO-ujOWEW7oKb7EYI=" did = didering.didGen64(vk) assert did == "did:dad:nxESHveBmK9RsEkgaZi-cNPvW0zO-ujOWEW7oKb7EYI="
def testDidGen64WithNone(): vk = None assert didering.didGen64(vk) is None
def testDidGen64(): vk, sk, did = gen.keyGen() did = didering.didGen64(vk) assert did == "did:dad:{}".format(vk)