Add Web Monetization properties

This commit is contained in:
Matt Baer
2025-10-23 14:15:03 -04:00
parent cf9f5db56b
commit 180136e6db
2 changed files with 15 additions and 1 deletions
+7 -1
View File
@@ -11,7 +11,13 @@ const (
toPublic = "https://www.w3.org/ns/activitystreams#Public" toPublic = "https://www.w3.org/ns/activitystreams#Public"
) )
var Extensions = map[string]string{} var (
Extensions = map[string]string{}
apMonetizationContext = map[string]interface{}{
"monetization": "https://interledger.org/ns#monetization",
}
)
// Activity describes actions that have either already occurred, are in the // Activity describes actions that have either already occurred, are in the
// process of occurring, or may occur in the future. // process of occurring, or may occur in the future.
+8
View File
@@ -13,6 +13,9 @@ type Person struct {
Summary string `json:"summary"` Summary string `json:"summary"`
PublicKey PublicKey `json:"publicKey"` PublicKey PublicKey `json:"publicKey"`
Endpoints Endpoints `json:"endpoints"` Endpoints Endpoints `json:"endpoints"`
// Extensions
Monetization string `json:"monetization,omitempty"`
} }
func NewPerson(accountRoot string) *Person { func NewPerson(accountRoot string) *Person {
@@ -49,3 +52,8 @@ func (p *Person) SetPrivKey(k []byte) {
func (p *Person) GetPrivKey() []byte { func (p *Person) GetPrivKey() []byte {
return p.PublicKey.privateKey return p.PublicKey.privateKey
} }
func (p *Person) AddWebMonetization(wallet string) {
p.Context = append(p.Context, apMonetizationContext)
p.Monetization = wallet
}