upgrade

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChallengeSize = 32
)

Variables

This section is empty.

Functions

func SHA256Digest

func SHA256Digest(ch driver.TokensUpgradeChallenge, tokens []token.LedgerToken) ([]byte, error)

Types

type Deserializer

type Deserializer interface {
	GetOwnerVerifier(id driver.Identity) (driver.Verifier, error)
}

type IdentityProvider

type IdentityProvider interface {
	GetSigner(ctx context.Context, id driver.Identity) (driver.Signer, error)
}

type Proof

type Proof struct {
	Challenge  driver.TokensUpgradeChallenge
	Tokens     []token.LedgerToken
	Signatures []Signature
}

func (*Proof) Deserialize

func (p *Proof) Deserialize(raw []byte) error

func (*Proof) Serialize

func (p *Proof) Serialize() ([]byte, error)

type Service

type Service struct {
	Logger                          logging.Logger
	MaxPrecision                    uint64
	UpgradeSupportedTokenFormatList []token.Format
	Deserializer                    Deserializer
	IdentityProvider                IdentityProvider
}

func NewService

func NewService(
	logger logging.Logger,
	maxPrecision uint64,
	deserializer Deserializer,
	identityProvider IdentityProvider,
) (*Service, error)

func (*Service) CheckUpgradeProof

func (s *Service) CheckUpgradeProof(ch driver.TokensUpgradeChallenge, proofRaw driver.TokensUpgradeProof, ledgerTokens []token.LedgerToken) (bool, error)

func (*Service) GenUpgradeProof

GenUpgradeProof does the following: For each token in input, it signs the concatenation of the challenge and the tokens to be upgraded. These signatures are then added to the proof

func (*Service) NewUpgradeChallenge

func (s *Service) NewUpgradeChallenge() (driver.TokensUpgradeChallenge, error)

func (*Service) ProcessTokens

func (s *Service) ProcessTokens(ledgerTokens []token.LedgerToken) ([]token.Token, error)

func (*Service) ProcessTokensUpgradeRequest

func (s *Service) ProcessTokensUpgradeRequest(utp *driver.TokenUpgradeRequest) ([]token.Token, error)

type Signature

type Signature = []byte

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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