Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateHash(raw []byte) string
- func GetJsonFields() (fields []string)
- type Config
- type HashType
- type HashrefClient
- func (hc *HashrefClient) CollectLocalMetadata(inputType HashType, input, hash string) map[string]interface{}
- func (hc *HashrefClient) GetRemoteData(inputType HashType, input, hashValue string) (bool, map[string]interface{})
- func (hc *HashrefClient) GetRemoteDataFromPublisher(inputType HashType, input, hashValue, publisher string) (bool, map[string]interface{})
- func (hc *HashrefClient) GetSelf() map[string]interface{}
- func (hc *HashrefClient) RemoveHash(force bool, input, calculatedHash string) bool
- func (hc *HashrefClient) SetRemoteData(inputType HashType, input string, calculatedHash string, ...) bool
- func (hc *HashrefClient) SetSelf(metadata map[string]interface{}) bool
Constants ¶
const ( Hash = 0 Text = 1 File = 2 Publisher = 3 )
Variables ¶
Functions ¶
func CalculateHash ¶
CalculateHash calculates the sha256 hashsum to a provided byte slice
func GetJsonFields ¶
func GetJsonFields() (fields []string)
GetJsonFields returns a slice of strings with json field names for a Config object
Types ¶
type Config ¶
type Config struct { Publisher string `json:"HASHREF_PUBLISHER"` DefaultMeta map[string]string `json:"HASHREF_DEFAULT_META"` HashrefServer string `json:"HASHREF_SERVER"` }
func LoadConfig ¶
LoadConfig loads the configuration from the provided file path
func (*Config) LoadEnvValues ¶
func (c *Config) LoadEnvValues()
LoadEnvValues loads Config object values based on the json field names from the environment
type HashType ¶
type HashType int
func GetHashTypeAndValue ¶
GetHashTypeAndValue identifies if the provided input is a text, file or sha256 hashsum
type HashrefClient ¶
type HashrefClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config Config) HashrefClient
func (*HashrefClient) CollectLocalMetadata ¶
func (hc *HashrefClient) CollectLocalMetadata(inputType HashType, input, hash string) map[string]interface{}
CollectLocalMetadata collects based on the provided input metadata and returns it as a map with metadata
func (*HashrefClient) GetRemoteData ¶
func (hc *HashrefClient) GetRemoteData(inputType HashType, input, hashValue string) (bool, map[string]interface{})
func (*HashrefClient) GetRemoteDataFromPublisher ¶
func (hc *HashrefClient) GetRemoteDataFromPublisher(inputType HashType, input, hashValue, publisher string) (bool, map[string]interface{})
func (*HashrefClient) GetSelf ¶
func (hc *HashrefClient) GetSelf() map[string]interface{}
GetSelf performs a request to the server and collects the metadata that is stored remotly to the publisher
func (*HashrefClient) RemoveHash ¶
func (hc *HashrefClient) RemoveHash(force bool, input, calculatedHash string) bool
RemoveHash deletes the metadata remotly to the provided hash.
func (*HashrefClient) SetRemoteData ¶
func (*HashrefClient) SetSelf ¶
func (hc *HashrefClient) SetSelf(metadata map[string]interface{}) bool
SetSelf sets the metadata to the hash of the identity remoely