utilities

package
v0.0.0-...-9a3149e Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package reggen generates text based on regex definitions This lib is from https://github.com/lucasjones/reggen/blob/master/reggen.go

Index

Constants

View Source
const (
	LITERAL_PARAM     = "literal"
	UUID_PARAM        = "uuid"
	STRING_PATTERN    = "stringPattern"
	INTEGER_RANGE     = "intRange"
	PAYLOAD_RANGE     = "payloadRange"
	SEQUENTIAL_STRING = "sequentialString"
	TRANSIENT_MAP     = "transientMap"
)

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key []byte, cipherText string) (plain string, err error)

Decrypt will decrypt cipher text with aes 256 key

func Encrypt

func Encrypt(key []byte, plain string) (cypherText string, err error)

Encrypt will encrypt plain text with aes 256 cbc mode

func GenAESKey

func GenAESKey(passwd string) [sha512.Size256]byte

GenAESKey generate aes key from a user defined password

func GenAESKeyWithHash

func GenAESKeyWithHash(passwd string, numOfHash int) [sha512.Size256]byte

GenAESKeyWithHash will generate AES key by numOfHash of sha512 hashes

func GenerateChaincodeParams

func GenerateChaincodeParams(chaincodeParamArray []string, transientMap string, dynamicTransientMapKs []string, dynamicTransientMapVs []string, iterationIndex int) (chaincodeArgs []string, transientStaticMap, transientDynamicMap map[string][]byte, err error)

Generate chaincode arguments (common chaincode) and transientMap (private data chaincode)

func GenerateRegexString

func GenerateRegexString(regex string, limit int) (string, error)

func GetComplexArgs

func GetComplexArgs(complexParams []string, loopIndex int) ([]string, error)

func GetTransientMap

func GetTransientMap(complexParams []string, loopIndex int) ([]byte, error)

func NewSecureIdentity

func NewSecureIdentity(pathToKeyAndCert string, id string, numOfHashes int) (secureSigningId msp.SigningIdentity, err error)

Types

type Generator

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

func NewGenerator

func NewGenerator(regex string) (*Generator, error)

create a new generator

func (*Generator) Generate

func (g *Generator) Generate(limit int) string

limit is the maximum number of times star, range or plus should repeat i.e. [0-9]+ will generate at most 10 characters if this is set to 10

type IntegerRange

type IntegerRange struct {
	Min string
	Max string
}

func (*IntegerRange) GetValue

func (p *IntegerRange) GetValue() (string, error)

type Literal

type Literal struct {
	Value string
}

func (*Literal) GetValue

func (p *Literal) GetValue() string

type PayloadRange

type PayloadRange struct {
	Min string
	Max string
}

func (*PayloadRange) GetValue

func (p *PayloadRange) GetValue() (string, error)

type ProviderFactory

type ProviderFactory struct{}

func NewProviderFactory

func NewProviderFactory() *ProviderFactory

func (ProviderFactory) CreateCryptoSuiteProvider

func (p ProviderFactory) CreateCryptoSuiteProvider(config core.CryptoSuiteConfig) (core.CryptoSuite, error)

func (ProviderFactory) CreateInfraProvider

func (p ProviderFactory) CreateInfraProvider(config fab.EndpointConfig) (fab.InfraProvider, error)

func (ProviderFactory) CreateSigningManager

func (p ProviderFactory) CreateSigningManager(cryptoProvider core.CryptoSuite) (core.SigningManager, error)

type SequentialString

type SequentialString struct {
	Value string
}

func (*SequentialString) GetValue

func (p *SequentialString) GetValue(loopIndex int) string

type StringPattern

type StringPattern struct {
	Regex string
}

func (*StringPattern) GetValue

func (p *StringPattern) GetValue() (string, error)

type UUID

type UUID struct {
}

func (*UUID) GetValue

func (p *UUID) GetValue() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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