validator

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PlatformFactories contains all supported platform factory.
	PlatformFactories map[types.Platform]func(*Base) IValidator
)

Functions

This section is empty.

Types

type Base

type Base struct {
	Platform types.Platform
	Previous string
	Action   types.Action
	Pubkey   *ecdsa.PublicKey
	// Identity on target platform.
	Identity         string
	AltID            string
	ProofLocation    string
	Signature        []byte
	SignaturePayload string
	Text             string
	// Extra info needed by separate platforms (e.g. Ethereum)
	Extra map[string]string
	// CreatedAt indicates creation time of this link
	CreatedAt time.Time
	// Uuid gives this link an unique identifier, to let other
	// third-party service distinguish / store / dedup links with
	// ease.
	Uuid uuid.UUID
}

type H

type H map[string]any

H for JSON builder.

type IValidator

type IValidator interface {
	// GeneratePostPayload gives a post structure (with
	// placeholders) for user to post on target platform.
	GeneratePostPayload() (post map[string]string)
	// GenerateSignPayload generates a string to be signed.
	GenerateSignPayload() (payload string)

	Validate() (err error)
}

func BaseToInterface

func BaseToInterface(v *Base) IValidator

BaseToInterface converts a `validator.Base` struct to `validator.IValidator` interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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