entity

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidRecordError     = "Record error: Invalid record"
	RecordNotFoundError    = "Infrastructure error: Http Client error: Request error - API connected by HttpClient found an error: record not found"
	WaitAnchorTimeoutError = "Anchor error: Wait Anchor timed out"
	AnchorNotFoundError    = "Infrastructure error: Http Client error: API connected by HttpClient found an error: anchor not found"
)

Variables

View Source
var (
	EncryptionAlgFromProto = map[proto.EncryptionAlg]EncryptionAlg{
		0: AES256GCM,
		1: RSA,
		2: ECIES,
	}
	EncryptionAlgToProto = map[EncryptionAlg]proto.EncryptionAlg{
		AES256GCM: 0,
		RSA:       1,
		ECIES:     2,
	}
)
View Source
var (
	SignatureAlgFromProto = map[string]SignatureAlg{
		"ES256K": ECDSA,
		"ENS":    ENS,
	}
)

Functions

func ListOfNetworks

func ListOfNetworks() networks

func MapRecordsToProto

func MapRecordsToProto(records []Record) []*proto.Record

func NetworkToProto

func NetworkToProto(network Network) *proto.Network

Types

type AesDecrypter

type AesDecrypter struct {
	Alg  proto.EncryptionAlg
	Args DecrypterArgs
}

func NewAesDecrypter

func NewAesDecrypter(password string) AesDecrypter

func (AesDecrypter) ToProto

func (e AesDecrypter) ToProto() *proto.Decrypter

type AesEncrypter

type AesEncrypter struct {
	Alg  proto.EncryptionAlg
	Args EncrypterArgs
}

func NewAesEncrypter

func NewAesEncrypter(password string) AesEncrypter

func (AesEncrypter) ToProto

func (e AesEncrypter) ToProto() *proto.Encrypter

type Anchor

type Anchor struct {
	Id         int64
	BlockRoots []string
	Networks   []AnchorNetwork
	Root       string
	Status     string
}

func NewAnchorFromProto

func NewAnchorFromProto(a *proto.Anchor) Anchor

type AnchorNetwork

type AnchorNetwork struct {
	Name   string
	State  string
	TxHash string
}

func MapAnchorNetworksFromProto

func MapAnchorNetworksFromProto(n []*proto.AnchorNetwork) []AnchorNetwork

func NewAnchorNetworkFromProto

func NewAnchorNetworkFromProto(a *proto.AnchorNetwork) AnchorNetwork

func (AnchorNetwork) ToProto

func (a AnchorNetwork) ToProto() *proto.AnchorNetwork

type AnchorParams

type AnchorParams struct {
	Timeout int64
}

func NewAnchorParams

func NewAnchorParams() AnchorParams

type Decrypter

type Decrypter interface {
	ToProto() *proto.Decrypter
}

type DecrypterArgs

type DecrypterArgs struct {
	Key string
}

func (DecrypterArgs) ToProto

func (e DecrypterArgs) ToProto() *proto.DecrypterArgs

type EcdsaSigner

type EcdsaSigner struct {
	Alg  proto.SignerAlg
	Args SignerArgs
}

func NewEcdsaSigner

func NewEcdsaSigner(args SignerArgs) EcdsaSigner

func NewEnsSigner

func NewEnsSigner(args EnsArgs) EcdsaSigner

func (EcdsaSigner) ToProto

func (s EcdsaSigner) ToProto() *proto.Signer

type EciesDecrypter

type EciesDecrypter struct {
	Alg  proto.EncryptionAlg
	Args DecrypterArgs
}

func (EciesDecrypter) ToProto

func (e EciesDecrypter) ToProto() *proto.Decrypter

type EciesEncrypter

type EciesEncrypter struct {
	Alg  proto.EncryptionAlg
	Args EncrypterArgs
}

func (EciesEncrypter) ToProto

func (e EciesEncrypter) ToProto() *proto.Encrypter

type Encrypter

type Encrypter interface {
	ToProto() *proto.Encrypter
}

type EncrypterArgs

type EncrypterArgs struct {
	Key string
}

func (EncrypterArgs) ToProto

func (e EncrypterArgs) ToProto() *proto.EncrypterArgs

type EncryptionAlg

type EncryptionAlg int32
const (
	AES256GCM                   EncryptionAlg = iota
	RSA                         EncryptionAlg = iota
	ECIES                       EncryptionAlg = iota
	UNRECOGNIZED_ENCRYPTION_ALG EncryptionAlg = -1
)

type EnsArgs

type EnsArgs struct {
	PrivateKey string
}

type EnsSigner

type EnsSigner struct {
	Alg  proto.SignerAlg
	Args SignerArgs
}

func (EnsSigner) ToProto

func (s EnsSigner) ToProto() *proto.Signer

type HostedLoader

type HostedLoader struct {
	Type proto.DataAvailabilityType
	Args LoaderArgs
}

func NewHostedLoader

func NewHostedLoader(id string) HostedLoader

func (HostedLoader) ToProto

func (e HostedLoader) ToProto() *proto.Loader

type HostedPublisher

type HostedPublisher struct {
	Type proto.DataAvailabilityType
	Args PublisherArgs
}

func NewHostedPublisher

func NewHostedPublisher() HostedPublisher

func (HostedPublisher) ToProto

func (e HostedPublisher) ToProto() *proto.Publisher

type IpfsLoader

type IpfsLoader struct {
	Type proto.DataAvailabilityType
	Args LoaderArgs
}

func NewIpfsLoader

func NewIpfsLoader(hash string) IpfsLoader

func (IpfsLoader) ToProto

func (e IpfsLoader) ToProto() *proto.Loader

type IpfsPublisher

type IpfsPublisher struct {
	Type proto.DataAvailabilityType
	Args PublisherArgs
}

func NewIpfsPublisher

func NewIpfsPublisher() IpfsPublisher

func (IpfsPublisher) ToProto

func (e IpfsPublisher) ToProto() *proto.Publisher

type KeyPair

type KeyPair struct {
	PublicKey  string
	PrivateKey string
}

func NewEciesKeyPairFromProto

func NewEciesKeyPairFromProto(k *proto.GenerateEciesKeyPairResponse) KeyPair

func NewKeysFromProto

func NewKeysFromProto(k *proto.GenerateEcdsaKeysResponse) KeyPair

func NewRsaKeyPairFromProto

func NewRsaKeyPairFromProto(k *proto.GenerateRsaKeyPairResponse) KeyPair

type Loader

type Loader interface {
	ToProto() *proto.Loader
}

type LoaderArgs

type LoaderArgs struct {
	Id string
}

func (LoaderArgs) ToProto

func (e LoaderArgs) ToProto() *proto.LoaderArgs

type Network

type Network = proto.Network

type NetworkParams

type NetworkParams struct {
	Network Network
}

func NewNetworkParams

func NewNetworkParams() NetworkParams

type Proof

type Proof struct {
	Leaves []string
	Nodes  []string
	Depth  string
	Bitmap string
	Anchor ProofAnchor
}

func NewProofFromProto

func NewProofFromProto(p *proto.Proof) Proof

func (Proof) ToProto

func (p Proof) ToProto() *proto.Proof

type ProofAnchor

type ProofAnchor struct {
	AnchorID int64
	Networks []AnchorNetwork
	Root     string
	Status   string
}

func NewProofAnchorFromProto

func NewProofAnchorFromProto(p *proto.ProofAnchor) ProofAnchor

func (ProofAnchor) ToProto

func (p ProofAnchor) ToProto() *proto.ProofAnchor

type Publisher

type Publisher interface {
	ToProto() *proto.Publisher
}

type PublisherArgs

type PublisherArgs struct {
}

func (PublisherArgs) ToProto

func (e PublisherArgs) ToProto() *proto.PublisherArgs

type Record

type Record struct {
	Payload []byte
	// contains filtered or unexported fields
}

func NewRecordFromProto

func NewRecordFromProto(r *proto.Record, configData *proto.ConfigData) Record

func (*Record) GetHash

func (r *Record) GetHash() (string, error)

func (*Record) Retrieve

func (r *Record) Retrieve() []byte

func (*Record) SetProof

func (r *Record) SetProof(proof Proof) error

func (*Record) ToProto

func (r *Record) ToProto() *proto.Record

type RecordHeader

type RecordHeader struct {
	Ty string
}

func NewRecordHeaderFromProto

func NewRecordHeaderFromProto(r *proto.RecordHeader) RecordHeader

func (RecordHeader) ToProto

func (rh RecordHeader) ToProto() *proto.RecordHeader

type RecordReceipt

type RecordReceipt struct {
	Anchor int64
	Client string
	Record string
	Status string
}

func NewRecordReceiptFromProto

func NewRecordReceiptFromProto(r *proto.RecordReceipt) RecordReceipt

type RsaDecrypter

type RsaDecrypter struct {
	Alg  proto.EncryptionAlg
	Args DecrypterArgs
}

func NewEciesDecrypter

func NewEciesDecrypter(key string) RsaDecrypter

func NewRsaDecrypter

func NewRsaDecrypter(key string) RsaDecrypter

func (RsaDecrypter) ToProto

func (e RsaDecrypter) ToProto() *proto.Decrypter

type RsaEncrypter

type RsaEncrypter struct {
	Alg  proto.EncryptionAlg
	Args EncrypterArgs
}

func NewEciesEncrypter

func NewEciesEncrypter(key string) RsaEncrypter

func NewRsaEncrypter

func NewRsaEncrypter(key string) RsaEncrypter

func (RsaEncrypter) ToProto

func (e RsaEncrypter) ToProto() *proto.Encrypter

type Signature

type Signature struct {
	Signature   string
	Protected   string
	Header      SignatureHeader
	MessageHash string
}

func NewSignatureFromProto

func NewSignatureFromProto(s *proto.Signature) Signature

func (*Signature) GetAlg

func (s *Signature) GetAlg() SignatureAlg

func (Signature) ToProto

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

type SignatureAlg

type SignatureAlg int32
const (
	ECDSA                      SignatureAlg = iota
	ENS                        SignatureAlg = iota
	UNRECOGNIZED_SIGNATURE_ALG SignatureAlg = -1
)

type SignatureHeader

type SignatureHeader struct {
	Alg string
	Kid string
}

func NewSignatureHeaderFromProto

func NewSignatureHeaderFromProto(s *proto.SignatureHeader) SignatureHeader

func (SignatureHeader) ToProto

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

type Signer

type Signer interface {
	ToProto() *proto.Signer
}

type SignerArgs

type SignerArgs struct {
	PrivateKey string
	CommonName *string
}

func (SignerArgs) ToProto

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

Jump to

Keyboard shortcuts

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