项目作者: alphagov

项目描述 :
Secure and simple software to ask questions and get answers from a federated network of personal data.
高级语言: Ruby
项目地址: git://github.com/alphagov/aquae-whirlpool.git
创建时间: 2017-10-06T11:16:05Z
项目社区:https://github.com/alphagov/aquae-whirlpool

开源协议:

下载


" class="reference-link">Whirlpool ALPHA

Whirlpool is a Ruby implementation of an AQuAE node that asks questions and computes answers by interacting with other nodes as part of a federation.

Whirlpool can be integrated with numerous kinds of systems:

  • a web server, to enable a personal data query to happen as part of an online journey,
  • an API server, for personal data answers to be served to other services,
  • a CRM system, to enable a personal data query to happen as part of a back-office workflow,
  • or any other software system that needs to ask questions of a personal data network about citizens.

Whirlpool is the application-level software that enables all of these integrations to occur.

It can also be run as a standalone application and be loaded with business-logic rules. This allows it to operate as a query server, collecting required data from other nodes and serving answers using that data to clients, all as part of an AQuAE network.

Please note this is ALPHA quality software as the ecosystem won’t be suitable for live use until v1.0. See the list of missing features below.

Installing

A compiled gem version is not available on Rubygems yet.

Add whirlpool to your Gemfile:

  1. gem 'whirlpool', github: 'alphagov/whirlpool'

Configuration

Configuration can be supplied to Whirlpool as a YAML file, to the following specification:

  1. ---
  2. metadata: my.federation # A federation file to load.
  3. this_node: simon1 # The name of this node in the metadata.
  4. keyfile: my.private.key # The private key for the node.
  5. queryfiles: # A list of files to load containing local queries.
  6. - queries.rb

Integrating

To create an integration, load the library and start an app instance.

  1. require 'whirlpool'
  2. config = Whirlpool::Configuration.new 'config.yml'
  3. app = Whirlpool::Application.new config

Now you can issue queries. Each query will start a new Thread, and return an object that can be used to give data to the thread.

  1. query = app.start_query

Set the question that you wish to ask, corresponding to a question in the metadata file.

  1. query.question_name = 'eligible?'

Whirlpool may offer you multiple choices for how the query can be implemented. Offer these to the user or make an appropriate decision. The methods will return futures that you can wait on or store for later.

  1. choices_promise = query.choices
  2. choices = choices_promise.value
  3. my_choice = choices.first # put your better decision logic here
  4. query.choice = my_choice

The choice tells you what identity information is required.

  1. my_choice.matching_requirements
  2. #<Aquae::Metadata::MatchingSpec required=[:surname, :postcode]>

Get your identity data signed via an appropriate route. For now, consent servers are not properly implemented so use a stub implementation.

  1. signer = Whirlpool::FakeQuerySigner.new query, my_choice
  2. signer.identity = {:surname => ..., :postcode => ..., ...}

Then ask for the answer.

  1. answer = query.answer.value

whirlpoold

This is a standalone app that will operate an AQuAE node.

It accepts as command-line argument a YAML file for configuration to the above specification.