utils

package
v4.2.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptString

func DecryptString(cipherKey string, message string) (
	retVal interface{}, err error)

DecryptString decodes encrypted string using the cipherKey

It accepts the following parameters: cipherKey: cipher key to use to decrypt. message: to encrypted.

returns the unencoded encrypted string, error if any.

func EncodeJSONAsPathComponent

func EncodeJSONAsPathComponent(jsonBytes string) string

encodeJSONAsPathComponent properly encodes serialized JSON for placement within a URI path

func EncryptString

func EncryptString(cipherKey string, message string) string

EncryptString creates the base64 encoded encrypted string using the cipherKey. It accepts the following parameters: cipherKey: cipher key to use to encrypt. message: to encrypted.

returns the base64 encoded encrypted string.

func GetHmacSha256

func GetHmacSha256(secretKey string, input string) string

getHmacSha256 creates the cipher key hashed against SHA256. It accepts the following parameters: secretKey: the secret key. input: input to hash.

returns the hash.

func JoinChannels

func JoinChannels(channels []string) []byte

JoinChannels

func PamEncode

func PamEncode(value string) string

func PreparePamParams

func PreparePamParams(params *url.Values) string

func QueryToString

func QueryToString(query *url.Values) string

func Serialize

func Serialize(msg interface{}) ([]byte, error)

func SerializeAndEncrypt

func SerializeAndEncrypt(msg interface{}, cipherKey string, serialize bool) (string, error)

func SerializeEncryptAndSerialize

func SerializeEncryptAndSerialize(msg interface{}, cipherKey string, serialize bool) (string, error)

func URLEncode

func URLEncode(s string) string

TODO: verify the helper is used where supposed to

func UUID

func UUID() string

Generate a random uuid string

func ValueAsString

func ValueAsString(value interface{}) ([]byte, error)

PubNub - specific serializer

Types

type A

type A struct {
	I         string
	Interface *B
}

type B

type B struct {
	Value string
}

Jump to

Keyboard shortcuts

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