Documentation ¶
Index ¶
- Variables
- func Contains(field string, required []string) bool
- func Format(field interface{}) string
- func GenerateB64EncodedEd25519DIDDoc(b64EncodedPrivKey string) (string, error)
- func GenerateB64EncodedEd25519DeactivatedDIDDoc(b64EncodedPrivKey, b64EncDID string) (string, error)
- func GenerateKeyDIDDoc(publicKey ed25519.PublicKey, keyRef string) *did.DIDDoc
- func GenerateRevocationKey(issuerDID did.DID, credentialID string) string
- func GenerateSchemaID(author did.DID, version string) string
- func GetKeyDef(ctx context.Context, did did.DID, keyID string, provider DIDDocProvider) (*did.KeyDef, error)
- func Type(field interface{}) string
- func ValidateDID(did did.DID) error
- func ValidateRevocations(ctx context.Context, revocations []Revocation, provider Provider) error
- func ValidateSchemaID(id string) error
- func Verify(ctx context.Context, provable proof.Provable, provider DIDDocProvider) error
- type DIDDoc
- func (d *DIDDoc) GetProof() *proof.Proof
- func (d *DIDDoc) IsEmpty() bool
- func (d *DIDDoc) SetProof(p *proof.Proof)
- func (d DIDDoc) Validate(ctx context.Context, provider DIDDocProvider) error
- func (d DIDDoc) ValidateDeactivated() error
- func (d DIDDoc) ValidateMetadata() error
- func (d *DIDDoc) ValidateNotEmpty() error
- func (d DIDDoc) ValidateProof() error
- func (d DIDDoc) ValidateStatic() error
- func (d DIDDoc) ValidateUniqueness(ctx context.Context, provider DIDDocProvider) error
- type DIDDocProvider
- type GenerateDIDDocInput
- type HasLedgerMetadata
- type HasLedgerMetadataProvable
- type JSONSchema
- type JSONSchemaMap
- type Metadata
- type Properties
- type Provider
- type Revocation
- func (r *Revocation) IsEmpty() bool
- func (r Revocation) Validate(ctx context.Context, provider Provider) error
- func (r Revocation) ValidateKey() error
- func (r Revocation) ValidateMetadata() error
- func (r Revocation) ValidateNotEmpty() error
- func (r Revocation) ValidateProof(ctx context.Context, provider DIDDocProvider) error
- func (r Revocation) ValidateStatic() error
- func (r Revocation) ValidateUniqueness(ctx context.Context, provider RevocationProvider) error
- type RevocationProvider
- type Schema
- func (s *Schema) IsEmpty() bool
- func (s Schema) Validate(ctx context.Context, provider Provider) error
- func (s Schema) ValidateID() error
- func (s Schema) ValidateMetadata() error
- func (s Schema) ValidateNotEmpty() error
- func (s Schema) ValidateProof(ctx context.Context, provider DIDDocProvider) error
- func (s Schema) ValidateStatic() error
- func (s Schema) ValidateUniqueness(ctx context.Context, provider SchemaProvider) error
- func (s Schema) Version() (string, error)
- type SchemaProvider
- type UnsignedRevocation
Constants ¶
This section is empty.
Variables ¶
var IDRx = regexp.MustCompile(idRxStr)
Functions ¶
func GenerateB64EncodedEd25519DIDDoc ¶
GenerateB64EncodedEd25519DIDDoc creates a DIDDoc from a base64 encoded ed25519 PrivateKey.
func GenerateB64EncodedEd25519DeactivatedDIDDoc ¶
func GenerateB64EncodedEd25519DeactivatedDIDDoc(b64EncodedPrivKey, b64EncDID string) (string, error)
GenerateB64EncodedEd25519DeactivatedDIDDoc creates a deactivated DID Document and returns it as base64 encoded JSON. Returns an error if the either the base64 encoded arguments cannot be decoded or if the key material is not a valid Ed25519 private key.
func GenerateKeyDIDDoc ¶
GenerateKeyDIDDoc generates DID Document as defined by The did:key Method based on supplied ED25519 Public Key and keyref.
func GenerateRevocationKey ¶
GenerateRevocationKey creates a hash of the issuer DID and the credential ID. This hash is used as the revocation ID. Revocations are issued by the Issuer of the credential. Using the issuer's DID in the hash effectively creates namespace for that issuer. The expectation is that the credential ID is a UUID and is therefore unique per credential. Hashing the two values together obfuscates the issuer's ID on the blockchain. Only parties that have already seen the credential, and therefore now the credential ID and issuer DID will be able to look up the revocation status in the ledger. This is intended to prevent data mining on the revocations store in an attempt to learn anything about the issuer.
func GetKeyDef ¶
func GetKeyDef(ctx context.Context, did did.DID, keyID string, provider DIDDocProvider) (*did.KeyDef, error)
GetKeyDef returns the Ed25519 public key with the given Key ID located on the DID Document.
func ValidateDID ¶
func ValidateRevocations ¶
func ValidateRevocations(ctx context.Context, revocations []Revocation, provider Provider) error
Revocation //
func ValidateSchemaID ¶
Types ¶
type DIDDoc ¶
func GenerateDeactivatedDIDDoc ¶
func GenerateDeactivatedDIDDoc(signer proof.Signer, suite proof.SignatureSuite, did did.DID) (*DIDDoc, error)
GenerateDeactivatedDIDDoc creates a deactivated DID Document. Returns an error if the Signer fails to generate the digital signature.
func GenerateLedgerDIDDoc ¶
func GenerateLedgerDIDDoc(keyType proof.KeyType, signatureType proof.SignatureType) (*DIDDoc, ed25519.PrivateKey)
func (DIDDoc) Validate ¶
func (d DIDDoc) Validate(ctx context.Context, provider DIDDocProvider) error
func (DIDDoc) ValidateDeactivated ¶
func (DIDDoc) ValidateMetadata ¶
func (*DIDDoc) ValidateNotEmpty ¶
func (DIDDoc) ValidateProof ¶
func (DIDDoc) ValidateStatic ¶
func (DIDDoc) ValidateUniqueness ¶
func (d DIDDoc) ValidateUniqueness(ctx context.Context, provider DIDDocProvider) error
type GenerateDIDDocInput ¶
type GenerateDIDDocInput struct { // DID is a decentralized identifier in the format of "did:work:<id>". DID did.DID `validate:"required"` // FullyQualifiedKeyRef is a URI that points to a public key associated with the SigningKey, // which can be used to verify the digital signature. This key must be included in the // PublicKeys map. FullyQualifiedKeyRef string `validate:"required"` // Signer is an interface can be used to digitally sign the DID Document. Signer proof.Signer `validate:"required"` // SignatureType specifies the suite used to generate the DID Doc signature SignatureType proof.SignatureType `validate:"required"` // PublicKeys is a map of KeyID to Ed25519 public keys. These keys will be listed in the DID // Document's publicKeys field. PublicKeys map[string]ed25519.PublicKey `validate:"required"` // Issuer is an optional DID who controls the SigningKey. This is intended to be used by // Issuers that create a different DID Document per schema type. Specifying the Issuer here // creates a linkage between the identities. Issuer did.DID `validate:"required"` // Services are service endpoints that are published in the DID Document. // // Workday uses a "schema" service endpoint to specify which schema an identity will issue // credentials against. This service endpoint is not strictly necessary, but may be useful // for Issuers managing multiple identities. Services []did.ServiceDef }
func (GenerateDIDDocInput) GenerateLedgerDIDDoc ¶
func (g GenerateDIDDocInput) GenerateLedgerDIDDoc() (*DIDDoc, error)
GenerateLedgerDIDDoc generates DID Document based on the current state of the input.
type HasLedgerMetadata ¶
type HasLedgerMetadata interface {
GetLedgerMetadata() *Metadata
}
type HasLedgerMetadataProvable ¶
type HasLedgerMetadataProvable interface { proof.Provable HasLedgerMetadata }
A unification of Provable and HasLedgerMetadata types as a utility to aid in the signing of objects that have ledger metadata
type JSONSchema ¶
type JSONSchema struct {
Schema JSONSchemaMap `json:"schema"`
}
Object for a credential that has not been signed
type JSONSchemaMap ¶
type JSONSchemaMap map[string]interface{}
go representation of json schema document
func (JSONSchemaMap) AllowsAdditionalProperties ¶
func (j JSONSchemaMap) AllowsAdditionalProperties() bool
func (JSONSchemaMap) Description ¶
func (j JSONSchemaMap) Description() string
Assumes the json schema has a description field
func (JSONSchemaMap) Properties ¶
func (j JSONSchemaMap) Properties() Properties
Assumes the json schema has a properties field
func (JSONSchemaMap) RequiredFields ¶
func (j JSONSchemaMap) RequiredFields() []string
func (JSONSchemaMap) ToJSON ¶
func (j JSONSchemaMap) ToJSON() string
type Metadata ¶
type Metadata struct { Type string `json:"type"` ModelVersion string `json:"modelVersion"` ID string `json:"id"` Name string `json:"name,omitempty"` Author did.DID `json:"author,omitempty"` Authored string `json:"authored,omitempty"` Proof *proof.Proof `json:"proof,omitempty"` }
Type, Model ModelVersion, and ID should always be present Depending on the model object, the remainder of the fields may be optional. This should be enforced by the platform and smart contracts.
func (*Metadata) GetLedgerMetadata ¶
type Properties ¶
type Properties map[string]interface{}
type Provider ¶
type Provider struct { SchemaProvider RevocationProvider DIDDocProvider }
type Revocation ¶
type Revocation struct { *Metadata *UnsignedRevocation `json:"revocation"` }
func GenerateLedgerRevocation ¶
func GenerateLedgerRevocation(credentialID string, issuer did.DID, signer proof.Signer, signatureType proof.SignatureType) (*Revocation, error)
func (*Revocation) IsEmpty ¶
func (r *Revocation) IsEmpty() bool
func (Revocation) Validate ¶
func (r Revocation) Validate(ctx context.Context, provider Provider) error
func (Revocation) ValidateKey ¶
func (r Revocation) ValidateKey() error
func (Revocation) ValidateMetadata ¶
func (r Revocation) ValidateMetadata() error
func (Revocation) ValidateNotEmpty ¶
func (r Revocation) ValidateNotEmpty() error
func (Revocation) ValidateProof ¶
func (r Revocation) ValidateProof(ctx context.Context, provider DIDDocProvider) error
func (Revocation) ValidateStatic ¶
func (r Revocation) ValidateStatic() error
func (Revocation) ValidateUniqueness ¶
func (r Revocation) ValidateUniqueness(ctx context.Context, provider RevocationProvider) error
type RevocationProvider ¶
type RevocationProvider func(ctx context.Context, credentialID, revocationID string) (*Revocation, error)
type Schema ¶
type Schema struct { *Metadata *JSONSchema }
func GenerateLedgerSchema ¶
func (Schema) ValidateID ¶
ID validation is based on our public schema specification: This identifier is a method-specific DID parameter name based upon the author of the schema. For example, if the author had a did like did:work:abcdefghi a possible schema ID the author created would have an identifier such as: did:work:abcdefghi;schema=17de181feb67447da4e78259d92d0240;version=1.0
func (Schema) ValidateMetadata ¶
func (Schema) ValidateNotEmpty ¶
func (Schema) ValidateProof ¶
func (s Schema) ValidateProof(ctx context.Context, provider DIDDocProvider) error
func (Schema) ValidateStatic ¶
func (Schema) ValidateUniqueness ¶
func (s Schema) ValidateUniqueness(ctx context.Context, provider SchemaProvider) error
type SchemaProvider ¶
type UnsignedRevocation ¶
type UnsignedRevocation struct { ID string `json:"id"` CredentialID string `json:"credentialId,omitempty"` IssuerDID did.DID `json:"issuerId,omitempty"` ReasonCode int `json:"reason,omitempty"` Revoked string `json:"revoked,omitempty"` }
func (*UnsignedRevocation) IsEmpty ¶
func (u *UnsignedRevocation) IsEmpty() bool