Documentation
¶
Overview ¶
The package idf contains the structure of the ID File. It holds a generated ID and a salt (a 256-bit random number) in a JSON file. This file is used by different entities to save their ID and salt to file. The file path is usually stored and referenced from each entity's configuration files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadIDF ¶
MarshalIdfToJSON creates an IdFile object with the provided values and marshals it into JSON bytes ready to be written to a file.
func UnloadIDF ¶
UnloadIDF reads the contents of the IDF at the given path and returns the salt and ID stored in it. It does so by unmarshalling the JSON in the file into an IdFile object. The ID bytes from the object are unmarshalled into an ID object and it is returned along with the salt.
Errors are returned when there is a failure to read the IDF, unmarshall the JSON, or unmarshalling the ID.
Types ¶
type IdFile ¶
type IdFile struct { ID string `json:"id"` Type string `json:"type"` Salt [saltLen]byte `json:"salt"` IdBytes [id.ArrIDLen]byte `json:"idBytes"` }
IdFile structure matches the JSON structure used to save IDs and salts. The ID and ID type are saved as strings to make the file easy to read; they are never used or processed.