Skip to content

Commit

Permalink
move DID doc code out to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Dec 6, 2024
1 parent 817bfc8 commit 28d2ee4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
20 changes: 0 additions & 20 deletions atproto/identity/did.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,6 @@ import (
"github.com/bluesky-social/indigo/atproto/syntax"
)

type DIDDocument struct {
DID syntax.DID `json:"id"`
AlsoKnownAs []string `json:"alsoKnownAs,omitempty"`
VerificationMethod []DocVerificationMethod `json:"verificationMethod,omitempty"`
Service []DocService `json:"service,omitempty"`
}

type DocVerificationMethod struct {
ID string `json:"id"`
Type string `json:"type"`
Controller string `json:"controller"`
PublicKeyMultibase string `json:"publicKeyMultibase"`
}

type DocService struct {
ID string `json:"id"`
Type string `json:"type"`
ServiceEndpoint string `json:"serviceEndpoint"`
}

// WARNING: this does *not* bi-directionally verify account metadata; it only implements direct DID-to-DID-document lookup for the supported DID methods, and parses the resulting DID Doc into an Identity struct
func (d *BaseDirectory) ResolveDID(ctx context.Context, did syntax.DID) (*DIDDocument, error) {
start := time.Now()
Expand Down
25 changes: 25 additions & 0 deletions atproto/identity/diddoc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package identity

import (
"github.com/bluesky-social/indigo/atproto/syntax"
)

type DIDDocument struct {
DID syntax.DID `json:"id"`
AlsoKnownAs []string `json:"alsoKnownAs,omitempty"`
VerificationMethod []DocVerificationMethod `json:"verificationMethod,omitempty"`
Service []DocService `json:"service,omitempty"`
}

type DocVerificationMethod struct {
ID string `json:"id"`
Type string `json:"type"`
Controller string `json:"controller"`
PublicKeyMultibase string `json:"publicKeyMultibase"`
}

type DocService struct {
ID string `json:"id"`
Type string `json:"type"`
ServiceEndpoint string `json:"serviceEndpoint"`
}
File renamed without changes.

0 comments on commit 28d2ee4

Please sign in to comment.