Documentation ¶
Overview ¶
Package salmon implements the Salmon protocol, as defined in http://www.salmon-protocol.org/salmon-protocol-summary.
Index ¶
- Constants
- func FormatPublicKey(pk crypto.PublicKey) (string, error)
- func FormatPublicKeyDataURL(pk crypto.PublicKey) (string, error)
- func NewHandler(be Backend) http.Handler
- func ParsePublicKey(s string) (crypto.PublicKey, error)
- func ParsePublicKeyDataURL(u string) (crypto.PublicKey, error)
- func PublicKeyID(pk crypto.PublicKey) (string, error)
- func ResourcePublicKey(resource *xrd.Resource) (crypto.PublicKey, error)
- type Backend
- type MagicData
- type MagicEnv
- type MagicSig
- type PublicKeyBackend
Constants ¶
const Rel = "salmon"
Rel is the salmon relation.
const RelMagicPublicKey = "magic-public-key"
MagicPublicKeyRel is the magic-public-key relation.
Variables ¶
This section is empty.
Functions ¶
func FormatPublicKey ¶
FormatPublicKey formats a public key into the application/magic-key format.
func FormatPublicKeyDataURL ¶
FormatPublicKeyDataURL returns the data URL for a public key.
func NewHandler ¶
NewHandler creates a new salmon endpoint.
func ParsePublicKey ¶
ParsePublicKey parses a public key from the application/magic-key format.
func ParsePublicKeyDataURL ¶
ParsePublicKeyDataURL parses a public key data URL.
func PublicKeyID ¶
PublicKeyID returns the key identifier for a public key.
Types ¶
type Backend ¶
type Backend interface { PublicKeyBackend // Notify is called when a salmon is pushed to the endpoint. Notify(*activitystream.Entry) error }
A Backend is used to build salmon endpoints.
type MagicData ¶
type MagicData struct { Type string `xml:"type,attr" json:"data_type"` Value string `xml:",chardata" json:"data"` }
A MagicaData contains a type and a value.
type MagicEnv ¶
type MagicEnv struct { XMLName xml.Name `xml:"http://salmon-protocol.org/ns/magic-env env"` Data *MagicData `xml:"data"` Encoding string `xml:"encoding"` Alg string `xml:"alg"` Sig []*MagicSig `xml:"sig"` }
A MagicEnv is a magic envelope and contains a message bundled along with signature(s) for that message.
func CreateMagicEnv ¶
CreateMagicEnv creates a new magic envelope.
func (*MagicEnv) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*MagicEnv) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*MagicEnv) UnverifiedData ¶
UnverifiedData returns this envelope's message, without checking the signature.
type MagicSig ¶
type MagicSig struct { KeyID string `xml:"key_id,attr" json:"key_id"` Value string `xml:",chardata" json:"value"` }
A MagicSig is a magic signature.
type PublicKeyBackend ¶
type PublicKeyBackend interface { // PublicKey retrieves a public key. PublicKey(accountURI string) (crypto.PublicKey, error) }
PublicKeyBackend represent a Public Key Infrastructure.
func NewPublicKeyBackend ¶
func NewPublicKeyBackend() PublicKeyBackend
NewPublicKeyBackend returns a basic PublicKeyBackend that queries public keys with LRDD.