Documentation ¶
Overview ¶
Package crypto provides tools for encrypting and decrypting files using age encryption and Shamir's Secret Sharing.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt decrypts a file using age identity obtained through shamir secret sharing.
Example ¶
package main import ( "log" "os" "gitlab.com/fav-cli/fav/pkg/crypto" ) func main() { tmpFile, err := os.CreateTemp("/tmp", "fav-test-file") if err != nil { log.Fatal(err) } defer tmpFile.Close() _, err = tmpFile.WriteString("test data") if err != nil { log.Fatal(err) } err = crypto.Encrypt(tmpFile.Name()) if err != nil { log.Fatal(err) } err = crypto.Decrypt(tmpFile.Name(), false) if err != nil { log.Fatal(err) } }
Output:
func Encrypt ¶
Encrypt encrypts the specified file using age encryption and distributes the resulting identity using Shamir's Secret Sharing.
Example ¶
package main import ( "log" "os" "gitlab.com/fav-cli/fav/pkg/crypto" ) func main() { tmpFile, err := os.CreateTemp("/tmp", "fav-test-file") if err != nil { log.Fatal(err) } defer tmpFile.Close() _, err = tmpFile.WriteString("test data") if err != nil { log.Fatal(err) } err = crypto.Encrypt(tmpFile.Name()) if err != nil { log.Fatal(err) } }
Output:
Types ¶
type SharedSecret ¶
type SharedSecret struct {}
SharedSecret contains information about a shared secret.
type SharedSecrets ¶
type SharedSecrets struct {
}SharedSecrets represents a collection of shared secrets.
Click to show internal directories.
Click to hide internal directories.