proxygen
fizz::server::test::MockTicketCipher Class Reference

#include <Mocks.h>

Inheritance diagram for fizz::server::test::MockTicketCipher:
fizz::server::TicketCipher

Public Member Functions

 MOCK_CONST_METHOD1 (_encrypt, folly::Future< folly::Optional< std::pair< Buf, std::chrono::seconds >>>(ResumptionState &))
 
folly::Future< folly::Optional< std::pair< Buf, std::chrono::seconds > > > encrypt (ResumptionState resState) const override
 
 MOCK_CONST_METHOD1 (_decrypt, folly::Future< std::pair< PskType, folly::Optional< ResumptionState >>>(std::unique_ptr< folly::IOBuf > &encryptedTicket))
 
folly::Future< std::pair< PskType, folly::Optional< ResumptionState > > > decrypt (std::unique_ptr< folly::IOBuf > encryptedTicket) const override
 
void setDefaults ()
 
- Public Member Functions inherited from fizz::server::TicketCipher
virtual ~TicketCipher ()=default
 

Detailed Description

Definition at line 88 of file Mocks.h.

Member Function Documentation

folly::Future<std::pair<PskType, folly::Optional<ResumptionState> > > fizz::server::test::MockTicketCipher::decrypt ( std::unique_ptr< folly::IOBuf encryptedTicket) const
inlineoverridevirtual

Returns the ResumptionState for an opaque PSK, and the type of PSK (resumption or external).

Returns Rejected if the PSK is not recognized.

Implements fizz::server::TicketCipher.

Definition at line 103 of file Mocks.h.

104  {
105  return _decrypt(encryptedTicket);
106  }
folly::Future<folly::Optional<std::pair<Buf, std::chrono::seconds> > > fizz::server::test::MockTicketCipher::encrypt ( ResumptionState  resState) const
inlineoverridevirtual

Returns an opaque PSK for ResumptionState, and its validity time.

Implements fizz::server::TicketCipher.

Definition at line 94 of file Mocks.h.

References MOCK_CONST_METHOD1.

95  {
96  return _encrypt(resState);
97  }
fizz::server::test::MockTicketCipher::MOCK_CONST_METHOD1 ( _encrypt  ,
folly::Future< folly::Optional< std::pair< Buf, std::chrono::seconds >>>  ResumptionState & 
)
fizz::server::test::MockTicketCipher::MOCK_CONST_METHOD1 ( _decrypt  ,
folly::Future< std::pair< PskType, folly::Optional< ResumptionState >>>  std::unique_ptr< folly::IOBuf > &encryptedTicket 
)
void fizz::server::test::MockTicketCipher::setDefaults ( )
inline

Definition at line 108 of file Mocks.h.

References testing::_, fizz::server::ResumptionState::alpn, fizz::server::ResumptionState::cipher, folly::IOBuf::copyBuffer(), testing::InvokeWithoutArgs(), folly::gen::move, now(), ON_CALL, fizz::server::ResumptionState::resumptionSecret, fizz::server::ResumptionState::ticketAgeAdd, fizz::server::ResumptionState::ticketIssueTime, and fizz::server::ResumptionState::version.

108  {
109  ON_CALL(*this, _decrypt(_)).WillByDefault(InvokeWithoutArgs([]() {
110  ResumptionState res;
111  res.version = ProtocolVersion::tls_1_3;
113  res.resumptionSecret = folly::IOBuf::copyBuffer("resumesecret");
114  res.alpn = "h2";
115  res.ticketAgeAdd = 0;
116  res.ticketIssueTime =
117  std::chrono::system_clock::now() - std::chrono::seconds(100);
118  return std::make_pair(PskType::Resumption, std::move(res));
119  }));
120  ON_CALL(*this, _encrypt(_)).WillByDefault(InvokeWithoutArgs([]() {
121  return std::make_pair(
122  folly::IOBuf::copyBuffer("ticket"), std::chrono::seconds(100));
123  }));
124  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::chrono::steady_clock::time_point now()
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
#define ON_CALL(obj, call)
const internal::AnythingMatcher _
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)
Definition: IOBuf.h:1587

The documentation for this class was generated from the following file: