| 36 | { |
| 37 | |
| 38 | Directory Directory::parse(const std::string & json_data) |
| 39 | { |
| 40 | Poco::JSON::Parser parser; |
| 41 | auto json = parser.parse(json_data).extract<Poco::JSON::Object::Ptr>(); |
| 42 | |
| 43 | auto dir = Directory{ |
| 44 | .new_account = Poco::URI(json->getValue<std::string>(Directory::new_account_key)), |
| 45 | .new_order = Poco::URI(json->getValue<std::string>(Directory::new_order_key)), |
| 46 | .new_nonce = Poco::URI(json->getValue<std::string>(Directory::new_nonce_key)), |
| 47 | }; |
| 48 | |
| 49 | chassert(!dir.new_account.empty()); |
| 50 | chassert(!dir.new_order.empty()); |
| 51 | chassert(!dir.new_nonce.empty()); |
| 52 | |
| 53 | LOG_TEST( |
| 54 | &Poco::Logger::get("ACME::Directory"), |
| 55 | "Directory: newAccount: {}, newOrder: {}, newNonce: {}", |
| 56 | dir.new_account.toString(), |
| 57 | dir.new_order.toString(), |
| 58 | dir.new_nonce.toString() |
| 59 | ); |
| 60 | |
| 61 | return dir; |
| 62 | } |
| 63 | |
| 64 | namespace |
| 65 | { |