secret

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package secret provide functions to encrypting and decrypting text such that the text can be persisted in a configuration file (xml / yaml / json etc.)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(cipherText string, decryptPassword bool) (plainText string)

Decode takes a cipher text and a boolean indicating whether to decrypt the cipher text using a password, and returns the resulting plain text. If the cipher text is an empty string, this function will panic.

func DecodeAsUtf16 added in v0.13.0

func DecodeAsUtf16(cipherText string, decryptPassword bool) []byte

DecodeAsUtf16 takes a cipher text and a boolean indicating whether to decrypt and returns the resulting plain text as a byte array in UTF-16 format which is required when passing the secret to applications written using managed code (C#), such as Azure Data Studio.

func Encode

func Encode(plainText string, encryptPassword bool) (cipherText string)

Encode takes a plain text string and a boolean indicating whether or not to encrypt the plain text using a password, and returns the resulting cipher text. If the plain text is an empty string, this function will panic.

func Generate

func Generate(passwordLength, minSpecialChar, minNum, minUpperCase int, specialCharSet string) string

Generate generates a random password of a specified length. The password will contain at least the specified number of special characters, numeric digits, and upper-case letters. The remaining characters in the password will be selected from a combination of lower-case letters, special characters, and numeric digits. The special characters are chosen from the provided special character set. The generated password is returned as a string.

func Initialize

func Initialize(handler func(err error))

Types

This section is empty.

Notes

Bugs

  • Encryption not yet implemented on linux

  • Encryption not yet implemented on linux

Jump to

Keyboard shortcuts

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