webfist

package module
v0.0.0-...-9c58cd4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2013 License: Apache-2.0 Imports: 16 Imported by: 0

README

WebFist implements WebFinger delegation for providers who don't
support WebFinger natively.

It takes advantage of the fact that all major providers DKIM-sign
their outgoing emails.

So if you have a Gmail, Facebook, Yahoo, Outlook, or whatever account,
you can email a server in the WebFist pool of servers, the server will
DKIM-verify it, parse it for a WebFinger delegation command, and then
encrypt your original email (with your email address as the key) and
then replicate the encrypted data across the network of WebFist servers.

Each WebFist node is then also a WebFinger server, so you can do
WebFinger lookups on gmail or facebook email addresses.

Consider it a WebFinger fallback.

One node is currently running at http://webfist.org/

The plan is to have a big pool of WebFist servers, like NTP pools.

Written by Brad Fitzpatrick and Brett Slatkin at IndieWebCamp in
Portland on 2013-06-23.

STATUS: quick hack, made while racing against demo time. It works, but
could use some polish.

Documentation

Overview

Package webfist implements WebFist.

Index

Constants

View Source
const MaxEmailSize = 64 << 10

MaxEmailSize is the maxium size of an RFC 822 email, including both its headers and body.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	// contains filtered or unexported fields
}

Email wraps a signed email.

func NewEmail

func NewEmail(all []byte) (*Email, error)

NewEmail parses all as an email and returns a wrapper around it. Its size and format is done, but no signing verification is done.

func (*Email) Date

func (e *Email) Date() (time.Time, error)

func (*Email) EncSHA1

func (e *Email) EncSHA1() (string, error)

EncSHA1 returns a lowercase SHA1 hex of the encrypted email.

func (*Email) Encrypted

func (e *Email) Encrypted() (io.Reader, error)

func (*Email) From

func (e *Email) From() (*EmailAddr, error)

func (*Email) SetEncSHA1

func (e *Email) SetEncSHA1(x string)

func (*Email) Verify

func (e *Email) Verify() bool

Verify returns whether

func (*Email) WebFist

func (e *Email) WebFist() (string, error)

WebFist returns the delegation identifier parse from the email. The email must contain a single assignment where the delegated WebFinger server lives.

webfist = http://example.com/my-profile.json

type EmailAddr

type EmailAddr struct {
	// contains filtered or unexported fields
}

EmailAddr provides utility functions on a wrapped email address.

func NewEmailAddr

func NewEmailAddr(addr string) *EmailAddr

NewEmailAddr returns a EmailAddr wrapper around an email address string. The incoming email address does not need to be canonicalized.

func (*EmailAddr) Canonical

func (e *EmailAddr) Canonical() string

Canonical returns the canonical version of the email address.

func (*EmailAddr) Decrypter

func (e *EmailAddr) Decrypter(r io.Reader) io.Reader

func (*EmailAddr) Encrypter

func (e *EmailAddr) Encrypter(w io.Writer) io.Writer

func (*EmailAddr) HexKey

func (e *EmailAddr) HexKey() string

HexKey returns the human-readable, lowercase hex version of the email address's key.

type Link struct {
	Rel        string            `json:"rel"`
	Type       string            `json:"type,omitempty"`
	Href       string            `json:"href"`
	Titles     []string          `json:"titles,omitempty"`
	Properties map[string]string `json:"properties,omitempty"`
}

Defined in: http://tools.ietf.org/html/draft-ietf-appsawg-webfinger

type Lookup

type Lookup interface {
	WebFinger(string) (*WebFingerResponse, error)
}

Lookup performs a WebFinger query for an email address and returns all known data for that address. Implementations may do standard WebFinger lookups over the network, fallback to using the WebFist network, or use local storage to map email address to WebFinger response.

type RecentMeta

type RecentMeta struct {
	AddrHexKey string
	EncSHA1    string
	AddTime    time.Time
}

RecentMeta describes an encrypted email in the storage system.

type Storage

type Storage interface {
	PutEmail(*EmailAddr, *Email) error
	Emails(*EmailAddr) ([]*Email, error)

	// StatEncryptedBlob returns the size of the encrypted blob on
	// disk. addrKey (the Email's HexKey) and encSHA1 (the SHA-1
	// of the encrypted email) are lowercase hex. The err will be
	// os.ErrNotExist if the file is doesn't exist.
	StatEncryptedEmail(addrKey, encSHA1 string) (size int, err error)

	// EncryptedEmail returns the encrypted email with for the
	// addrKey (the Email's HexKey) and encSHA1 (the SHA-1 of |
	// fi, err := os.Stat(s.hexPath(sha1)) the encrypted
	// email). Both are lowercase hex.  The err will be
	// os.ErrNotExist if the file is doesn't exist.
	EncryptedEmail(addrKey, sha1 string) ([]byte, error)

	PutEncryptedEmail(addrKey, sha1 string, data []byte) error

	// RecentMeta returns the recently-received encrypted emails.
	RecentMeta() ([]*RecentMeta, error)
}

Storage is the interface implemented by backends.

type WebFingerResponse

type WebFingerResponse struct {
	Subject    string            `json:"subject"`
	Aliases    []string          `json:"aliases,omitempty"`
	Properties map[string]string `json:"properties,omitempty"`
	Links      []Link            `json:"links,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL