An open API service indexing awesome lists of open source software.

https://github.com/riboseinc/rails-keyserver

A generic Rails engine for serving most kinds of keys
https://github.com/riboseinc/rails-keyserver

Last synced: 9 months ago
JSON representation

A generic Rails engine for serving most kinds of keys

Awesome Lists containing this project

README

          

= Rails::Keyserver

image:https://img.shields.io/gem/v/rails-keyserver.svg[
Gem Version, link="https://rubygems.org/gems/rails-keyserver"]
image:https://img.shields.io/travis/riboseinc/rails-keyserver/master.svg[
Build Status, link="https://travis-ci.org/riboseinc/rails-keyserver/branches"]
image:https://img.shields.io/codecov/c/github/riboseinc/rails-keyserver.svg[
Test Coverage, link="https://codecov.io/gh/riboseinc/rails-keyserver"]
image:https://img.shields.io/codeclimate/maintainability/riboseinc/rails-keyserver.svg[
"Code Climate", link="https://codeclimate.com/github/riboseinc/rails-keyserver"]

A generic Rails engine for serving most kinds of keys.

== Installation

Add this line to your application’s Gemfile:

[source,ruby]
----
gem 'rails-keyserver'
----

And then execute:

[source,console]
----
$ bundle
----

Or install it yourself as:

[source,console]
----
$ gem install rails-keyserver
----

== Routes

The following is a sample of what we would like to achieve in terms of API
endpoints:

[source]
----
# GET JSON
# /security/pgp_keys?date_from=X&date_to=Y&purpose=mail&sort_by=activation_date&order=desc
[
{
public: '===== BEGIN PGP BLOCK ==========.....',
key_id: 0x346cb447
key_type: rsa
expires: '2055/12/12 11:23:45Z+08:00'
key_size: 4096/4096
fingerprint: 72e5 f8ae da12 7b85 fadb 25a5 83a3 ef8c 346c b447
userid: apple product security
activation_date: '2055/12/12 11:23:45Z+08:00',
}
]

# GET JSON /security/pgp_keys
[
{
public: '===== BEGIN PGP BLOCK ==========.....',
key_id: 0x346cb446
key_type: rsa
expires: '2055/12/12 11:23:45Z+08:00'
key_size: 4096/4096
fingerprint: 72e5 f8ae da12 7b85 fadb 25a5 83a3 ef8c 346c b447
userid: apple product security
activation_date: '2055/12/12 11:23:45Z+08:00',
}
]

# rails users: public PGP
# DELETE JSON /settings/pgp_key
# POST PUT GET JSON /settings/pgp_key
200:
{
id: 'slfsjdfdklsj',
public: '===== BEGIN PGP BLOCK ==========.....',
key_id: 0x346cb446
key_type: rsa
expires: '2055/12/12 11:23:45Z+08:00'
key_size: 4096/4096
fingerprint: 72e5 f8ae da12 7b85 fadb 25a5 83a3 ef8c 346c b447
userid: apple product security
created_at: '2055/12/12 11:23:45Z+08:00',
}

422:
{
errors: {
format: 'invalid'
}
}

403:
{
errors: {
permission: 'denied'
}
}
----

== Usage

=== Override controllers and rendering methods

==== Keys Controller

* `#render_index`
** `@composed` is the collection to render
* `#render_show_json(key)`
* `#render_show_ext(key)`

==== Default settings for mounted routes

[source,ruby]
----
# E.g. in config/routes.rb
mount_keyserver at: 'ks', controllers: {
keys: 'rails/keyserver/api/v1/keys',
}
----

== Contributing

First, thank you for contributing! We love pull requests from everyone.
By participating in this project, you hereby grant
https://www.ribose.com[Ribose Inc.] the right to grant or transfer an
unlimited number of non exclusive licenses or sub-licenses to third
parties, under the copyright covering the contribution to use the
contribution by all means.

Here are a few technical guidelines to follow:

1. Open an https://github.com/riboseinc/rails-keyserver/issues[issue] to discuss
a new feature.
2. Write tests to support your new feature.
3. Make sure the entire test suite passes locally and on CI.
4. Open a Pull Request.
5. After receiving feedback, perform
https://help.github.com/articles/about-git-rebase/[an interactive rebase]
on your branch, in order to create a series of cohesive commits with
descriptive messages.
6. Party!

== Credits

This gem is developed, maintained and funded by
https://www.ribose.com[Ribose Inc.]

== License

The gem is available as open source under the terms of the
http://opensource.org/licenses/MIT[MIT License].