immutable

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: MIT Imports: 11 Imported by: 0

README

Immutable

Easy and ready to use immutable document publisher. It works generating an immutable content minted in IPFS.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRecordToLogs

func AddRecordToLogs(cfg *Config, record *ImmutableRecord) error

AddRecordToLogs adds a new record to the records file.

func GeneratePDF

func GeneratePDF(cfg *Config) error

GeneratePDF generates a PDF from the given config.

func GenerateREADME

func GenerateREADME(cfg *Config, readmeFilepath string) error

GenerateREADME generates a README document into given filepath.

func GenerateREADMEFile

func GenerateREADMEFile(cfg *Config) error

GenerateREADMEFile generates a README.md or _README.md file based on production config flag. If production flag is true, then the file is named README.md, otherwise it is named _README.md.

Types

type Config

type Config struct {
	Document DocumentConfig `yaml:"document"`

	ImmutableDir string `yaml:"immutableDir"`
	TemplatesDir string `yaml:"templatesDir"`

	Gotenberg GotenbergConfig `yaml:"gotenberg"`
	Pinata    PinataConfig    `yaml:"pinata"`

	Production bool `yaml:"production"`
}

func LoadConfigFromFile

func LoadConfigFromFile(configPath string) (*Config, error)

type DocumentConfig

type DocumentConfig struct {
	Title          string `yaml:"title"`
	OutputFilename string `yaml:"outputFilename"`
}

type GotenbergConfig

type GotenbergConfig struct {
	Hostname string `yaml:"hostname"`
}

type ImmutableRecord

type ImmutableRecord struct {
	CID  string
	Date time.Time
}

func NewRecord

func NewRecord(config *Config) (*ImmutableRecord, error)

NewRecord returns a new immutable record with the given config.

func ReadSortedRecords

func ReadSortedRecords(cfg *Config) ([]ImmutableRecord, error)

ReadSortedRecords reads the records file and returns a sorted by created date, slice of records.

func (*ImmutableRecord) RecordLine

func (ir *ImmutableRecord) RecordLine() string

RecordLine returns a string representation of the record.

type PinataConfig

type PinataConfig struct {
	APIKey    string `yaml:"APIKey"`
	APISecret string `yaml:"APISecret"`
}

type PinataResponse

type PinataResponse struct {
	IpfsHash  string
	Timestamp time.Time
}

func PinDocumentToIPFS

func PinDocumentToIPFS(cfg *Config) (*PinataResponse, error)

PinAssetToIPFS pins a file to IPFS and returns the hash of the file.

type ReadmeData

type ReadmeData struct {
	DocumentTitle string
	DocumentName  string
	Records       []ReadmeRecord
}

type ReadmeRecord

type ReadmeRecord struct {
	SerialNumber int
	CID          string
	Date         string
	DocumentName string
	DocumentPath string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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