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.
Getting Started
Library was written in base of Tink library, which is official from Google.
Prerequisites
Install by one step
go get -v github.com/m1crogravity/google-pay-decryptor
Types
There are two main types in library:
- Token - encrypted payload from GooglePay
var input types.Token
- Decrypted - decrypted payload
var output types.Decrypted
Demo
- 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
}
Running the tests
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
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- 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