INNER CODE UNIT · Go

func

cryptag/cryptag · servers/cryptag-webserver/main.go:461

func (fs *FileSystem) Init() error {
	var err error
	dirs := []string{fs.cryptagPath, fs.tagsPath, fs.rowsPath, fs.rowsDeletedPath}
	for _, path := range dirs {
		err = os.MkdirAll(path, 0755)
		if err == nil || os.IsExist(err) {
			// Created successfully or already exists
			continue
		}
		return fmt.Errorf("Error making dir `%s`: %v", path, err)
	}
	return nil
}

func (fs *FileSystem) SaveTagPair(pair *types.TagPair) error {
	if len(pair.PlainEncrypted) == 0 || len(pair.Random) == 0 || pair.Nonce == nil || *pair.Nonce == [24]byte{} {
		// TODO(elimisteve): Make error global?
		return errors.New("Invalid tag pair; requires plain_encrypted, random, and nonce fields")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…