identity

package
v2.8.9 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Id    string
	Value interface{}
}

Attribute represents an attribute with an identifier and a corresponding value.

type AttributeDescriptor

type AttributeDescriptor struct {
	// DisplayName is the human-readable display name of the attribute.
	DisplayName string
	// Id is the identifier for the attribute.
	Id string
	// Description is a description providing additional information about the attribute.
	Description string
	// Required specifies whether the attribute is required.
	Required bool
}

AttributeDescriptor represents a descriptor for an attribute.

type BooleanAttribute

type BooleanAttribute struct {
	Attribute
}

BooleanAttribute represents an attribute with a boolean value.

func NewBooleanAttribute

func NewBooleanAttribute(key string, value bool) BooleanAttribute

NewBooleanAttribute creates a new BooleanAttribute instance with the provided key and value.

func NewBooleanAttributeFromProto

func NewBooleanAttributeFromProto(s *proto.BooleanAttribute) BooleanAttribute

func (BooleanAttribute) ToProto

type BooleanAttributeDescriptor

type BooleanAttributeDescriptor struct {
	AttributeDescriptor
}

BooleanAttributeDescriptor represents a descriptor for a boolean attribute.

func NewBooleanAttributeDescriptor

func NewBooleanAttributeDescriptor(name string, id string, description string, required bool) BooleanAttributeDescriptor

NewBooleanAttributeDescriptor creates a new BooleanAttributeDescriptor instance with the provided details.

func (BooleanAttributeDescriptor) ToProto

type Credential

type Credential struct {
	Context           []string
	Id                string
	Type              []string
	IssuanceDate      string
	Expiration        string
	CredentialSubject interface{}
	CredentialStatus  CredentialStatus
	Issuer            string
	CredentialSchema  CredentialSchema
	Proof             CredentialProof
}

Credential represents a verifiable credential with its associated information. Verifiable Credentials Data Model v2.0.

func NewCredentialFromJson

func NewCredentialFromJson(json string) (Credential, error)

NewCredentialFromJson creates a Credential instance from a JSON string representation.

func NewCredentialFromProto

func NewCredentialFromProto(s *proto.Credential) Credential

func (Credential) ToJson

func (c Credential) ToJson() (string, error)

ToJson converts the Credential instance to its JSON string representation.

func (Credential) ToProto

func (c Credential) ToProto() *proto.Credential

type CredentialBuilder

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

CredentialBuilder helps construct credentials by specifying various attributes.

func NewCredentialBuilder

func NewCredentialBuilder(issuer Issuer, schemaId, holderDid string, expiration int64, version int32, configData *proto.ConfigData) CredentialBuilder

NewCredentialBuilder creates a new CredentialBuilder instance with the specified parameters.

func (CredentialBuilder) Build

Build creates and returns a Credential using the specified attributes.

func (CredentialBuilder) WithBooleanAttribute

func (c CredentialBuilder) WithBooleanAttribute(key string, value bool) CredentialBuilder

WithBooleanAttribute adds a boolean attribute to the CredentialBuilder.

func (CredentialBuilder) WithDateAttribute

func (c CredentialBuilder) WithDateAttribute(key string, value time.Time) CredentialBuilder

WithDateAttribute adds a date attribute to the CredentialBuilder.

func (CredentialBuilder) WithDatetimeAttribute

func (c CredentialBuilder) WithDatetimeAttribute(key string, value time.Time) CredentialBuilder

WithDatetimeAttribute adds a datetime attribute to the CredentialBuilder.

func (CredentialBuilder) WithDecimalAttribute added in v2.8.0

func (c CredentialBuilder) WithDecimalAttribute(key string, value float64) CredentialBuilder

WithDecimalAttribute adds a decimal attribute to the CredentialBuilder.

func (CredentialBuilder) WithIntegerAttribute added in v2.8.0

func (c CredentialBuilder) WithIntegerAttribute(key string, value int64) CredentialBuilder

WithIntegerAttribute adds an integer attribute to the CredentialBuilder.

func (CredentialBuilder) WithStringAttribute added in v2.5.7

func (c CredentialBuilder) WithStringAttribute(key string, value string) CredentialBuilder

WithStringAttribute adds a string attribute to the CredentialBuilder.

type CredentialCoreBuilder added in v2.8.0

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

CredentialCoreBuilder helps construct credentials by specifying various attributes.

func NewCredentialCoreBuilder added in v2.8.0

func NewCredentialCoreBuilder(issuer Issuer, schemaId, holderDid string, expiration int64, version int32, configData *proto.ConfigData) CredentialCoreBuilder

NewCredentialCoreBuilder creates a new CredentialCoreBuilder instance with the specified parameters.

func (CredentialCoreBuilder) Build added in v2.8.0

Build creates and returns a Credential using the specified attributes.

func (CredentialCoreBuilder) WithBooleanAttribute added in v2.8.0

func (c CredentialCoreBuilder) WithBooleanAttribute(key string, value bool) CredentialCoreBuilder

WithBooleanAttribute adds a boolean attribute to the CredentialCoreBuilder.

func (CredentialCoreBuilder) WithDateAttribute added in v2.8.0

func (c CredentialCoreBuilder) WithDateAttribute(key string, value time.Time) CredentialCoreBuilder

WithDateAttribute adds a date attribute to the CredentialCoreBuilder.

func (CredentialCoreBuilder) WithDatetimeAttribute added in v2.8.0

func (c CredentialCoreBuilder) WithDatetimeAttribute(key string, value time.Time) CredentialCoreBuilder

WithDatetimeAttribute adds a datetime attribute to the CredentialCoreBuilder.

func (CredentialCoreBuilder) WithDecimalAttribute added in v2.8.0

func (c CredentialCoreBuilder) WithDecimalAttribute(key string, value float64) CredentialCoreBuilder

WithDecimalAttribute adds a decimal attribute to the CredentialCoreBuilder.

func (CredentialCoreBuilder) WithIntegerAttribute added in v2.8.0

func (c CredentialCoreBuilder) WithIntegerAttribute(key string, value int64) CredentialCoreBuilder

WithIntegerAttribute adds an integer attribute to the CredentialCoreBuilder.

func (CredentialCoreBuilder) WithStringAttribute added in v2.8.0

func (c CredentialCoreBuilder) WithStringAttribute(key string, value string) CredentialCoreBuilder

WithStringAttribute adds a string attribute to the CredentialCoreBuilder.

type CredentialProof

type CredentialProof struct {
	SignatureProof string
	SparseMtProof  string
}

CredentialProof represents the proof associated with a credential, including signature and sparse merkle tree proof.

func NewCredentialProofFromProto

func NewCredentialProofFromProto(s *proto.CredentialProof) CredentialProof

func (CredentialProof) ToProto

func (c CredentialProof) ToProto() *proto.CredentialProof

type CredentialReceipt

type CredentialReceipt struct {
	Credential     Credential
	CredentialId   string
	CredentialType string
}

CredentialReceipt represents a receipt for a credential, including the credential itself, its ID, and type.

func NewCredentialReceiptFromProto

func NewCredentialReceiptFromProto(s *proto.CredentialReceipt) CredentialReceipt

func (CredentialReceipt) ToProto

type CredentialSchema

type CredentialSchema struct {
	Id   string
	Type string
}

CredentialSchema represents the schema information for a credential, including its ID and type.

func NewCredentialSchemaFromProto

func NewCredentialSchemaFromProto(s *proto.CredentialSchema) CredentialSchema

func (CredentialSchema) ToProto

type CredentialStatus

type CredentialStatus struct {
	Id              string
	RevocationNonce int64
	Type            string
}

CredentialStatus represents the status information for a credential, including its ID, revocation nonce, and type.

func NewCredentialStatusFromProto

func NewCredentialStatusFromProto(s *proto.CredentialStatus) CredentialStatus

func (CredentialStatus) ToProto

type DateAttribute

type DateAttribute struct {
	Attribute
}

DateAttribute represents an attribute with a date value, including its key and formatted value.

func NewDateAttribute

func NewDateAttribute(key string, value time.Time) DateAttribute

NewDateAttribute creates a new DateAttribute instance with the provided key and time value.

func NewDateAttributeFromProto

func NewDateAttributeFromProto(s *proto.DateAttribute) DateAttribute

func (DateAttribute) ToProto

func (s DateAttribute) ToProto() *proto.DateAttribute

type DateAttributeDescriptor

type DateAttributeDescriptor struct {
	AttributeDescriptor
}

DateAttributeDescriptor represents a descriptor for a date attribute, including its display name, ID, description, and required status.

func NewDateAttributeDescriptor

func NewDateAttributeDescriptor(name string, id string, description string, required bool) DateAttributeDescriptor

NewDateAttributeDescriptor creates a new DateAttributeDescriptor instance with the provided details.

func (DateAttributeDescriptor) ToProto

type DatetimeAttribute

type DatetimeAttribute struct {
	Attribute
}

DatetimeAttribute represents an attribute with a datetime value.

func NewDatetimeAttribute

func NewDatetimeAttribute(key string, value time.Time) DatetimeAttribute

NewDatetimeAttribute creates a new DatetimeAttribute instance with the provided key and value.

func NewDatetimeAttributeFromProto

func NewDatetimeAttributeFromProto(s *proto.DateTimeAttribute) DatetimeAttribute

func (DatetimeAttribute) ToProto

type DatetimeAttributeDescriptor

type DatetimeAttributeDescriptor struct {
	AttributeDescriptor
}

DatetimeAttributeDescriptor represents a descriptor for an attribute with a datetime value.

func NewDatetimeAttributeDescriptor

func NewDatetimeAttributeDescriptor(name string, id string, description string, required bool) DatetimeAttributeDescriptor

NewDatetimeAttributeDescriptor creates a new DatetimeAttributeDescriptor instance with the provided details.

func (DatetimeAttributeDescriptor) ToProto

type DecimalAttribute added in v2.8.0

type DecimalAttribute struct {
	Attribute
}

DecimalAttribute represents an attribute with a decimal value.

func NewDecimalAttribute added in v2.8.0

func NewDecimalAttribute(key string, value float64) DecimalAttribute

NewDecimalAttribute creates a new DecimalAttribute instance with the provided key and value.

func NewDecimalAttributeFromProto added in v2.8.0

func NewDecimalAttributeFromProto(s *proto.DecimalAttribute) DecimalAttribute

func (DecimalAttribute) ToProto added in v2.8.0

type DecimalAttributeDescriptor added in v2.8.0

type DecimalAttributeDescriptor struct {
	AttributeDescriptor
}

DecimalAttributeDescriptor represents a descriptor for an attribute with a decimal value.

func NewDecimalAttributeDescriptor added in v2.8.0

func NewDecimalAttributeDescriptor(name string, id string, description string, required bool) DecimalAttributeDescriptor

NewDecimalAttributeDescriptor creates a new DecimalAttributeDescriptor instance with the provided details.

func NewDecimalAttributeDescriptorFromProto added in v2.8.0

func NewDecimalAttributeDescriptorFromProto(s *proto.DecimalAttributeDefinition) DecimalAttributeDescriptor

func (DecimalAttributeDescriptor) ToProto added in v2.8.0

type DecimalEnumAttributeDescriptor added in v2.8.0

type DecimalEnumAttributeDescriptor struct {
	AttributeDescriptor
	Enum []float64
}

DecimalEnumAttributeDescriptor represents a descriptor for an attribute with a decimal enum value.

func NewDecimalEnumAttributeDescriptor added in v2.8.0

func NewDecimalEnumAttributeDescriptor(name string, id string, description string, required bool, enum []float64) DecimalEnumAttributeDescriptor

NewDecimalEnumAttributeDescriptor creates a new DecimalEnumAttributeDescriptor instance with the provided details.

func NewDecimalEnumAttributeDescriptorFromProto added in v2.8.0

func NewDecimalEnumAttributeDescriptorFromProto(s *proto.DecimalEnumAttributeDefinition) DecimalEnumAttributeDescriptor

func (DecimalEnumAttributeDescriptor) ToProto added in v2.8.0

type Did added in v2.8.0

type Did struct {
	Did       string
	DidMethod DidMethod
}

Did represents a DID.

func NewDid added in v2.8.0

func NewDid(did string, didMethod DidMethod) Did

NewDid returns a new instance of Did for the given parameters.

type DidMethod added in v2.8.0

type DidMethod int32

DidMethod represents the type of method did.

const (
	// PolygonID represents the polygon id method did.
	PolygonID DidMethod = iota
	// PolygonIDTest represents the polygon id test method did.
	PolygonIDTest DidMethod = iota
)

type Holder added in v2.8.0

type Holder struct {
	Did Did
	Key key.Key
}

Holder represents a Holder identity.

func NewHolder added in v2.8.0

func NewHolder(did string, didMethod DidMethod, key key.Key) Holder

NewHolder returns a new instance of Holder identity for the given parameters.

type IntegerAttribute added in v2.8.0

type IntegerAttribute struct {
	Attribute
}

IntegerAttribute represents an attribute with an integer value.

func NewIntegerAttribute added in v2.8.0

func NewIntegerAttribute(key string, value int64) IntegerAttribute

NewIntegerAttribute creates a new IntegerAttribute instance with the provided key and value.

func NewIntegerAttributeFromProto added in v2.8.0

func NewIntegerAttributeFromProto(s *proto.IntegerAttribute) IntegerAttribute

func (IntegerAttribute) ToProto added in v2.8.0

type IntegerAttributeDescriptor added in v2.8.0

type IntegerAttributeDescriptor struct {
	AttributeDescriptor
}

IntegerAttributeDescriptor represents a descriptor for an attribute with an integer value.

func NewIntegerAttributeDescriptor added in v2.8.0

func NewIntegerAttributeDescriptor(name string, id string, description string, required bool) IntegerAttributeDescriptor

NewIntegerAttributeDescriptor creates a new IntegerAttributeDescriptor instance with the provided details.

func (IntegerAttributeDescriptor) ToProto added in v2.8.0

type IntegerEnumAttributeDescriptor added in v2.8.0

type IntegerEnumAttributeDescriptor struct {
	AttributeDescriptor
	Enum []int64
}

IntegerEnumAttributeDescriptor represents a descriptor for an attribute with an integer enum value.

func NewIntegerEnumAttributeDescriptor added in v2.8.0

func NewIntegerEnumAttributeDescriptor(name string, id string, description string, required bool, enum []int64) IntegerEnumAttributeDescriptor

NewIntegerEnumAttributeDescriptor creates a new IntegerEnumAttributeDescriptor instance with the provided details.

func NewIntegerEnumAttributeDescriptorFromProto added in v2.8.0

func NewIntegerEnumAttributeDescriptorFromProto(s *proto.IntegerEnumAttributeDefinition) IntegerEnumAttributeDescriptor

func (IntegerEnumAttributeDescriptor) ToProto added in v2.8.0

type Issuer added in v2.8.0

type Issuer struct {
	Did Did
	Key key.Key
}

Issuer represents an Issuer identity.

func NewIssuer added in v2.8.0

func NewIssuer(did string, didMethod DidMethod, key key.Key) Issuer

NewIssuer returns a new instance of Issuer identity for the given parameters.

type IssuerStateReceipt added in v2.8.0

type IssuerStateReceipt struct {
	TxHash string
}

IssuerStateReceipt represents a receipt for the issuer's state.

func NewIssuerStateReceiptFromProto added in v2.8.0

func NewIssuerStateReceiptFromProto(s *proto.IssuerStateReceipt) IssuerStateReceipt

func (IssuerStateReceipt) ToProto added in v2.8.0

type PublishIntervalParams added in v2.8.0

type PublishIntervalParams int32

PublishIntervalParams represents different publish intervals.

const (
	// Interval5 represents a 5-minute publish interval.
	Interval5 PublishIntervalParams = iota
	// Interval15 represents a 15-minute publish interval.
	Interval15 PublishIntervalParams = iota
	// Interval60 represents a 60-minute publish interval.
	Interval60 PublishIntervalParams = iota
)

type Schema

type Schema struct {
	Cid        string
	CidJsonLd  string
	SchemaType string
	Json       string
}

Schema represents a schema with its attributes.

func NewSchemaFromProto

func NewSchemaFromProto(s *proto.Schema) Schema

func (Schema) ToProto

func (c Schema) ToProto() *proto.Schema

type SchemaBuilder

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

SchemaBuilder is a builder pattern for constructing schema instances.

func NewSchemaBuilder

func NewSchemaBuilder(displayName string, schemaType, version, description string, configData *proto.ConfigData) SchemaBuilder

NewSchemaBuilder creates a new instance of SchemaBuilder with initial values.

func (SchemaBuilder) AddBooleanAttribute

func (c SchemaBuilder) AddBooleanAttribute(name string, id string, description string, required bool) SchemaBuilder

AddBooleanAttribute adds a boolean attribute descriptor to the schema builder.

func (SchemaBuilder) AddDateAttribute

func (c SchemaBuilder) AddDateAttribute(name string, id string, description string, required bool) SchemaBuilder

AddDateAttribute adds a date attribute descriptor to the schema builder.

func (SchemaBuilder) AddDatetimeAttribute

func (c SchemaBuilder) AddDatetimeAttribute(name string, id string, description string, required bool) SchemaBuilder

AddDatetimeAttribute adds a datetime attribute descriptor to the schema builder.

func (SchemaBuilder) AddDecimalAttribute added in v2.8.0

func (c SchemaBuilder) AddDecimalAttribute(name string, id string, description string, required bool) SchemaBuilder

AddDecimalAttribute adds a decimal attribute descriptor to the schema builder.

func (SchemaBuilder) AddDecimalEnumAttribute added in v2.8.0

func (c SchemaBuilder) AddDecimalEnumAttribute(name string, id string, description string, required bool, enum []float64) SchemaBuilder

AddDecimalEnumAttribute adds a decimal enum attribute descriptor to the schema builder.

func (SchemaBuilder) AddIntegerAttribute added in v2.8.0

func (c SchemaBuilder) AddIntegerAttribute(name string, id string, description string, required bool) SchemaBuilder

AddIntegerAttribute adds an integer attribute descriptor to the schema builder.

func (SchemaBuilder) AddIntegerEnumAttribute added in v2.8.0

func (c SchemaBuilder) AddIntegerEnumAttribute(name string, id string, description string, required bool, enum []int64) SchemaBuilder

AddIntegerEnumAttribute adds an integer enum attribute descriptor to the schema builder.

func (SchemaBuilder) AddStringAttribute added in v2.5.7

func (c SchemaBuilder) AddStringAttribute(name string, id string, description string, required bool) SchemaBuilder

AddStringAttribute adds a string attribute descriptor to the schema builder.

func (SchemaBuilder) AddStringEnumAttribute added in v2.8.0

func (c SchemaBuilder) AddStringEnumAttribute(name string, id string, description string, required bool, enum []string) SchemaBuilder

AddStringEnumAttribute adds a string enum attribute descriptor to the schema builder.

func (SchemaBuilder) Build

func (c SchemaBuilder) Build() (Schema, error)

Build creates a schema using the configured attributes.

type StringAttribute added in v2.5.7

type StringAttribute struct {
	Attribute
}

StringAttribute represents an attribute with a string value.

func NewStringAttribute added in v2.5.7

func NewStringAttribute(key string, value string) StringAttribute

NewStringAttribute creates a new StringAttribute instance with the provided key and value.

func NewStringAttributeFromProto added in v2.5.7

func NewStringAttributeFromProto(s *proto.StringAttribute) StringAttribute

func (StringAttribute) ToProto added in v2.5.7

func (s StringAttribute) ToProto() *proto.StringAttribute

type StringAttributeDescriptor added in v2.5.7

type StringAttributeDescriptor struct {
	AttributeDescriptor
}

StringAttributeDescriptor represents a descriptor for an attribute with a string value.

func NewStringAttributeDescriptor added in v2.5.7

func NewStringAttributeDescriptor(name string, id string, description string, required bool) StringAttributeDescriptor

NewStringAttributeDescriptor creates a new StringAttributeDescriptor instance with the provided details.

func NewStringAttributeDescriptorFromProto added in v2.5.7

func NewStringAttributeDescriptorFromProto(s *proto.StringAttributeDefinition) StringAttributeDescriptor

func (StringAttributeDescriptor) ToProto added in v2.5.7

type StringEnumAttributeDescriptor added in v2.8.0

type StringEnumAttributeDescriptor struct {
	AttributeDescriptor
	Enum []string
}

StringEnumAttributeDescriptor represents a descriptor for an attribute with a string enum value.

func NewStringEnumAttributeDescriptor added in v2.8.0

func NewStringEnumAttributeDescriptor(name string, id string, description string, required bool, enum []string) StringEnumAttributeDescriptor

NewStringEnumAttributeDescriptor creates a new StringEnumAttributeDescriptor instance with the provided details.

func NewStringEnumAttributeDescriptorFromProto added in v2.8.0

func NewStringEnumAttributeDescriptorFromProto(s *proto.StringEnumAttributeDefinition) StringEnumAttributeDescriptor

func (StringEnumAttributeDescriptor) ToProto added in v2.8.0

type VerificationParams added in v2.8.0

type VerificationParams struct {
	Timeout int64
}

VerificationParams represents parameters for verification.

func NewVerificationParams added in v2.8.0

func NewVerificationParams() VerificationParams

NewVerificationParams creates a new VerificationParams instance with default values.

type VerificationReceipt added in v2.8.0

type VerificationReceipt struct {
	SessionID           int64
	VerificationRequest string
}

VerificationReceipt represents a receipt for a verification session.

func NewVerificationReceiptFromProto added in v2.8.0

func NewVerificationReceiptFromProto(s *proto.VerificationReceipt) VerificationReceipt

func (VerificationReceipt) ToProto added in v2.8.0

Jump to

Keyboard shortcuts

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