From 180136e6db47a71ec6b515f0c3ce78886a2b7b29 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 23 Oct 2025 14:15:03 -0400 Subject: [PATCH] Add Web Monetization properties --- activitystreams/activity.go | 8 +++++++- activitystreams/person.go | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/activitystreams/activity.go b/activitystreams/activity.go index 915ae56..81da084 100644 --- a/activitystreams/activity.go +++ b/activitystreams/activity.go @@ -11,7 +11,13 @@ const ( 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 // process of occurring, or may occur in the future. diff --git a/activitystreams/person.go b/activitystreams/person.go index b878d2c..f359b80 100644 --- a/activitystreams/person.go +++ b/activitystreams/person.go @@ -13,6 +13,9 @@ type Person struct { Summary string `json:"summary"` PublicKey PublicKey `json:"publicKey"` Endpoints Endpoints `json:"endpoints"` + + // Extensions + Monetization string `json:"monetization,omitempty"` } func NewPerson(accountRoot string) *Person { @@ -49,3 +52,8 @@ func (p *Person) SetPrivKey(k []byte) { func (p *Person) GetPrivKey() []byte { return p.PublicKey.privateKey } + +func (p *Person) AddWebMonetization(wallet string) { + p.Context = append(p.Context, apMonetizationContext) + p.Monetization = wallet +}