Documentation
¶
Index ¶
- func GetMockAmex(key *rsa.PrivateKey, amount, currency string) (jwe string, plaintext []byte)
- func GetMockAmexWithPublicKey(key *rsa.PublicKey, amount, currency string) (jwe string, plaintext []byte)
- func GetMockMastercard(key *rsa.PrivateKey, amount, currency string) (jwe string, plaintext []byte)
- func GetMockMastercardWithPublicKey(key *rsa.PublicKey, amount, currency string) (jwe string, plaintext []byte)
- func GetMockVisa(key *rsa.PrivateKey, amount, currency string) (jwe string, plaintext []byte)
- func GetMockVisaWithPublicKey(key *rsa.PublicKey, amount, currency string) (jwe string, plaintext []byte)
- func Kid(key PrivateKey) string
- func KidFromPublic(key crypto.PublicKey) string
- type Decryptor
- type KeyAdder
- type KeyProvider
- type PrivateKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMockAmex ¶
func GetMockAmex(key *rsa.PrivateKey, amount, currency string) (jwe string, plaintext []byte)
Produces a JWE and plaintext of an American Express test DPAN. Uses the test card listed on MPGS documentation: https://ap-gateway.mastercard.com/api/documentation/integrationGuidelines/supportedFeatures/pickPaymentMethod/devicePayments/SamsungPay.html?locale=en_US
func GetMockAmexWithPublicKey ¶
func GetMockAmexWithPublicKey(key *rsa.PublicKey, amount, currency string) (jwe string, plaintext []byte)
Produces a JWE and plaintext of an American Express test DPAN. Uses the test card listed on MPGS documentation: https://ap-gateway.mastercard.com/api/documentation/integrationGuidelines/supportedFeatures/pickPaymentMethod/devicePayments/SamsungPay.html?locale=en_US
func GetMockMastercard ¶
func GetMockMastercard(key *rsa.PrivateKey, amount, currency string) (jwe string, plaintext []byte)
Produces a JWE and plaintext of a Mastercard test DPAN. Uses the test card listed on MPGS documentation: https://ap-gateway.mastercard.com/api/documentation/integrationGuidelines/supportedFeatures/pickPaymentMethod/devicePayments/SamsungPay.html?locale=en_US
func GetMockMastercardWithPublicKey ¶
func GetMockMastercardWithPublicKey(key *rsa.PublicKey, amount, currency string) (jwe string, plaintext []byte)
Produces a JWE and plaintext of a Mastercard test DPAN. Uses the test card listed on MPGS documentation: https://ap-gateway.mastercard.com/api/documentation/integrationGuidelines/supportedFeatures/pickPaymentMethod/devicePayments/SamsungPay.html?locale=en_US
func GetMockVisa ¶
func GetMockVisa(key *rsa.PrivateKey, amount, currency string) (jwe string, plaintext []byte)
Produces a JWE and plaintext of a Visa test DPAN. Uses the test card listed on MPGS documentation: https://ap-gateway.mastercard.com/api/documentation/integrationGuidelines/supportedFeatures/pickPaymentMethod/devicePayments/SamsungPay.html?locale=en_US
func GetMockVisaWithPublicKey ¶
func GetMockVisaWithPublicKey(key *rsa.PublicKey, amount, currency string) (jwe string, plaintext []byte)
Produces a JWE and plaintext of a Visa test DPAN. Uses the test card listed on MPGS documentation: https://ap-gateway.mastercard.com/api/documentation/integrationGuidelines/supportedFeatures/pickPaymentMethod/devicePayments/SamsungPay.html?locale=en_US
func Kid ¶
func Kid(key PrivateKey) string
Kid calculates the Kid of the private key as the base64 of the SHA-256 of the public key component
func KidFromPublic ¶
KidFromPublic is the base64 of the SHA-256 of the public key
Types ¶
type Decryptor ¶
func NewJWEDecryptor ¶
func NewJWEDecryptor(version string, provider KeyProvider) (Decryptor, error)
A factory function to produce JWE decryptors compliant to the stated version spec and using `provider` for key retrieval
type KeyAdder ¶
type KeyAdder interface {
AddKey(PrivateKey) error
}
KeyAdder is a helper interface to signal the provider's ability to add keys.
type KeyProvider ¶
type KeyProvider interface {
GetKey(kid string) PrivateKey
}
KeyProvider is a generic interface for an implementation fetching the private key from backing storage given `kid`.
func NewFilesystemKeyProvider ¶
func NewFilesystemKeyProvider(root string) (KeyProvider, error)
Expects a directory path containing private keys formatted as PKCS8 PEM
func NewMemoryKeyProvider ¶
func NewMemoryKeyProvider(keys ...PrivateKey) KeyProvider
The static key provider is an in-memory key provider
type PrivateKey ¶
type PrivateKey interface {
Public() crypto.PublicKey
Equal(x crypto.PrivateKey) bool
}