router

package
v0.0.0-...-0fc66b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IssuerParam  string = "issuer"
	SubjectParam string = "subject"
	SchemaParam  string = "schema"
)
View Source
const (
	MethodParam  = "method"
	IDParam      = "id"
	DeletedParam = "deleted"
)
View Source
const (
	ParentParam string = "parent"
	FilterParam string = "filter"
)
View Source
const (
	DoneIdentifier = "done"
	True           = "true"
	False          = "false"
)
View Source
const FilterCharacterLimit = 1024
View Source
const (
	HealthOK string = "OK"
)

Variables

This section is empty.

Functions

func Health

func Health(c *gin.Context)

Health godoc

@Summary		Service health check
@Description	Health is a simple handler that always responds with a 200 OK
@Tags			ServiceInfo
@Accept			json
@Produce		json
@Success		200	{object}	GetHealthCheckResponse
@Router			/health [get]

func Readiness

func Readiness(services []svcframework.Service) gin.HandlerFunc

Types

type BatchCreateCredentialsRequest

type BatchCreateCredentialsRequest struct {
	// Required. The list of create credential requests. Cannot be more than {{.Services.CredentialConfig.BatchCreateMaxItems}} items.
	Requests []CreateCredentialRequest `json:"requests" maxItems:"1000" validate:"required,dive"`
}

type BatchCreateCredentialsResponse

type BatchCreateCredentialsResponse struct {
	// The credentials created.
	Credentials []credmodel.Container `json:"credentials"`
}

type BatchCreateDIDsRequest

type BatchCreateDIDsRequest struct {
	// Required. The list of create credential requests. Cannot be more than {{.Services.DIDConfig.BatchCreateMaxItems}} items.
	Requests []CreateDIDByMethodRequest `json:"requests" maxItems:"100" validate:"required,dive"`
}

type BatchCreateDIDsResponse

type BatchCreateDIDsResponse struct {
	// The DID documents created.
	DIDs []didsdk.Document `json:"dids"`
}

type BatchDIDRouter

type BatchDIDRouter struct {
	// contains filtered or unexported fields
}

func NewBatchDIDRouter

func NewBatchDIDRouter(svc *did.BatchService) *BatchDIDRouter

func (BatchDIDRouter) BatchCreateDIDs

func (dr BatchDIDRouter) BatchCreateDIDs(c *gin.Context)

BatchCreateDIDs godoc

@Summary		Batch Create DIDs
@Description	Create a batch of DIDs. The operation is atomic, meaning that all requests will
@Description	succeed or fail. This is currently only supported for the DID method named `did:key`.
@Tags			DecentralizedIdentifiers
@Accept			json
@Produce		json
@Param			method	path		string					true	"Method. Only `key` is supported."
@Param			request	body		BatchCreateDIDsRequest	true	"The batch requests"
@Success		201		{object}	BatchCreateDIDsResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/dids/{method}/batch [put]

type BatchUpdateCredentialStatusRequest

type BatchUpdateCredentialStatusRequest struct {
	// Required. The list of update credential requests. Cannot be more than the config value in `services.credentials.batch_update_status_max_items`.
	Requests []SingleUpdateCredentialStatusRequest `json:"requests" maxItems:"100" validate:"required,dive"`
}

type BatchUpdateCredentialStatusResponse

type BatchUpdateCredentialStatusResponse struct {
	CredentialStatuses []credential.Status `json:"credentialStatuses"`
}

type CommonCreateRequestRequest

type CommonCreateRequestRequest struct {
	// Audience as defined in https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.3
	// Optional
	Audience []string `json:"audience"`

	// Expiration as defined in https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.4
	// Optional.
	Expiration string `json:"expiration"`

	// DID of the issuer of this presentation definition. The DID must have been previously created with the DID API.
	IssuerDID string `json:"issuerId" validate:"required"`

	// The id of the verificationMethod (see https://www.w3.org/TR/did-core/#verification-methods) who's privateKey is
	// stored in ssi-service. The verificationMethod must be part of the did document associated with `issuerId`.
	// The private key associated with the verificationMethod's publicKey will be used to sign an envelope that contains
	// the created presentation definition.
	VerificationMethodID string `` /* 163-byte string literal not displayed */

	// The URL that the presenter should be submitting the presentation submission to.
	// Optional.
	CallbackURL string `json:"callbackUrl" example:"https://example.com"`
}

type CreateCredentialRequest

type CreateCredentialRequest struct {
	// The issuer id.
	Issuer string `json:"issuer" validate:"required" example:"did:key:z6MkkZDjunoN4gyPMx5TSy7Mfzw22D2RZQZUcx46bii53Ex3"`

	// The id of the verificationMethod (see https://www.w3.org/TR/did-core/#verification-methods) who's privateKey is
	// stored in ssi-service. The verificationMethod must be part of the did document associated with `issuer`.
	// The private key associated with the verificationMethod's publicKey will be used to sign the credential.
	VerificationMethodID string `` /* 163-byte string literal not displayed */

	// The subject id.
	Subject string `json:"subject" validate:"required" example:"did:key:z6MkiTBz1ymuepAQ4HEHYSF1H8quG5GLVVQR3djdX3mDooWp"`

	// A context is optional. If not present, we'll apply default, required context values.
	Context string `json:"@context,omitempty" example:""`

	// A schema ID is optional. If present, we'll attempt to look it up and validate the data against it.
	SchemaID string `json:"schemaId,omitempty" example:"30e3f9b7-0528-4f6f-8aac-b74c8843187a"`

	// Claims about the subject. The keys should be predicates (e.g. "alumniOf"), and the values can be any object.
	Data map[string]any `json:"data" validate:"required" swaggertype:"object,string" example:"alumniOf:did_for_uni"`

	// Optional. Corresponds to `expirationDate` in https://www.w3.org/TR/vc-data-model/#expiration.
	Expiry string `json:"expiry,omitempty" example:"2029-01-01T19:23:24Z"`

	// Whether this credential can be revoked. When true, the created VC will have the "credentialStatus"
	// property set.
	Revocable bool `json:"revocable,omitempty" example:"true"`

	// Whether this credential can be suspended. When true, the created VC will have the "credentialStatus"
	// property set.
	Suspendable bool `json:"suspendable,omitempty" example:"false"`

	// Optional. Corresponds to `evidence` in https://www.w3.org/TR/vc-data-model-2.0/#evidence
	Evidence []any `` /* 142-byte string literal not displayed */

}

type CreateCredentialResponse

type CreateCredentialResponse struct {
	credmodel.Container
}

type CreateDIDByMethodRequest

type CreateDIDByMethodRequest struct {
	// Identifies the cryptographic algorithm family to use when generating this key.
	KeyType crypto.KeyType `json:"keyType" validate:"required"`

	// Options for creating the DID. Implementation dependent on the method.
	Options any `json:"options,omitempty"`
}

type CreateDIDByMethodResponse

type CreateDIDByMethodResponse struct {
	DID didsdk.Document `json:"did,omitempty"`
}

type CreateDIDConfigurationRequest

type CreateDIDConfigurationRequest struct {
	// DID that identifies who the issuer of the credential(s) will be.
	// Required.
	IssuerDID string `json:"issuerDid" validate:"required" example:"did:key:z6MkkZDjunoN4gyPMx5TSy7Mfzw22D2RZQZUcx46bii53Ex3"`

	// The id of the verificationMethod (see https://www.w3.org/TR/did-core/#verification-methods) who's privateKey is
	// stored in ssi-service. The verificationMethod must be part of the did document associated with `issuer`.
	// The private key associated with the verificationMethod's publicKey will be used to sign the domain linkage credential.
	// Required.
	VerificationMethodID string `` /* 163-byte string literal not displayed */

	// Serialization of an origin as described in https://html.spec.whatwg.org/multipage/browsers.html#origin. Represents
	// the origin that the IssuerDID controls, which will be included in the `DomainLinkageCredential.credentialSubject.origin`
	// value.
	// Required.
	Origin string `json:"origin" validate:"required" example:"https://www.cyware.github.io/"`

	// Will be used to set the `DomainLinkageCredential.credentialSubject.expirationDate`. Required.
	ExpirationDate string `json:"expirationDate" validate:"required" example:"2051-10-05T14:48:00.000Z"`

	// Will be used to set the `DomainLinkageCredential.credentialSubject.issuanceDate`. If left empty, then the current
	// time will be used.
	// Optional.
	IssuanceDate string `json:"issuanceDate" example:"2021-10-05T14:48:00.000Z"`
}

type CreateDIDConfigurationResponse

type CreateDIDConfigurationResponse struct {
	// The location in which the `didConfiguration` value should be hosted.
	WellKnownLocation string `json:"wellKnownLocation"`

	// The DID Configuration Resource according to https://identity.foundation/.well-known/resources/did-configuration/#did-configuration-resource
	DIDConfiguration DIDConfiguration `json:"didConfiguration"`
}

type CreateIssuanceTemplateRequest

type CreateIssuanceTemplateRequest struct {
	issuance.Template
}

type CreateManifestRequest

type CreateManifestRequest struct {
	// Summarizing title for the Manifest in question.
	// Optional.
	Name *string `json:"name,omitempty"`

	// Explains what the Manifest in question is generally offering in exchange for meeting its requirements.
	// Optional.
	Description *string `json:"description,omitempty"`

	// DID that identifies who the issuer of the credential(s) will be.
	// Required.
	IssuerDID string `json:"issuerDid" validate:"required"`

	// The id of the verificationMethod (see https://www.w3.org/TR/did-core/#verification-methods) who's privateKey is
	// stored in ssi-service. The verificationMethod must be part of the did document associated with `issuer`.
	// The private key associated with the verificationMethod's publicKey will be used to sign the issued credentials.
	// Required.
	VerificationMethodID string `` /* 163-byte string literal not displayed */

	// Human-readable name the Issuer wishes to be recognized by.
	// Optional.
	IssuerName *string `json:"issuerName,omitempty"`

	// Formats that the issuer can support when issuing the credential. At least one needs to be set. We currently only
	// support `jwt_vc` for issuance. See https://identity.foundation/claim-format-registry/#registry for the definition.
	// TODO: support different claim formats https://github.com/cyware/ssi-service/issues/96
	ClaimFormat *exchange.ClaimFormat `json:"format" validate:"required,dive"`

	// Array of objects as defined in https://identity.foundation/credential-manifest/#output-descriptor.
	OutputDescriptors []manifestsdk.OutputDescriptor `json:"outputDescriptors" validate:"required,dive"`

	// Describes what proofs are required in order to issue this credential. When present, only `id` or `value` may be
	// populated, but not both.
	// Optional.
	*model.PresentationDefinitionRef
}

CreateManifestRequest is the request body for creating a manifest, which populates all remaining fields and builds a well-formed manifest object.

func (CreateManifestRequest) ToServiceRequest

func (c CreateManifestRequest) ToServiceRequest() model.CreateManifestRequest

type CreateManifestRequestRequest

type CreateManifestRequestRequest struct {
	*CommonCreateRequestRequest `validate:"required,dive"`

	// ID of the credential manifest to use for this request.
	CredentialManifestID string `json:"credentialManifestId" validate:"required"`
}

type CreateManifestRequestResponse

type CreateManifestRequestResponse struct {
	Request *model.Request `json:"manifestRequest"`
}

type CreateManifestResponse

type CreateManifestResponse struct {
	Manifest manifestsdk.CredentialManifest `json:"credential_manifest"`
}

type CreatePresentationDefinitionRequest

type CreatePresentationDefinitionRequest struct {
	Name                   string                           `json:"name,omitempty"`
	Purpose                string                           `json:"purpose,omitempty"`
	Format                 *exchange.ClaimFormat            `json:"format,omitempty" validate:"omitempty,dive"`
	InputDescriptors       []exchange.InputDescriptor       `json:"inputDescriptors" validate:"required,dive"`
	SubmissionRequirements []exchange.SubmissionRequirement `json:"submissionRequirements,omitempty" validate:"omitempty,dive"`
}

type CreatePresentationDefinitionResponse

type CreatePresentationDefinitionResponse struct {
	PresentationDefinition exchange.PresentationDefinition `json:"presentation_definition,omitempty"`

	// Signed envelope that contains the PresentationDefinition created using the privateKey of the author of the
	// definition.
	PresentationDefinitionJWT keyaccess.JWT `json:"presentationDefinitionJwt,omitempty"`
}

type CreateRequestRequest

type CreateRequestRequest struct {
	*CommonCreateRequestRequest `validate:"required,dive"`
	// ID of the presentation definition to use for this request.
	PresentationDefinitionID string `json:"presentationDefinitionId" validate:"required"`
}

type CreateRequestResponse

type CreateRequestResponse struct {
	Request *model.Request `json:"presentationRequest"`
}

type CreateSchemaRequest

type CreateSchemaRequest struct {
	// Name is a human-readable name for a schema
	Name string `json:"name" validate:"required"`
	// Description is an optional human-readable description for a schema
	Description string `json:"description,omitempty"`
	// Schema represents the JSON schema for the credential schema
	// If the schema has an $id field, it will be overwritten with an ID the service generates.
	// The schema must be against draft 2020-12, 2019-09, or 7.
	// Must include a string field `$schema` that must be one of `https://json-schema.org/draft/2020-12/schema`,
	// `https://json-schema.org/draft/2019-09/schema`, or `https://json-schema.org/draft-07/schema`.
	Schema schemalib.JSONSchema `json:"schema" validate:"required"`

	// CredentialSchemaRequest request is an optional additional request to create a credentialized version of a schema.
	*CredentialSchemaRequest
}

type CreateSchemaResponse

type CreateSchemaResponse struct {
	*SchemaResponse
}

type CreateSubmissionRequest

type CreateSubmissionRequest struct {
	// A Verifiable Presentation that's encoded as a JWT.
	// Verifiable Presentation are described in https://www.w3.org/TR/vc-data-model/#presentations-0
	// JWT encoding of the Presentation as described in https://www.w3.org/TR/vc-data-model/#presentations-0
	SubmissionJWT keyaccess.JWT `json:"submissionJwt" validate:"required"`
}

type CreateWebhookRequest

type CreateWebhookRequest struct {
	// The noun (entity) for the new webhook.eg: Credential
	Noun webhook.Noun `json:"noun" validate:"required"`
	// The verb for the new webhook.eg: Create
	Verb webhook.Verb `json:"verb" validate:"required"`
	// The URL to post the output of this request to Noun.Verb action to.
	URL string `json:"url" validate:"required"`
}

CreateWebhookRequest In the context of webhooks, it's common to use noun.verb notation to describe events, such as "credential.create" or "schema.delete".

type CreateWebhookResponse

type CreateWebhookResponse struct {
	Webhook webhook.Webhook `json:"webhook"`
}

type CredentialRouter

type CredentialRouter struct {
	// contains filtered or unexported fields
}

func NewCredentialRouter

func NewCredentialRouter(s svcframework.Service) (*CredentialRouter, error)

func (CredentialRouter) BatchCreateCredentials

func (cr CredentialRouter) BatchCreateCredentials(c *gin.Context)

BatchCreateCredentials godoc

@Summary		Batch create Credentials
@Description	Create a batch of Verifiable Credentials.
@Tags			Credentials
@Accept			json
@Produce		json
@Param			request	body		BatchCreateCredentialsRequest	true	"The batch requests"
@Success		201		{object}	BatchCreateCredentialsResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/credentials/batch [put]

func (CredentialRouter) BatchUpdateCredentialStatus

func (cr CredentialRouter) BatchUpdateCredentialStatus(c *gin.Context)

BatchUpdateCredentialStatus godoc

@Summary		Batch Update a Verifiable Credential's status
@Description	Updates the status all a batch of Verifiable Credentials.
@Tags			Credentials
@Accept			json
@Produce		json
@Param			request	body		BatchUpdateCredentialStatusRequest	true	"request body"
@Success		201		{object}	BatchUpdateCredentialStatusResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/credentials/status/batch [put]

func (CredentialRouter) CreateCredential

func (cr CredentialRouter) CreateCredential(c *gin.Context)

CreateCredential godoc

@Summary		Create a Verifiable Credential
@Description	Create a Verifiable Credential
@Tags			Credentials
@Accept			json
@Produce		json
@Param			request	body		CreateCredentialRequest	true	"request body"
@Success		201		{object}	CreateCredentialResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/credentials [put]

func (CredentialRouter) DeleteCredential

func (cr CredentialRouter) DeleteCredential(c *gin.Context)

DeleteCredential godoc

@Summary		Delete a Verifiable Credential
@Description	Delete a Verifiable Credential by its ID
@Tags			Credentials
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID of the credential to delete"
@Success		204	{string}	string	"No Content"
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/credentials/{id} [delete]

func (CredentialRouter) GetCredential

func (cr CredentialRouter) GetCredential(c *gin.Context)

GetCredential godoc

@Summary		Get a Verifiable Credential
@Description	Get a Verifiable Credential by its ID
@Tags			Credentials
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID of the credential within SSI-Service. Must be a UUID."
@Success		200	{object}	GetCredentialResponse
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/credentials/{id} [get]

func (CredentialRouter) GetCredentialStatus

func (cr CredentialRouter) GetCredentialStatus(c *gin.Context)

GetCredentialStatus godoc

@Summary		Get a Verifiable Credential's status
@Description	Get a Verifiable Credential's status by the credential's ID
@Tags			Credentials
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	GetCredentialStatusResponse
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/credentials/{id}/status [get]

func (CredentialRouter) GetCredentialStatusList

func (cr CredentialRouter) GetCredentialStatusList(c *gin.Context)

GetCredentialStatusList godoc

@Summary		Get a Credential Status List
@Description	Get a credential status list by its ID
@Tags			Credentials
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	GetCredentialStatusListResponse
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/credentials/status/{id} [get]

func (CredentialRouter) ListCredentials

func (cr CredentialRouter) ListCredentials(c *gin.Context)

ListCredentials godoc

@Summary		List Verifiable Credentials
@Description	Checks for the presence of an optional query parameter and calls the associated filtered get method.
@Description	Only one optional parameter is allowed to be specified.
@Tags			Credentials
@Accept			json
@Produce		json
@Param			issuer		query		string	false	"The issuer id, e.g. did:key:z6MkiTBz1ymuepAQ4HEHYSF1H8quG5GLVVQR3djdX3mDooWp"
@Param			schema		query		string	false	"The credentialSchema.id value to filter by"
@Param			subject		query		string	false	"The credentialSubject.id value to filter by"
@Param			pageSize	query		number	false	"Hint to the server of the maximum elements to return. More may be returned. When not set, the server will return all elements."
@Param			pageToken	query		string	false	"Used to indicate to the server to return a specific page of the list results. Must match a previous requests' `nextPageToken`."
@Success		200			{object}	ListCredentialsResponse
@Failure		400			{string}	string	"Bad request"
@Failure		500			{string}	string	"Internal server error"
@Router			/v1/credentials [get]

func (CredentialRouter) UpdateCredentialStatus

func (cr CredentialRouter) UpdateCredentialStatus(c *gin.Context)

UpdateCredentialStatus godoc

@Summary		Update a Verifiable Credential's status
@Description	Update a Verifiable Credential's status
@Tags			Credentials
@Accept			json
@Produce		json
@Param			id		path		string							true	"ID"
@Param			request	body		UpdateCredentialStatusRequest	true	"request body"
@Success		201		{object}	UpdateCredentialStatusResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/credentials/{id}/status [put]

func (CredentialRouter) VerifyCredential

func (cr CredentialRouter) VerifyCredential(c *gin.Context)

VerifyCredential godoc

@Summary		Verify a Verifiable Credential
@Description	Verifies a given verifiable credential. The system does the following levels of verification:
@Description	1. Makes sure the credential has a valid signature
@Description	2. Makes sure the credential has is not expired
@Description	3. Makes sure the credential complies with the VC Data Model v1.1
@Description	4. If the credential has a schema, makes sure its data complies with the schema
@Tags			Credentials
@Accept			json
@Produce		json
@Param			request	body		VerifyCredentialRequest	true	"request body"
@Success		200		{object}	VerifyCredentialResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/credentials/verification [put]

type CredentialSchemaRequest

type CredentialSchemaRequest struct {
	// Issuer represents the DID of the issuer for the schema if it's signed. Required if intending to sign the
	// schema as a credential using JsonSchemaCredential.
	Issuer string `json:"issuer,omitempty" validate:"required"`

	// The id of the verificationMethod (see https://www.w3.org/TR/did-core/#verification-methods) who's privateKey is
	// stored in ssi-service. The verificationMethod must be part of the did document associated with `issuer`.
	// The private key associated with the verificationMethod's publicKey will be used to sign the schema as a
	// credential using JsonSchemaCredential.
	// Required if intending to sign the schema as a credential using JsonSchemaCredential.
	VerificationMethodID string `` /* 163-byte string literal not displayed */
}

CredentialSchemaRequest request is an optional additional request to create a credentialized version of a schema.

func (*CredentialSchemaRequest) IsValid

func (csr *CredentialSchemaRequest) IsValid() bool

type DIDConfiguration

type DIDConfiguration struct {
	Context    any   `json:"@context" validate:"required"`
	LinkedDIDs []any `json:"linked_dids" validate:"required"`
}

type DIDConfigurationRouter

type DIDConfigurationRouter struct {
	Service *wellknown.DIDConfigurationService
}

func NewDIDConfigurationsRouter

func NewDIDConfigurationsRouter(svc svcframework.Service) (*DIDConfigurationRouter, error)

func (DIDConfigurationRouter) CreateDIDConfiguration

func (wr DIDConfigurationRouter) CreateDIDConfiguration(c *gin.Context)

CreateDIDConfiguration godoc

@Summary		Create DID Configurations
@Description	Creates a DID Configuration Resource which conforms to https://identity.foundation/.well-known/resources/did-configuration/#did-configuration-resource
@Description	The `didConfiguration` can be hosted at the `wellKnownLocation` specified in the response.
@Tags			DIDConfigurations
@Accept			json
@Produce		json
@Param			request	body		CreateDIDConfigurationRequest	true	"request body"
@Success		201		{object}	CreateDIDConfigurationResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/did-configurations [put]

func (DIDConfigurationRouter) VerifyDIDConfiguration

func (wr DIDConfigurationRouter) VerifyDIDConfiguration(c *gin.Context)

VerifyDIDConfiguration godoc

@Summary		Verifies a DID Configuration Resource
@Description	Verifies a DID Configuration Resource according to https://identity.foundation/.well-known/resources/did-configuration/#did-configuration-resource-verification
@Tags			DIDConfigurations
@Accept			json
@Produce		json
@Param			request	body		wellknown.VerifyDIDConfigurationRequest	true	"request body"
@Success		201		{object}	wellknown.VerifyDIDConfigurationResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/did-configurations/verification [put]

type DIDRouter

type DIDRouter struct {
	// contains filtered or unexported fields
}

DIDRouter represents the dependencies required to instantiate a DID-HTTP service

func NewDIDRouter

func NewDIDRouter(s svcframework.Service) (*DIDRouter, error)

NewDIDRouter creates an HTP router for the DID Service

func (DIDRouter) CreateDIDByMethod

func (dr DIDRouter) CreateDIDByMethod(c *gin.Context)

CreateDIDByMethod godoc

@Summary		Create a DID Document
@Description	Creates a fully custodial DID document with the given method. The document created is stored internally
@Description	and can be retrieved using the GetOperation. Method dependent registration (for example, DID web
@Description	registration) is left up to the clients of this API. The private key(s) created by the method are stored
@Description	internally never leave the service boundary.
@Tags			DecentralizedIdentifiers
@Accept			json
@Produce		json
@Param			method	path		string														true	"Method"
@Param			request	body		CreateDIDByMethodRequest{options=did.CreateIONDIDOptions}	true	"request body"
@Success		201		{object}	CreateDIDByMethodResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/dids/{method} [put]

func (DIDRouter) GetDIDByMethod

func (dr DIDRouter) GetDIDByMethod(c *gin.Context)

GetDIDByMethod godoc

@Summary		Get a DID
@Description	Gets a DID Document by its DID ID
@Tags			DecentralizedIdentifiers
@Accept			json
@Produce		json
@Param			request	body		CreateDIDByMethodRequest	true	"request body"
@Param			method	path		string						true	"Method"
@Param			id		path		string						true	"ID"
@Success		200		{object}	GetDIDByMethodResponse
@Failure		400		{string}	string	"Bad request"
@Router			/v1/dids/{method}/{id} [get]

func (DIDRouter) ListDIDMethods

func (dr DIDRouter) ListDIDMethods(c *gin.Context)

ListDIDMethods godoc

@Summary		List DID methods
@Description	Get the list of supported DID methods
@Tags			DecentralizedIdentifiers
@Accept			json
@Produce		json
@Success		200	{object}	ListDIDMethodsResponse
@Router			/v1/dids [get]

func (DIDRouter) ListDIDsByMethod

func (dr DIDRouter) ListDIDsByMethod(c *gin.Context)

ListDIDsByMethod godoc

@Summary		List DIDs by method
@Description	List DIDs by method. Checks for an optional "deleted=true" query parameter, which exclusively
@Description	returns DIDs that have been "Soft Deleted".
@Tags			DecentralizedIdentifiers
@Accept			json
@Produce		json
@Param			method		path		string	true	"Method must be one returned by GET /v1/dids"
@Param			deleted		query		boolean	false	"When true, returns soft-deleted DIDs. Otherwise, returns DIDs that have not been soft-deleted. Default is false."
@Param			pageSize	query		number	false	"Hint to the server of the maximum elements to return. More may be returned. When not set, the server will return all elements."
@Param			pageToken	query		string	false	"Used to indicate to the server to return a specific page of the list results. Must match a previous requests' `nextPageToken`."
@Success		200			{object}	ListDIDsByMethodResponse
@Failure		400			{string}	string	"Bad request"
@Failure		500			{string}	string	"Internal server error"
@Router			/v1/dids/{method} [get]

func (DIDRouter) ResolveDID

func (dr DIDRouter) ResolveDID(c *gin.Context)

ResolveDID godoc

@Summary		Resolve a DID
@Description	Resolve a DID that may not be stored in this service
@Tags			DecentralizedIdentifiers
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	ResolveDIDResponse
@Failure		400	{string}	string	"Bad request"
@Router			/v1/dids/resolver/{id} [get]

func (DIDRouter) SoftDeleteDIDByMethod

func (dr DIDRouter) SoftDeleteDIDByMethod(c *gin.Context)

SoftDeleteDIDByMethod godoc

@Description	When this is called with the correct did method and id it will flip the softDelete flag to true for the db entry.
@Description	A user can still get the did if they know the DID ID, and the did keys will still exist, but this did will not show up in the ListDIDsByMethod call
@Description	This facilitates a clean SSI-Service Admin UI but not leave any hanging VCs with inaccessible hanging DIDs.
@Summary		Soft delete a DID
@Description	Soft deletes a DID by its method
@Tags			DecentralizedIdentifiers
@Accept			json
@Produce		json
@Param			method	path		string	true	"Method"
@Param			id		path		string	true	"ID"
@Success		204		{string}	string	"No Content"
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/dids/{method}/{id} [delete]

func (DIDRouter) UpdateDIDByMethod

func (dr DIDRouter) UpdateDIDByMethod(c *gin.Context)

UpdateDIDByMethod godoc

@Summary		Updates a DID document.
@Description	Updates a DID for which SSI is the custodian. The DID must have been previously created by calling
@Description	the "Create DID Document" endpoint. Currently, only ION dids support updates.
@Tags			DecentralizedIdentifiers
@Accept			json
@Produce		json
@Param			method	path		string						true	"Method"
@Param			id		path		string						true	"ID"
@Param			request	body		UpdateDIDByMethodRequest	true	"request body"
@Success		200		{object}	UpdateDIDByMethodResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/dids/{method}/{id} [put]

type DeleteWebhookRequest

type DeleteWebhookRequest struct {
	Noun webhook.Noun `json:"noun" validate:"required"`
	Verb webhook.Verb `json:"verb" validate:"required"`
	URL  string       `json:"url" validate:"required"`
}

type GetApplicationResponse

type GetApplicationResponse struct {
	ID          string                            `json:"id"`
	Application manifestsdk.CredentialApplication `json:"application"`
}

type GetCredentialResponse

type GetCredentialResponse struct {
	// The `id` of this credential within SSI-Service. Same as the `id` passed in the query parameter.
	ID string `json:"id"`
	credmodel.Container
}

type GetCredentialStatusListResponse

type GetCredentialStatusListResponse struct {
	ID string `json:"id"`
	// Credential where type includes "VerifiableCredential" and "StatusList2021".
	Credential *credsdk.VerifiableCredential `json:"credential,omitempty"`

	// The JWT signed with the associated issuer's private key.
	CredentialJWT *keyaccess.JWT `json:"credentialJwt,omitempty"`
}

type GetCredentialStatusResponse

type GetCredentialStatusResponse struct {
	// Whether the credential has been revoked.
	Revoked bool `json:"revoked"`
	// Whether the credential has been suspended.
	Suspended bool `json:"suspended"`
}

type GetDIDByMethodResponse

type GetDIDByMethodResponse struct {
	DID didsdk.Document `json:"did"`
}

type GetDIDsRequest

type GetDIDsRequest struct {
	// A standard filter expression conforming to https://google.aip.dev/160.
	// Not implemented yet.
	Filter string `json:"filter,omitempty"`
}

type GetHealthCheckResponse

type GetHealthCheckResponse struct {
	// Status is always equal to `OK`.
	Status string `json:"status"`
}

type GetKeyDetailsResponse

type GetKeyDetailsResponse struct {
	ID         string         `json:"id,omitempty"`
	Type       crypto.KeyType `json:"type,omitempty"`
	Controller string         `json:"controller,omitempty"`

	// Represents the time at which the key was created. Encoded according to RFC3339.
	CreatedAt string `json:"createdAt,omitempty"`

	// The public key in JWK format according to RFC7517. This public key is associated with the private
	// key with the associated ID.
	PublicKeyJWK jwx.PublicKeyJWK `json:"publicKeyJwk"`
}

type GetManifestRequestResponse

type GetManifestRequestResponse struct {
	Request *model.Request `json:"manifestRequest"`
}

type GetPresentationDefinitionResponse

type GetPresentationDefinitionResponse struct {
	PresentationDefinition exchange.PresentationDefinition `json:"presentation_definition,omitempty"`
}

type GetReadinessResponse

type GetReadinessResponse struct {
	// Overall status of the ssi service.
	Status svcframework.Status `json:"status"`

	// A map from the name of the service to the status of that current service.
	ServiceStatuses map[svcframework.Type]svcframework.Status `json:"serviceStatuses"`
}

type GetRequestResponse

type GetRequestResponse struct {
	Request *model.Request `json:"presentationRequest"`
}

type GetResponseResponse

type GetResponseResponse struct {
	Response manifestsdk.CredentialResponse `json:"credential_response"`
	// this is an interface type to union Data Integrity and JWT style VCs
	Credentials any           `json:"verifiableCredentials,omitempty"`
	ResponseJWT keyaccess.JWT `json:"responseJwt"`
}

type GetSchemaResponse

type GetSchemaResponse struct {
	*SchemaResponse
}

type GetSubmissionResponse

type GetSubmissionResponse struct {
	*model.Submission
}

type GetSupportedNounsResponse

type GetSupportedNounsResponse struct {
	Nouns []webhook.Noun `json:"nouns,omitempty"`
}

type GetSupportedVerbsResponse

type GetSupportedVerbsResponse struct {
	Verbs []webhook.Verb `json:"verbs,omitempty"`
}

type IssuanceRouter

type IssuanceRouter struct {
	// contains filtered or unexported fields
}

func NewIssuanceRouter

func NewIssuanceRouter(svc svcframework.Service) (*IssuanceRouter, error)

func (IssuanceRouter) CreateIssuanceTemplate

func (ir IssuanceRouter) CreateIssuanceTemplate(c *gin.Context)

CreateIssuanceTemplate godoc

@Summary		Create an issuance template
@Description	Creates an issuance template
@Tags			IssuanceTemplates
@Accept			json
@Produce		json
@Param			request	body		CreateIssuanceTemplateRequest	true	"request body"
@Success		201		{object}	issuance.Template
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/issuancetemplates [put]

func (IssuanceRouter) DeleteIssuanceTemplate

func (ir IssuanceRouter) DeleteIssuanceTemplate(c *gin.Context)

DeleteIssuanceTemplate godoc

@Summary		Delete an issuance template
@Description	Delete an issuance template by its ID
@Tags			IssuanceTemplates
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		204	{string}	string	"No Content"
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/issuancetemplates/{id} [delete]

func (IssuanceRouter) GetIssuanceTemplate

func (ir IssuanceRouter) GetIssuanceTemplate(c *gin.Context)

GetIssuanceTemplate godoc

@Summary		Get an issuance template
@Description	Get an issuance template by its ID
@Tags			IssuanceTemplates
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	issuance.Template
@Failure		400	{string}	string	"Bad request"
@Router			/v1/issuancetemplates/{id} [get]

func (IssuanceRouter) ListIssuanceTemplates

func (ir IssuanceRouter) ListIssuanceTemplates(c *gin.Context)

ListIssuanceTemplates godoc

@Summary		Lists issuance templates
@Description	Lists all issuance templates stored in this service.
@Tags			Issuance
@Accept			json
@Produce		json
@Success		200	{object}	ListIssuanceTemplatesResponse
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/manifests [get]

type KeyStoreRouter

type KeyStoreRouter struct {
	// contains filtered or unexported fields
}

func NewKeyStoreRouter

func NewKeyStoreRouter(s svcframework.Service) (*KeyStoreRouter, error)

func (*KeyStoreRouter) GetKeyDetails

func (ksr *KeyStoreRouter) GetKeyDetails(c *gin.Context)

GetKeyDetails godoc

@Summary		Get details for a key
@Description	Get details about a stored key
@Tags			KeyStore
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID of the key to get"
@Success		200	{object}	GetKeyDetailsResponse
@Failure		400	{string}	string	"Bad request"
@Router			/v1/keys/{id} [get]

func (*KeyStoreRouter) RevokeKey

func (ksr *KeyStoreRouter) RevokeKey(c *gin.Context)

RevokeKey godoc

@Summary		Revoke a key
@Description	Marks a key as being revoked, along with the timestamps of when it was revoked.
@Description	NB: the key can still be used for signing. This will likely be addressed before v1 is released.
@Tags			KeyStore
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID of the key to revoke"
@Success		200	{object}	RevokeKeyResponse
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/keys/{id} [delete]

func (*KeyStoreRouter) StoreKey

func (ksr *KeyStoreRouter) StoreKey(c *gin.Context)

StoreKey godoc

@Summary		Store a keys
@Description	Stores a key to be used by the service
@Tags			KeyStore
@Accept			json
@Produce		json
@Param			request	body	StoreKeyRequest	true	"request body"
@Success		201
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/keys [put]

type ListApplicationsResponse

type ListApplicationsResponse struct {
	Applications []manifestsdk.CredentialApplication `json:"applications"`
}

type ListCredentialsResponse

type ListCredentialsResponse struct {
	// Array of credentials that match the query parameters.
	Credentials []credmodel.Container `json:"credentials,omitempty"`

	// Pagination token to retrieve the next page of results. If the value is "", it means no further results for the request.
	NextPageToken string `json:"nextPageToken"`
}

type ListDIDMethodsResponse

type ListDIDMethodsResponse struct {
	DIDMethods []didsdk.Method `json:"method,omitempty"`
}

type ListDIDsByMethodResponse

type ListDIDsByMethodResponse struct {
	DIDs []didsdk.Document `json:"dids,omitempty"`

	// Pagination token to retrieve the next page of results. If the value is "", it means no further results for the request.
	NextPageToken string `json:"nextPageToken"`
}

type ListDefinitionsResponse

type ListDefinitionsResponse struct {
	Definitions []*exchange.PresentationDefinition `json:"definitions,omitempty"`
}

type ListIssuanceTemplatesResponse

type ListIssuanceTemplatesResponse struct {
	IssuanceTemplates []issuance.Template `json:"issuanceTemplates,omitempty"`
}

type ListManifestRequestsResponse

type ListManifestRequestsResponse struct {
	// The manifest requests matching the query.
	Requests []model.Request `json:"manifestRequests"`
}

type ListManifestResponse

type ListManifestResponse struct {
	ID       string                         `json:"id"`
	Manifest manifestsdk.CredentialManifest `json:"credential_manifest"`
}

type ListManifestsResponse

type ListManifestsResponse struct {
	Manifests []ListManifestResponse `json:"manifests"`
}

type ListOperationsResponse

type ListOperationsResponse struct {
	Operations []Operation `json:"operations"`

	// Pagination token to retrieve the next page of results. If the value is "", it means no further results for the request.
	NextPageToken string `json:"nextPageToken"`
}

type ListPresentationRequestsResponse

type ListPresentationRequestsResponse struct {
	// The presentation requests matching the query.
	Requests []model.Request `json:"presentationRequests"`
}

type ListResponsesResponse

type ListResponsesResponse struct {
	Responses []manifestsdk.CredentialResponse `json:"responses"`
}

type ListSchemasResponse

type ListSchemasResponse struct {
	// Schemas is the list of all schemas the service holds
	Schemas []GetSchemaResponse `json:"schemas,omitempty"`

	// Pagination token to retrieve the next page of results. If the value is "", it means no further results for the request.
	NextPageToken string `json:"nextPageToken"`
}

type ListSubmissionResponse

type ListSubmissionResponse struct {
	Submissions []model.Submission `json:"submissions,omitempty"`

	// Pagination token to retrieve the next page of results. If the value is "", it means no further results for the request.
	NextPageToken string `json:"nextPageToken"`
}

type ListWebhookResponse

type ListWebhookResponse struct {
	Webhook webhook.Webhook `json:"webhook"`
}

type ListWebhooksResponse

type ListWebhooksResponse struct {
	Webhooks []ListWebhookResponse `json:"webhooks,omitempty"`
}

type ManifestRouter

type ManifestRouter struct {
	// contains filtered or unexported fields
}

func NewManifestRouter

func NewManifestRouter(s svcframework.Service) (*ManifestRouter, error)

func (ManifestRouter) CreateManifest

func (mr ManifestRouter) CreateManifest(c *gin.Context)

CreateManifest godoc

@Summary		Create a Credential Manifest
@Description	Create a Credential Manifest. Most fields map to the definitions from https://identity.foundation/credential-manifest/#general-composition.
@Tags			Manifests
@Accept			json
@Produce		json
@Param			request	body		CreateManifestRequest	true	"request body"
@Success		201		{object}	CreateManifestResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/manifests [put]

func (ManifestRouter) CreateRequest

func (mr ManifestRouter) CreateRequest(c *gin.Context)

CreateRequest godoc

@Summary		Create a Credential Manifest Request
@Description	Create a Credential Manifest Request from an existing Credential Manifest.
@Tags			ManifestRequests
@Accept			json
@Produce		json
@Param			request	body		CreateManifestRequestRequest	true	"request body"
@Success		201		{object}	CreateManifestRequestResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/manifests/requests [put]

func (ManifestRouter) DeleteApplication

func (mr ManifestRouter) DeleteApplication(c *gin.Context)

DeleteApplication godoc

@Summary		Delete Credential Applications
@Description	Delete a Credential Application by its ID
@Tags			ManifestApplications
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		204	{string}	string	"No Content"
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/manifests/applications/{id} [delete]

func (ManifestRouter) DeleteManifest

func (mr ManifestRouter) DeleteManifest(c *gin.Context)

DeleteManifest godoc

@Summary		Delete a Credential Manifests
@Description	Delete a Credential Manifest by its ID
@Tags			Manifests
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		204	{string}	string	"No Content"
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/manifests/{id} [delete]

func (ManifestRouter) DeleteRequest

func (mr ManifestRouter) DeleteRequest(c *gin.Context)

DeleteRequest godoc

@Summary		Delete a Credential Manifest Request
@Description	Delete a Credential Manifest Request by its ID
@Tags			ManifestRequests
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		204	{string}	string	"No Content"
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/manifests/requests/{id} [delete]

func (ManifestRouter) DeleteResponse

func (mr ManifestRouter) DeleteResponse(c *gin.Context)

DeleteResponse godoc

@Summary		Delete a Credential Manifest Response
@Description	Delete a Credential Manifest Response by its ID
@Tags			ManifestResponses
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{string}	string	"OK"
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/manifests/responses/{id} [delete]

func (ManifestRouter) GetApplication

func (mr ManifestRouter) GetApplication(c *gin.Context)

GetApplication godoc

@Summary		Get a Credential Application
@Description	Get a Credential Application by its ID
@Tags			ManifestApplications
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	GetApplicationResponse
@Failure		400	{string}	string	"Bad request"
@Router			/v1/manifests/applications/{id} [get]

func (ManifestRouter) GetManifest

func (mr ManifestRouter) GetManifest(c *gin.Context)

GetManifest godoc

@Summary		Get a Credential Manifest
@Description	Get a Credential Manifest by its ID
@Tags			Manifests
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	ListManifestResponse
@Failure		400	{string}	string	"Bad request"
@Router			/v1/manifests/{id} [get]

func (ManifestRouter) GetRequest

func (mr ManifestRouter) GetRequest(c *gin.Context)

GetRequest godoc

@Summary		Get a Credential Manifest Request
@Description	Get a Credential Manifest Request by its ID
@Tags			ManifestRequests
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	GetManifestRequestResponse
@Failure		400	{string}	string	"Bad request"
@Router			/v1/manifests/requests/{id} [get]

func (ManifestRouter) GetResponse

func (mr ManifestRouter) GetResponse(c *gin.Context)

GetResponse godoc

@Summary		Get a Credential Manifest Response
@Description	Get a Credential Manifest Response by its ID https://identity.foundation/credential-manifest/#credential-response
@Tags			ManifestResponses
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	GetResponseResponse
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/manifests/responses/{id} [get]

func (ManifestRouter) ListApplications

func (mr ManifestRouter) ListApplications(c *gin.Context)

ListApplications godoc

@Summary		List Credential Applications
@Description	List all the existing Credential Applications.
@Tags			ManifestApplications
@Accept			json
@Produce		json
@Success		200	{object}	ListApplicationsResponse
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/manifests/applications [get]

func (ManifestRouter) ListManifests

func (mr ManifestRouter) ListManifests(c *gin.Context)

ListManifests godoc

@Summary		List Credential Manifests
@Description	Checks for the presence of a query parameter and calls the associated filtered get method for Credential Manifests
@Tags			Manifests
@Accept			json
@Produce		json
@Param			issuer	query		string	false	"string issuer"
@Param			schema	query		string	false	"string schema"
@Param			subject	query		string	false	"string subject"
@Success		200		{object}	ListManifestsResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/manifests [get]

func (ManifestRouter) ListRequests

func (mr ManifestRouter) ListRequests(c *gin.Context)

ListRequests godoc

@Summary		List Credential Manifest Requests
@Description	Lists all the existing Credential Manifest requests
@Tags			ManifestRequests
@Accept			json
@Produce		json
@Success		200	{object}	ListManifestRequestsResponse
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/manifests/requests [get]

func (ManifestRouter) ListResponses

func (mr ManifestRouter) ListResponses(c *gin.Context)

ListResponses godoc

@Summary		List Credential Manifest Responses
@Description	Lists all responses to Credential Applications associated with a Credential Manifest
@Tags			ManifestResponses
@Accept			json
@Produce		json
@Success		200	{object}	ListResponsesResponse
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/manifests/responses [get]

func (ManifestRouter) ReviewApplication

func (mr ManifestRouter) ReviewApplication(c *gin.Context)

ReviewApplication godoc

@Summary		Review a Credential Application
@Description	Reviewing a Credential Application either fulfills or denies the credential(s) issuance according
@Description	to the spec https://identity.foundation/credential-manifest/#credential-application.
@Tags			ManifestApplications
@Accept			json
@Produce		json
@Param			id		path		string						true	"ID"
@Param			request	body		ReviewApplicationRequest	true	"request body"
@Success		201		{object}	SubmitApplicationResponse	"Credential Response"
@Failure		400		{string}	string						"Bad request"
@Failure		500		{string}	string						"Internal server error"
@Router			/v1/manifests/applications/{id}/review [put]

func (ManifestRouter) SubmitApplication

func (mr ManifestRouter) SubmitApplication(c *gin.Context)

SubmitApplication godoc

@Summary		Submit a Credential Application
@Description	Submit a Credential Application in response to a Credential Manifest request. The request body is expected to
@Description	be a valid JWT signed by the applicant's DID, containing two top level properties: `credential_application` and `vcs`
@Description	according to the spec https://identity.foundation/credential-manifest/#credential-application
@Tags			ManifestApplications
@Accept			json
@Produce		json
@Param			request	body		SubmitApplicationRequest	true	"request body"
@Success		201		{object}	Operation					"Operation with a SubmitApplicationResponse type in the `result.response` field."
@Failure		400		{string}	string						"Bad request"
@Failure		500		{string}	string						"Internal server error"
@Router			/v1/manifests/applications [put]

type Operation

type Operation struct {
	// The name of the resource related to this operation. E.g. "presentations/submissions/<uuid>"
	ID string `json:"id" validate:"required"`

	// Whether this operation has finished.
	Done bool `json:"done" validate:"required"`

	// Populated if Done == true.
	Result OperationResult `json:"result,omitempty"`
}

type OperationResult

type OperationResult struct {
	// Populated when there was an error with the operation.
	Error string `json:"error,omitempty"`

	// Populated iff Error == "". The type should be specified in the calling APIs documentation.
	Response any `json:"response,omitempty"`
}

type OperationRouter

type OperationRouter struct {
	// contains filtered or unexported fields
}

func NewOperationRouter

func NewOperationRouter(s svcframework.Service) (*OperationRouter, error)

func (OperationRouter) CancelOperation

func (o OperationRouter) CancelOperation(c *gin.Context)

CancelOperation godoc

@Summary		Cancel an operation
@Description	Cancels an active operation, if possible.
@Tags			Operations
@Accept			json
@Produce		json
@Param			id	path		string		true	"ID"
@Success		200	{object}	Operation	"OK"
@Failure		400	{string}	string		"Bad request"
@Failure		500	{string}	string		"Internal server error"
@Router			/v1/operations/cancel/{id} [get]

func (OperationRouter) GetOperation

func (o OperationRouter) GetOperation(c *gin.Context)

GetOperation godoc

@Summary		Get an operation
@Description	Get operation by its ID
@Tags			Operations
@Accept			json
@Produce		json
@Param			id	path		string		true	"ID"
@Success		200	{object}	Operation	"OK"
@Failure		400	{string}	string		"Bad request"
@Failure		500	{string}	string		"Internal server error"
@Router			/v1/operations/{id} [get]

func (OperationRouter) ListOperations

func (o OperationRouter) ListOperations(c *gin.Context)

ListOperations godoc

@Summary		List operations
@Description	List operations according to the request
@Tags			Operations
@Accept			json
@Produce		json
@Param			parent		query		string					false	"The name of the parent's resource. For example: `?parent=/presentation/submissions`"
@Param			filter		query		string					false	"A standard filter expression conforming to https://google.aip.dev/160. For example: `?filter=done="true"`"
@Param			pageSize	query		number					false	"Hint to the server of the maximum elements to return. More may be returned. When not set, the server will return all elements."
@Param			pageToken	query		string					false	"Used to indicate to the server to return a specific page of the list results. Must match a previous requests' `nextPageToken`."
@Success		200			{object}	ListOperationsResponse	"OK"
@Failure		400			{string}	string					"Bad request"
@Failure		500			{string}	string					"Internal server error"
@Router			/v1/operations [get]

type PresentationRouter

type PresentationRouter struct {
	// contains filtered or unexported fields
}

func NewPresentationRouter

func NewPresentationRouter(s svcframework.Service) (*PresentationRouter, error)

func (PresentationRouter) CreateDefinition

func (pr PresentationRouter) CreateDefinition(c *gin.Context)

CreateDefinition godoc

@Summary		Create a Presentation Definition
@Description	Create a Presentation Definition https://identity.foundation/presentation-exchange/spec/v2.0.0/#presentation-definition
@Tags			Presentations
@Accept			json
@Produce		json
@Param			request	body		CreatePresentationDefinitionRequest	true	"request body"
@Success		201		{object}	CreatePresentationDefinitionResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/presentations/definitions [put]

func (PresentationRouter) CreateRequest

func (pr PresentationRouter) CreateRequest(c *gin.Context)

CreateRequest godoc

@Summary		Create a Presentation Request
@Description	Create a Presentation Request from an existing Presentation Definition with an existing DID according
@Description	to the spec https://identity.foundation/presentation-exchange/spec/v2.0.0/#presentation-request
@Tags			PresentationRequests
@Accept			json
@Produce		json
@Param			request	body		CreateRequestRequest	true	"request body"
@Success		201		{object}	CreateRequestResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/presentations/requests [put]

func (PresentationRouter) CreateSubmission

func (pr PresentationRouter) CreateSubmission(c *gin.Context)

CreateSubmission godoc

@Summary		Create a Presentation Submission
@Description	Accepts a Presentation Submission (https://identity.foundation/presentation-exchange/spec/v2.0.0/#presentation-submission) in this server ready to be reviewed.
@Tags			PresentationSubmissions
@Accept			json
@Produce		json
@Param			request	body		CreateSubmissionRequest	true	"request body"
@Success		201		{object}	Operation				"The type of response is Submission once the operation has finished."
@Failure		400		{string}	string					"Bad request"
@Failure		500		{string}	string					"Internal server error"
@Router			/v1/presentations/submissions [put]

func (PresentationRouter) DeleteDefinition

func (pr PresentationRouter) DeleteDefinition(c *gin.Context)

DeleteDefinition godoc

@Summary		Delete a Presentation Definition
@Description	Delete a Presentation Definition by its ID
@Tags			Presentations
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		204	{string}	string	"No Content"
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/presentations/definitions/{id} [delete]

func (PresentationRouter) DeleteRequest

func (pr PresentationRouter) DeleteRequest(c *gin.Context)

DeleteRequest godoc

@Summary		Delete a Presentation Request
@Description	Delete a Presentation Request by its ID
@Tags			PresentationRequests
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		204	{string}	string	"No Content"
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/presentations/requests/{id} [delete]

func (PresentationRouter) GetDefinition

func (pr PresentationRouter) GetDefinition(c *gin.Context)

GetDefinition godoc

@Summary		Get a Presentation Definition
@Description	Get a Presentation Definition by its ID
@Tags			Presentations
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	GetPresentationDefinitionResponse
@Failure		400	{string}	string	"Bad request"
@Router			/v1/presentations/definitions/{id} [get]

func (PresentationRouter) GetRequest

func (pr PresentationRouter) GetRequest(c *gin.Context)

GetRequest godoc

@Summary		Get a Presentation Request
@Description	Get a Presentation Request by its ID
@Tags			PresentationRequests
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	GetRequestResponse
@Failure		400	{string}	string	"Bad request"
@Router			/v1/presentations/requests/{id} [get]

func (PresentationRouter) GetSubmission

func (pr PresentationRouter) GetSubmission(c *gin.Context)

GetSubmission godoc

@Summary		Get a Presentation Submission
@Description	Get a Presentation Submission by its ID
@Tags			PresentationSubmissions
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	GetSubmissionResponse
@Failure		400	{string}	string	"Bad request"
@Router			/v1/presentations/submissions/{id} [get]

func (PresentationRouter) ListDefinitions

func (pr PresentationRouter) ListDefinitions(c *gin.Context)

ListDefinitions godoc

@Summary		List Presentation Definitions
@Description	Lists all the existing Presentation Definitions
@Tags			Presentations
@Accept			json
@Produce		json
@Success		200	{object}	ListDefinitionsResponse
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/presentations/definitions [get]

func (PresentationRouter) ListRequests

func (pr PresentationRouter) ListRequests(c *gin.Context)

ListRequests godoc

@Summary		List Presentation Requests
@Description	Lists all the existing Presentation Requests
@Tags			PresentationRequests
@Accept			json
@Produce		json
@Success		200	{object}	ListPresentationRequestsResponse
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/presentations/requests [get]

func (PresentationRouter) ListSubmissions

func (pr PresentationRouter) ListSubmissions(c *gin.Context)

ListSubmissions godoc

@Summary		List Presentation Submissions
@Description	List existing Presentation Submissions according to a filtering query. The `filter` field follows the syntax described in https://google.aip.dev/160.
@Tags			PresentationSubmissions
@Accept			json
@Produce		json
@Param			filter		query		string	false	"A standard filter expression conforming to https://google.aip.dev/160. For example: `?filter=status="pending"`"
@Param			pageSize	query		number	false	"Hint to the server of the maximum elements to return. More may be returned. When not set, the server will return all elements."
@Param			pageToken	query		string	false	"Used to indicate to the server to return a specific page of the list results. Must match a previous requests' `nextPageToken`."
@Success		200			{object}	ListSubmissionResponse
@Failure		400			{string}	string	"Bad request"
@Failure		500			{string}	string	"Internal server error"
@Router			/v1/presentations/submissions [get]

func (PresentationRouter) ReviewSubmission

func (pr PresentationRouter) ReviewSubmission(c *gin.Context)

ReviewSubmission godoc

@Summary		Review a pending Presentation Submission
@Description	Reviews a pending Presentation Submission. After this method is called, the operation with
@Description	`id==presentations/submissions/{submission_id}` will be updated with the result of this invocation.
@Tags			PresentationSubmissions
@Accept			json
@Produce		json
@Param			id		path		string					true	"ID"
@Param			request	body		ReviewSubmissionRequest	true	"request body"
@Success		200		{object}	ReviewSubmissionResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/presentations/submissions/{id}/review [put]

func (PresentationRouter) VerifyPresentation

func (pr PresentationRouter) VerifyPresentation(c *gin.Context)

VerifyPresentation godoc

@Summary		Verifies a Verifiable Presentation
@Description	Verifies a given presentation. The system does the following levels of verification:
@Description	1. Makes sure the presentation has a valid signature
@Description	2. Makes sure the presentation is not expired
@Description	3. Makes sure the presentation complies with https://www.w3.org/TR/vc-data-model/#presentations-0 of VC Data Model v1.1
@Description	4. For each credential in the presentation, makes sure:
@Description	a. Makes sure the credential has a valid signature
@Description	b. Makes sure the credential is not expired
@Description	c. Makes sure the credential complies with the VC Data Model
@Description	d. If the credential has a schema, makes sure its data complies with the schema
@Tags			Presentations
@Accept			json
@Produce		json
@Param			request	body		VerifyPresentationRequest	true	"request body"
@Success		200		{object}	VerifyPresentationResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/presentations/verification [put]

type ResolveDIDResponse

type ResolveDIDResponse struct {
	ResolutionMetadata  *resolution.Metadata         `json:"didResolutionMetadata,omitempty"`
	DIDDocument         *didsdk.Document             `json:"didDocument"`
	DIDDocumentMetadata *resolution.DocumentMetadata `json:"didDocumentMetadata,omitempty"`
}

type ReviewApplicationRequest

type ReviewApplicationRequest struct {
	Approved bool   `json:"approved"`
	Reason   string `json:"reason"`

	// Overrides to apply to the credentials that will be created. Keys are the ID that corresponds to an
	// OutputDescriptor.ID from the manifest.
	CredentialOverrides map[string]model.CredentialOverride `json:"credentialOverrides,omitempty"`
}

type ReviewSubmissionRequest

type ReviewSubmissionRequest struct {
	Approved bool   `json:"approved" validate:"required"`
	Reason   string `json:"reason,omitempty"`
}

type ReviewSubmissionResponse

type ReviewSubmissionResponse struct {
	*model.Submission
}

type RevokeKeyResponse

type RevokeKeyResponse struct {
	ID string `json:"id,omitempty"`
}

type SchemaResponse

type SchemaResponse struct {
	// ID is the URL of for resolution of the schema
	ID string `json:"id"`
	// Type is the type of schema such as `JsonSchema` or `JsonSchemaCredential`
	Type schemalib.VCJSONSchemaType `json:"type" validate:"required"`

	// Schema is the JSON schema for the credential, returned when the type is JsonSchema
	Schema *schemalib.JSONSchema `json:"schema,omitempty"`

	// CredentialSchema is the JWT schema for the credential, returned when the type is CredentialSchema
	CredentialSchema *keyaccess.JWT `json:"credentialSchema,omitempty"`
}

type SchemaRouter

type SchemaRouter struct {
	// contains filtered or unexported fields
}

func NewSchemaRouter

func NewSchemaRouter(s svcframework.Service) (*SchemaRouter, error)

func (SchemaRouter) CreateSchema

func (sr SchemaRouter) CreateSchema(c *gin.Context)

CreateSchema godoc

@Summary		Create a Credential Schema
@Description	Create a schema for use with a Verifiable Credential
@Tags			Schemas
@Accept			json
@Produce		json
@Param			request	body		CreateSchemaRequest	true	"request body"
@Success		201		{object}	CreateSchemaResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/schemas [put]

func (SchemaRouter) DeleteSchema

func (sr SchemaRouter) DeleteSchema(c *gin.Context)

DeleteSchema godoc

@Summary		Delete a Credential Schema
@Description	Delete a Credential Schema by its ID
@Tags			Schemas
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		204	{string}	string	"No Content"
@Failure		400	{string}	string	"Bad request"
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/schemas/{id} [delete]

func (SchemaRouter) GetSchema

func (sr SchemaRouter) GetSchema(c *gin.Context)

GetSchema godoc

@Summary		Get a Credential Schema
@Description	Get a Credential Schema by its ID
@Tags			Schemas
@Accept			json
@Produce		json
@Param			id	path		string	true	"ID"
@Success		200	{object}	GetSchemaResponse
@Failure		400	{string}	string	"Bad request"
@Router			/v1/schemas/{id} [get]

func (SchemaRouter) ListSchemas

func (sr SchemaRouter) ListSchemas(c *gin.Context)

ListSchemas godoc

@Summary		List Credential Schemas
@Description	List Credential Schemas stored by the service
@Tags			Schemas
@Accept			json
@Produce		json
@Param			pageSize	query		number	false	"Hint to the server of the maximum elements to return. More may be returned. When not set, the server will return all elements."
@Param			pageToken	query		string	false	"Used to indicate to the server to return a specific page of the list results. Must match a previous requests' `nextPageToken`."
@Success		200			{object}	ListSchemasResponse
@Failure		500			{string}	string	"Internal server error"
@Router			/v1/schemas [get]

type SingleUpdateCredentialStatusRequest

type SingleUpdateCredentialStatusRequest struct {
	// ID of the credential who's status should be updated.
	ID string `json:"id" validate:"required"`
	UpdateCredentialStatusRequest
}

type StateChange

type StateChange struct {
	ServicesToAdd        []didsdk.Service `json:"servicesToAdd,omitempty"`
	ServiceIDsToRemove   []string         `json:"serviceIdsToRemove,omitempty"`
	PublicKeysToAdd      []ion.PublicKey  `json:"publicKeysToAdd,omitempty"`
	PublicKeyIDsToRemove []string         `json:"publicKeyIdsToRemove"`
}

type StoreKeyRequest

type StoreKeyRequest struct {
	// The `id` field is the unique identifier for this object. If set to a resolvable DID, the ssi-service will use
	// the private key encoded in the `PrivateKeyBase58` field of this object to sign objects issued or authored by this
	// DID; otherwise, it will only be used to identify this object.
	ID string `json:"id" validate:"required"`

	// Identifies the cryptographic algorithm family used with the key.
	// One of the following: "Ed25519", "X25519", "secp256k1", "P-224", "P-256", "P-384", "P-521", "RSA".
	Type crypto.KeyType `json:"type,omitempty" validate:"required"`

	// See https://www.w3.org/TR/did-core/#did-controller
	Controller string `json:"controller,omitempty" validate:"required"`

	// Base58 encoding of the bytes that result from marshalling the private key using golang's implementation.
	PrivateKeyBase58 string `json:"base58PrivateKey,omitempty" validate:"required"`
}

func (StoreKeyRequest) ToServiceRequest

func (sk StoreKeyRequest) ToServiceRequest() (*keystore.StoreKeyRequest, error)

type SubmitApplicationRequest

type SubmitApplicationRequest struct {
	// A JWT signed by the applicant. The payload MUST contain the following properties:
	// - `credential_application`: an object of type manifest.CredentialApplication (specified in https://identity.foundation/credential-manifest/#credential-application).
	// - `vcs`: an array of Verifiable Credentials.
	ApplicationJWT keyaccess.JWT `json:"applicationJwt" validate:"required"`
}

type SubmitApplicationResponse

type SubmitApplicationResponse struct {
	Response manifestsdk.CredentialResponse `json:"credential_response"`
	// this is an any type to union Data Integrity and JWT style VCs
	Credentials []any         `json:"verifiableCredentials,omitempty"`
	ResponseJWT keyaccess.JWT `json:"responseJwt,omitempty"`
}

type UpdateCredentialStatusRequest

type UpdateCredentialStatusRequest struct {
	// The new revoked status of this credential. The status will be saved in the encodedList of the StatusList2021
	// credential associated with this VC.
	Revoked   bool `json:"revoked,omitempty"`
	Suspended bool `json:"suspended,omitempty"`
}

type UpdateCredentialStatusResponse

type UpdateCredentialStatusResponse struct {
	// The updated status of this credential.
	Revoked   bool `json:"revoked"`
	Suspended bool `json:"suspended"`
}

type UpdateDIDByMethodRequest

type UpdateDIDByMethodRequest struct {
	// Expected to be populated when `method == "ion"`. Describes the changes that are requested.
	StateChange StateChange `json:"stateChange" validate:"required"`
}

type UpdateDIDByMethodResponse

type UpdateDIDByMethodResponse struct {
	DID didsdk.Document `json:"did,omitempty"`
}

type VerifyCredentialRequest

type VerifyCredentialRequest struct {
	// A credential secured via data integrity. Must have the "proof" property set.
	DataIntegrityCredential *credsdk.VerifiableCredential `json:"credential,omitempty"`

	// A JWT that encodes a credential.
	CredentialJWT *keyaccess.JWT `json:"credentialJwt,omitempty"`
}

func (VerifyCredentialRequest) IsValid

func (vcr VerifyCredentialRequest) IsValid() bool

type VerifyCredentialResponse

type VerifyCredentialResponse struct {
	// Whether the credential was verified.
	Verified bool `json:"verified"`

	// The reason why this credential couldn't be verified.
	Reason string `json:"reason,omitempty"`
}

type VerifyPresentationRequest

type VerifyPresentationRequest struct {
	// A JWT that encodes a verifiable presentation according to https://www.w3.org/TR/vc-data-model/#json-web-token
	PresentationJWT *keyaccess.JWT `json:"presentationJwt,omitempty" validate:"required"`
}

type VerifyPresentationResponse

type VerifyPresentationResponse struct {
	// Whether the presentation was verified.
	Verified bool `json:"verified"`

	// The reason why this presentation couldn't be verified.
	Reason string `json:"reason,omitempty"`
}

type WebhookRouter

type WebhookRouter struct {
	// contains filtered or unexported fields
}

func NewWebhookRouter

func NewWebhookRouter(s svcframework.Service) (*WebhookRouter, error)

func (WebhookRouter) CreateWebhook

func (wr WebhookRouter) CreateWebhook(c *gin.Context)

CreateWebhook godoc

@Summary		Create a webhook
@Description	Creates a webhook
@Tags			Webhooks
@Accept			json
@Produce		json
@Param			request	body		CreateWebhookRequest	true	"request body"
@Success		201		{object}	CreateWebhookResponse
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/webhooks [put]

func (WebhookRouter) DeleteWebhook

func (wr WebhookRouter) DeleteWebhook(c *gin.Context)

DeleteWebhook godoc

@Summary		Delete a webhook
@Description	Delete a webhook by its ID
@Tags			Webhooks
@Accept			json
@Produce		json
@Param			noun	path		string	true	"noun"
@Param			verb	path		string	true	"verb"
@Param			url		path		string	true	"url"
@Success		204		{string}	string	"No Content"
@Failure		400		{string}	string	"Bad request"
@Failure		500		{string}	string	"Internal server error"
@Router			/v1/webhooks/{noun}/{verb}/{url} [delete]

func (WebhookRouter) GetSupportedNouns

func (wr WebhookRouter) GetSupportedNouns(c *gin.Context)

GetSupportedNouns godoc

@Summary		Get supported webhook nouns
@Description	Get supported nouns for webhook generation
@Tags			Webhooks
@Accept			json
@Produce		json
@Success		200	{object}	webhook.GetSupportedNounsResponse
@Router			/v1/webhooks/nouns [get]

func (WebhookRouter) GetSupportedVerbs

func (wr WebhookRouter) GetSupportedVerbs(c *gin.Context)

GetSupportedVerbs godoc

@Summary		Get supported webhook verbs
@Description	Get supported verbs for webhook generation
@Tags			Webhooks
@Accept			json
@Produce		json
@Success		200	{object}	webhook.GetSupportedVerbsResponse
@Router			/v1/webhooks/verbs [get]

func (WebhookRouter) GetWebhook

func (wr WebhookRouter) GetWebhook(c *gin.Context)

GetWebhook godoc

@Summary		Get a webhook
@Description	Get a webhook by its ID
@Tags			Webhooks
@Accept			json
@Produce		json
@Param			noun	path		string	true	"noun"
@Param			verb	path		string	true	"verb"
@Success		200		{object}	ListWebhookResponse
@Failure		400		{string}	string	"Bad request"
@Router			/v1/webhooks/{noun}/{verb} [get]

func (WebhookRouter) ListWebhooks

func (wr WebhookRouter) ListWebhooks(c *gin.Context)

ListWebhooks godoc

@Summary		List webhooks
@Description	Lists all webhooks stored by the service
@Tags			Webhooks
@Accept			json
@Produce		json
@Success		200	{object}	ListWebhooksResponse
@Failure		500	{string}	string	"Internal server error"
@Router			/v1/webhooks [get]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL