Documentation
¶
Index ¶
- Constants
- func GeneratePrivateKey() (string, error)
- func PrivateKey(path string) (string, error)
- func TrampolineURL(target string, opts ...func(*urlConfig)) string
- func WithBaseURL(baseURL string) func(*urlConfig)
- func WithParams(params map[string]string) func(*urlConfig)
- type AliasResponse
- type ClaimOptions
- type Client
- func (c *Client) Ack(ids []string) (IDResponse, error)
- func (c *Client) Claim(opts ClaimOptions) (*DeliveryResponse, error)
- func (c *Client) CloudEventsURL() string
- func (c *Client) DiscordURL(appPublicKey string) string
- func (c *Client) InboxURL(opts InboxOptions) string
- func (c *Client) MetaURL(verifyToken string) string
- func (c *Client) Peek(opts PeekOptions) (*DeliveryResponse, error)
- func (c *Client) PingbackURL() string
- func (c *Client) Release(ids []string) (IDResponse, error)
- func (c *Client) SlackURL() string
- func (c *Client) WebmentionURL() string
- func (c *Client) WebsubURL() string
- type Delivery
- type DeliveryResponse
- type Header
- type IDResponse
- type InboxOptions
- type PeekOptions
Constants ¶
const DefaultBaseURL = "https://cc.me/"
DefaultBaseURL is the public cc.me endpoint.
Variables ¶
This section is empty.
Functions ¶
func GeneratePrivateKey ¶
GeneratePrivateKey returns a freshly generated private key: a 32-byte Ed25519 seed encoded as base64url without padding.
func PrivateKey ¶
PrivateKey loads the base64url seed from path, creating it (mode 0600) with a freshly generated key if it does not exist. An existing file is reused and re-secured to 0600. The file contains the base64url seed followed by a newline.
func TrampolineURL ¶
TrampolineURL builds GET {base}/?at={target} plus any extra query params.
func WithBaseURL ¶
func WithBaseURL(baseURL string) func(*urlConfig)
WithBaseURL overrides the base URL for a builder call.
func WithParams ¶
WithParams adds extra query parameters (used by TrampolineURL).
Types ¶
type AliasResponse ¶
type AliasResponse struct {
URL string `json:"url"`
}
AliasResponse is the result of CreateAlias.
func CreateAlias ¶
func CreateAlias(target string, opts ...func(*urlConfig)) (AliasResponse, error)
CreateAlias registers a permanent alias for target: POST {base}/c with {"at": target}. It is idempotent and requires no authentication.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to a cc.me inbox using a private key for owner authentication.
func (*Client) Ack ¶
func (c *Client) Ack(ids []string) (IDResponse, error)
Ack confirms handling of the given delivery ids.
func (*Client) Claim ¶
func (c *Client) Claim(opts ClaimOptions) (*DeliveryResponse, error)
Claim reserves up to Limit deliveries until they are acked or released.
func (*Client) CloudEventsURL ¶
CloudEventsURL returns the cloudevents receiver URL.
func (*Client) DiscordURL ¶
DiscordURL returns the discord receiver URL for the given app public key.
func (*Client) InboxURL ¶
func (c *Client) InboxURL(opts InboxOptions) string
InboxURL returns the inbox URL with optional query parameters.
func (*Client) MetaURL ¶
MetaURL returns the meta receiver URL, appending ?v={verifyToken} when set.
func (*Client) Peek ¶
func (c *Client) Peek(opts PeekOptions) (*DeliveryResponse, error)
Peek fetches deliveries without reserving them.
func (*Client) PingbackURL ¶
PingbackURL returns the pingback receiver URL.
func (*Client) Release ¶
func (c *Client) Release(ids []string) (IDResponse, error)
Release returns the given delivery ids to the queue.
func (*Client) WebmentionURL ¶
WebmentionURL returns the webmention receiver URL.
type Delivery ¶
type Delivery struct {
ID string
ReceivedAtUnixMs int64
Method string
Path string
Query string
Headers []Header
BodyBytes []byte
}
Delivery is a decrypted captured request.
type DeliveryResponse ¶
DeliveryResponse holds the decrypted deliveries from peek/claim.
type Header ¶
Header is a single captured request header. Value is the UTF-8 decoding of ValueBytes; ValueBytes holds the raw bytes.
type IDResponse ¶
type IDResponse struct {
Acked int `json:"acked"`
Released int `json:"released"`
Missing []string `json:"missing"`
}
IDResponse is the result of Ack and Release.
type InboxOptions ¶
type InboxOptions struct {
// Limit, when > 0, sets the `l` query parameter.
Limit int
// Cursor, when non-empty, sets the `c` query parameter.
Cursor string
// Poll, when true, sets the `p` query parameter with an empty value.
Poll bool
}
InboxOptions controls the optional query parameters on an inbox URL.