Documentation
¶
Index ¶
- func IsSWANCookie(c *http.Cookie) bool
- type Base
- type Bid
- type ByteArray
- type Client
- type Connection
- func (c *Connection) CreateRID() (*Identifier, *Error)
- func (c *Connection) Decrypt(encrypted string) ([]*Pair, *Error)
- func (c *Connection) DecryptRaw(encrypted string) (map[string]interface{}, *Error)
- func (c *Connection) HomeNode(r *http.Request) (string, *Error)
- func (c *Connection) NewClient(request *http.Request) *Client
- func (c *Connection) NewDecrypt(encrypted string) *Decrypt
- func (c *Connection) NewFetch(request *http.Request, returnUrl string, existing []*Pair) *Fetch
- func (c *Connection) NewSWAN() *SWAN
- func (c *Connection) NewStop(request *http.Request, returnUrl string, host string) *Stop
- func (c *Connection) NewUpdate(request *http.Request, returnUrl string) *Update
- type Decrypt
- type Email
- type Empty
- type Error
- type Failed
- type Fetch
- type Field
- type Identifier
- type Operation
- type Pair
- type Preferences
- type PreferencesData
- type Response
- type SWAN
- type Salt
- type Seed
- type Stop
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSWANCookie ¶
IsSWANCookie returns true if a SWAN cookie.
Types ¶
type Base ¶ added in v0.1.5
type Base struct {
Version byte `json:"version"` // Used to indicate the version encoding of the type.
OWID *owid.OWID `json:"source"` // OWID related to the structure
}
Base used with any SWAN field.
type Bid ¶
type Bid struct {
Response
MediaURL string `json:"mediaUrl"` // The URL of the content of the advert provided in response
AdvertiserURL string `json:"advertiserURL"` // The URL to direct the browser to if the advert is selected
}
Bid contains the information about the advert to be displayed.
func BidFromBase64 ¶ added in v0.1.5
func BidFromJson ¶ added in v0.1.5
func (*Bid) MarshalBinary ¶ added in v0.1.5
func (*Bid) MarshalOwid ¶ added in v0.1.5
func (*Bid) UnmarshalBinary ¶ added in v0.1.5
type ByteArray ¶ added in v0.1.5
ByteArray used for general purpose data storage.
func ByteArrayFromBase64 ¶ added in v0.1.5
func ByteArrayFromJson ¶ added in v0.1.5
func NewByteArray ¶ added in v0.1.5
func NewSID ¶ added in v0.1.8
NewSID generates the SID by hashing the salt and the email to create a sha256 hash. If the email address is empty an empty byte array is returned.
func (*ByteArray) FromBase64 ¶ added in v0.1.9
func (*ByteArray) MarshalBinary ¶ added in v0.1.5
func (*ByteArray) MarshalOwid ¶ added in v0.1.5
func (*ByteArray) UnmarshalBinary ¶ added in v0.1.5
type Client ¶
Client is used for actions where a request from a web browser is available. It is mainly used to set the home node from the public IP address of the web browser.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection stores the static details that are used when creating a new swan request.
func NewConnection ¶
func NewConnection(operation Operation) *Connection
NewConnection creates a new SWAN connection based on the operation provided.
func (*Connection) CreateRID ¶ added in v0.1.6
func (c *Connection) CreateRID() (*Identifier, *Error)
CreateRID returns a new RID in OWID format from the SWAN Operator. Only SWAN Operators can create legitimate RIDs.
func (*Connection) Decrypt ¶
func (c *Connection) Decrypt(encrypted string) ([]*Pair, *Error)
Decrypt returns SWAN key value pairs for the data contained in the encrypted string.
func (*Connection) DecryptRaw ¶
func (c *Connection) DecryptRaw( encrypted string) (map[string]interface{}, *Error)
DecryptRaw returns key value pairs for the raw SWAN data contained in the encrypted string. Must only be used by User Interface Providers.
func (*Connection) HomeNode ¶
func (c *Connection) HomeNode(r *http.Request) (string, *Error)
HomeNode returns the SWAN home node associated with the web browser.
func (*Connection) NewClient ¶
func (c *Connection) NewClient(request *http.Request) *Client
NewClient creates a new request.
request http request from a web browser
func (*Connection) NewDecrypt ¶
func (c *Connection) NewDecrypt(encrypted string) *Decrypt
NewDecrypt creates a new decrypt request using the default in the connection.
encrypted the base 64 encoded SWAN data to be decrypted
func (*Connection) NewFetch ¶
NewFetch creates a new fetch operation using the default in the connection.
request http request from a web browser
returnUrl return URL after the operation completes
existing if any values already exist then use these if none are available in SWAN
func (*Connection) NewSWAN ¶
func (c *Connection) NewSWAN() *SWAN
NewSWAN creates a new request using the default in the connection.
type Email ¶ added in v0.1.5
Email used to represent an email address.
func EmailFromBase64 ¶ added in v0.1.5
func EmailFromJson ¶ added in v0.1.5
func (*Email) FromBase64 ¶ added in v0.1.9
func (*Email) MarshalBinary ¶ added in v0.1.5
func (*Email) MarshalOwid ¶ added in v0.1.5
func (*Email) UnmarshalBinary ¶ added in v0.1.5
type Empty ¶
type Empty struct {
Response
}
Empty contains nothing. Used for most OWIDs that just sign the root and themselves.
