def keygen(get_keyring=get_keyring):
    """Generate a public/private key pair."""
    warn_signatures()
    WheelKeys, keyring = get_keyring()

    ed25519ll = signatures.get_ed25519ll()

    wk = WheelKeys().load()

    keypair = ed25519ll.crypto_sign_keypair()
    vk = native(urlsafe_b64encode(keypair.vk))
    sk = native(urlsafe_b64encode(keypair.sk))
    kr = keyring.get_keyring()
    kr.set_password("wheel", vk, sk)
    print("Created Ed25519 keypair with vk={}".format(vk))
    print("in {!r}".format(kr))

    sk2 = kr.get_password('wheel', vk)
    if sk2 != sk:
        raise WheelError("Keyring is broken. Could not retrieve secret key.")

    print("Trusting {} to sign and verify all packages.".format(vk))
    wk.add_signer('+', vk)
    wk.trust('+', vk)
    wk.save()
def keygen ( get_keyring = get_keyring ) : warn_signatures ( ) WheelKeys , keyring = get_keyring ( ) ed25519ll = signatures . get_ed25519ll ( ) wk = WheelKeys ( ) . load ( ) keypair = ed25519ll . crypto_sign_keypair ( ) vk = native ( urlsafe_b64encode ( keypair . vk ) ) sk = native ( urlsafe_b64encode ( keypair . sk ) ) kr = keyring . get_keyring ( ) kr . set_password ( "wheel" , vk , sk ) print ( "Created Ed25519 keypair with vk={}" . format ( vk ) ) print ( "in {!r}" . format ( kr ) ) sk2 = kr . get_password ( 'wheel' , vk ) if sk2 != sk : raise WheelError ( "Keyring is broken. Could not retrieve secret key." ) print ( "Trusting {} to sign and verify all packages." . format ( vk ) ) wk . add_signer ( '+' , vk ) wk . trust ( '+' , vk ) wk . save ( )
Generate a public/private key pair.