keystore

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppInfo

type AppInfo struct {
	Application   string `json:"application"`
	AppIdentifier string `json:"appIdentifier"`
	Version       string `json:"version"`
}

AppInfo is a helper structure that contains information about the application that uses these credentials

type AppKeystore

type AppKeystore struct {
	Application   string                        `json:"application"`
	AppIdentifier string                        `json:"appIdentifier"`
	Credentials   map[Key]appKeystoreCredential `json:"credentials"`
	Version       string                        `json:"version"`
	// contains filtered or unexported fields
}

AppKeystore represents the membership credentials to be used in RLN

func New added in v0.8.0

func New(path string, appInfo AppInfo, logger *zap.Logger) (*AppKeystore, error)

New creates a new instance of a rln credentials keystore

func (*AppKeystore) AddMembershipCredentials added in v0.8.0

func (k *AppKeystore) AddMembershipCredentials(newCredential MembershipCredentials, password string) error

AddMembershipCredentials inserts a membership credential to the keystore matching the application, appIdentifier and version filters.

func (*AppKeystore) GetMembershipCredentials added in v0.8.0

func (k *AppKeystore) GetMembershipCredentials(keystorePassword string, index *rln.MembershipIndex, filterMembershipContract MembershipContractInfo) (*MembershipCredentials, error)

GetMembershipCredentials decrypts and retrieves membership credentials from the keystore applying filters

type ChainID added in v0.8.0

type ChainID struct {
	*big.Int
}

ChainID is a helper struct created to comply with the expected marshalling for the credentials

func (ChainID) MarshalJSON added in v0.8.0

func (c ChainID) MarshalJSON() (text []byte, err error)

MarshalJSON is used to convert a ChainID into a valid value expected by the json encoder

func (ChainID) String added in v0.8.0

func (c ChainID) String() string

String returns a string with the expected chainId format for the credentials

func (*ChainID) UnmarshalJSON added in v0.8.0

func (c *ChainID) UnmarshalJSON(text []byte) error

UnmarshalJSON converts a byte slice into a ChainID

type ContractAddress added in v0.8.0

type ContractAddress common.Address

ContractAddress is a common.Address created to comply with the expected marshalling for the credentials

func (ContractAddress) MarshalText added in v0.8.0

func (c ContractAddress) MarshalText() ([]byte, error)

MarshalText is used to convert a ContractAddress into a valid value expected by the json encoder

func (*ContractAddress) UnmarshalText added in v0.8.0

func (c *ContractAddress) UnmarshalText(text []byte) error

UnmarshalText converts a byte slice into a ContractAddress

type Key added in v0.8.0

type Key string

Key is a helper type created to represent the key in a map of credentials

type MembershipContractInfo added in v0.8.0

type MembershipContractInfo struct {
	ChainID ChainID         `json:"chainId"`
	Address ContractAddress `json:"address"`
}

MembershipContractInfo contains information about a membership smart contract address and the chain in which it is deployed

func NewMembershipContractInfo added in v0.8.0

func NewMembershipContractInfo(chainID *big.Int, address common.Address) MembershipContractInfo

NewMembershipContractInfo generates a new MembershipContract instance

func (MembershipContractInfo) Equals added in v0.8.0

Equals is used to compare MembershipContract

type MembershipCredentials

type MembershipCredentials struct {
	IdentityCredential     *rln.IdentityCredential `json:"identityCredential"`
	MembershipContractInfo MembershipContractInfo  `json:"membershipContract"`
	TreeIndex              rln.MembershipIndex     `json:"treeIndex"`
}

MembershipCredentials contains all the information about an RLN Identity Credential and membership group it belongs to

func (MembershipCredentials) Equals

Equals is used to compare MembershipCredentials

Jump to

Keyboard shortcuts

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