Documentation ¶
Index ¶
- Constants
- Variables
- func Any(b ...bool) bool
- func Context(purpose string) string
- func Counter(arr []byte) (map[byte]int, map[int]byte, int)
- func DecodeBase64(arr []byte) chan []byte
- func DecodeHex(src []byte) chan []byte
- func DeriveCA(sk ed25519.PrivateKey, req *x509.CertificateRequest, parent *x509.Certificate) (*x509.Certificate, error)
- func Empty(arr []byte) chan []byte
- func EncodeBase64(arr []byte) chan []byte
- func EncodeHex(src []byte) chan []byte
- func Even(i uint64) uint64
- func Expand(k []byte, toSize int) []byte
- func F_ALL(s *Set) bool
- func F_LSB0(s *Set) bool
- func F_MSB0(s *Set) bool
- func FmtLetsEncrypt(domain string) (string, string)
- func Freq(arr []byte) map[byte]int
- func GetMajor() int
- func GetMinor() int
- func Ham(t0, t1 []byte) int
- func Max(x, y int) int
- func MaxEq(x, y int) int
- func MaxR() []byte
- func Min(x, y int) int
- func MinEq(x, y int) int
- func NewCName(commonName string) pkix.Name
- func NewCsr(sk ed25519.PrivateKey, name pkix.Name) (*x509.CertificateRequest, error)
- func NewEndEntityCert(sk ed25519.PrivateKey, req *x509.CertificateRequest, parent *x509.Certificate) (*x509.Certificate, error)
- func NewName(commonName, country, org string) pkix.Name
- func Nor(err error) bool
- func Outln(ifces ...interface{}) error
- func Outlnh(ifces ...interface{}) error
- func Outlnp(ifces ...interface{}) error
- func ParseURI(u *url.URL) map[string]string
- func PemDecodeCRL(rawPemBytes []byte) (*pkix.CertificateList, error)
- func PemDecodeCRT(rawCRT []byte) (*x509.Certificate, error)
- func PemDecodeCSR(rawCSR []byte) (*x509.CertificateRequest, error)
- func PemEncodeCRL(rawCRL []byte) []byte
- func PemEncodeCRT(rawCRT []byte) []byte
- func PemEncodeCSR(rawCSR []byte) []byte
- func RandXor(a *big.Int, b uint64) *big.Int
- func RedirectServer() *http.Server
- func Rp(s int) *big.Int
- func Rpb(s int) []byte
- func SelfSignedCA(sk ed25519.PrivateKey, req *x509.CertificateRequest) (*x509.Certificate, error)
- func Sock(at string, with []byte) error
- func Split(k []byte, p int) ([][]byte, int)
- func Sum(x []byte) int
- func ToBase(raw []byte, base int) []byte
- func TransformRange(value, xMin, xMax, nMin, nMax float64) float64
- func Xor(x, y *big.Int) *big.Int
- func XorK(x []byte, k byte) []byte
- func XorY(x, y []byte) []byte
- type Alg
- type Bit
- type Bitflag
- type DirectoryGraph
- type EncodingSet
- type ExtToFileNode
- type FileExtension
- type FileNode
- type FlagToEncodingSet
- type LClient
- func (c *LClient) Decrypt(dst, src *bytes.Buffer) (*bytes.Buffer, error)
- func (c *LClient) Encrypt(dst, src *bytes.Buffer) (*bytes.Buffer, error)
- func (c *LClient) FmtRequest(endpoint ValidEndpoint, args ...string) *bytes.Buffer
- func (c *LClient) Get(key string) ([]byte, error)
- func (c *LClient) GetKey() ([]byte, error)
- func (c *LClient) GetServerKey() (*age.X25519Recipient, error)
- func (c *LClient) Home() ([]byte, error)
- func (c *LClient) Set(key, val string) ([]byte, error)
- func (c *LClient) SetKey() ([]byte, error)
- type Linker
- type Mode
- type Set
- func (set *Set) Base(base int) []byte
- func (s *Set) Bytes() []byte
- func (s *Set) Clear() *Set
- func (set *Set) Eq(x *Set) bool
- func (s *Set) Gt(set *Set) bool
- func (s *Set) Ham(set *Set) *Set
- func (set *Set) Lsb() Bit
- func (set *Set) Lsbs(last uint) []Bit
- func (s *Set) Lt(set *Set) bool
- func (s *Set) MaxEq(set *Set) *Set
- func (s *Set) MinEq(set *Set) *Set
- func (set *Set) Msb() Bit
- func (set *Set) Msbs(last uint) []Bit
- func (s *Set) Reader() *bytes.Reader
- func (s *Set) Scanner() *bufio.Scanner
- func (s *Set) Weight() *Set
- func (s *Set) Xor(set *Set) *Set
- type SysInfo
- type Transform
- type Tsec
- type Universe
- func DecodePEM(raw []byte) (*Universe, error)
- func DecodePEMFile(path string) (*Universe, error)
- func PointDistribution(bits int) *Universe
- func UniformDistribution(N int64) *Universe
- func UniformDistributionRp(N int64, Z int) *Universe
- func UniformFrom(bytes ...[]byte) *Universe
- func UniformOver(sets ...*Set) *Universe
- func (u *Universe) Add(y *Set) *Universe
- func (u *Universe) Apply(t func(*Set, *Set) *Set, z *Set) *Universe
- func (u *Universe) Bdp() int
- func (u *Universe) Collect() map[string]int
- func (u *Universe) Div(y *Set) *Universe
- func (u *Universe) EncodePEM() []byte
- func (u *Universe) Factorial() *Set
- func (u *Universe) Filter(f func(s *Set) bool) *Universe
- func (u *Universe) Headers() map[string]string
- func (u *Universe) Insert(set *Set) *Universe
- func (u *Universe) Intersection(U *Universe) *Universe
- func (u *Universe) Inverse(f func(s *Set) bool) *Universe
- func (u *Universe) Join(together ...*Universe) *Universe
- func (u *Universe) Mul(y *Set) *Universe
- func (u *Universe) P() float64
- func (u *Universe) Size() int
- func (u *Universe) SizeF() float64
- func (u *Universe) Slice(f func(s *Set) bool) (*Universe, *Universe)
- func (u *Universe) Sqrt() float64
- func (u *Universe) Sum() *Set
- func (u *Universe) Union(U *Universe) *Universe
- func (u *Universe) Write(f *os.File, base int)
- func (u *Universe) WritePEM(f *os.File) (int, error)
- func (u *Universe) Xor(y *Set) *Universe
- type ValidEndpoint
Constants ¶
const ( BitFlagUse string = "bf" BitFlagShort string = "interact with bitflags" BitFlagAlias0, BitFlagAlias1, BitFlagAlias2, BitFlagAlias3 string = "bflag", "bflags", "bit-flag", "bit-flags" )
For cli interface
const ( // the probability to be distributed across the Sets of U. Probility float64 = 1.0 // uint8 values for 0, 1. Zero Bit = 47 + iota One )
const (
Application string = ""
)
We are following a pattern of libraries (such as wireguard) that integrate the version of the library into the protocol. If the two versions do not match, then we do not allow use of cryptographic primitives or functions. If the two versions have differing major versions, they are incompatable. If any version < v1.x.x, it is unstable. The version is embeded into the library, stored in the following local structure
.tag ├── .tag/MNOR ├── .tag/MVAR ├── .tag/RLSE
See https://github.com/ok-john/tag for manipulation the file structure from a cli easily Or run make install-scripts.
Variables ¶
var ( ErrNotPEMEncoded = errors.New("invalid: Not PEM Encoded") ErrExcessInput = errors.New("invalid: Excess") ErrUnknownHeader = errors.New("invalid: Unknown Header Type") ErrUnknownHash = errors.New("invalid: Unknown Hash Type") ErrInvalidHeader = errors.New("invalid: PEM Header") ErrMismatchedVersion = errors.New("invalid: Mismatched Version") ErrFutureTimestamp = errors.New("invalid: Timestamp in the future") )
var (
ErrServerPublicKey = errors.New("client: could not get serverkey")
)
var Major string
var Minor string
var Release string
We accept that release values may have arbitrary strings concatinated to the end of it and do not parse it to an integer.
var Version string
This is constructed from the embedded version tag
Functions ¶
func Context ¶
Generates a timestamped context string in the format
purpose-vX.X.X-time
These are not to be trusted as we accept anybody could forge any context. They are not an acceptable replacement for a nonce, either.
func DecodeBase64 ¶
func DeriveCA ¶
func DeriveCA(sk ed25519.PrivateKey, req *x509.CertificateRequest, parent *x509.Certificate) (*x509.Certificate, error)
returns a new certificate authority issued from a parent x509 certificate
func EncodeBase64 ¶
func F_ALL ¶
Filter that guarentees all Sets of U. to have a filter that guarentees no sets use Inverse(F_ALL).
func F_LSB0 ¶
Filters for all Sets where the least significant bit == 0. To filter the set of Sets where lsb == 1 use Inverse(F_LSB0).
func F_MSB0 ¶
Filters for all sets where the most significant bit == 0. To filter the set of Sets where msb == 1 use Inverse(F_MSB0).
func FmtLetsEncrypt ¶
func NewCsr ¶
func NewCsr(sk ed25519.PrivateKey, name pkix.Name) (*x509.CertificateRequest, error)
creates a new certificate signing request for a
func NewEndEntityCert ¶
func NewEndEntityCert(sk ed25519.PrivateKey, req *x509.CertificateRequest, parent *x509.Certificate) (*x509.Certificate, error)
issues a new certificate from a parent certificate authority
func PemDecodeCRL ¶
func PemDecodeCRL(rawPemBytes []byte) (*pkix.CertificateList, error)
der encodes a pem encoded crl
func PemDecodeCRT ¶
func PemDecodeCRT(rawCRT []byte) (*x509.Certificate, error)
der encodes a pem encoded crt
func PemDecodeCSR ¶
func PemDecodeCSR(rawCSR []byte) (*x509.CertificateRequest, error)
pem encodes a der encoded csr
func RedirectServer ¶
func SelfSignedCA ¶
func SelfSignedCA(sk ed25519.PrivateKey, req *x509.CertificateRequest) (*x509.Certificate, error)
returns a new self-signed certificate
func Split ¶
Splits a k sized byte array p pieces. Returns the sliced array of arrays and the amount of spillover.
func TransformRange ¶
performs a linear transform on value from a known xMin, xMax to the new range nMin, nMax
Types ¶
type DirectoryGraph ¶
type DirectoryGraph struct { // at creation Node is the serialized FileNode at path Node *ring.Ring // contains filtered or unexported fields }
func NewDirectoryGraph ¶
func NewDirectoryGraph(root string) DirectoryGraph
Creates a new directory graph, all subdirectories of root are recursively traversed when this function is called
func NewGraphRing ¶
func NewGraphRing(roots ...string) DirectoryGraph
Creates an array of new directory graphs and links them into one ring
func (DirectoryGraph) FilterFor ¶
func (e DirectoryGraph) FilterFor(exts ...FileExtension) ExtToFileNode
filters the DirectoryGraph using the FileExtensions (keys) of extMap for each extension we populate an array of all FileNode using that extension
func (DirectoryGraph) InvertByExt ¶
func (e DirectoryGraph) InvertByExt() ExtToFileNode
inverts a DirectoryGraph creating a constant time lookup from map[FileExtension][]FileNode This includes the SysInfo last acquired from serialize() Acquires a lock on the result & e.DirectoryGraph while populating the index
func (DirectoryGraph) OpenAll ¶
func (e DirectoryGraph) OpenAll(exts ...FileExtension) []*os.File
type EncodingSet ¶
type EncodingSet [2]Transform
[0] encodes bytes & [1] decodes bytes, theorhetically atleast
type ExtToFileNode ¶
type ExtToFileNode map[FileExtension][]FileNode
func FindKeys ¶
func FindKeys(filepaths ...string) ExtToFileNode
returns any files using a common set of certificate file extensions from a ring of all children of filepaths should a given filepath have any. see DirectoryGraph for more details
func InitExtMap ¶
func InitExtMap(exts ...FileExtension) ExtToFileNode
func (ExtToFileNode) Add ¶
func (e ExtToFileNode) Add(ext FileExtension) ExtToFileNode
func (ExtToFileNode) Exists ¶
func (e ExtToFileNode) Exists(ext FileExtension) bool
func (ExtToFileNode) Flatten ¶
func (e ExtToFileNode) Flatten() []FileNode
flattens the FileNodes (values) down to an array
func (ExtToFileNode) OpenAll ¶
func (e ExtToFileNode) OpenAll() []*os.File
type FileExtension ¶
type FileExtension string
const ( EXT_JSON FileExtension = ".json" EXT_CSV FileExtension = ".csv" EXT_TXT FileExtension = ".txt" EXT_MD FileExtension = ".md" EXT_MOV FileExtension = ".mov" EXT_WAV FileExtension = ".wav" EXT_GIF FileExtension = ".gif" EXT_PNG FileExtension = ".png" EXT_JPG FileExtension = ".jpg" EXT_JPEG FileExtension = ".jpeg" EXT_CRT FileExtension = ".crt" EXT_CERT FileExtension = ".cert" EXT_PEM FileExtension = ".pem" EXT_CSR FileExtension = ".csr" EXT_SH FileExtension = ".sh" EXT_GO FileExtension = ".go" EXT_JS FileExtension = ".js" EXT_PY FileExtension = ".py" EXT_C FileExtension = ".c" EXT_AGE FileExtension = ".age" EXT_NOEXT FileExtension = "" )
type FlagToEncodingSet ¶
type FlagToEncodingSet map[string]EncodingSet
maps flags to their possible encoding functions
func GenEncSet ¶
func GenEncSet() FlagToEncodingSet
Mapping of cli flags to encoding sets, including the default mapped to ""
func (FlagToEncodingSet) GetOrDefault ¶
func (set FlagToEncodingSet) GetOrDefault(flag string) (Transform, Transform)
Gets the encoding set or returns athe default select encoding
type LClient ¶
type LClient struct {
API, User string
PublicKey, ServerKey *age.X25519Recipient
// contains filtered or unexported fields
}
func NewClientFromPath ¶
func (*LClient) FmtRequest ¶
func (c *LClient) FmtRequest(endpoint ValidEndpoint, args ...string) *bytes.Buffer
func (*LClient) GetServerKey ¶
func (c *LClient) GetServerKey() (*age.X25519Recipient, error)
type Linker ¶
type Linker struct { S *http.Server RC *redis.Client ID *age.X25519Identity SM map[string]func(rw http.ResponseWriter, r *http.Request) }
type Set ¶
type Universe ¶
type Universe struct {
// contains filtered or unexported fields
}
a ring of discrete Sets.
func DecodePEMFile ¶
Attempts to read/decode a file at path into a Universe. Returns an error if the file cannot be read or decoded.
func PointDistribution ¶
Distributes all probability onto U0 where U == U[0..2]^bit and returns U.
func UniformDistribution ¶
Evenly distributes U[0..2]^N over U and returns U.
func UniformDistributionRp ¶
Evenly distributes U[Rp(Z)]^N over U and returns U.
func UniformFrom ¶
func UniformOver ¶
func (*Universe) Intersection ¶
Sets u equal to u ⋂ U, return u.
type ValidEndpoint ¶
type ValidEndpoint string
const ( GET_KEY ValidEndpoint = "get" SET_KEY ValidEndpoint = "set" HOME ValidEndpoint = "" )