emergencykit

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDescriptors

func GetDescriptors(data *DescriptorsData) []string

GetDescriptors returns an array of raw output descriptors.

func GetDescriptorsHTML

func GetDescriptorsHTML(data *DescriptorsData) string

GetDescriptorsHTML returns the HTML for the output descriptor list in the Emergency Kit.

Types

type DescriptorsData

type DescriptorsData struct {
	FirstFingerprint  string
	SecondFingerprint string
}

type Input

type Input struct {
	FirstEncryptedKey  string
	FirstFingerprint   string
	SecondEncryptedKey string
	SecondFingerprint  string
	Version            int
}

Input struct to fill the PDF

type Metadata

type Metadata struct {
	Version           int            `json:"version"`
	BirthdayBlock     int            `json:"birthdayBlock"`
	EncryptedKeys     []*MetadataKey `json:"encryptedKeys"`
	OutputDescriptors []string       `json:"outputDescriptors"`
}

Metadata holds the machine-readable data for an Emergency Kit.

type MetadataKey

type MetadataKey struct {
	DhPubKey         string `json:"dhPubKey"`
	EncryptedPrivKey string `json:"encryptedPrivKey"`
	Salt             string `json:"salt"`
}

MetadataKey holds an entry in the Metadata key array.

type MetadataReader

type MetadataReader struct {
	SrcFile string
}

MetadataReader can extract the metadata file from a PDF.

func (*MetadataReader) HasMetadata

func (mr *MetadataReader) HasMetadata() (bool, error)

HasMetadata returns whether the metadata is present (and alone) in SrcFile.

func (*MetadataReader) ReadMetadata

func (mr *MetadataReader) ReadMetadata() (*Metadata, error)

ReadMetadata returns the deserialized metadata file embedded in the SrcFile PDF.

type MetadataWriter

type MetadataWriter struct {
	SrcFile string
	DstFile string
}

MetadataWriter can add the metadata file to a PDF.

func (*MetadataWriter) WriteMetadata

func (mw *MetadataWriter) WriteMetadata(metadata *Metadata) error

WriteMetadata creates a copy of SrcFile with attached JSON metadata into DstFile.

type Output

type Output struct {
	HTML             string
	VerificationCode string
}

Output with the html as string and the verification code

func GenerateHTML

func GenerateHTML(params *Input, lang string) (*Output, error)

GenerateHTML returns the translated emergency kit html as a string along with the verification code.

Jump to

Keyboard shortcuts

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