Documentation ¶
Index ¶
- func NewHandlerResolver(handlers map[didsdk.Method]MethodHandler) (*resolution.MultiMethodResolver, error)
- type CreateDIDRequest
- type CreateDIDRequestOptions
- type CreateDIDResponse
- type CreateIONDIDOptions
- type CreateWebDIDOptions
- type DefaultStoredDID
- type DeleteDIDRequest
- type GetDIDRequest
- type GetDIDResponse
- type GetKeyFromDIDRequest
- type GetKeyFromDIDResponse
- type GetSupportedMethodsResponse
- type ListDIDsRequest
- type ListDIDsResponse
- type MethodHandler
- type ResolveDIDRequest
- type ResolveDIDResponse
- type Service
- func (s *Service) Config() config.DIDServiceConfig
- func (s *Service) CreateDIDByMethod(ctx context.Context, request CreateDIDRequest) (*CreateDIDResponse, error)
- func (s *Service) GetDIDByMethod(ctx context.Context, request GetDIDRequest) (*GetDIDResponse, error)
- func (s *Service) GetKeyFromDID(ctx context.Context, request GetKeyFromDIDRequest) (*GetKeyFromDIDResponse, error)
- func (s *Service) GetResolver() didresolution.Resolver
- func (s *Service) GetSupportedMethods() GetSupportedMethodsResponse
- func (s *Service) ListDIDsByMethod(ctx context.Context, request ListDIDsRequest) (*ListDIDsResponse, error)
- func (s *Service) Resolve(ctx context.Context, did string, opts ...didresolution.Option) (*didresolution.Result, error)
- func (s *Service) ResolveDID(request ResolveDIDRequest) (*ResolveDIDResponse, error)
- func (s *Service) SoftDeleteDIDByMethod(ctx context.Context, request DeleteDIDRequest) error
- func (s *Service) Status() framework.Status
- func (s *Service) Type() framework.Type
- type Storage
- func (ds *Storage) DeleteDID(ctx context.Context, id string) error
- func (ds *Storage) GetDID(ctx context.Context, id string, out StoredDID) error
- func (ds *Storage) GetDIDDefault(ctx context.Context, id string) (*DefaultStoredDID, error)
- func (ds *Storage) ListDIDs(ctx context.Context, method string, outType StoredDID) ([]StoredDID, error)
- func (ds *Storage) ListDIDsDefault(ctx context.Context, method string) ([]DefaultStoredDID, error)
- func (ds *Storage) StoreDID(ctx context.Context, did StoredDID) error
- type StoredDID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandlerResolver ¶
func NewHandlerResolver(handlers map[didsdk.Method]MethodHandler) (*resolution.MultiMethodResolver, error)
NewHandlerResolver creates a new HandlerResolver from a map of MethodHandlers which are used to resolve DIDs stored in our database
Types ¶
type CreateDIDRequest ¶
type CreateDIDRequest struct { Method didsdk.Method `json:"method" validate:"required"` KeyType crypto.KeyType `validate:"required"` Options CreateDIDRequestOptions `json:"options"` }
CreateDIDRequest is the JSON-serializable request for creating a DID across DID method
type CreateDIDRequestOptions ¶
type CreateDIDResponse ¶
CreateDIDResponse is the JSON-serializable response for creating a DID
type CreateIONDIDOptions ¶
type CreateIONDIDOptions struct { // TODO(gabe) for now we only allow adding service endpoints upon creation. // we do not allow adding external keys or other properties. // Related: // - https://github.com/TBD54566975/ssi-sdk/issues/336 // - https://github.com/TBD54566975/ssi-sdk/issues/335 ServiceEndpoints []did.Service `json:"serviceEndpoints"` }
func (CreateIONDIDOptions) Method ¶
func (c CreateIONDIDOptions) Method() did.Method
type CreateWebDIDOptions ¶
type CreateWebDIDOptions struct { // e.g. did:web:example.com DIDWebID string `json:"didWebId" validate:"required"` }
func (CreateWebDIDOptions) Method ¶
func (c CreateWebDIDOptions) Method() did.Method
type DefaultStoredDID ¶
type DefaultStoredDID struct { ID string `json:"id"` DID did.Document `json:"did"` SoftDeleted bool `json:"softDeleted"` }
DefaultStoredDID is the default implementation of StoredDID if no other implementation requirements are needed.
func (DefaultStoredDID) GetDocument ¶
func (d DefaultStoredDID) GetDocument() did.Document
func (DefaultStoredDID) GetID ¶
func (d DefaultStoredDID) GetID() string
func (DefaultStoredDID) IsSoftDeleted ¶
func (d DefaultStoredDID) IsSoftDeleted() bool
type DeleteDIDRequest ¶
type GetDIDRequest ¶
type GetDIDResponse ¶
GetDIDResponse is the JSON-serializable response for getting a DID
type GetKeyFromDIDRequest ¶
type GetKeyFromDIDResponse ¶
type ListDIDsRequest ¶
type ListDIDsResponse ¶
ListDIDsResponse is the JSON-serializable response for getting all DIDs for a given method
type MethodHandler ¶
type MethodHandler interface { GetMethod() didsdk.Method CreateDID(ctx context.Context, request CreateDIDRequest) (*CreateDIDResponse, error) // TODO(gabe): support query parameters to get soft deleted and other DIDs https://github.com/TBD54566975/ssi-service/issues/364 GetDID(ctx context.Context, request GetDIDRequest) (*GetDIDResponse, error) ListDIDs(ctx context.Context) (*ListDIDsResponse, error) ListDeletedDIDs(ctx context.Context) (*ListDIDsResponse, error) SoftDeleteDID(ctx context.Context, request DeleteDIDRequest) error }
MethodHandler describes the functionality of *all* possible DID service, regardless of method TODO(gabe) consider smaller/more composable interfaces and promoting reusability across methods https://github.com/TBD54566975/ssi-service/issues/362
func NewIONHandler ¶
func NewKeyHandler ¶
func NewKeyHandler(s *Storage, ks *keystore.Service) (MethodHandler, error)
func NewWebHandler ¶
func NewWebHandler(s *Storage, ks *keystore.Service) (MethodHandler, error)
type ResolveDIDRequest ¶
type ResolveDIDRequest struct {
DID string `json:"did" validate:"required"`
}
type ResolveDIDResponse ¶
type ResolveDIDResponse struct { ResolutionMetadata *resolution.Metadata `json:"didResolutionMetadata,omitempty"` DIDDocument *didsdk.Document `json:"didDocument"` DIDDocumentMetadata *resolution.DocumentMetadata `json:"didDocumentMetadata,omitempty"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewDIDService ¶
func NewDIDService(config config.DIDServiceConfig, s storage.ServiceStorage, keyStore *keystore.Service) (*Service, error)
func (*Service) Config ¶
func (s *Service) Config() config.DIDServiceConfig
func (*Service) CreateDIDByMethod ¶
func (s *Service) CreateDIDByMethod(ctx context.Context, request CreateDIDRequest) (*CreateDIDResponse, error)
func (*Service) GetDIDByMethod ¶
func (s *Service) GetDIDByMethod(ctx context.Context, request GetDIDRequest) (*GetDIDResponse, error)
func (*Service) GetKeyFromDID ¶
func (s *Service) GetKeyFromDID(ctx context.Context, request GetKeyFromDIDRequest) (*GetKeyFromDIDResponse, error)
func (*Service) GetResolver ¶
func (s *Service) GetResolver() didresolution.Resolver
func (*Service) GetSupportedMethods ¶
func (s *Service) GetSupportedMethods() GetSupportedMethodsResponse
func (*Service) ListDIDsByMethod ¶
func (s *Service) ListDIDsByMethod(ctx context.Context, request ListDIDsRequest) (*ListDIDsResponse, error)
func (*Service) Resolve ¶
func (s *Service) Resolve(ctx context.Context, did string, opts ...didresolution.Option) (*didresolution.Result, error)
func (*Service) ResolveDID ¶
func (s *Service) ResolveDID(request ResolveDIDRequest) (*ResolveDIDResponse, error)
func (*Service) SoftDeleteDIDByMethod ¶
func (s *Service) SoftDeleteDIDByMethod(ctx context.Context, request DeleteDIDRequest) error
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewDIDStorage ¶
func NewDIDStorage(db storage.ServiceStorage) (*Storage, error)
func (*Storage) GetDID ¶
GetDID attempts to get a DID from the database. It will return an error if it cannot. The out parameter must be a pointer to a struct that implements the StoredDID interface.
func (*Storage) GetDIDDefault ¶
GetDIDDefault is a convenience method for getting a DID that is stored as a DefaultStoredDID.
func (*Storage) ListDIDs ¶
func (ds *Storage) ListDIDs(ctx context.Context, method string, outType StoredDID) ([]StoredDID, error)
ListDIDs attempts to get all DIDs for a given method. It will return those it can even if it has trouble with some. The out parameter must be a pointer to a struct for a type that implement the StoredDID interface. The result is a slice of the type of the out parameter (an array of pointers to the type of the out parameter).)