Documentation ¶
Index ¶
- Constants
- func Decrypt(data []byte, password string) ([]byte, error)
- func Encrypt(data []byte, password string) ([]byte, error)
- func FileToSkeleton(path, password, ff string) (bool, error)
- func GeneratePythonSkeleton(lines []string) []string
- func RestoreSkeletonFile(path string, password string, ff string) (bool, error)
Constants ¶
const DefaultSkeletonFileExtension = "skeletonpy"
DefaultSkeletonFileExtension is the default file extension for the skeleton file
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt takes a byte slice of data and a password string as input. It extracts the salt from the data and uses it along with the password to derive an AES key using Argon2. It then creates a new GCM cipher with the derived key. The nonce and the ciphertext are extracted from the data, and the ciphertext is decrypted using the GCM cipher and the nonce. The resulting plaintext is returned. If an error occurs during any of these steps, it is returned.
func Encrypt ¶
Encrypt takes a byte slice of data and a password string as input. It generates a random salt and uses it along with the password to derive an AES key using Argon2. It then creates a new GCM cipher with the derived key and generates a random nonce. The data is encrypted using the GCM cipher and the nonce, and the resulting ciphertext is returned along with the salt. If an error occurs during any of these steps, it is returned.
func FileToSkeleton ¶
FileToSkeleton takes a Python file, encrypts it using AES, and stores it in a file. It then opens the original file and replaces all the function bodies with ... If a password is provided, it is used for the encryption. The function returns true if the operation was successful, false otherwise.
func GeneratePythonSkeleton ¶
GeneratePythonSkeleton takes a slice of strings representing lines of Python code, and returns a new slice where function bodies and variable assignments are replaced with '...'. It also replaces tabs with spaces and removes comments.
func RestoreSkeletonFile ¶
RestoreSkeletonFile takes a skeleton file and restores the original Python file. If a password is provided, it is used for the decryption. The function returns true if the operation was successful, false otherwise.
Types ¶
This section is empty.