OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <functional> | 6 #include <functional> |
7 #include <map> | 7 #include <map> |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
787 | 787 |
788 } | 788 } |
789 | 789 |
790 return Status::ErrorJwkUnrecognizedKty(); | 790 return Status::ErrorJwkUnrecognizedKty(); |
791 } | 791 } |
792 | 792 |
793 Status ExportKeyJwk(const blink::WebCryptoKey& key, | 793 Status ExportKeyJwk(const blink::WebCryptoKey& key, |
794 blink::WebArrayBuffer* buffer) { | 794 blink::WebArrayBuffer* buffer) { |
795 DCHECK(key.extractable()); | 795 DCHECK(key.extractable()); |
796 base::DictionaryValue jwk_dict; | 796 base::DictionaryValue jwk_dict; |
797 Status status = Status::Error(); | 797 Status status = Status::OperationError(); |
Ryan Sleevi
2014/04/22 23:45:50
What part of the spec led you to believe this was
eroman
2014/04/23 00:11:30
I renamed Status::Error() to Status::OperationErro
| |
798 | 798 |
799 switch (key.type()) { | 799 switch (key.type()) { |
800 case blink::WebCryptoKeyTypeSecret: { | 800 case blink::WebCryptoKeyTypeSecret: { |
801 blink::WebArrayBuffer exported_key; | 801 blink::WebArrayBuffer exported_key; |
802 status = ExportKey(blink::WebCryptoKeyFormatRaw, key, &exported_key); | 802 status = ExportKey(blink::WebCryptoKeyFormatRaw, key, &exported_key); |
803 if (status.IsError()) | 803 if (status.IsError()) |
804 return status; | 804 return status; |
805 WriteSecretKey(exported_key, &jwk_dict); | 805 WriteSecretKey(exported_key, &jwk_dict); |
806 break; | 806 break; |
807 } | 807 } |
(...skipping 28 matching lines...) Expand all Loading... | |
836 std::string json; | 836 std::string json; |
837 base::JSONWriter::Write(&jwk_dict, &json); | 837 base::JSONWriter::Write(&jwk_dict, &json); |
838 *buffer = CreateArrayBuffer(reinterpret_cast<const uint8*>(json.data()), | 838 *buffer = CreateArrayBuffer(reinterpret_cast<const uint8*>(json.data()), |
839 json.size()); | 839 json.size()); |
840 return Status::Success(); | 840 return Status::Success(); |
841 } | 841 } |
842 | 842 |
843 } // namespace webcrypto | 843 } // namespace webcrypto |
844 | 844 |
845 } // namespace content | 845 } // namespace content |
OLD | NEW |