crypto

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadAttachment

func DownloadAttachment(url string) ([]byte, error)

Types

type Attachment

type Attachment struct {
	EncryptedFile struct {
		SubmissionPublicKey string `json:"submissionPublicKey"`
		Nonce               string `json:"nonce"`
		Binary              string `json:"binary"`
	} `json:"encryptedFile"`
}

type DecryptedBody

type DecryptedBody struct {
	Data struct {
		FormID           string    `json:"formId"`
		SubmissionID     string    `json:"submissionId"`
		DecryptedContent []Field   `json:"decryptedContent"`
		Version          int       `json:"version"`
		Created          time.Time `json:"created"`
	} `json:"data"`
}

DecryptedBody

func Decrypt

func Decrypt(encryptedBody EncryptedBody) (*DecryptedBody, error)

type EncryptedBody

type EncryptedBody struct {
	Data struct {
		FormID                 string            `json:"formId"`
		SubmissionID           string            `json:"submissionId"`
		EncryptedContent       string            `json:"encryptedContent"`
		Version                int               `json:"version"`
		Created                time.Time         `json:"created"`
		AttachmentDownloadUrls map[string]string `json:"attachmentDownloadUrls"`
	} `json:"data"`
}

EncryptedBody is the JSON body sent to the /submissions endpoint from FormSG.

type Field

type Field struct {
	ID          string   `json:"_id"`
	Answer      string   `json:"answer"`
	AnswerArray []string `json:"answerArray"`
	FieldType   string   `json:"fieldType"`
	Question    string   `json:"question"`
}

Field

Jump to

Keyboard shortcuts

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