Autodoc¶
HTTP endpoints¶
- 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:
201 Created – on success, returns empty data
200 OK – key already exists, nothing done
400 Bad Request – incorrect request
500 Internal Server Error – internal server error
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.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.