go_airgap

package module
v0.0.0-...-852e68f Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

AirGap is a binary protocol for communication between isolated devices, key vaults, and unsecured networks.

This package used for Soika Wallet operations and signing offline transactions with Soika AirGap.

Documentation

Index

Constants

View Source
const (
	VersionDefault = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AirGap

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

func NewAirGap

func NewAirGap(version uint8, instanceId []byte) *AirGap

NewAirGap initiates a new AirGap instance with secp256k1 serialized compressed public key

func (*AirGap) ChunkSize

func (a *AirGap) ChunkSize() int

func (*AirGap) CreateMessage

func (a *AirGap) CreateMessage() *Message

CreateMessage initiates new builder for AirGap messages batch

func (*AirGap) SetChunkSize

func (a *AirGap) SetChunkSize(chunkSize int)

func (*AirGap) SetEncryptorDecryptor

func (a *AirGap) SetEncryptorDecryptor(ed EncryptorDecryptor) *AirGap

func (*AirGap) SetVersion

func (a *AirGap) SetVersion(version uint8)

func (*AirGap) Unmarshal

func (a *AirGap) Unmarshal(data []byte) (*Message, error)

type Chunks

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

func NewChunks

func NewChunks() *Chunks

func (*Chunks) Count

func (ch *Chunks) Count() uint16

func (*Chunks) Data

func (ch *Chunks) Data() []byte

func (*Chunks) Filled

func (ch *Chunks) Filled() uint16

func (*Chunks) IsFilled

func (ch *Chunks) IsFilled() bool

func (*Chunks) ReadB64Chunk

func (ch *Chunks) ReadB64Chunk(frame string) (wasAdded bool, err error)

func (*Chunks) SerializeB64

func (ch *Chunks) SerializeB64() []string

SerializeB64 represents data frames to strings array, ready for generate QR code animation frames

func (*Chunks) SetData

func (ch *Chunks) SetData(src []byte, chunkSize int) (*Chunks, error)

type Decryptor

type Decryptor interface {
	Decrypt(data []byte) ([]byte, error)
}

Decryptor implements decryption method for Chunks

type Encryptor

type Encryptor interface {
	Encrypt(data []byte) ([]byte, error)
}

Encryptor implements encryption method for Chunks

type EncryptorDecryptor

type EncryptorDecryptor interface {
	Encryptor
	Decryptor
}

EncryptorDecryptor provides encryption and decryption methods for airgap session security

type Message

type Message struct {
	Version    uint8
	InstanceId []byte
	Operations []*Operation
	// contains filtered or unexported fields
}

Message contains

func (*Message) AddOperation

func (m *Message) AddOperation(opCode uint16, data []byte) *Message

func (*Message) Marshal

func (m *Message) Marshal() ([]byte, error)

func (*Message) MarshalB64Chunks

func (m *Message) MarshalB64Chunks() ([]string, error)

type Operation

type Operation struct {
	// OpCode - operation code
	OpCode uint16
	Size   uint32
	Data   []byte
}

Operation contains payload data for operation

Jump to

Keyboard shortcuts

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