Skip to content

Commit

Permalink
feat: Support DID as service (actor) ID
Browse files Browse the repository at this point in the history
A service ID may be configured as a DID and the public key (used for HTTP signature verifications) may be configured as a key ID referencing a public key within the service's DID document.

closes #1113

Signed-off-by: Bob Stasyszyn <[email protected]>
  • Loading branch information
bstasyszyn committed Aug 12, 2022
1 parent adb3687 commit 21915b1
Show file tree
Hide file tree
Showing 57 changed files with 2,465 additions and 907 deletions.
16 changes: 15 additions & 1 deletion cmd/orb-server/startcmd/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const (
mqDefaultRedeliveryInitialInterval = 2 * time.Second
mqDefaultRedeliveryMaxInterval = time.Minute
defaultActivityPubClientCacheSize = 100
defaultActivityPubClientCacheExpiration = time.Hour
defaultActivityPubClientCacheExpiration = 10 * time.Minute
defaultActivityPubIRICacheSize = 100
defaultActivityPubIRICacheExpiration = time.Hour
defaultFollowAuthType = acceptAllPolicy
Expand Down Expand Up @@ -214,6 +214,12 @@ const (
" should be resolvable by external clients. Format: HostName[:Port]."
externalEndpointEnvKey = "ORB_EXTERNAL_ENDPOINT"

serviceIDFlagName = "service-id"
serviceIDFlagUsage = "The ID of the ActivityPub service." +
" By default, the ID is composed of the external endpoint appended with /services/orb, " +
" but it can also be set to a did:web DID, e.g. did:web:alice.example.com:services:anchor."
serviceIDEnvKey = "ORB_SERVICE_ID"

discoveryDomainFlagName = "discovery-domain"
discoveryDomainFlagUsage = "Discovery domain for this domain." + " Format: HostName"
discoveryDomainEnvKey = "ORB_DISCOVERY_DOMAIN"
Expand Down Expand Up @@ -677,6 +683,7 @@ type orbParameters struct {
hostURL string
hostMetricsURL string
externalEndpoint string
serviceID string
discoveryDomain string
didNamespace string
didAliases []string
Expand Down Expand Up @@ -874,6 +881,11 @@ func getOrbParameters(cmd *cobra.Command) (*orbParameters, error) {
externalEndpoint = hostURL
}

serviceID, err := cmdutils.GetUserSetVarFromString(cmd, serviceIDFlagName, serviceIDEnvKey, true)
if err != nil {
return nil, err
}

discoveryDomain, err := cmdutils.GetUserSetVarFromString(cmd, discoveryDomainFlagName, discoveryDomainEnvKey, true)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1411,6 +1423,7 @@ func getOrbParameters(cmd *cobra.Command) (*orbParameters, error) {
hostMetricsURL: hostMetricsURL,
discoveryDomain: discoveryDomain,
externalEndpoint: externalEndpoint,
serviceID: serviceID,
tlsParams: tlsParams,
didNamespace: didNamespace,
didAliases: didAliases,
Expand Down Expand Up @@ -2034,6 +2047,7 @@ func createFlags(startCmd *cobra.Command) {
startCmd.Flags().String(secretLockKeyPathFlagName, "", secretLockKeyPathFlagUsage)
startCmd.Flags().String(kmsTypeFlagName, "", kmsTypeFlagUsage)
startCmd.Flags().StringP(externalEndpointFlagName, externalEndpointFlagShorthand, "", externalEndpointFlagUsage)
startCmd.Flags().StringP(serviceIDFlagName, "", "", serviceIDFlagUsage)
startCmd.Flags().String(discoveryDomainFlagName, "", discoveryDomainFlagUsage)
startCmd.Flags().StringP(tlsCertificateFlagName, tlsCertificateFlagShorthand, "", tlsCertificateFlagUsage)
startCmd.Flags().StringP(tlsKeyFlagName, tlsKeyFlagShorthand, "", tlsKeyFlagUsage)
Expand Down
Loading

0 comments on commit 21915b1

Please sign in to comment.