oni

package module
v0.0.0-...-1c4205e Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 71 Imported by: 0

README

Oni

Is a single user ActivityPub server compatible with the Fediverse.

It is part of the tools built for and with the help with of the GoActivityPub library.

ONI main page after fresh install

Getting the source

$ git clone https://git.sr.ht/~mariusor/oni
$ cd oni
Container images

Another option for running ONI is to use the pre-built images. More details about that can be found here.

Features

Posting to an ONI instance is done using Client to Server ActivityPub. Currently, the client that supports most features is BOX.

The application supports text posts, image, audio and short video uploads.

Compiling

# We need to download the JavaScript dependencies, using yarn or npm:
# yarn install
# npm install
# Also, while we are in heavy development, we do have the 'go.sum' module checksum file in the repository,
# so we need to created it:
$ go mod tidy
# As a last step we need to bundle the static assets, for which we use go:generate with the 'esbuilder' API:
$ go generate assets.go
# We now can build the ONI binary:
$ go build -trimpath -a -ldflags '-s -w -extldflags "-static"' -o $(go env GOPATH)/bin/oni ./cmd/oni/main.go
# All of these steps have been grouped together with Make:
$ make all

Run server

# --listen can be a tcp socket, a domain socket, or the magic string "systemd"
# The later should be used if running as a systemd service with socket activation
$ oni --listen 127.0.4.2:4567 --path ~/.cache/oni
Running a server in a production environment

The development builds of ONI are not compatible with Mastodon, as the HTTP-Signatures generated are meant to be replayble from other contexts, which in production environments should be avoided.

Therefore, if you want to run an ONI instance as part of the wider fediverse you must make sure that it was built by passing either -tags prod or -tags qa to the build command.

Add root actor

# Creates an actor for URL https://johndoe.example.com and adds an OAuth2 client application with name 'johndoe.example.com'
# with OAuth2 client password 'SuperSecretOAuth2ClientPassword'. 
# The --with-token boolean flag can make the application generate an Authorization header containing a Bearer token 
# usable directly in an ActivityPub client.
$ oni actor add --pw SuperSecretOAuth2ClientPassword https://johndoe.example.com
# with box

Block remote instances

# Blocks all access to all johndoe.example.com pages for any access that has requests with Authorization 
# headers generated for actors hosted on naughty.social
$ oni block --client https://johndoe.example.com https://naughty.social

Interacting with ONI instances using BOX cli helper

Documentation

Further reading on how to use ONI can be found on the wiki.

The wiki also contains more examples than the ones detailed here about how to use BOX for managing an ONI instance.

Authorization
$ box authorize --as https://johndoe.example.com --secret SuperSecretOAuth2ClientPassword 
Post a Note
# Here --iri, --name and --content are optional
# --iri gets generated by the server if missing
# If --name and --content are empty $EDITOR is opened and they get extracted from the result
# if the content contains two empty lines, the --name is the text that precedes them, 
# and the --content the text after
$ box post --as https://johndoe.example.com --iri https://johndoe.example.com/posts/first \
--name "First Post" --content "Hello Fediverse⁂!"

First post

Upload an image
$ box upload --as https://johndoe.example.com --iri https://johndoe.example.com/uploads/funny \
--name "Funny image" --summary "This is a short description." --path SOME/PATH/funny.jpg
Blocking an Actor/Instance
$ box block --as https://johndoe.example.com --reason "Naughty, naughty!" https://naughty.social

Contact and feedback

If you have problems, questions, ideas or suggestions, please contact us by posting to the discussions mailing list, or on GitHub. For quicker feedback the mailing list is preferred, as the GitHub issues are not checked very often.

Documentation

Index

Constants

View Source
const (
	// DefaultOniAppRedirectURL is the default redirect URL used by the OAuth2 mechanism in the
	// Flutter ONI Application: https://git.sr.ht/~mariusor/oni-app
	// It makes use of the custom URI scheme 'org.oni.app://'
	DefaultOniAppRedirectURL = "org.oni.app://oauth2redirect"
	// DefaultBOXAppRedirectURL is the default redirect URL used by the OAuth2 mechanisms based on the
	// GoActivityPub client library. We're using the http://127.0.0.1 explicitly to allow for wildcard ports
	// from the client side. See: https://www.rfc-editor.org/rfc/rfc8252#section-7.3
	DefaultBOXAppRedirectURL = "http://127.0.0.1"
)

ID is the type of authorization that IndieAuth is using

View Source
const IsDev = true
View Source
const MaxItems = 20
View Source
const NodeInfoDiscoverPath = "/.well-known/nodeinfo"
View Source
const NodeInfoPath = "/nodeinfo"

Variables

View Source
var (
	DefaultAuthorizeTypes = osin.AllowedAuthorizeType{osin.CODE, osin.TOKEN, ID}
	DefaultAccessTypes    = osin.AllowedAccessType{osin.AUTHORIZATION_CODE, osin.REFRESH_TOKEN, osin.PASSWORD, osin.CLIENT_CREDENTIALS}

	DefaultConfig = osin.ServerConfig{
		AuthorizationExpiration:     86400,
		AccessExpiration:            2678400,
		TokenType:                   "Bearer",
		AllowedAuthorizeTypes:       DefaultAuthorizeTypes,
		AllowedAccessTypes:          DefaultAccessTypes,
		ErrorStatusCode:             http.StatusForbidden,
		AllowClientSecretInParams:   false,
		AllowGetAccessRequest:       false,
		RetainTokenAfterRefresh:     true,
		RedirectUriSeparator:        "\n",
		RequirePKCEForPublicClients: true,
	}
)
View Source
var (
	AppName    = "oni"
	Version    = "HEAD"
	ProjectURL = "https://git.sr.ht/~mariusor/oni"
	DefaultURL = "https://oni.local"
)
View Source
var AssetsFS embed.FS
View Source
var CLI struct {
	SSH
	Path    string `` /* 132-byte string literal not displayed */
	Verbose int    `name:"verbose" short:"v" default:"0" type:"counter" help:"Increase verbosity of the log output" `

	Run Run `cmd:"" help:"Run the ${name} instance server (version: ${version})" default:"withargs"`
}
View Source
var DefaultOAuth2ClientPw = rand.Text()

DefaultOAuth2ClientPw is the default password used by the main actor

View Source
var ExtraRedirectURL = ""
View Source
var InDebugMode = atomic.Bool{}
View Source
var InMaintenanceMode = atomic.Bool{}
View Source
var TemplateFS embed.FS
View Source
var TimeNow = func() time.Time { return time.Now().Truncate(time.Millisecond).UTC() }

Functions

func Actor

func Actor(a ...vocab.Actor) optionFn

func AddKeyToItem

func AddKeyToItem(metaSaver MetadataStorage, it vocab.Item, typ string) error

func AddKeyToPerson

func AddKeyToPerson(metaSaver MetadataStorage, typ string) func(act *vocab.Actor) error

func AllTrue

func AllTrue(fns ...func(vocab.Item) bool) func(vocab.Item) bool

func AnyTrue

func AnyTrue(fns ...func(vocab.Item) bool) func(actor vocab.Item) bool

func AuthorizeURL

func AuthorizeURL(actor vocab.Actor, state string) string

func CheckItemID

func CheckItemID(url vocab.IRI) func(vocab.Item) bool

func CheckItemName

func CheckItemName(name string) func(vocab.Item) bool

func CheckItemURL

func CheckItemURL(url vocab.IRI) func(vocab.Item) bool

func Client

func Client(tr http.RoundTripper) *http.Client

func CollectionExists

func CollectionExists(ob vocab.Item, col vocab.CollectionPath) bool

func CreateBlankActor

func CreateBlankActor(o *oni, id vocab.IRI) vocab.Actor

func CreateOAuthClient

func CreateOAuthClient(st storage.FullStorage, clientActor *vocab.Actor, redirect []string, pw, userData []byte) (osin.Client, error)

func DefaultActor

func DefaultActor(iri vocab.IRI) vocab.Actor

func DefaultValue

func DefaultValue(name string) vocab.NaturalLanguageValues

func GenerateID

func GenerateID(it vocab.Item, by vocab.Item) (vocab.ID, error)

func GenerateRSAKeyPair

func GenerateRSAKeyPair() (pem.Block, pem.Block)

func GeneratedClientActor

func GeneratedClientActor(author vocab.Item, clientRequest *ClientMetadata) *vocab.Actor

func HandleHostMeta

func HandleHostMeta(o *oni) func(w http.ResponseWriter, r *http.Request)

HandleHostMeta serves /.well-known/host-meta

func HandleNodeInfo

func HandleNodeInfo(o *oni) func(w http.ResponseWriter, r *http.Request)

HandleNodeInfo handles "/nodeinfo"

func HandleNodeInfoDiscover

func HandleNodeInfoDiscover(o *oni) func(w http.ResponseWriter, r *http.Request)

HandleNodeInfoDiscover handles "/.well-known/nodeinfo"

func HandleOAuthClientRegistration

func HandleOAuthClientRegistration(o *oni) func(w http.ResponseWriter, r *http.Request)

func HandleOauthAuthorizationServer

func HandleOauthAuthorizationServer(o *oni) func(w http.ResponseWriter, r *http.Request)

func HandleStaticAssets

func HandleStaticAssets(s fs.FS, errFn func(error) http.HandlerFunc) http.HandlerFunc

func HandleWebFinger

func HandleWebFinger(o *oni) func(w http.ResponseWriter, r *http.Request)

HandleWebFinger serves /.well-known/webfinger/

func IRIHost

func IRIHost(iri vocab.IRI) (string, bool)

func IRIPath

func IRIPath(iri vocab.IRI) (string, bool)

func IconOf

func IconOf(it vocab.Item) string

func IsValidAuthorizationRequest

func IsValidAuthorizationRequest(r *http.Request) bool

func ListenOn

func ListenOn(listen string) optionFn

func LoadActor

func LoadActor(items ...vocab.Item) optionFn

func LoadClientActorByID

func LoadClientActorByID(repo storage.FullStorage, app vocab.Actor, clientID vocab.IRI) (*vocab.Actor, error)

func LoadIRI

func LoadIRI(db processing.ReadStore, what vocab.IRI, checkFns ...func(vocab.Item) bool) (vocab.Item, error)

func Log

func Log(l lw.Logger) func(next http.Handler) http.Handler

func MkDirIfNotExists

func MkDirIfNotExists(p string) (err error, exists bool)

func NodeInfoConfig

func NodeInfoConfig(app vocab.Actor, ni WebInfo) nodeinfo.Config

func Oni

func Oni(initFns ...optionFn) *oni

func ParseStorageDSN

func ParseStorageDSN(s string) (storage.Type, string)

func PublicKey

func PublicKey(iri vocab.IRI, prvKey *rsa.PrivateKey) vocab.PublicKey

func SetPreferredUsername

func SetPreferredUsername(i vocab.Item, name vocab.NaturalLanguageValues) error

func ValueMatchesLangRefs

func ValueMatchesLangRefs(val vocab.Content, toCheck ...vocab.NaturalLanguageValues) bool

func WithLogger

func WithLogger(l lw.Logger) optionFn

func WithPassword

func WithPassword(pw string) optionFn

func WithStorage

func WithStorage(st storage.FullStorage, path string) optionFn

Types

type ActorCmd

type ActorCmd struct {
	Add            AddActor       `cmd:"" description:"Add a new root actor"`
	Move           Move           `cmd:"" description:"Move an existing actor to a new URL"`
	FixCollections FixCollections `cmd:"" description:"Fix a root actor's collections"`
	RotateKey      RotateKey      `cmd:"" description:"Rotate the public/private key pair for an actor"`
	ChangePassword ChangePassword `cmd:"" description:"Change the password for the actor"`
}

type Add

type Add struct {
	For string `required:"" description:"Which ONI root actor to create the authorization token for."`
}

func (Add) Run

func (a Add) Run(c *Control) error

type AddActor

type AddActor struct {
	URL       string `description:"The URL for the new actor."`
	Pw        string `default:"${default_pw}" description:"The password for the new actor."`
	WithToken bool   `negatable:"without-token" description:"Create an OAuth2 token that can be used immediately."`
}

func (AddActor) Run

func (a AddActor) Run(ctl *Control) error

type Block

type Block struct {
	For string   `description:"Which root actor to block for."`
	URL []string `arg:"" description:"The URL of the instances or actors we want to block."`
}

func (Block) Run

func (b Block) Run(ctl *Control) error

type ChangePassword

type ChangePassword struct {
	IRI vocab.IRI `arg:"" optional:"" name:"for" help:"The actor IRI to change the password for."`
}

func (ChangePassword) Run

func (c ChangePassword) Run(ctl *Control) error

type ClientMetadata

type ClientMetadata struct {
	// TODO(marius): look into how this struct is different from
	//   https://pkg.go.dev/github.com/go-ap/webfinger#OAuthAuthorizationMetadata
	ClientID string `json:"client_id"`
	IssuedAt int64  `json:"client_id_issued_at"`
	ClientRegistrationRequest
}

func (*ClientMetadata) UnmarshalJSON

func (c *ClientMetadata) UnmarshalJSON(data []byte) error

type ClientRegistrationRequest

type ClientRegistrationRequest struct {
	// RedirectUris Array of redirection URI strings for use in redirect-based flows
	// such as the authorization code and implicit flows.  As required by
	// Section 2 of OAuth 2.0 [RFC6749], clients using flows with
	// redirection MUST register their redirection URI values.
	// Authorization servers that support dynamic registration for
	// redirect-based flows MUST implement support for this metadata
	// value.
	RedirectUris []string `json:"redirect_uris"`

	// ClientName
	// Human-readable string name of the client to be presented to the
	// end-user during authorization.  If omitted, the authorization
	// server MAY display the raw "client_id" value to the end-user
	// instead.  It is RECOMMENDED that clients always send this field.
	// The value of this field MAY be internationalized, as described in
	// Section 2.2.
	ClientName string `json:"client_name"`

	// TokenEndpointAuthMethod
	// String indicator of the requested authentication method for the
	// token endpoint.  Values defined by this specification are:
	// *  "none": The client is a public client as defined in OAuth 2.0,
	//    Section 2.1, and does not have a client secret.
	// *  "client_secret_post": The client uses the HTTP POST parameters
	//    as defined in OAuth 2.0, Section 2.3.1.
	// *  "client_secret_basic": The client uses HTTP Basic as defined in
	//    OAuth 2.0, Section 2.3.1.
	// Additional values can be defined via the IANA "OAuth Token
	// Endpoint Authentication Methods" registry established in
	// Section 4.2.  Absolute URIs can also be used as values for this
	// parameter without being registered.  If unspecified or omitted,
	// the default is "client_secret_basic", denoting the HTTP Basic
	// authentication scheme as specified in Section 2.3.1 of OAuth 2.0.
	TokenEndpointAuthMethod string `json:"token_endpoint_auth_method"`

	// GrantTypes
	// Array of OAuth 2.0 grant type strings that the client can use at
	// the token endpoint.  These grant types are defined as follows:
	// *  "authorization_code": The authorization code grant type defined
	//    in OAuth 2.0, Section 4.1.
	// *  "implicit": The implicit grant type defined in OAuth 2.0,
	//    Section 4.2.
	// *  "password": The resource owner password credentials grant type
	//    defined in OAuth 2.0, Section 4.3.
	// *  "client_credentials": The client credentials grant type defined
	//    in OAuth 2.0, Section 4.4.
	// *  "refresh_token": The refresh token grant type defined in OAuth
	//    2.0, Section 6.
	// *  "urn:ietf:params:oauth:grant-type:jwt-bearer": The JWT Bearer
	//    Token Grant Type defined in OAuth JWT Bearer Token Profiles
	//    [RFC7523].
	// *  "urn:ietf:params:oauth:grant-type:saml2-bearer": The SAML 2.0
	//    Bearer Assertion Grant defined in OAuth SAML 2 Bearer Token
	//    Profiles [RFC7522].
	// If the token endpoint is used in the grant type, the value of this
	// parameter MUST be the same as the value of the "grant_type"
	// parameter passed to the token endpoint defined in the grant type
	// definition.  Authorization servers MAY allow for other values as
	// defined in the grant type extension process described in OAuth
	// 2.0, Section 4.5.  If omitted, the default behavior is that the
	// client will use only the "authorization_code" Grant Type.
	GrantTypes []string `json:"grant_types"`

	// ResponseTypes
	// Array of the OAuth 2.0 response type strings that the client can
	// use at the authorization endpoint.  These response types are
	// defined as follows:
	// *  "code": The authorization code response type defined in OAuth
	//    2.0, Section 4.1.
	// *  "token": The implicit response type defined in OAuth 2.0,
	//    Section 4.2.
	//  If the authorization endpoint is used by the grant type, the value
	// of this parameter MUST be the same as the value of the
	// "response_type" parameter passed to the authorization endpoint
	// defined in the grant type definition.  Authorization servers MAY
	// allow for other values as defined in the grant type extension
	// process is described in OAuth 2.0, Section 4.5.  If omitted, the
	// default is that the client will use only the "code" response type.
	ResponseTypes []string `json:"response_types,omitempty"`

	// ClientURI
	// URL string of a web page providing information about the client.
	// If present, the server SHOULD display this URL to the end-user in
	// a clickable fashion.  It is RECOMMENDED that clients always send
	// this field.  The value of this field MUST point to a valid web
	// page.  The value of this field MAY be internationalized, as
	// described in Section 2.2.
	ClientURI string `json:"client_uri,omitempty"`

	// LogoURI
	// URL string that references a logo for the client.  If present, the
	// server SHOULD display this image to the end-user during approval.
	// The value of this field MUST point to a valid image file.  The
	// value of this field MAY be internationalized, as described in
	// Section 2.2.
	LogoURI string `json:"logo_uri,omitempty"`

	// Scope
	// String containing a space-separated list of scope values (as
	// described in Section 3.3 of OAuth 2.0 [RFC6749]) that the client
	// can use when requesting access tokens.  The semantics of values in
	// this list are service specific.  If omitted, an authorization
	// server MAY register a client with a default set of scopes.
	Scope string `json:"scope,omitempty"`

	// Contacts
	// Array of strings representing ways to contact people responsible
	// for this client, typically email addresses.  The authorization
	// server MAY make these contact addresses available to end-users for
	// support requests for the client.  See Section 6 for information on
	// Privacy Considerations.
	Contacts []string `json:"contacts,omitempty"`

	// TosURI
	// URL string that points to a human-readable terms of service
	// document for the client that describes a contractual relationship
	// between the end-user and the client that the end-user accepts when
	// authorizing the client.  The authorization server SHOULD display
	// this URL to the end-user if it is provided.  The value of this
	// field MUST point to a valid web page.  The value of this field MAY
	// be internationalized, as described in Section 2.2.
	TosURI string `json:"tos_uri,omitempty"`

	// PolicyURI
	// URL string that points to a human-readable privacy policy document
	// that describes how the deployment organization collects, uses,
	// retains, and discloses personal data.  The authorization server
	// SHOULD display this URL to the end-user if it is provided.  The
	// value of this field MUST point to a valid web page.  The value of
	// this field MAY be internationalized, as described in Section 2.2.
	PolicyURI string `json:"policy_uri,omitempty"`

	// JwksURI
	// URL string referencing the client's JSON Web Key (JWK) Set
	// [RFC7517] document, which contains the client's public keys.  The
	// value of this field MUST point to a valid JWK Set document.  These
	// keys can be used by higher-level protocols that use signing or
	// encryption.  For instance, these keys might be used by some
	// applications for validating signed requests made to the token
	// endpoint when using JWTs for client authentication [RFC7523].  Use
	// of this parameter is preferred over the "jwks" parameter, as it
	// allows for easier key rotation.  The "jwks_uri" and "jwks"
	// parameters MUST NOT both be present in the same request or
	// response.
	JwksURI string `json:"jwks_uri,omitempty"`

	// Jwks
	// Client's JSON Web Key Set [RFC7517] document value, which contains
	// the client's public keys.  The value of this field MUST be a JSON
	// object containing a valid JWK Set.  These keys can be used by
	// higher-level protocols that use signing or encryption.  This
	// parameter is intended to be used by clients that cannot use the
	// "jwks_uri" parameter, such as native clients that cannot host
	// public URLs.  The "jwks_uri" and "jwks" parameters MUST NOT both
	// be present in the same request or response.
	Jwks json.RawMessage `json:"jwks,omitempty"`

	// SoftwareID
	// A unique identifier string (e.g., a Universally Unique Identifier
	// (UUID)) assigned by the client developer or software publisher
	// used by registration endpoints to identify the client software to
	// be dynamically registered.  Unlike "client_id", which is issued by
	// the authorization server and SHOULD vary between instances, the
	// "software_id" SHOULD remain the same for all instances of the
	// client software.  The "software_id" SHOULD remain the same across
	SoftwareID *uuid.UUID `json:"software_id,omitempty"`
}

func (*ClientRegistrationRequest) UnmarshalJSON

func (c *ClientRegistrationRequest) UnmarshalJSON(data []byte) error

type ClientRegistrationResponse

type ClientRegistrationResponse struct {
	// ClientID REQUIRED. OAuth 2.0 client identifier string.  It SHOULD NOT be
	// currently valid for any other registered client, though an
	// authorization server MAY issue the same client identifier to
	// multiple instances of a registered client at its discretion.
	ClientID string `json:"client_id"`

	// ClientSecret
	// OPTIONAL.  OAuth 2.0 client secret string.  If issued, this MUST
	// be unique for each "client_id" and SHOULD be unique for multiple
	// instances of a client using the same "client_id".  This value is
	// used by confidential clients to authenticate to the token
	// endpoint, as described in OAuth 2.0 [RFC6749], Section 2.3.1.
	ClientSecret string `json:"client_secret"`

	// IssuedAt OPTIONAL.  Time at which the client identifier was issued.  The
	// time is represented as the number of seconds from
	// 1970-01-01T00:00:00Z as measured in UTC until the date/time of
	// issuance.
	IssuedAt int64 `json:"client_id_issued_at"`

	// Expires REQUIRED if "client_secret" is issued.  Time at which the client
	// secret will expire or 0 if it will not expire.  The time is
	// represented as the number of seconds from 1970-01-01T00:00:00Z as
	// measured in UTC until the date/time of expiration.
	Expires int64 `json:"client_secret_expires_at"`
}

type Control

type Control struct {
	Storage storage.FullStorage
	Logger  lw.Logger

	StoragePath string
	// contains filtered or unexported fields
}

func SetupCtl

func SetupCtl(storagePath string, ll lw.Logger, typ storage.Type) (*Control, error)

func (*Control) AddActorWithPassword

func (c *Control) AddActorWithPassword(p *vocab.Person, pw []byte, author vocab.Actor) (*vocab.Person, error)

func (*Control) Client

func (c *Control) Client(actor vocab.Actor, lctx lw.Ctx) *client.C

func (*Control) Close

func (c *Control) Close()

func (*Control) CreateActor

func (c *Control) CreateActor(iri vocab.IRI, pw string) (*vocab.Actor, error)

func (*Control) CreateOAuth2ClientAlways

func (c *Control) CreateOAuth2ClientAlways(i vocab.IRI, pw string) error

func (*Control) GenAccessToken

func (c *Control) GenAccessToken(clientID, actorIdentifier string, dat interface{}) (string, error)

func (*Control) GenKeyPair

func (c *Control) GenKeyPair(actor *vocab.Actor) (*vocab.Actor, error)

func (*Control) IRIHasLocalParent

func (c *Control) IRIHasLocalParent() func(i vocab.IRI) bool

func (*Control) Open

func (c *Control) Open() error

func (*Control) SendSignal

func (c *Control) SendSignal(sig syscall.Signal) error

func (*Control) UpdateActorKey

func (c *Control) UpdateActorKey(actor *vocab.Actor) (*vocab.Actor, error)

type Debug

type Debug struct{}

func (Debug) Run

func (d Debug) Run(ctl *Control) error

type FixCollections

type FixCollections struct {
	For []string `arg:"" description:"The root actors we want to run the operation for."`
}

func (FixCollections) Run

func (f FixCollections) Run(ctl *Control) error

type Maintenance

type Maintenance struct{}

func (Maintenance) Run

func (m Maintenance) Run(ctl *Control) error

type Metadata

type Metadata struct {
	Pw         []byte `jsonld:"pw,omitempty"`
	PrivateKey []byte `jsonld:"key,omitempty"`
}

type MetadataStorage

type MetadataStorage interface {
	LoadMetadata(vocab.IRI, any) error
	SaveMetadata(vocab.IRI, any) error
}

type Move

type Move struct {
	FromURL string `arg:""`
	ToURL   string `arg:""`
}

func (Move) Run

func (m Move) Run(ctl *Control) error

type NodeInfoResolver

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

func NodeInfoResolverNew

func NodeInfoResolverNew(r storage.ReadStore, app vocab.Actor) NodeInfoResolver

func (NodeInfoResolver) IsOpenRegistration

func (n NodeInfoResolver) IsOpenRegistration() (bool, error)

func (NodeInfoResolver) Usage

func (n NodeInfoResolver) Usage() (nodeinfo.Usage, error)

type OAuth2

type OAuth2 struct {
	Token Token `cmd:"" name:"token" description:"OAuth2 authorization token management"`
}

type OauthAuthorizationMetadata

type OauthAuthorizationMetadata struct {
	Issuer                                     string                   `json:"issuer"`
	AuthorizationEndpoint                      string                   `json:"authorization_endpoint"`
	TokenEndpoint                              string                   `json:"token_endpoint"`
	TokenEndpointAuthMethodsSupported          []string                 `json:"token_endpoint_auth_methods_supported,omitempty"`
	TokenEndpointAuthSigningAlgValuesSupported []string                 `json:"token_endpoint_auth_signing_alg_values_supported,omitempty"`
	RegistrationEndpoint                       string                   `json:"registration_endpoint"`
	GrantTypesSupported                        []osin.AccessRequestType `json:"grant_types_supported,omitempty"`
	ScopesSupported                            []string                 `json:"scopes_supported,omitempty"`
	ResponseTypesSupported                     []string                 `json:"response_types_supported,omitempty"`
}

OauthAuthorizationMetadata is the metadata returned by RFC8414 well known oauth-authorization-server end-point

https://datatracker.ietf.org/doc/html/rfc8414#section-3.2

type Reload

type Reload struct{}

func (Reload) Run

func (m Reload) Run(ctl *Control) error

type RotateKey

type RotateKey struct {
	URL []string `arg:""`
}

func (RotateKey) Run

func (r RotateKey) Run(ctl *Control) error

type Run

type Run struct {
	Listen string `default:"127.0.0.1:60123" short:"l" help:"Listen socket"`
	URL    string `default:"${default_url}" help:"Default URL for the instance actor"`
	Pw     string `default:"${default_pw}" help:"Default password to use for the instance actor"`
}

func (Run) Run

func (s Run) Run(ctl *Control) error

type SSH

type SSH struct {
	OAuth2      OAuth2      `cmd:"" name:"oauth" description:"OAuth2 client and access token helper"`
	Actor       ActorCmd    `cmd:"" description:"Actor helper"`
	Block       Block       `cmd:"" description:"Block instances or actors"`
	Debug       Debug       `cmd:"" help:"Toggle debug mode for the running ${name} server."`
	Maintenance Maintenance `cmd:"" help:"Toggle maintenance mode for the running ${name} server."`
	Reload      Reload      `cmd:"" help:"Reload the running ${name} server configuration"`
	Stop        Stop        `cmd:"" help:"Stops the running ${name} server configuration"`
}

type Stop

type Stop struct{}

func (Stop) Run

func (m Stop) Run(ctl *Control) error

type Token

type Token struct {
	Add Add `cmd:"" description:"Adds an OAuth2 authorization token" alias:"new"`
}

type WebInfo

type WebInfo struct {
	Title       string   `json:"title"`
	Email       string   `json:"email"`
	Summary     string   `json:"summary"`
	Description string   `json:"description"`
	Thumbnail   string   `json:"thumbnail,omitempty"`
	Languages   []string `json:"languages"`
	URI         string   `json:"uri"`
	Urls        []string `json:"urls,omitempty"`
	Version     string   `json:"version"`
}

Directories

Path Synopsis
cmd
oni command
internal
esbuild command
xdg

Jump to

Keyboard shortcuts

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