1 #pragma once 2 3 #include <memory> 4 #include <vector> 5 6 #include <android-base/result.h> 7 8 namespace hwtrust { 9 10 // Hide the details of the rust binding from clients with an opaque type. 11 struct BoxedDiceChain; 12 13 class DiceChain final { 14 public: 15 enum class Kind { 16 kVsr13, 17 kVsr14, 18 }; 19 20 static android::base::Result<DiceChain> Verify(const std::vector<uint8_t>& chain, DiceChain::Kind kind) noexcept; 21 22 ~DiceChain(); 23 DiceChain(DiceChain&&) = default; 24 25 android::base::Result<std::vector<std::vector<uint8_t>>> CosePublicKeys() const noexcept; 26 27 private: 28 DiceChain(std::unique_ptr<BoxedDiceChain> chain, size_t size) noexcept; 29 30 std::unique_ptr<BoxedDiceChain> chain_; 31 size_t size_; 32 }; 33 34 } // namespace hwtrust 35