Documentation ¶
Index ¶
- Constants
- Variables
- func Concat(vs ...[]byte) []byte
- func ConvertToLinkedDataProof(proof interface{}) (*linkeddata.Proof, error)
- func FindLinkedDataProof(proofs interface{}) (*linkeddata.Proof, error)
- func HashDID(did *didlib.DID) ([]byte, error)
- func NewClaimFromEntry(entry *merkletree.Entry) (merkletree.Claim, error)
- type ClaimRegisteredDocument
- type ClaimSetRootKeyDID
- type ContentCredential
- type ContentCredentialSubject
- type ContentSubject
- type Credential
- type CredentialSchema
- type CredentialType
- type LicenseCredential
- type LicenserSubject
Constants ¶
const ( // ContentCredentialDocType is an enum value that differentiates content credentials from other document types that may be registered later ContentCredentialDocType uint32 = iota // LicenseCredentialDocType is an enum value that differentiates license credentials from other documents LicenseCredentialDocType uint32 = iota // JWTDocType is an enum value that differentiates jwts from other documents JWTDocType uint32 = iota // RawDataDocType is an enum value that represents unparsable data RawDataDocType uint32 = iota )
const ( // RootInContract is a proof that indicates the root value is in the blockchain RootInContract string = "RootInContract" // MerkleProof is proof that the entry is in the tree MerkleProof string = "MerkleProof" )
Variables ¶
var ClaimTypeRegisteredDocument = core.NewClaimTypeNum(11)
ClaimTypeRegisteredDocument is the type indicator for the registered document claim
var ClaimTypeSetRootKeyDID = core.NewClaimTypeNum(10)
ClaimTypeSetRootKeyDID this claimtype marks a new root key for a did tree
Functions ¶
func Concat ¶
Concat is a internal method from iden3 db that seemed necessary to implement the interface
func ConvertToLinkedDataProof ¶
func ConvertToLinkedDataProof(proof interface{}) (*linkeddata.Proof, error)
ConvertToLinkedDataProof returns a linkeddata.Proof from the proof interface{} value
func FindLinkedDataProof ¶
func FindLinkedDataProof(proofs interface{}) (*linkeddata.Proof, error)
FindLinkedDataProof returns the first the linked data proof in the proof slice
func HashDID ¶
HashDID uses poseidon to hash the did to create a hash that fits in the merkletree's 31 byte limit
func NewClaimFromEntry ¶
func NewClaimFromEntry(entry *merkletree.Entry) (merkletree.Claim, error)
NewClaimFromEntry extends iden3 NewClaimFromEntry with our claim types
Types ¶
type ClaimRegisteredDocument ¶
type ClaimRegisteredDocument struct { Version uint32 ContentHash [34]byte DID [32]byte DocType uint32 }
ClaimRegisteredDocument is a claim type for registering other claims like signed claims in the merkle tree
func NewClaimRegisteredDocument ¶
func NewClaimRegisteredDocument(ch [34]byte, did *didlib.DID, dt uint32) (*ClaimRegisteredDocument, error)
NewClaimRegisteredDocument creates a new ClaimRegisteredDocument from a did a contentHash and a type
func NewClaimRegisteredDocumentFromEntry ¶
func NewClaimRegisteredDocumentFromEntry(e *merkletree.Entry) *ClaimRegisteredDocument
NewClaimRegisteredDocumentFromEntry turns a merkletree Entry into a ClaimRegisteredDocument
func (ClaimRegisteredDocument) Entry ¶
func (c ClaimRegisteredDocument) Entry() *merkletree.Entry
Entry converts the ClaimRegisteredDocument into a merkletree entry
func (*ClaimRegisteredDocument) Type ¶
func (c *ClaimRegisteredDocument) Type() core.ClaimType
Type returns the type of the claim
type ClaimSetRootKeyDID ¶
type ClaimSetRootKeyDID struct { // Version is the claim version. Version uint32 // Era is used for labeling epochs. Era uint32 // DID is the DID related to the root key represented in bytes DID [32]byte // RootKey is the root of the merkle tree. RootKey merkletree.Hash }
ClaimSetRootKeyDID is a claim of the root key of a merkle tree that goes into the relay. this is changed slightly from the version in Iden3 to use our dids instead of there ID type
func NewClaimSetRootKeyDID ¶
func NewClaimSetRootKeyDID(did *didlib.DID, rootKey *merkletree.Hash) (*ClaimSetRootKeyDID, error)
NewClaimSetRootKeyDID returns a ClaimSetRootKey with the given Eth ID and merklee tree root key.
func NewClaimSetRootKeyDIDFromEntry ¶
func NewClaimSetRootKeyDIDFromEntry(e *merkletree.Entry) *ClaimSetRootKeyDID
NewClaimSetRootKeyDIDFromEntry deserializes a ClaimSetRootKeyDID from an Entry.
func (ClaimSetRootKeyDID) Entry ¶
func (c ClaimSetRootKeyDID) Entry() *merkletree.Entry
Entry serializes the claim into an Entry.
func (*ClaimSetRootKeyDID) Type ¶
func (c *ClaimSetRootKeyDID) Type() core.ClaimType
Type returns the ClaimType of the claim.
type ContentCredential ¶
type ContentCredential struct { Context []string `json:"@context"` Type []CredentialType `json:"type"` CredentialSubject ContentCredentialSubject `json:"credentialSubject"` Issuer string `json:"issuer"` Holder string `json:"holder,omitempty"` CredentialSchema CredentialSchema `json:"credentialSchema"` IssuanceDate time.Time `json:"issuanceDate"` Proof interface{} `json:"proof,omitempty"` }
ContentCredential a credential that claims a piece of content https://www.w3.org/TR/vc-data-model/#basic-concepts
func (*ContentCredential) CanonicalizeCredential ¶
func (c *ContentCredential) CanonicalizeCredential() ([]byte, error)
CanonicalizeCredential removes the proof and returns json bytes
func (*ContentCredential) FindLinkedDataProof ¶
func (c *ContentCredential) FindLinkedDataProof() (*linkeddata.Proof, error)
FindLinkedDataProof returns the first the linked data proof in the proof slice
type ContentCredentialSubject ¶
type ContentCredentialSubject struct { ID string `json:"id"` Metadata article.Metadata `json:"metadata"` }
ContentCredentialSubject the datatype for claiming a piece of content https://www.w3.org/TR/vc-data-model/#credential-subject
type ContentSubject ¶
ContentSubject represents the content being licensed https://www.w3.org/TR/vc-data-model/#credential-subject
type Credential ¶
type Credential interface { CanonicalizeCredential() ([]byte, error) FindLinkedDataProof() (*linkeddata.Proof, error) }
Credential is a common interface for credentials
type CredentialSchema ¶
CredentialSchema for specifying schemas for a credential type https://www.w3.org/TR/vc-data-model/#data-schemas
type CredentialType ¶
type CredentialType string
CredentialType is a non-exclusive type for a credential
const ( // VerifiableCredentialType standard credential type VerifiableCredentialType CredentialType = "VerifiableCredential" // ContentCredentialType marks the credential as a content credential ContentCredentialType CredentialType = "ContentCredential" // LicenseCredentialType marks the credential as a license credential LicenseCredentialType CredentialType = "LicenseCredential" )
type LicenseCredential ¶
type LicenseCredential struct { Context []string `json:"@context"` Type []CredentialType `json:"type"` CredentialSubject interface{} `json:"credentialSubject"` Issuer string `json:"issuer"` Holder string `json:"holder,omitempty"` CredentialSchema CredentialSchema `json:"credentialSchema"` IssuanceDate time.Time `json:"issuanceDate"` ExpirationDate time.Time `json:"expirationDate"` Proof interface{} `json:"proof,omitempty"` }
LicenseCredential a credential that represents the righ to use some content granted by the owner https://www.w3.org/TR/vc-data-model/#basic-concepts
func (*LicenseCredential) CanonicalizeCredential ¶
func (c *LicenseCredential) CanonicalizeCredential() ([]byte, error)
CanonicalizeCredential converts the cred into a predictable json format for signing
func (*LicenseCredential) FindLinkedDataProof ¶
func (c *LicenseCredential) FindLinkedDataProof() (*linkeddata.Proof, error)
FindLinkedDataProof returns the first the linked data proof in the proof slice
type LicenserSubject ¶
LicenserSubject is the ententity licensing the content https://www.w3.org/TR/vc-data-model/#credential-subject