Documentation ¶
Index ¶
- func NewHandlerResolver(handlers map[didsdk.Method]MethodHandler) (*resolution.MultiMethodResolver, error)
- type Anchor
- type BatchCreateDIDsRequest
- type BatchCreateDIDsResponse
- type BatchService
- 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 PreAnchor
- 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
- func (s *Service) UpdateIONDID(ctx context.Context, request UpdateIONDIDRequest) (*UpdateIONDIDResponse, error)
- type Storage
- func (ds *Storage) DIDExists(ctx context.Context, id string) (bool, error)
- 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) ListDIDsPage(ctx context.Context, method string, page *common.Page, outType StoredDID) (*StoredDIDs, error)
- func (ds *Storage) StoreDID(ctx context.Context, did StoredDID) error
- type StorageFactory
- type StoredDID
- type StoredDIDs
- type UpdateIONDIDRequest
- type UpdateIONDIDResponse
- type UpdateRequestStatus
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 BatchCreateDIDsRequest ¶
type BatchCreateDIDsRequest struct {
Requests []CreateDIDRequest `json:"requests"`
}
type BatchCreateDIDsResponse ¶
type BatchService ¶
type BatchService struct {
// contains filtered or unexported fields
}
func NewBatchDIDService ¶
func NewBatchDIDService(config config.DIDServiceConfig, s storage.ServiceStorage, factory keystore.ServiceFactory) (*BatchService, error)
func (*BatchService) BatchCreateDIDs ¶
func (s *BatchService) BatchCreateDIDs(ctx context.Context, batchReq BatchCreateDIDsRequest) (*BatchCreateDIDsResponse, error)
func (*BatchService) Config ¶
func (s *BatchService) Config() config.DIDServiceConfig
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 { // Services to add to the DID document that will be created. ServiceEndpoints []did.Service `json:"serviceEndpoints"` // List of JSON Web Signatures serialized using compact serialization. The payload must be a JSON object that // represents a publicKey object. Such object must follow the schema described in step 3 of // https://identity.foundation/sidetree/spec/#add-public-keys. The payload must be signed // with the private key associated with the `publicKeyJwk` that will be added in the DID document. // The input will be parsed and verified, and the payload will be used to add public keys to the DID document in the // same way in which the `add-public-keys` patch action adds keys (see https://identity.foundation/sidetree/spec/#add-public-keys). JWSPublicKeys []string `json:"jwsPublicKeys"` }
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 returns the did method that this handler is implementing. GetMethod() didsdk.Method // CreateDID creates a DID who's did method is `GetMethod`. CreateDID(ctx context.Context, request CreateDIDRequest) (*CreateDIDResponse, error) // GetDID returns a DID document for a did who's method is `GetMethod`. The DID must not have been soft-deleted. // TODO(gabe): support query parameters to get soft deleted and other DIDs https://github.com/fapiper/onchain-access-control/issues/364 GetDID(ctx context.Context, request GetDIDRequest) (*GetDIDResponse, error) // ListDIDs returns all non-deleted DIDs for the given page. When page is nil, all non-deleted DIDs will be returned. ListDIDs(ctx context.Context, page *common.Page) (*ListDIDsResponse, error) // ListDeletedDIDs returns all soft-deleted DIDs. ListDeletedDIDs(ctx context.Context) (*ListDIDsResponse, error) // SoftDeleteDID marks the given DID as deleted. It is not removed from storage. 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/fapiper/onchain-access-control/issues/362
func NewIONHandler ¶
func NewIONHandler(baseURL string, s *Storage, ks *keystore.Service, factory keystore.ServiceFactory, storageFactory StorageFactory) (MethodHandler, error)
func NewKeyHandler ¶
func NewKeyHandler(s *Storage, ks *keystore.Service) (MethodHandler, error)
func NewWebHandler ¶
func NewWebHandler(s *Storage, ks *keystore.Service) (MethodHandler, error)
type PreAnchor ¶
type PreAnchor struct { UpdateOperation *ion.UpdateRequest NextUpdatePublicJWK *jwx.PublicKeyJWK UpdatedDID *ionStoredDID NextUpdatePrivateJWKID string }
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, factory keystore.ServiceFactory) (*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
func (*Service) UpdateIONDID ¶
func (s *Service) UpdateIONDID(ctx context.Context, request UpdateIONDIDRequest) (*UpdateIONDIDResponse, 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).)
func (*Storage) ListDIDsDefault ¶
func (*Storage) ListDIDsPage ¶
type StorageFactory ¶
func NewDIDStorageFactory ¶
func NewDIDStorageFactory(db storage.ServiceStorage) StorageFactory
type StoredDID ¶
StoredDID is a DID that has been stored in the database. It is an interface to allow for different implementations of DID storage based on the DID method.
type StoredDIDs ¶
type UpdateIONDIDRequest ¶
type UpdateIONDIDRequest struct { DID ion.ION `json:"did"` StateChange ion.StateChange `json:"stateChange"` }
type UpdateIONDIDResponse ¶
type UpdateRequestStatus ¶
type UpdateRequestStatus string
const ( PreAnchorStatus UpdateRequestStatus = "pre-anchor" AnchorErrorStatus UpdateRequestStatus = "anchor-error" AnchoredStatus UpdateRequestStatus = "anchored" DoneStatus UpdateRequestStatus = "done" )
func (UpdateRequestStatus) Bytes ¶
func (s UpdateRequestStatus) Bytes() []byte