This repository has been archived on 2022-11-27. You can view files and clone it, but cannot push or open issues or pull requests.
activitypub/object_id.go

21 lines
1,005 B
Go
Raw Normal View History

2019-12-05 15:43:55 +00:00
package activitypub
2022-06-06 11:22:54 +00:00
// ID designates a unique global identifier.
2019-12-05 15:43:55 +00:00
// All Objects in [ActivityStreams] should have unique global identifiers.
// ActivityPub extends this requirement; all objects distributed by the ActivityPub protocol MUST
// have unique global identifiers, unless they are intentionally transient
2022-06-06 11:22:54 +00:00
// (short-lived activities that are not intended to be able to be looked up,
2019-12-05 15:43:55 +00:00
// such as some kinds of chat messages or game notifications).
// These identifiers must fall into one of the following groups:
//
2022-06-06 11:22:54 +00:00
// 1. Publicly de-referenceable URIs, such as HTTPS URIs, with their authority belonging
2019-12-05 15:43:55 +00:00
// to that of their originating server. (Publicly facing content SHOULD use HTTPS URIs).
// 2. An ID explicitly specified as the JSON null object, which implies an anonymous object
// (a part of its parent context)
2020-03-26 18:24:44 +00:00
type ID = IRI
2021-11-12 19:05:08 +00:00
// IsValid returns if the receiver pointer is not nil and if dereferenced it has a positive length.
2019-12-05 18:02:15 +00:00
func (i *ID) IsValid() bool {
2019-12-05 15:43:55 +00:00
return i != nil && len(*i) > 0
}