don't convert a string to an array buffer

This commit is contained in:
bridiver 2016-08-10 14:47:05 -07:00
parent 58b391cb77
commit 94c60379d1
3 changed files with 5 additions and 8 deletions

View file

@ -42,10 +42,7 @@ v8::Local<v8::Value> Converter<scoped_refptr<net::X509Certificate>>::ToV8(
std::string encoded_data; std::string encoded_data;
net::X509Certificate::GetPEMEncoded( net::X509Certificate::GetPEMEncoded(
val->os_cert_handle(), &encoded_data); val->os_cert_handle(), &encoded_data);
auto buffer = node::Buffer::Copy(isolate, dict.Set("data", encoded_data);
encoded_data.data(),
encoded_data.size()).ToLocalChecked();
dict.Set("data", buffer);
dict.Set("issuerName", val->issuer().GetDisplayName()); dict.Set("issuerName", val->issuer().GetDisplayName());
dict.Set("subjectName", val->subject().GetDisplayName()); dict.Set("subjectName", val->subject().GetDisplayName());
dict.Set("serialNumber", base::HexEncode(val->serial_number().data(), dict.Set("serialNumber", base::HexEncode(val->serial_number().data(),

View file

@ -178,7 +178,7 @@ Returns:
* `url` URL * `url` URL
* `error` String - The error code * `error` String - The error code
* `certificate` Object * `certificate` Object
* `data` Buffer - PEM encoded data * `data` String - PEM encoded data
* `issuerName` String - Issuer's Common Name * `issuerName` String - Issuer's Common Name
* `subjectName` String - Subject's Common Name * `subjectName` String - Subject's Common Name
* `serialNumber` String - Hex value represented string * `serialNumber` String - Hex value represented string
@ -213,7 +213,7 @@ Returns:
* `webContents` [WebContents](web-contents.md) * `webContents` [WebContents](web-contents.md)
* `url` URL * `url` URL
* `certificateList` [Objects] * `certificateList` [Objects]
* `data` Buffer - PEM encoded data * `data` String - PEM encoded data
* `issuerName` String - Issuer's Common Name * `issuerName` String - Issuer's Common Name
* `subjectName` String - Subject's Common Name * `subjectName` String - Subject's Common Name
* `serialNumber` String - Hex value represented string * `serialNumber` String - Hex value represented string

View file

@ -230,7 +230,7 @@ Returns:
* `url` URL * `url` URL
* `error` String - The error code * `error` String - The error code
* `certificate` Object * `certificate` Object
* `data` Buffer - PEM encoded data * `data` String - PEM encoded data
* `issuerName` String - Issuer's Common Name * `issuerName` String - Issuer's Common Name
* `subjectName` String - Subject's Common Name * `subjectName` String - Subject's Common Name
* `serialNumber` String - Hex value represented string * `serialNumber` String - Hex value represented string
@ -251,7 +251,7 @@ Returns:
* `event` Event * `event` Event
* `url` URL * `url` URL
* `certificateList` [Objects] * `certificateList` [Objects]
* `data` Buffer - PEM encoded data * `data` String - PEM encoded data
* `issuerName` String - Issuer's Common Name * `issuerName` String - Issuer's Common Name
* `subjectName` String - Subject's Common Name * `subjectName` String - Subject's Common Name
* `serialNumber` String - Hex value represented string * `serialNumber` String - Hex value represented string