1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PROXIMITY_AUTH_SECURE_CONTEXT_H
6 #define COMPONENTS_PROXIMITY_AUTH_SECURE_CONTEXT_H
8 namespace proximity_auth
{
10 // An interface used to decode and encode messages.
13 // The protocol version used during authentication.
14 enum ProtocolVersion
{
15 PROTOCOL_VERSION_THREE_ZERO
, // 3.0
16 PROTOCOL_VERSION_THREE_ONE
, // 3.1
19 virtual ~SecureContext() {}
21 // Decodes the |encoded_message| and returns the result.
22 virtual std::string
Decode(const std::string
& encoded_message
) = 0;
24 // Encodes the |message| and returns the result.
25 virtual std::string
Encode(const std::string
& message
) = 0;
27 // Returns the message received from the remote device that authenticates it.
28 // This message should have been received during the handshake that
29 // establishes the secure channel.
30 virtual std::string
GetReceivedAuthMessage() const = 0;
32 // Returns the protocol version that was used during authentication.
33 virtual ProtocolVersion
GetProtocolVersion() const = 0;
36 } // namespace proximity_auth
38 #endif // COMPONENTS_PROXIMITY_AUTH_SECURE_CONTEXT_H