types

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDID

func FormatDID(method DIDMethod, identifier DIDIdentifier) string

FormatDID formats a DID string

func ParseDID

func ParseDID(did string) (DIDMethod, DIDIdentifier, error)

ParseDID parses a DID string

Types

type AnySignerEntity

type AnySignerEntity interface {
	Sign([]byte) ([]byte, error)
	PublicKey() (*crypto.Secp256k1PubKey, error)
	Verify(msg []byte, sig []byte) (bool, error)
}

AnySignerEntity is an entity that can sign and verify messages

type BroadcastTxResponse

type BroadcastTxResponse = txtypes.BroadcastTxResponse

BroadcastTxResponse is a tx response

type ControllerAccount

type ControllerAccount = identitytypes.ControllerAccount

ControllerAccount is an interface for a controller account

type Credential

type Credential = servicetypes.WebauthnCredential

Credential is a webauthn credential

type DIDAccumulator

type DIDAccumulator string

DIDAccumulator is a ZKSet accumulator for a DID

func NewAccumulator

func NewAccumulator(id DIDIdentifier, key string) DIDAccumulator

NewAccumulator creates a new accumulator for the DID

func (DIDAccumulator) Add

func (zk DIDAccumulator) Add(id string, key DIDSecretKey) error

Add adds a new element to the accumulator

func (DIDAccumulator) Identifier

func (zk DIDAccumulator) Identifier() DIDIdentifier

Identifier returns the identifier of the resource

func (DIDAccumulator) Key

func (zk DIDAccumulator) Key() string

Key returns the key of the resource

func (DIDAccumulator) Remove

func (zk DIDAccumulator) Remove(id string, key DIDSecretKey) error

Remove removes an element from the accumulator

func (DIDAccumulator) String

func (zk DIDAccumulator) String() string

String returns the string representation of the property

func (DIDAccumulator) Validate

func (zk DIDAccumulator) Validate(id string, key DIDSecretKey) (bool, error)

Validate checks if the accumulator contains an element

func (DIDAccumulator) Value

func (zk DIDAccumulator) Value() string

Value Returns the value for the Properties key

type DIDIdentifier

type DIDIdentifier string

DIDIdentifier is a DID identifier

func (DIDIdentifier) AddResource

func (d DIDIdentifier) AddResource(k string, v []byte) (DIDResource, error)

AddResource adds a resource to the store

func (DIDIdentifier) AppendKeyList

func (d DIDIdentifier) AppendKeyList(key string, values ...string)

AppendKeyList appends a list of values to the key

func (DIDIdentifier) FetchResource

func (d DIDIdentifier) FetchResource(k string) ([]byte, error)

FetchResource fetches a resource from the store

func (DIDIdentifier) GetKey

func (d DIDIdentifier) GetKey(key string) string

GetKey returns the value for the key

func (DIDIdentifier) GetKeyList

func (d DIDIdentifier) GetKeyList(key string) []string

GetKeyList returns the list of values for the key

func (DIDIdentifier) HasKey

func (d DIDIdentifier) HasKey(key string) bool

HasKey returns true if the key exists in the store

func (DIDIdentifier) RemoveKeyList

func (d DIDIdentifier) RemoveKeyList(key string, values ...string)

RemoveKeyList removes a list of values from the key

func (DIDIdentifier) SetKey

func (d DIDIdentifier) SetKey(key string, value string)

SetKey sets the value for the key

func (DIDIdentifier) String

func (d DIDIdentifier) String() string

String returns the string representation of the DID

type DIDMethod

type DIDMethod string

DIDMethod is a DID method

func (DIDMethod) CoinType

func (d DIDMethod) CoinType() crypto.CoinType

CoinType returns the coin type for the DID method

func (DIDMethod) Equals

func (d DIDMethod) Equals(other DIDMethod) bool

Equals returns true if the DID methods are equal

func (DIDMethod) GetKey

func (d DIDMethod) GetKey(key string) string

GetKey returns the value for the key

func (DIDMethod) HasKey

func (d DIDMethod) HasKey(key string) bool

HasKey returns true if the key exists in the store

func (DIDMethod) SetKey

func (d DIDMethod) SetKey(key string, value string)

SetKey sets the value for the key

func (DIDMethod) String

func (d DIDMethod) String() string

String returns the string representation of the DID method

type DIDProperty

type DIDProperty string

DIDProperty is a string that is stored under a DID identifier in its internal store.

func NewProperty

func NewProperty(id DIDIdentifier, key string) DIDProperty

NewProperty creates a new property for the DID

func (DIDProperty) Identifier

func (d DIDProperty) Identifier() DIDIdentifier

Identifier returns the identifier of the resource

func (DIDProperty) Key

func (d DIDProperty) Key() string

Key returns the key of the resource

func (DIDProperty) String

func (d DIDProperty) String() string

String returns the string representation of the property

func (DIDProperty) Value

func (d DIDProperty) Value() string

Value Returns the value for the Properties key

type DIDResource

type DIDResource string

DIDResource is a byte array that is stored under a DID identifier in its internal store.

func NewResource

func NewResource(id DIDIdentifier, key string) DIDResource

NewResource returns a new DID resource from a DID URL, and key

func (DIDResource) Data

func (d DIDResource) Data() ([]byte, error)

Data returns the data stored in the resource

func (DIDResource) Identifier

func (d DIDResource) Identifier() DIDIdentifier

Identifier returns the identifier of the resource

func (DIDResource) Key

func (d DIDResource) Key() string

Key returns the key of the resource

func (DIDResource) String

func (d DIDResource) String() string

String returns the string representation of the resource

func (DIDResource) Update

func (d DIDResource) Update(data []byte) error

Update replaces the data stored in the resource

type DIDSecretKey

type DIDSecretKey interface {
	// AccumulatorKey returns the accumulator key for the DID
	AccumulatorKey() (*accumulator.SecretKey, error)

	// Bytes returns the bytes of the secret key
	Bytes() []byte

	// Encrypt encrypts a byte array
	Encrypt(bz []byte) ([]byte, error)

	// Decrypt decrypts a byte array
	Decrypt(ciphertext []byte) ([]byte, error)
}

DIDSecretKey is an interface for a DID secret key

type DIDStore

type DIDStore struct {
	Name       string
	Store      sfs.Map
	Method     DIDMethod
	Identifier DIDIdentifier
	IsMethod   bool
}

DIDStore is a store for a DID

func GetIdentifierStore

func GetIdentifierStore(name DIDIdentifier) *DIDStore

GetIdentifierStore returns a store for a DID identifier

func GetMethodStore

func GetMethodStore(name DIDMethod) *DIDStore

GetMethodStore returns a store for a DID method

func (*DIDStore) AppendList

func (g *DIDStore) AppendList(key string, values ...string) error

AppendList appends a list of values to a key in the store

func (*DIDStore) GetKey

func (g *DIDStore) GetKey(k string) (string, error)

GetKey returns the value of a key in the store

func (*DIDStore) GetList

func (g *DIDStore) GetList(key string) ([]string, error)

GetList returns a list of values from a key in the store

func (*DIDStore) HasKey

func (g *DIDStore) HasKey(k string) (bool, error)

HasKey returns whether a key exists in the store

func (*DIDStore) RemoveList

func (g *DIDStore) RemoveList(key string, values ...string) error

RemoveList removes a list of values from a key in the store

func (*DIDStore) SetKey

func (g *DIDStore) SetKey(k string, v string) error

SetKey sets the value of a key in the store

func (*DIDStore) StoreKey

func (g *DIDStore) StoreKey() string

StoreKey returns the store key for the store

type DIDUrl

type DIDUrl string

DIDUrl is a DID URL

var EmptyDIDURL DIDUrl = ""

EmptyDIDURL is an empty DID URL

func NewDIDUrl

func NewDIDUrl(method DIDMethod, id DIDIdentifier) DIDUrl

NewDIDUrl creates a new DID URL

func ParseDIDUrl

func ParseDIDUrl(did string) (DIDUrl, error)

ParseDIDUrl parses a DID URL

func (DIDUrl) Identifier

func (d DIDUrl) Identifier() (DIDIdentifier, error)

Identifier returns the identifier of the DID URL

func (DIDUrl) Method

func (d DIDUrl) Method() (DIDMethod, error)

Method returns the method of the DID URL

func (DIDUrl) String

func (d DIDUrl) String() string

String returns the string representation of the DID URL

func (DIDUrl) Valid

func (d DIDUrl) Valid() error

Valid returns whether the DID URL is valid

type TxResponse

type TxResponse = sdk.TxResponse

TxResponse is a type alias for sdk.TxResponse

type WalletAccount

type WalletAccount interface {
	// Address returns the address of the account
	Address() string
	Info() *crypto.AccountData
	Method() DIDMethod
	Sign(msg []byte) ([]byte, error)
	PublicKey() (*crypto.Secp256k1PubKey, error)
	Type() string
	Verify(msg []byte, sig []byte) (bool, error)
}

WalletAccount is an interface that provides acces to a DID Wallet

Jump to

Keyboard shortcuts

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