pomerium/internal/cryptutil/mock_cipher.go
Bobby DeSimone 7c755d833f
authenticate: encrypt & mac oauth2 callback state
- cryptutil: add hmac & tests
- cryptutil: rename cipher / encoders to be more clear
- cryptutil: simplify SecureEncoder interface
- cryptutil: renamed NewCipherFromBase64 to NewAEADCipherFromBase64
- cryptutil: move key & random generators to helpers

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-09-23 19:15:52 -07:00

18 lines
552 B
Go

package cryptutil // import "github.com/pomerium/pomerium/internal/cryptutil"
// MockEncoder MockCSRFStore is a mock implementation of Cipher.
type MockEncoder struct {
MarshalResponse string
MarshalError error
UnmarshalError error
}
// Marshal is a mock implementation of MockEncoder.
func (mc MockEncoder) Marshal(i interface{}) (string, error) {
return mc.MarshalResponse, mc.MarshalError
}
// Unmarshal is a mock implementation of MockEncoder.
func (mc MockEncoder) Unmarshal(s string, i interface{}) error {
return mc.UnmarshalError
}