Documentation ¶
Index ¶
- Variables
- func ChallengeHandler(w http.ResponseWriter, r *http.Request)
- func EncodePublicRSA(pubkey *rsa.PublicKey) (string, error)
- func ListHandler(w http.ResponseWriter, r *http.Request)
- func LogHandler(w http.ResponseWriter, r *http.Request)
- func MakeConvoHandler(w http.ResponseWriter, r *http.Request)
- func ParsePublicRSA(public string) (*rsa.PublicKey, error)
- func ReadHandler(w http.ResponseWriter, r *http.Request)
- func RegisterInHandler(w http.ResponseWriter, r *http.Request)
- func UFO(w http.ResponseWriter, r *http.Request)
- func WriteHandler(w http.ResponseWriter, r *http.Request)
- type ChallengeIn
- type ChallengeOut
- type Event
- type FingerPrint
- type Group
- type GroupIn
- type GroupOut
- type ListIn
- type ListOut
- type Msg
- type ReadIn
- type ReadOut
- type Reciept
- type RegisterIn
- type Sig
- type SignedFingerPrint
- type WriteIn
Constants ¶
This section is empty.
Variables ¶
var ErrAuthDenied = errors.New("Auth denied")
ErrAuthDenied is returned when a user has failed a verification challenge
var ErrBadUUID = errors.New("bad UUID")
ErrBadUUID is returned when a user sends a malfromed UUID to the server.
var ErrGroupExists = errors.New("Group Exists")
ErrGroupExists is returned when a user tries to create a group with an existing UUID
var ErrKeyExists = errors.New("Key already exist")
ErrKeyExists is returned on registration when a someone has already registered with that key
var ErrKeyNotExist = errors.New("Key doesnt exist")
ErrKeyNotExist is returned when a user tries to verify with a key that is not registered
var ErrNoSuchUUID = errors.New("No such UUID")
Functions ¶
func ChallengeHandler ¶
func ChallengeHandler(w http.ResponseWriter, r *http.Request)
ChallengeHandler is the endpoint for challenge requests it accepts a json marshalled ChallengeIn struct and returns a marshalled ChallengeOut on success.
func EncodePublicRSA ¶
EncodePublicRSA key takes a PublicKey struct and encodes it to a PKIX PEM encoded string
func ListHandler ¶
func ListHandler(w http.ResponseWriter, r *http.Request)
ListHandler is the endpoint for users to query what groups they are a part of. It accepts a ListIn struct and returns a ListOut struct.
func LogHandler ¶
func LogHandler(w http.ResponseWriter, r *http.Request)
LogHandler is the debug page for viewing errors
func MakeConvoHandler ¶
func MakeConvoHandler(w http.ResponseWriter, r *http.Request)
MakeConvoHandler is the endpoint for creation of conversations, it accepts a json marshalled GroupIn struct and returns a marshalled GroupOut struct on success.
func ParsePublicRSA ¶
ParsePublicRSA parses a PKIX PEM encoded RSA key
func ReadHandler ¶
func ReadHandler(w http.ResponseWriter, r *http.Request)
ReadHandler is the endpoint for requesting messages from the server. It accepts a marshalled ReadIn struct and returns a marshalled ReadOut struct on success.
func RegisterInHandler ¶
func RegisterInHandler(w http.ResponseWriter, r *http.Request)
RegisterInHandler is the endpoint for registration requests it accepts a marshalled RegisterIn struct and returns a 200 status code on success.
func UFO ¶
func UFO(w http.ResponseWriter, r *http.Request)
UFO is a http.HandlerFunc that routes all of ufo's HTTP endpoints.
func WriteHandler ¶
func WriteHandler(w http.ResponseWriter, r *http.Request)
WriteHandler is the endpoint for writing messages to a group. It accepts a WriteIn struct and returns a 200 status code on success with a body of "OK"
Types ¶
type ChallengeIn ¶
type ChallengeIn struct {
FingerPrint //User's public key fingerprint
}
ChallengeIn is the JSON object for users to request a challenge
type ChallengeOut ¶
type ChallengeOut struct {
UUID string //Plain text UUID that user must sign
}
ChallengeOut is the JSON object for challenge reuqest responses.
type FingerPrint ¶
type FingerPrint string
FingerPrint is a SHA256 hash of PEM encoded public key */
type Group ¶
type Group struct { UUID string //UUID of group Members []FingerPrint //Public keys of the members in that group }
Group represents a group chat, identified by UUID
type GroupIn ¶
type GroupIn struct { Group SignedFingerPrint }
GroupIn is the JSON object for conversation create requests
type GroupOut ¶
type GroupOut struct {
Error, UUID string
}
GroupOut is the JSON object response for conversation create requests.
type ListIn ¶
type ListIn struct {
SignedFingerPrint
}
ListIn is the JSON object for users to list what groups they are in.
type ListOut ¶
type ListOut struct {
GroupUUIDs []string
}
ListOut is the JSON object response for list requests.
type Msg ¶
type Msg struct { From FingerPrint //Sender's public key Content string //Content of message }
Msg is a single message from or to a client
type ReadIn ¶
type ReadIn struct { SignedFingerPrint GroupID string }
ReadIn is the JSON object for users to request their messages.
type Reciept ¶
type Reciept struct { User FingerPrint Room string }
Reciept is a mark in to the message array for a conversation such that we only send new "unread" messages
type RegisterIn ¶
type RegisterIn struct { Public string //Pem enoded public key Sig Sig //Signature of the contents of Public }
RegisterIn is the JSON object for user registration.
type SignedFingerPrint ¶
type SignedFingerPrint struct { FingerPrint //Public key of user they claim to be SignedChallenge Sig //Signature of sha256 encoded UUID challenge }
SignedFingerPrint is used to verify the authenticity of a user.
type WriteIn ¶
type WriteIn struct { SignedFingerPrint GroupID string Content string }
WriteIn is the JSON object for write requests.