Documentation ¶
Index ¶
- Constants
- func Register(ctx map[string]interface{}, r chi.Router)
- type AddRole
- type Bootstrapper
- type CloneDocumentRequest
- type CreateDocumentRequest
- type RemoveCollaboratorsRequest
- type Role
- type Service
- func (s Service) AddRole(ctx context.Context, docID []byte, roleKey string, dids []identity.DID) (*coredocumentpb.Role, error)
- func (s Service) AddSignedAttribute(ctx context.Context, docID []byte, label string, payload []byte, ...) (documents.Model, error)
- func (s Service) AddTransitionRules(ctx context.Context, docID []byte, addRules pending.AddTransitionRules) ([]*coredocumentpb.TransitionRule, error)
- func (s Service) CloneDocument(ctx context.Context, payload documents.ClonePayload) (documents.Model, error)
- func (s Service) Commit(ctx context.Context, docID []byte) (documents.Model, jobs.JobID, error)
- func (s Service) CreateDocument(ctx context.Context, req documents.UpdatePayload) (documents.Model, error)
- func (s Service) DeleteTransitionRule(ctx context.Context, docID, ruleID []byte) error
- func (s Service) GetDocument(ctx context.Context, docID []byte, status documents.Status) (documents.Model, error)
- func (s Service) GetDocumentVersion(ctx context.Context, docID, versionID []byte) (documents.Model, error)
- func (s Service) GetRole(ctx context.Context, docID, roleID []byte) (*coredocumentpb.Role, error)
- func (s Service) GetTransitionRule(ctx context.Context, docID, ruleID []byte) (*coredocumentpb.TransitionRule, error)
- func (s Service) PushAttributeToOracle(ctx context.Context, docID []byte, req oracle.PushAttributeToOracleRequest) (*oracle.PushToOracleResponse, error)
- func (s Service) RemoveCollaborators(ctx context.Context, docID []byte, dids []identity.DID) (documents.Model, error)
- func (s Service) UpdateDocument(ctx context.Context, req documents.UpdatePayload) (documents.Model, error)
- func (s Service) UpdateRole(ctx context.Context, docID, roleID []byte, dids []identity.DID) (*coredocumentpb.Role, error)
- type SignedAttributeRequest
- type TransitionRule
- type TransitionRules
- type UpdateDocumentRequest
- type UpdateRole
Constants ¶
const BootstrappedService = "V2 Service"
BootstrappedService key maps to the Service implementation in Bootstrap context.
const ErrInvalidRoleID = errors.Error("Invalid RoleID")
ErrInvalidRoleID for invalid roleID in the api path.
const ErrInvalidRuleID = errors.Error("Invalid Transition Rule ID")
ErrInvalidRuleID for invalid ruleID in the api path.
const RoleIDParam = "role_id"
RoleIDParam is the key for roleID in the API path.
const RuleIDParam = "rule_id"
RuleIDParam is the key for ruleID in the API path.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddRole ¶
type AddRole struct { // Key is either hex encoded 32 byte ID or string label. // String label is used as a preimage to sha256 for 32 byte hash. Key string `json:"key"` Collaborators []identity.DID `json:"collaborators" swaggertype:"array,string"` }
AddRole used for marshalling add request for role.
type Bootstrapper ¶
type Bootstrapper struct{}
Bootstrapper implements bootstrap.Bootstrapper.
func (Bootstrapper) Bootstrap ¶
func (b Bootstrapper) Bootstrap(ctx map[string]interface{}) error
Bootstrap adds transaction.Repository into context.
type CloneDocumentRequest ¶ added in v1.2.0
type CloneDocumentRequest struct {
Scheme string `json:"scheme" enums:"generic,entity"`
}
CloneDocumentRequest defines the payload for creating documents.
type CreateDocumentRequest ¶
type CreateDocumentRequest struct { coreapi.CreateDocumentRequest DocumentID byteutils.OptionalHex `json:"document_id" swaggertype:"primitive,string"` // if provided, creates the next version of the document. }
CreateDocumentRequest defines the payload for creating documents.
type RemoveCollaboratorsRequest ¶
type RemoveCollaboratorsRequest struct {
Collaborators []identity.DID `json:"collaborators" swaggertype:"array,string"`
}
RemoveCollaboratorsRequest contains the list of collaborators that are to be removed from the document
type Role ¶
type Role struct { ID byteutils.HexBytes `json:"id" swaggertype:"primitive,string"` Collaborators []byteutils.HexBytes `json:"collaborators" swaggertype:"array,string"` }
Role is a single role in the document.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the entry point for all the V2 APIs.
func (Service) AddRole ¶
func (s Service) AddRole(ctx context.Context, docID []byte, roleKey string, dids []identity.DID) (*coredocumentpb.Role, error)
AddRole adds a new role to the document
func (Service) AddSignedAttribute ¶
func (s Service) AddSignedAttribute(ctx context.Context, docID []byte, label string, payload []byte, valType documents.AttributeType) (documents.Model, error)
AddSignedAttribute signs the payload with acc signing key and add it the document associated with docID.
func (Service) AddTransitionRules ¶
func (s Service) AddTransitionRules( ctx context.Context, docID []byte, addRules pending.AddTransitionRules) ([]*coredocumentpb.TransitionRule, error)
AddTransitionRules adds new rules to the document
func (Service) CloneDocument ¶ added in v1.2.0
func (s Service) CloneDocument(ctx context.Context, payload documents.ClonePayload) (documents.Model, error)
CloneDocument creates a new cloned document from the template (docID specified in payload).
func (Service) CreateDocument ¶
func (s Service) CreateDocument(ctx context.Context, req documents.UpdatePayload) (documents.Model, error)
CreateDocument creates a pending document from the given payload. if the document_id is provided, next version of the document is created.
func (Service) DeleteTransitionRule ¶
DeleteTransitionRule deletes the transition rule associated with ruleID from the document.
func (Service) GetDocument ¶
func (s Service) GetDocument(ctx context.Context, docID []byte, status documents.Status) (documents.Model, error)
GetDocument returns the document associated with docID and status.
func (Service) GetDocumentVersion ¶
func (s Service) GetDocumentVersion(ctx context.Context, docID, versionID []byte) (documents.Model, error)
GetDocumentVersion returns the specific version of the document.
func (Service) GetTransitionRule ¶
func (s Service) GetTransitionRule(ctx context.Context, docID, ruleID []byte) (*coredocumentpb.TransitionRule, error)
GetTransitionRule returns the transition rule associated with ruleID in the document.
func (Service) PushAttributeToOracle ¶ added in v1.2.0
func (s Service) PushAttributeToOracle( ctx context.Context, docID []byte, req oracle.PushAttributeToOracleRequest) (*oracle.PushToOracleResponse, error)
PushAttributeToOracle pushes a given attribute in a given document to the oracle
func (Service) RemoveCollaborators ¶
func (s Service) RemoveCollaborators(ctx context.Context, docID []byte, dids []identity.DID) (documents.Model, error)
RemoveCollaborators removes collaborators from the document.
func (Service) UpdateDocument ¶
func (s Service) UpdateDocument(ctx context.Context, req documents.UpdatePayload) (documents.Model, error)
UpdateDocument updates a pending document with the given payload
type SignedAttributeRequest ¶
type SignedAttributeRequest struct { Label string `json:"label"` Type string `json:"type" enums:"integer,string,bytes,timestamp"` Payload string `json:"payload"` }
SignedAttributeRequest contains the payload to be signed and added to the document.
type TransitionRule ¶
type TransitionRule struct { RuleID byteutils.HexBytes `json:"rule_id" swaggertype:"primitive,string"` Action string `json:"action"` Roles []byteutils.HexBytes `json:"roles,omitempty" swaggertype:"array,string"` Field byteutils.HexBytes `json:"field,omitempty" swaggertype:"primitive,string"` AttributeLabels []byteutils.HexBytes `json:"attribute_labels,omitempty" swaggertype:"array,string"` Wasm byteutils.HexBytes `json:"wasm,omitempty" swaggertype:"primitive,string"` TargetAttributeLabel string `json:"target_attribute_label,omitempty"` }
TransitionRule holds the ruleID, roles, and fields in hex format
type TransitionRules ¶
type TransitionRules struct {
Rules []TransitionRule `json:"rules"`
}
TransitionRules holds the list of transition rule.
type UpdateDocumentRequest ¶
type UpdateDocumentRequest struct {
coreapi.CreateDocumentRequest
}
UpdateDocumentRequest defines the payload to patch an existing document.
type UpdateRole ¶
type UpdateRole struct {
Collaborators []identity.DID `json:"collaborators" swaggertype:"array,string"`
}
UpdateRole holds the collaborators that are to be replaced with older one in the role.