iden3mobile

package
v0.0.0-...-145d54f Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: GPL-3.0 Imports: 35 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TicketTypeClaimReq    = "RequestClaim"
	TicketTypeTest        = "test ticket"
	TicketStatusDone      = "Done"
	TicketStatusDoneError = "Done with error"
	TicketStatusPending   = "Pending"
	TicketStatusCancel    = "Canceled"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BytesArray

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

TODO. HAVE A LOOK AT CODE GEN

func NewBytesArray

func NewBytesArray() *BytesArray

func (*BytesArray) Append

func (ba *BytesArray) Append(bs []byte)

func (*BytesArray) Get

func (ba *BytesArray) Get(i int) []byte

func (*BytesArray) Len

func (ba *BytesArray) Len() int

type CallbackProveClaim

type CallbackProveClaim interface {
	Fn(bool, error)
}

CallbackProveClaim is a interface used to get an asynchronous response from ProveClaimWithCb and ProveClaimZKWithCb

type CallbackRequestClaim

type CallbackRequestClaim interface {
	Fn(*Ticket, error)
}

type ClaimDB

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

func NewClaimDB

func NewClaimDB(storage db.Storage) *ClaimDB

func (*ClaimDB) AddCredentialExistance

func (cdb *ClaimDB) AddCredentialExistance(cred *proof.CredentialExistence) (string, error)

AddCredentialExistance adds a credential existence to the ClaimDB and returns the id of the entry in the DB.

func (*ClaimDB) GetClaimJSON

func (cdb *ClaimDB) GetClaimJSON(id string) (string, error)

func (*ClaimDB) GetCredExist

func (cdb *ClaimDB) GetCredExist(id string) (*proof.CredentialExistence, error)

func (*ClaimDB) GetCredExistJSON

func (cdb *ClaimDB) GetCredExistJSON(id string) (string, error)

GetCredExistJSON returns the requested claim

func (*ClaimDB) IterateClaimsJSON

func (cdb *ClaimDB) IterateClaimsJSON(iterFn ClaimDBIterFner) error

func (*ClaimDB) IterateClaimsJSON_

func (cdb *ClaimDB) IterateClaimsJSON_(fn func(string, string) (bool, error)) error

func (*ClaimDB) IterateCredExistJSON

func (cdb *ClaimDB) IterateCredExistJSON(iterFn ClaimDBIterFner) error

func (*ClaimDB) IterateCredExistJSON_

func (cdb *ClaimDB) IterateCredExistJSON_(fn func(string, string) (bool, error)) error

func (*ClaimDB) Iterate_

func (cdb *ClaimDB) Iterate_(fn func(string, *proof.CredentialExistence) (bool, error)) error

type ClaimDBIterFner

type ClaimDBIterFner interface {
	Fn(string, string) (bool, error)
}

type Event

type Event struct {
	Type     string
	TicketId string
	Data     string
	Err      error
}

type EventManager

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

func NewEventManager

func NewEventManager(storage db.Storage, eventQueue chan Event, s Sender) *EventManager

NewEventManager creates an event mannager

func (*EventManager) EventLength

func (em *EventManager) EventLength() (uint32, error)

func (*EventManager) GetEvent

func (em *EventManager) GetEvent(idx uint32) (*Event, error)

func (*EventManager) Init

func (em *EventManager) Init() error

func (*EventManager) Start

func (em *EventManager) Start()

func (*EventManager) Stop

func (em *EventManager) Stop()

type HttpClient

type HttpClient struct {
	httpclient.HttpClient
}

func NewHttpClient

func NewHttpClient(urlBase string) *HttpClient

func (*HttpClient) DoRequest

func (p *HttpClient) DoRequest(s *sling.Sling, res interface{}) error

DoRequest performs an HTTP request

type Identity

type Identity struct {
	ClaimDB *ClaimDB
	Tickets *Tickets
	// contains filtered or unexported fields
}

func NewIdentity

func NewIdentity(storePath, sharedStorePath, pass, web3Url string, checkTicketsPeriodMilis int, extraGenesisClaims *BytesArray, eventHandler Sender) (*Identity, error)

NewIdentity creates a new identity this funciton is mapped as a constructor in Java. NOTE: The storePath must be unique per Identity. NOTE: Right now the extraGenesisClaims is useless.

func NewIdentityLoad

func NewIdentityLoad(storePath, sharedStorePath, pass, web3Url string, checkTicketsPeriodMilis int, eventHandler Sender) (*Identity, error)

NewIdentityLoad loads an already created identity this funciton is mapped as a constructor in Java

func (*Identity) ProveClaim

func (i *Identity) ProveClaim(baseUrl string, credID string) (bool, error)

ProveClaim sends a credentialValidity build from the given credentialExistance to a verifier. The response should be true if the verified accepted the prove as valid

func (*Identity) ProveClaimWithCb

func (i *Identity) ProveClaimWithCb(baseUrl string, credID string, c CallbackProveClaim)

ProveClaimWithCb sends a credentialValidity build from the given credentialExistance to a verifier. The callback is used to check if the verifier has accepted the credential as valid in an async maner

func (*Identity) ProveClaimZK

func (i *Identity) ProveClaimZK(baseUrl string, credID string) (bool, error)

ProveClaimZK sends a credentialValidity build from the given credentialExistance to a verifier. This method will generate a zero knowledge proof so the verifier can't see the content of the claim. The response should be true if the verified accepted the prove as valid.

func (*Identity) ProveClaimZKWithCb

func (i *Identity) ProveClaimZKWithCb(baseUrl string, credID string, c CallbackProveClaim)

ProveClaimZKWithCb sends a credentialValidity build from the given credentialExistance to a verifier. This method will generate a zero knowledge proof so the verifier can't see the content of the claim. The callback is used to check if the verifier has accepted the credential as valid in an async maner

func (*Identity) RequestClaim

func (i *Identity) RequestClaim(baseUrl, data string) (*Ticket, error)

RequestClaim sends a petition to issue a claim to an issuer. This function will eventually trigger an event, the returned ticket can be used to reference the event

func (*Identity) RequestClaimWithCb

func (i *Identity) RequestClaimWithCb(baseUrl, data string, c CallbackRequestClaim)

func (*Identity) Stop

func (i *Identity) Stop()

Stop close all the open resources of the Identity

type Sender

type Sender interface {
	Send(*Event)
}

Sender is an interface that sends events

type Ticket

type Ticket struct {
	Id          string
	LastChecked int64
	Type        string
	Status      string

	HandlerJSON json.RawMessage
	// contains filtered or unexported fields
}

func (Ticket) MarshalJSON

func (t Ticket) MarshalJSON() ([]byte, error)

func (*Ticket) UnmarshalJSON

func (t *Ticket) UnmarshalJSON(b []byte) error

type TicketOperator

type TicketOperator interface {
	Iterate(*Ticket) (bool, error)
}

type TicketStatus

type TicketStatus string

type TicketType

type TicketType string

type Tickets

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

func NewTickets

func NewTickets(storage db.Storage) *Tickets

func (*Tickets) Add

func (ts *Tickets) Add(tickets []Ticket) error

func (*Tickets) CancelTicket

func (ts *Tickets) CancelTicket(id string) error

func (*Tickets) CheckPending

func (ts *Tickets) CheckPending(id *Identity, eventCh chan Event, checkPendingPeriod time.Duration, stopCh chan bool)

func (*Tickets) GetPending

func (ts *Tickets) GetPending() ([]*Ticket, error)

func (*Tickets) Init

func (ts *Tickets) Init() error

func (*Tickets) Iterate

func (ts *Tickets) Iterate(handler TicketOperator) error

func (*Tickets) Iterate_

func (ts *Tickets) Iterate_(fn func(*Ticket) (bool, error)) error

type ValidationError

type ValidationError struct {
	FieldError validator.FieldError
	Next       *ValidationError
}

func NewValidationError

func NewValidationError(validationErrors validator.ValidationErrors) ValidationError

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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