1
0
Fork 0
mirror of https://gitlab.com/hagrid-keyserver/hagrid.git synced 2023-02-13 20:55:02 -05:00

Machine-usable key submission.

- Fixes #50.
This commit is contained in:
Justus Winter 2019-03-12 16:21:28 +01:00
parent a2d38fceb5
commit de91be2b31
No known key found for this signature in database
GPG key ID: 686F55B4AB2B3386
5 changed files with 24 additions and 5 deletions

View file

@ -102,6 +102,14 @@ Retrieves the key with the given *User ID*. Only exact matches are
accepted. Lookup by *User ID* requires opt-in by the key's owner.
The returned key is *ASCII Armored*.
#### `POST /vks/v1/publish`
Keys may be submitted using a POST request to `/vks/v1/publish`, the
body of the request being a `multipart/form-data` query. `keytext`
must be the keys to submit, either *ASCII Armored* or not. More than
one key may be submitted in one request. Hagrid will send
verification emails to every non-expired *User ID*.
Building
--------

View file

@ -37,6 +37,17 @@
by the key's owner. The returned key is <em>ASCII Armored</em>.
</p>
<h4><code>POST /vks/v1/publish</code></h4>
<p>
Keys may be submitted using a POST request
to <code>/vks/v1/publish</code>, the body of the request being
a <code>multipart/form-data</code> query. <code>keytext</code>
must be the keys to submit, either <em>ASCII Armored</em> or not.
More than one key may be submitted in one request. Hagrid will
send verification emails to every non-expired <em>User ID</em>.
</p>
<h3>HPK interface</h3>
<p>
Hagrid implements a subset of

View file

@ -2,7 +2,7 @@
<p>After uploading your key we will send a verification link to each email address we find inside. Clicking that link will make your key searchable by that email address.</p>
<div class="row">
<form action="/publish" method="POST" enctype="multipart/form-data">
<form action="/vks/v1/publish" method="POST" enctype="multipart/form-data">
<div class="upload">
<input type="hidden" name="csrf" value="{{csrf}}" />
<input type="file" id="keytext" name="keytext" autofocus class="fileUpload" placeholder="Your public key"/>

View file

@ -434,12 +434,12 @@ fn rocket_factory(rocket: rocket::Rocket) -> Result<rocket::Rocket> {
vks_v1_by_email,
vks_v1_by_fingerprint,
vks_v1_by_keyid,
upload::vks_v1_publish_post,
// User interaction.
delete,
delete_post,
delete_confirm,
upload::publish,
upload::publish_post,
publish_verify,
// HKP
hkp::pks_lookup,
@ -904,7 +904,7 @@ pub mod tests {
body.extend_from_slice(header);
body.extend_from_slice(data);
body.extend_from_slice(footer);
let response = client.post("/publish")
let response = client.post("/vks/v1/publish")
.header(ct)
.body(&body[..])
.dispatch();

View file

@ -36,8 +36,8 @@ pub fn publish() -> MyResponse {
MyResponse::ok("publish", context)
}
#[post("/publish", data = "<data>")]
pub fn publish_post(
#[post("/vks/v1/publish", data = "<data>")]
pub fn vks_v1_publish_post(
db: rocket::State<Polymorphic>, cont_type: &ContentType, data: Data,
mail_service: rocket::State<mail::Service>, state: rocket::State<State>,
) -> MyResponse {