https://github.com/rkritchat/jsonmask
json mask is about masking request json for logging with random star and hight performance.
https://github.com/rkritchat/jsonmask
go golang json logging mask
Last synced: 4 months ago
JSON representation
json mask is about masking request json for logging with random star and hight performance.
- Host: GitHub
- URL: https://github.com/rkritchat/jsonmask
- Owner: rkritchat
- License: mit
- Created: 2021-11-25T20:01:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-12T13:50:10.000Z (over 4 years ago)
- Last Synced: 2024-10-09T09:30:53.722Z (over 1 year ago)
- Topics: go, golang, json, logging, mask
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Jsonmask use for mask sensitive data from json format
## Installation
```shell
go get github.com/rkritchat/jsonmask
```
Code example
```go
package main
import (
"fmt"
"github.com/rkritchat/jsonmask"
)
var j = []byte(`{"foo":1,"bar":2,"baz":[3,4],"phoneNo":123456789, "newField":"test", "userInfo":{"firstname":"Kritchat", "lastname": "Rojanaphruk"}}`)
func main() {
m := jsonmask.Init([]string{"newField"}) //optional
t, err := m.Json(j)
if err != nil {
panic(err)
}
fmt.Println(*t)
}
```
Default Sensitive fields
```go
var defaultSensitiveData = []string{
"name",
"surName",
"firstName",
"lastName",
"identification",
"national",
"card",
"phone",
"phoneNo",
"number",
"username",
"password",
"email",
"address",
"phoneNo",
}
```
enjoy!