Documentation
¶
Index ¶
- Constants
- func RandomActivity(withObject, parent vocab.Item) vocab.Item
- func RandomActor(parent vocab.Item) vocab.Item
- func RandomCollection(cnt int) vocab.ItemCollection
- func RandomImage(mimeType vocab.MimeType, parent vocab.Item) vocab.Item
- func RandomLink(attrTo vocab.Item) vocab.Item
- func RandomObject(parent vocab.Item) vocab.Item
- func RandomTag(parent vocab.Item) vocab.Item
- func RunActivityPubTests(t *testing.T, storage ActivityPubStorage)
- func RunKeyTests(t *testing.T, storage ActivityPubStorage)
- func RunMetadataTests(t *testing.T, storage ActivityPubStorage)
- func RunOAuthTests(t *testing.T, storage ActivityPubStorage)
- func RunPasswordTests(t *testing.T, storage ActivityPubStorage)
- type ActivityPubStorage
- type ClientLister
- type ClientSaver
- type KeyStorage
- type MetadataStorage
- type NilCloser
- type OSINStorage
- type Opener
- type PassAndKeyMetadata
- type PasswordStorage
- type TestType
Constants ¶
View Source
const ( TestActivityPub = 1 TestKey = 1 << iota TestPassword TestMetadata TestOAuth TestNone = 0 TestsFull = TestActivityPub | TestKey | TestPassword | TestMetadata | TestOAuth )
Variables ¶
This section is empty.
Functions ¶
func RandomCollection ¶
func RandomCollection(cnt int) vocab.ItemCollection
func RunActivityPubTests ¶
func RunActivityPubTests(t *testing.T, storage ActivityPubStorage)
func RunKeyTests ¶
func RunKeyTests(t *testing.T, storage ActivityPubStorage)
func RunMetadataTests ¶
func RunMetadataTests(t *testing.T, storage ActivityPubStorage)
func RunOAuthTests ¶
func RunOAuthTests(t *testing.T, storage ActivityPubStorage)
func RunPasswordTests ¶
func RunPasswordTests(t *testing.T, storage ActivityPubStorage)
Types ¶
type ActivityPubStorage ¶
type ActivityPubStorage interface {
// Save saves te [vocab.Item] to storage.
// To conform to what the GoActivityPub library expects out of it, there are a couple of hidden behaviours:
// * When saving a [vocab.Object] compatible type the backend *MUST* create all the object's collections
// that have IRIs set. These collections are in [vocab.OfObject].
// Eg: For
//
// vocab.Object{
// Likes: "https://example.com/objects/1/likes",
// Replies:"https://example.com/objects/1/replies",
// Shares: nil
// }
//
// We create the collections https://example.com/objects/1/likes, and https://example.com/objects/1/replies.
// * When saving a [vocab.Actor] compatible type the backend *MUST* create all the actor's collections that
// have IRIs set. These collections are in [vocab.OfActor].
// Eg: For
//
// vocab.Actor{
// Inbox:"https://example.com/~jdoe/inbox",
// Outbox: "https://example.com/~jdoe/outbox",
// Followers: "https://example.com/~jdoe/followers",
// Following: nil
// }
//
// We create the collections https://example.com/~jdoe/inbox, https://example.com/~jdoe/outbox and
// "https://example.com/~jdoe/followers".
Save(it vocab.Item) (vocab.Item, error)
// Load loads the item found at the "iri" [vocab.IRI].
// If iri points to a collection, the filters "f" get applied to the items of the collection.
// An implicit assumption made by filters is that when the list contains checks for one level deep properties,
// the storage backend loads those properties and replaces them into the original.
// For example if filtering in an activities collection with a check that the Actor should have a preferred username
// of "janeDoe", the actors of the activities need to be loaded and the check applied on them.
// So when the object loaded is flattened to something like this:
//
// vocab.Activity {
// Actor: "https://example.com/~jdoe" ...
// }
//
// the actor gets dereferenced to:
//
// vocab.Activity{
// Actor: vocab.Actor{
// ID: "https://example.com/~jdoe",
// preferredUsername: "janeDoe" ...
// }
// }
//
// which then can be filtered with the "preferredUsername" check.
// The filters can also contain pagination checks, and when those get applied (see the github.com/go-ap/filtering package)
// the result can be different from the actual persisted value.
// The [filters.Checks.Paginate] method should handle most cases, so it should be enough to call it just before
// returning, similarly to how the local "memStorage" type does.
Load(iri vocab.IRI, ff ...filters.Check) (vocab.Item, error)
Delete(it vocab.Item) error
// Create
// NOTE(marius): should we remove this in favour of custom logic for Save()?
Create(col vocab.CollectionInterface) (vocab.CollectionInterface, error)
// AddTo adds items to the collection.
// Similarly to Save(), this method needs to implement some hidden behaviour in order to conform to the expectations
// of the rest of GoActivityPub library when executing logic for the blocking and ignoring ActivityPub operations.
// In summary, when adding items to the "blocked" or "ignored" collections of a [vocab.Actor]
// they need to be created if missing.
// These two collections are called "hidden" because they do not appear as properties on the Actor,
// so the only way to build their IDs is to append the paths "/blocked" and "/ignored" the Actor's ID.
AddTo(colIRI vocab.IRI, items ...vocab.Item) error
RemoveFrom(colIRI vocab.IRI, items ...vocab.Item) error
}
type ClientLister ¶
type ClientSaver ¶
type KeyStorage ¶
type MetadataStorage ¶
type OSINStorage ¶
type OSINStorage interface {
Clone() osin.Storage
Close()
GetClient(id string) (osin.Client, error)
SaveAuthorize(*osin.AuthorizeData) error
LoadAuthorize(code string) (*osin.AuthorizeData, error)
RemoveAuthorize(code string) error
SaveAccess(*osin.AccessData) error
LoadAccess(token string) (*osin.AccessData, error)
RemoveAccess(token string) error
LoadRefresh(token string) (*osin.AccessData, error)
RemoveRefresh(token string) error
}
OSINStorage is a verbatim copy of the osin.Storage interface We use this method instead of aliasing it, so it's more obvious what needs to be implemented.
type PassAndKeyMetadata ¶
type PassAndKeyMetadata struct {
Pw string `json:"pw"`
Key crypto.PrivateKey `json:"key"`
}
func (PassAndKeyMetadata) MarshalJSON ¶
func (p PassAndKeyMetadata) MarshalJSON() ([]byte, error)
func (*PassAndKeyMetadata) UnmarshalJSON ¶
func (p *PassAndKeyMetadata) UnmarshalJSON(raw []byte) error
type PasswordStorage ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
names
Package names is copy/pasted from docker's code source The original can be found in package: "github.com/docker/docker/pkg/namesgenerator"
|
Package names is copy/pasted from docker's code source The original can be found in package: "github.com/docker/docker/pkg/namesgenerator" |
Click to show internal directories.
Click to hide internal directories.