Tired of looking for information about cryptography and decrypting google pay token in Golang? Then this library will definitely make your work easier. I can’t say that the solution is ideal, so I accept any suggestions and will be glad to contributors.
Library was written in base of Tink library, which is official from Google.
Install by one step
go get -v github.com/m1crogravity/google-pay-decryptor
There are two main types in library:
- Token - encrypted payload from GooglePay
var input types.Token
- Decrypted - decrypted payload
var output types.Decrypted
- Load root signing keys, private key and merchantID as recipientId while launching app
decrypt.Init(rootKeys, recipientId, privateKey)
Keys will be initialized and stored to environment variables.
If you want to renew keys, just restart app.
- Decrypt payload
decryptor, err = decrypt.NewGooglePayDecryptor()
if err != nil {
return types.Decrypted{}, err
}
output, err = decrypt.Decrypt(input) // input is payload in types.Token
if err != nil {
return types.Decrypted{}, err
}
To run tests
go test -v ./...
To see coverage of tests
go test -cover -coverprofile=c.out
To visualize coverage by tests
go tool cover -html=c.out -o coverage.html
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Zhuman Rakhat - Initial work - Google Pay Decryptor
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details
- If you find an error, feel free to open an issue and we will figure it out
- Let's make the world easier and improve the design and implementations in Go