Autodoc

HTTP endpoints

GET /ping

Checks if server still alive

Status Codes:
POST /gen_key

Generates new key-pair

Example request:

POST /gen_key HTTP 1.1
Content-Type: application/json

{
  "name_real": "foo_bar",
  "name_email": "foo_bar@example.com"
}
request fields:
  • name_real, name_email, name_comment: for key identification

  • key_length: now supports 1024 or 2048 bytes

  • expire: [optional] key expire in days, default 0 means never

Return:

Http response with plain text content

Status Codes:

Python modules

copr_keygen.logic.create_new_key(app, name_real, name_email, key_length, expire=None, name_comment=None)[source]

Creates new key for user. WARNING! This method doesn’t check for the key duplicity. :param app: Flask application object

Parameters:
  • name_real – name for key identification

  • name_email – email for key identification

  • key_length – length of key in bytes, accepts 1024 or 2048

  • expire – [optional] days for key to expire, default 0 == never expire

  • name_comment – [optional] comment for key

Returns:

(stdout, stderr) from gpg invocation

copr_keygen.logic.ensure_passphrase_exist(app, name_email)[source]

Need this to tell signd server that name_email available in keyring Key not protected by passphrase, so we write something to passphrase file.

copr_keygen.logic.get_passphrase_location(app, name_email)[source]
copr_keygen.logic.user_exists(app, mail)[source]

Checks if the user identified by mail presents in keyring

Returns:

bool True when user present

Raises:

GpgErrorException

copr_keygen.logic.validate_name_email(name_email)[source]
We read get a value from clients, that looks like this

frostyx#foo@copr.fedorahosted.org @copr#foo@copr.fedorahosted.org

This function returns True if the name_value is in an expected format.

exception copr_keygen.exceptions.BadRequestException(*args, **kwargs)[source]
status_code = 400
exception copr_keygen.exceptions.GpgErrorException(*args, **kwargs)[source]
status_code = 500
exception copr_keygen.exceptions.KeygenServiceBaseException(*args, **kwargs)[source]
property msg
status_code = 500