Versions in this module Expand all Collapse all v0 v0.1.0 Mar 10, 2024 Changes in this version + var DefaultCipherLoc = "./.cipher" + var EnvKeyAESCipher = "CIPHER" + var EnvKeyInitializationVector = "IV" + var ErrCipherToken404AES = errors.New("aes cipher not found in cipher map") + var ErrCipherToken404IV = errors.New("initialization vector (IV) not found in cipher map") + var ErrDuplicateKeys = errors.New("key already exists in request. accepted only the first one") + var ErrKeyAlreadyExists = errors.New("key already exists. not overriding") + var ErrKeyDoesNotExists = "key %s does not exist" + var ErrTokenInvalidBlockSize = errors.New(...) + var ErrTokenInvalidPadding = errors.New("invalid token string: padded bytes larger than aes block size: 16") + var ErrTokenInvalidPaddingNotHomogeneous = errors.New("invalid token string: padded bytes are not all the same") + var KeyDelimiter = "__" + func Detokenize(token string, cypher map[string]string) (string, error) + func GenAlphaNumericString(n int) string + func GetCombinedKey(s ...string) (cs string) + func IsErrKeyAlreadyExist(err error) bool + func WithStore(store store.Store) func(*Manager) + type Manager struct + func NewManager(ctx context.Context, logger *vlog.Logger, opts ...Options) *Manager + func (m *Manager) DeleteTokenByID(ctx context.Context, id string) (bool, error) + func (m *Manager) Detokenize(ctx context.Context, key, token string) (bool, string, error) + func (m *Manager) GenerateCipher() error + func (m *Manager) GetAllTokens(ctx context.Context) ([]*model.Tokenize, error) + func (m *Manager) GetTokenByID(ctx context.Context, id string) (*model.Tokenize, error) + func (m *Manager) PatchTokenByID(ctx context.Context, key, val string) (string, error) + func (m *Manager) Tokenize(ctx context.Context, key, val string) (string, error) + func (m *Manager) Validate(ctx context.Context, token *model.Tokenize, patch bool) ([]*ValidateResponse, bool) + func (m *Manager) ValidateKeys(ctx context.Context, token *model.Tokenize) ([]*ValidateResponse, bool) + type Options func(*Manager) + type Token struct + func Tokenize(s string, cypher map[string]string) (*Token, error) + func (t *Token) String() string + type ValidateResponse struct + Err error + Key string