kikcode

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyData   = errors.New("payload data is empty")
	ErrDataTooLong = errors.New("payload data is too long")
	ErrInvalidSize = errors.New("invalid size")
)

Functions

func DeriveRendezvousPrivateKey

func DeriveRendezvousPrivateKey(payload *Payload) ed25519.PrivateKey

Types

type Description

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

todo: Use proper arc struct

func GenerateDescription

func GenerateDescription(dimension float64, data KikCodePayload) (*Description, error)

func (*Description) ToSvg

func (d *Description) ToSvg(opts *QrCodeRenderOptions) string

type IdempotencyKey

type IdempotencyKey [nonceSize]byte

func GenerateRandomIdempotencyKey

func GenerateRandomIdempotencyKey() IdempotencyKey

type KikCodePayload

type KikCodePayload []byte

func CreateKikCodePayload

func CreateKikCodePayload(data []byte) KikCodePayload

type Kind

type Kind uint8
const (
	Cash Kind = iota
	GiftCard
	PaymentRequest
)

type Payload

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

func NewPayloadFromFiatAmount

func NewPayloadFromFiatAmount(kind Kind, currency currency.Code, amount float64, nonce IdempotencyKey) (*Payload, error)

func NewPayloadFromKinAmount

func NewPayloadFromKinAmount(kind Kind, quarks uint64, nonce IdempotencyKey) *Payload

func (*Payload) GetIdempotencyKey

func (p *Payload) GetIdempotencyKey() IdempotencyKey

func (*Payload) ToBytes

func (p *Payload) ToBytes() []byte

func (*Payload) ToQrCodeDescription

func (p *Payload) ToQrCodeDescription(dimension float64) (*Description, error)

func (*Payload) ToRendezvousKey

func (p *Payload) ToRendezvousKey() ed25519.PrivateKey

type QrCodeRenderOptions

type QrCodeRenderOptions struct {
	ForegroundColor color.Color

	IncludeBackground bool
	BackgroundColor   color.Color
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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