git-secure-export

Experimental tooling for encrypting the git-fast-export(1) output

git clone https://git.8pit.net/git-secure-export.git

 1package main
 2
 3import (
 4	"io"
 5	"log"
 6	"os"
 7	"path/filepath"
 8
 9	git "github.com/nmeum/git-secure-export"
10	cmd "github.com/nmeum/git-secure-export/cmd"
11)
12
13var key *[git.KeySize]byte
14
15func cryptFn(in io.Reader, inLen int64, out io.Writer) (int, error) {
16	return git.Decrypt(in, inLen, out, key)
17}
18
19func main() {
20	log.SetFlags(log.Lshortfile)
21
22	gitDir, err := git.GetDir()
23	if err != nil {
24		log.Fatal(err)
25	}
26
27	keyPath := filepath.Join(gitDir, "git-secure-key")
28	key, err = git.ReadKey(keyPath)
29	if err != nil {
30		log.Fatal(err)
31	}
32
33	if err = cmd.Handle(os.Stdin, os.Stdout, cryptFn); err != nil {
34		log.Fatal(err)
35	}
36}