Documentation ¶
Index ¶
- type AnchorDocument
- type AnchorDocumentType
- type AnchoringInfo
- type Client
- type ClientProvider
- type DocumentComposer
- type DocumentTransformer
- type DocumentValidator
- type OperationApplier
- type OperationHandler
- type OperationParser
- type OperationProvider
- type Protocol
- type ResolutionModel
- type TransformationInfo
- type TxnProcessor
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnchorDocument ¶ added in v0.7.0
type AnchorDocument struct { ID string Desc string Type AnchorDocumentType }
AnchorDocument describes Sidetree batch files.
type AnchorDocumentType ¶ added in v0.7.0
type AnchorDocumentType string
AnchorDocumentType defines valid values for anchor document type.
const ( // TypePermanent captures "permanent" anchor document type. TypePermanent AnchorDocumentType = "permanent" // TypeProvisional captures "provisional" anchor document type. TypeProvisional AnchorDocumentType = "provisional" )
type AnchoringInfo ¶ added in v1.0.0
type AnchoringInfo struct { AnchorString string Artifacts []*AnchorDocument OperationReferences []*operation.Reference AdditionalOperations []*operation.QueuedOperation ExpiredOperations []*operation.QueuedOperation }
AnchoringInfo contains anchoring info plus additional batch information.
type Client ¶
type Client interface { // Current returns latest version of protocol. Current() (Version, error) // Get returns the version at the given transaction time. Get(transactionTime uint64) (Version, error) }
Client defines interface for accessing protocol version/information.
type ClientProvider ¶ added in v0.1.4
ClientProvider returns a protocol client for the given namespace.
type DocumentComposer ¶ added in v0.1.5
type DocumentComposer interface {
ApplyPatches(doc document.Document, patches []patch.Patch) (document.Document, error)
}
DocumentComposer applies patches to the given document.
type DocumentTransformer ¶ added in v0.1.5
type DocumentTransformer interface {
TransformDocument(rm *ResolutionModel, info TransformationInfo) (*document.ResolutionResult, error)
}
DocumentTransformer transforms internal resolution model into external document(resolution result).
type DocumentValidator ¶ added in v0.1.5
type DocumentValidator interface { IsValidOriginalDocument(payload []byte) error IsValidPayload(payload []byte) error }
DocumentValidator is an interface for validating document operations.
type OperationApplier ¶ added in v0.1.5
type OperationApplier interface {
Apply(op *operation.AnchoredOperation, rm *ResolutionModel) (*ResolutionModel, error)
}
OperationApplier applies the given operation to the document.
type OperationHandler ¶ added in v0.1.5
type OperationHandler interface { // PrepareTxnFiles operations will create relevant batch files, store them in CAS and return anchor string. PrepareTxnFiles(ops []*operation.QueuedOperation) (*AnchoringInfo, error) }
OperationHandler defines an interface for creating batch files.
type OperationParser ¶ added in v0.1.5
type OperationParser interface { Parse(namespace string, operation []byte) (*operation.Operation, error) ParseDID(namespace, shortOrLongFormDID string) (string, []byte, error) GetRevealValue(operation []byte) (string, error) GetCommitment(operation []byte) (string, error) }
OperationParser defines the functions for parsing operations.
type OperationProvider ¶ added in v0.1.5
type OperationProvider interface {
GetTxnOperations(sidetreeTxn *txn.SidetreeTxn) ([]*operation.AnchoredOperation, error)
}
OperationProvider retrieves the anchored operations for the given Sidetree transaction.
type Protocol ¶
type Protocol struct { // GenesisTime is inclusive starting logical anchoring time that this protocol applies to. // (e.g. block number in a blockchain) GenesisTime uint64 `json:"genesisTime"` // MultihashAlgorithms are supported multihash algorithm codes MultihashAlgorithms []uint `json:"multihashAlgorithms"` // MaxOperationCount defines maximum number of operations per batch. MaxOperationCount uint `json:"maxOperationCount"` // MaxOperationSize is maximum operation size in bytes (used to reject operations before parsing them) // It has to be greater than max delta size (big) + max proof size (medium) + other small values (operation type, suffix-data) MaxOperationSize uint `json:"maxOperationSize"` // MaxOperationHashLength is maximum operation hash length MaxOperationHashLength uint `json:"maxOperationHashLength"` // MaxDeltaSize is maximum size of operation's delta property. MaxDeltaSize uint `json:"maxDeltaSize"` // MaxCasUriLength is maximum length of CAS URI in batch files. MaxCasURILength uint `json:"maxCasUriLength"` // CompressionAlgorithm is file compression algorithm. CompressionAlgorithm string `json:"compressionAlgorithm"` // MaxCoreIndexFileSize is maximum allowed size (in bytes) of core index file stored in CAS. MaxCoreIndexFileSize uint `json:"maxCoreIndexFileSize"` // MaxProofFileSize is maximum allowed size (in bytes) of proof files stored in CAS. MaxProofFileSize uint `json:"maxProofFileSize"` // MaxProvisionalIndexFileSize is maximum allowed size (in bytes) of provisional index file stored in CAS. MaxProvisionalIndexFileSize uint `json:"maxProvisionalIndexFileSize"` // MaxChunkFileSize is maximum allowed size (in bytes) of chunk file stored in CAS. MaxChunkFileSize uint `json:"maxChunkFileSize"` // Patches contains the list of allowed patches. Patches []string `json:"patches"` // SignatureAlgorithms contain supported signature algorithms for signed operations (e.g. EdDSA, ES256, ES384, ES512, ES256K). SignatureAlgorithms []string `json:"signatureAlgorithms"` // KeyAlgorithms contain supported key algorithms for signed operations (e.g. secp256k1, P-256, P-384, P-512, Ed25519). KeyAlgorithms []string `json:"keyAlgorithms"` // MaxOperationTimeDelta is maximum time that operation should be valid before it expires; used with anchor from time MaxOperationTimeDelta uint64 `json:"maxOperationTimeDelta"` // NonceSize is the number of bytes in nonce values NonceSize uint64 `json:"nonceSize"` // MaxMemoryDecompressionFactor is maximum file size after decompression (e.g. 3 times maximum file size) MaxMemoryDecompressionFactor uint `json:"maxMemoryDecompressionFactor"` }
Protocol defines protocol parameters.
type ResolutionModel ¶ added in v0.1.5
type ResolutionModel struct { Doc document.Document CreatedTime uint64 UpdatedTime uint64 LastOperationTransactionTime uint64 LastOperationTransactionNumber uint64 LastOperationProtocolVersion uint64 UpdateCommitment string RecoveryCommitment string Deactivated bool AnchorOrigin interface{} EquivalentReferences []string CanonicalReference string VersionID string PublishedOperations []*operation.AnchoredOperation UnpublishedOperations []*operation.AnchoredOperation }
ResolutionModel contains temporary data during document resolution.
type TransformationInfo ¶ added in v0.1.5
type TransformationInfo map[string]interface{}
TransformationInfo contains document transformation info.
type TxnProcessor ¶ added in v0.1.5
type TxnProcessor interface {
Process(sidetreeTxn txn.SidetreeTxn, suffixes ...string) (numProcessed int, err error)
}
TxnProcessor defines the functions for processing a Sidetree transaction.
type Version ¶ added in v0.1.5
type Version interface { Version() string Protocol() Protocol TransactionProcessor() TxnProcessor OperationParser() OperationParser OperationApplier() OperationApplier OperationHandler() OperationHandler OperationProvider() OperationProvider DocumentComposer() DocumentComposer DocumentValidator() DocumentValidator DocumentTransformer() DocumentTransformer }
Version contains the protocol and corresponding implementations that are compatible with the protocol version.