Commit fc0b31a5 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Update comments, README, docs

parent b241f20d
# irmago
# irmago   [![GoDoc](https://godoc.org/github.com/privacybydesign/irmago?status.svg)](https://godoc.org/github.com/privacybydesign/irmago) [![Go Report Card](https://goreportcard.com/badge/github.com/privacybydesign/irmago)](https://goreportcard.com/report/github.com/privacybydesign/irmago)
`irmago` is an IRMA implementation in Go. It contains multiple libraries and applications:
* The Go package `irma` contains generic IRMA functionality used by all other components below, such as parsing [credential and issuer definitions and public keys](https://github.com/privacybydesign/irma-demo-schememanager), parsing [IRMA metadata attributes](https://credentials.github.io/docs/irma.html#the-metadata-attribute), and structs representing messages of the [IRMA protocol](https://credentials.github.io/protocols/irma-protocol/).
* The Go package `irmaclient` is a library that serves as the client in the IRMA protocol; it can receive and disclose IRMA attributes and store and read them from storage. It also implements the [keyshare protocol](https://github.com/privacybydesign/irma_keyshare_server) and handles registering to keyshare servers. The [IRMA mobile app](https://github.com/privacybydesign/irma_mobile) uses `irmaclient`.
* The `server` package contains the corresponding IRMA server as a Go library and as an executable.
* The tool `irma` for generating IRMA issuer public/private keypairs, and for verifying and signing [IRMA schemes](https://credentials.github.io/docs/irma.html#scheme-managers).
* The Go package [`irmaclient`](tree/master/irmaclient) is a library that serves as the client in the IRMA protocol; it can receive and disclose IRMA attributes and store and read them from storage. It also implements the [keyshare protocol](https://github.com/privacybydesign/irma_keyshare_server) and handles registering to keyshare servers. The [IRMA mobile app](https://github.com/privacybydesign/irma_mobile) uses `irmaclient`.
* The [`server`](tree/master/server) package contains the corresponding IRMA server as a Go library and as an executable.
* The tool [`irma`](tree/master/irma) for generating IRMA issuer public/private keypairs, and for verifying and signing [IRMA schemes](https://credentials.github.io/docs/irma.html#scheme-managers).
## Dependencies
`irmago` uses [`dep`](https://github.com/golang/dep) for its dependencies. After [Installing `dep`](https://golang.github.io/dep/docs/installation.html) if necesssary, run
`irmago` and its subpackages uses [`dep`](https://github.com/golang/dep) for its dependencies. After [Installing `dep`](https://golang.github.io/dep/docs/installation.html) if necesssary, run
dep ensure
......
// Executable for the irmad.
// Package main is the irmad executable.
package main
import "github.com/privacybydesign/irmago/server/irmad/cmd"
......
......@@ -14,7 +14,7 @@ import (
"github.com/privacybydesign/irmago/server"
)
// Server is an irmareqestor server instance.
// Server is an irmaserver instance.
type Server struct {
*servercore.Server
handlers map[string]SessionHandler
......@@ -24,6 +24,7 @@ type Server struct {
// once an IRMA session has completed.
type SessionHandler func(*server.SessionResult)
// New creates a new Server instance with the specified configuration.
func New(conf *server.Configuration) (*Server, error) {
s, err := servercore.New(conf)
if err != nil {
......@@ -49,6 +50,27 @@ func (s *Server) StartSession(request interface{}, handler SessionHandler) (*irm
return qr, token, nil
}
// GetSessionResult retrieves the result of the specified IRMA session.
func (s *Server) GetSessionResult(token string) *server.SessionResult {
return s.Server.GetSessionResult(token)
}
// GetRequest retrieves the request submitted by the requestor that started the specified IRMA session.
func (s *Server) GetRequest(token string) irma.RequestorRequest {
return s.Server.GetRequest(token)
}
// CancelSession cancels the specified IRMA session.
func (s *Server) CancelSession(token string) error {
return s.Server.CancelSession(token)
}
// SubscribeServerSentEvents subscribes the HTTP client to server sent events on status updates
// of the specified IRMA session.
func (s *Server) SubscribeServerSentEvents(w http.ResponseWriter, r *http.Request, token string) error {
return s.Server.SubscribeServerSentEvents(w, r, token)
}
// HandlerFunc returns a http.HandlerFunc that handles the IRMA protocol
// with IRMA apps.
//
......
// Package irmad is a server allowing IRMA verifiers, issuers or attribute-based signature
// Package requestorserver is a server allowing IRMA verifiers, issuers or attribute-based signature
// applications (the requestor) to perform IRMA sessions with irmaclient instances (i.e. the IRMA
// app). It exposes a RESTful protocol with which the requestor can start and manage the session as
// well as HTTP endpoints for the irmaclient.
......@@ -24,6 +24,7 @@ import (
"github.com/sirupsen/logrus"
)
// Server is a requestor server instance.
type Server struct {
serv, clientserv *http.Server
conf *Configuration
......@@ -173,7 +174,7 @@ func (s *Server) handleCreate(w http.ResponseWriter, r *http.Request) {
rerr *irma.RemoteError
applies bool
)
for _, authenticator := range authenticators {
for _, authenticator := range authenticators { // rrequest abbreviates "requestor request"
applies, rrequest, requestor, rerr = authenticator.Authenticate(r.Header, body)
if applies || rerr != nil {
break
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment