idf

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: BSD-2-Clause Imports: 4 Imported by: 2

Documentation

Overview

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

func LoadIDF(filePath string, salt []byte, genID *id.ID) error

LoadIDF creates an IdFile object with the provided values and marshals it into JSON bytes ready to be written to a file.

func UnloadIDF

func UnloadIDF(path string) ([]byte, *id.ID, error)

UnloadIDF unmarshal the JSON encoded IdFile at the given file path and returns its 32-byte salt and id.ID.

Types

type IdFile

type IdFile struct {
	ID        *id.ID            `json:"id"`
	Type      string            `json:"type"`
	Salt      [saltLen]byte     `json:"salt"`
	IdBytes   [id.ArrIDLen]byte `json:"idBytes"`
	HexNodeID string            `json:"hexNodeID"`
}

IdFile is used to save IDs and salts to file in a human-readable form.

Jump to

Keyboard shortcuts

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