buf

package
v0.0.0-...-c9cba37 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Unlicense Imports: 10 Imported by: 0

Documentation

Overview

Package buf is a library for simplifying the handling of byte slices and has a special secure buffer that is protected from snooping by other processes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Byte

type Byte struct {
	Val *[]byte
	core.State
	Coding string
}

Byte is a simple byte slice

func NewByte

func NewByte() *Byte

NewByte creates a new Byte

func (*Byte) Bytes

func (r *Byte) Bytes() (out *[]byte)

Bytes returns a pointer to the buffer

func (*Byte) Copy

func (r *Byte) Copy(in *[]byte) core.Buffer

Copy copies the byte from a provided byte slice to a new buffer

func (*Byte) Free

func (r *Byte) Free() core.Buffer

Free is a

func (*Byte) Freeze

func (r *Byte) Freeze() (out *[]byte)

Freeze returns a json format struct of the data

func (*Byte) GetCoding

func (r *Byte) GetCoding() (out *string)

GetCoding is a

func (*Byte) GetElem

func (r *Byte) GetElem(index int) (out interface{})

GetElem is a

func (*Byte) IsEqual

func (r *Byte) IsEqual(p *[]byte) (is bool)

IsEqual returns true if a serialized public key matches this one, also in format (compressed is preferred in a distributed ledger due to size)

func (*Byte) Len

func (r *Byte) Len() int

Len is a

func (*Byte) ListCodings

func (r *Byte) ListCodings() (out *[]string)

ListCodings is a

func (*Byte) NewIf

func (r *Byte) NewIf() *Byte

NewIf creates a new Byte

func (*Byte) OK

func (r *Byte) OK() bool

OK returns true if there is no error

func (*Byte) SetCoding

func (r *Byte) SetCoding(in string) core.Coder

SetCoding is a

func (*Byte) SetElem

func (r *Byte) SetElem(index int, in interface{}) core.Array

SetElem is a

func (*Byte) SetStatus

func (r *Byte) SetStatus(s string) core.Status

SetStatus is a

func (*Byte) SetStatusIf

func (r *Byte) SetStatusIf(err error) core.Status

SetStatusIf is a

func (*Byte) String

func (r *Byte) String() (s string)

String implements the stringer, uses coding to determine how the string is contstructed

func (*Byte) Thaw

func (r *Byte) Thaw(in *[]byte) core.Streamer

Thaw is a

func (*Byte) UnsetStatus

func (r *Byte) UnsetStatus() core.Status

UnsetStatus is a

func (*Byte) Zero

func (r *Byte) Zero() core.Buffer

Zero writes zeroes to the byte slice

type Secure

type Secure struct {
	Val *memguard.LockedBuffer
	core.State
	Coding string
}

Secure is a memguard LockedBuffer

func NewSecure

func NewSecure() *Secure

NewSecure creates a new Secure

func (*Secure) Bytes

func (r *Secure) Bytes() (out *[]byte)

Bytes returns a pointer to the buffer

func (*Secure) Copy

func (r *Secure) Copy(in *[]byte) core.Buffer

Copy is a

func (*Secure) Error

func (r *Secure) Error() string

Error implements the Error interface

func (*Secure) Free

func (r *Secure) Free() core.Buffer

Free is a

func (*Secure) Freeze

func (r *Secure) Freeze() (out *[]byte)

Freeze returns a json format struct of the data

func (*Secure) GetCoding

func (r *Secure) GetCoding() (out *string)

GetCoding is a

func (*Secure) GetElem

func (r *Secure) GetElem(index int) (out interface{})

GetElem returns the byte at a given position if it is in bounds

func (*Secure) IsEqual

func (r *Secure) IsEqual(p *[]byte) (is bool)

IsEqual returns true if a serialized public key matches this one, also in format (compressed is preferred in a distributed ledger due to size).

func (*Secure) Len

func (r *Secure) Len() (length int)

Len returns the length of the buffer or -1 if it is not allocated

func (*Secure) ListCodings

func (r *Secure) ListCodings() (out *[]string)

ListCodings returns the set of codings available

func (*Secure) NewIf

func (r *Secure) NewIf() *Secure

NewIf creates a new Byte

func (*Secure) OK

func (r *Secure) OK() bool

OK returns true if there is no error

func (*Secure) Rand

func (r *Secure) Rand(length int) *Secure

Rand creates a secure buffer containing cryptographically secure random bytes

func (*Secure) SetCoding

func (r *Secure) SetCoding(in string) core.Coder

SetCoding sets the encoding for the stringer

func (*Secure) SetElem

func (r *Secure) SetElem(index int, in interface{}) core.Array

SetElem sets a byte in the buffer to a given value if it is in bounds

func (*Secure) SetStatus

func (r *Secure) SetStatus(s string) core.Status

SetStatus sets the status of an object after an operation

func (*Secure) SetStatusIf

func (r *Secure) SetStatusIf(err error) core.Status

SetStatusIf is a

func (*Secure) String

func (r *Secure) String() (s string)

String implements the stringer, uses coding to determine how the string is contstructed

func (*Secure) Thaw

func (r *Secure) Thaw(in *[]byte) core.Streamer

Thaw turns a json representation back into a variable

func (*Secure) UnsetStatus

func (r *Secure) UnsetStatus() core.Status

UnsetStatus is a

func (*Secure) Zero

func (r *Secure) Zero() core.Buffer

Zero is a

Jump to

Keyboard shortcuts

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