sensitive

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 1 Imported by: 0

README

sensitive

Documentation

Overview

package sensitive provides a way to create sensitive data types

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	masked.MaskedText
}

Email represents a sensitive email address.

func NewEmail

func NewEmail(s string) Email

NewEmail creates a new Email instance with the default email masking function.

func NewEmailWithMask

func NewEmailWithMask(s string, mask MaskFunc) Email

NewEmailWithMask creates a new Email instance with a custom masking function.

type MaskFunc

type MaskFunc func(string) string

MaskFunc is a function type that takes a string as input and returns a masked string. It is used to define custom masking functions for sensitive data.

type Password

type Password struct {
	masked.MaskedText
}

Password represents a sensitive password value.

Example
package main

import (
	"fmt"

	"github.com/pedrolemes/sensitive"
)

func main() {
	p := sensitive.NewPassword("my-password")
	fmt.Println(p)
}
Output:

****

func NewPassword

func NewPassword(s string) Password

NewPassword creates a new Password instance with a default mask.

func NewPasswordWithMask

func NewPasswordWithMask(s string, mask MaskFunc) Password

NewPasswordWithMask creates a new Password instance with a custom mask.

Example
package main

import (
	"fmt"

	"github.com/pedrolemes/sensitive"
)

func main() {
	p := sensitive.NewPasswordWithMask("my-password", func(s string) string {
		return "---"
	})

	fmt.Println(p)
}
Output:

---

type Phone

type Phone struct {
	masked.MaskedText
}

Phone represents a sensitive phone number.

func NewPhone

func NewPhone(s string) Phone

NewPhone creates a new Phone instance with the default mask.

func NewPhoneWithMask

func NewPhoneWithMask(s string, mask MaskFunc) Phone

NewPhoneWithMask creates a new Phone instance with a custom mask.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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