| 480 | } |
| 481 | |
| 482 | std::string KeyManagerRunner::http_remove_key(std::string pub_key) { |
| 483 | auto R = td::hex_decode(pub_key); |
| 484 | if (R.is_error()) { |
| 485 | return wrap_short_answer_to_http(PSTRING() << "cannot decode hex: " << R.move_as_error()); |
| 486 | } |
| 487 | auto r = R.move_as_ok(); |
| 488 | if (r.size() != 32) { |
| 489 | return wrap_short_answer_to_http(PSTRING() << "cannot decode hex: public key must be 32 bytes long"); |
| 490 | } |
| 491 | td::Bits256 p; |
| 492 | p.as_slice().copy_from(r); |
| 493 | remove_key(p); |
| 494 | return wrap_short_answer_to_http(PSTRING() << "key removed"); |
| 495 | } |
| 496 | |
| 497 | std::string KeyManagerRunner::http_generate_key(std::string key_type) { |
| 498 | if (key_type == "") { |