contentUtils

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewUUIDv4Base58 = func() string {
	randomUuid, _ := uuid.NewRandom()
	uuidBytes, _ := randomUuid.MarshalBinary()
	return base58.Encode(uuidBytes)
}

Functions

func Base64UrlEncodedDataByJSON

func Base64UrlEncodedDataByJSON(jsonData map[string]interface{}) string

func CalculateSHA256

func CalculateSHA256(dataBytes *[]byte) string

CalculateSHA256 is used to generate the Thumbprint of a public JSON Web Key (JWK).

func CalculateSHA3_256

func CalculateSHA3_256(dataBytes *[]byte) string

CalculateSHA3_256 is used to generate the H(pk) in Crystals-Kyber

func CalculateShake256

func CalculateShake256(dataBytes *[]byte) string

CalculateShake256 is used to generate "xs" & "ds" in Crystals-Dilithium

func CheckValidLanguage

func CheckValidLanguage(language interface{}) bool

func CheckValidLocalizedText

func CheckValidLocalizedText(localizedText string) bool

CheckValidLocalizedText accepts "urn:ietf:bcp:47|<language>|<text>" but also "bcp:47|<language>|<text>" and "<language>|<text>" are allowed.

func CheckValidMultipleLocalizedTexts

func CheckValidMultipleLocalizedTexts(inputStr string) bool

func ComputeIndexedAttributeByHmacKey added in v1.0.4

func ComputeIndexedAttributeByHmacKey(hmacKey []byte, attributeName, attributeValue string) (string, string)

returns protected attribute name and value, raw Base64Url encoded (without padding characters '=')

func ComputeMAC

func ComputeMAC(message, key []byte) []byte

ComputeMAC creates a message authentication code (MAC), sometimes known as a "tag", which is a short piece of information used for authenticating a message, by using some deterministic data (the traditional "key" concept) which authenticates the origin of the message, where the deterministic data (key) serves to regenerate the expected MAC (tag) for the original message. In other words, to confirm a tag matches with the expected data and key (its authenticity).

func Contains

func Contains(slice []string, item string) bool

TODO: describe the function

func ConvertBytesToRawJson

func ConvertBytesToRawJson(bytes *[]byte) (result json.RawMessage, errMsg string)

func GetMultihashBase58

func GetMultihashBase58(inputBytes *[]byte, hashName string) string

Multihash is byte slice with the following form: <hash function code><digest size><hash function output>. See the spec for more information. B58String returns the B58-encoded representation of a multihash. Create a new multihash with the digest data.

func GetMultihashSHA256Base58

func GetMultihashSHA256Base58(inputBytes *[]byte) string

Multihash is byte slice with the following form: <hash function code><digest size><hash function output>. See the spec for more information. B58String returns the B58-encoded representation of a multihash. Create a new multihash with the digest data.

func GetVerifiedLocalizedText

func GetVerifiedLocalizedText(localizedText string) string

GetVerifiedLocalizedText returns empty string if wrong formatted instead of true or false

func InterfaceToMap

func InterfaceToMap(i interface{}) (map[string]interface{}, error)

func NewMultibase58UUIDv4

func NewMultibase58UUIDv4() string

NewMultibase58UUIDv4 returns an UUID v4 encoded as multi base58 BTC ("z" prefix). See https://tools.ietf.org/id/draft-multiformats-multibase-00.html#rfc.appendix.D.1

func StringToStringsArray

func StringToStringsArray(spaceSeparatedString *string) []string

StringToStringsArray splits the string around each instance of one or more consecutive white space characters

func StringsArrayByConcatenatedString

func StringsArrayByConcatenatedString(concatenatedString *string, concatenationSymbol string) []string

StringToStringsArray splits the string around each instance of one or more consecutive white space characters

func StringsArrayToString

func StringsArrayToString(stringsSlice *[]string) string

StringsArrayToString converts a slice of strings to a string containing a space separated list of strings

func StringsSliceContainsString

func StringsSliceContainsString(slice []string, strValue string) bool

StringsSliceContainsString checks if a string is contained in some member of the slice

func StringsSliceHasStringMember

func StringsSliceHasStringMember(slice []string, strValue string) bool

StringsSliceContains checks if a string is equal to some member in the slice

func ValidMAC

func ValidMAC(message, messageMAC, key []byte) bool

ValidMAC reports whether messageMAC is a valid HMAC tag for message. Receivers should be careful to use Equal to compare MACs in order to avoid timing side-channels:

Types

This section is empty.

Jump to

Keyboard shortcuts

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