Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAuthenticationPending = fmt.Errorf("authentication pending")
ErrAuthenticationPending is returned when the authentication process is still pending.
Functions ¶
This section is empty.
Types ¶
type ChannelResponse ¶
type ChannelResponse struct { ChannelToken string `json:"channelToken"` URL string `json:"url"` ConnectUri string `json:"connectUri"` Nonce string `json:"nonce"` }
ChannelResponse holds the response data from creating a new channel.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds the HTTP client used for the requests and the ChannelToken needed for authentication. Implements FIP-11: https://github.com/farcasterxyz/protocol/discussions/110
func (*Client) CheckStatus ¶
func (c *Client) CheckStatus() (*StatusResponse, error)
CheckStatus checks the status of the authentication process. A channel must be created first. If the error message is ErrAuthenticationPending, the client should retry after a few seconds. If the status is "completed", the authentication process is successful and the returned data can be used. Expect only valid responses when the status is "completed".
func (*Client) CreateChannel ¶
func (c *Client) CreateChannel(siweUri string) (*ChannelResponse, error)
CreateChannel initiates the authentication process by creating a new channel. The siweUri is the URI of the SIWE server and the domain is the domain of the application that is requesting authentication. The returned response includes the URL that must be relayed to the user for authentication.
type StatusResponse ¶
type StatusResponse struct { State string `json:"state,omitempty"` Nonce string `json:"nonce,omitempty"` Message string `json:"message,omitempty"` Signature string `json:"signature,omitempty"` Fid uint64 `json:"fid,omitempty"` Username string `json:"username,omitempty"` DisplayName string `json:"displayName,omitempty"` Bio string `json:"bio,omitempty"` PfpUrl string `json:"pfpUrl,omitempty"` Custody string `json:"custody,omitempty"` Verifications []string `json:"verifications,omitempty"` }
StatusResponse holds the response data for checking the channel's status.