mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
src: change SetEncodedValue to return Maybe<void>
With recent versions of V8, it is not necessary to use Maybe<bool> anymore. This changes SetEncodedValue to return Maybe<void> instead. PR-URL: https://github.com/nodejs/node/pull/54443 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
1 parent
1399d4ea8a
commit
c6a72f2de4
3 files changed
+14
-20
No files matched your search
@@ -828,12 +828,7 @@ Maybe<void> ExportJWKEcKey(
|
||||
|
||||
if (key->GetKeyType() == kKeyTypePrivate) {
|
||||
const BIGNUM* pvt = EC_KEY_get0_private_key(ec);
|
||||
return SetEncodedValue(
|
||||
env,
|
||||
target,
|
||||
env->jwk_d_string(),
|
||||
pvt,
|
||||
degree_bytes).IsJust() ? JustVoid() : Nothing<void>();
|
||||
return SetEncodedValue(env, target, env->jwk_d_string(), pvt, degree_bytes);
|
||||
}
|
||||
|
||||
return JustVoid();
|
||||
|
||||
@@ -604,12 +604,11 @@ MaybeLocal<Value> EncodeBignum(
|
||||
error);
|
||||
}
|
||||
|
||||
Maybe<bool> SetEncodedValue(
|
||||
Environment* env,
|
||||
Local<Object> target,
|
||||
Local<String> name,
|
||||
const BIGNUM* bn,
|
||||
int size) {
|
||||
Maybe<void> SetEncodedValue(Environment* env,
|
||||
Local<Object> target,
|
||||
Local<String> name,
|
||||
const BIGNUM* bn,
|
||||
int size) {
|
||||
Local<Value> value;
|
||||
Local<Value> error;
|
||||
CHECK_NOT_NULL(bn);
|
||||
@@ -617,9 +616,10 @@ Maybe<bool> SetEncodedValue(
|
||||
if (!EncodeBignum(env, bn, size, &error).ToLocal(&value)) {
|
||||
if (!error.IsEmpty())
|
||||
env->isolate()->ThrowException(error);
|
||||
return Nothing<bool>();
|
||||
return Nothing<void>();
|
||||
}
|
||||
return target->Set(env->context(), name, value);
|
||||
return target->Set(env->context(), name, value).IsJust() ? JustVoid()
|
||||
: Nothing<void>();
|
||||
}
|
||||
|
||||
bool SetRsaOaepLabel(const EVPKeyCtxPointer& ctx, const ByteSource& label) {
|
||||
|
||||
@@ -713,12 +713,11 @@ v8::MaybeLocal<v8::Value> EncodeBignum(
|
||||
int size,
|
||||
v8::Local<v8::Value>* error);
|
||||
|
||||
v8::Maybe<bool> SetEncodedValue(
|
||||
Environment* env,
|
||||
v8::Local<v8::Object> target,
|
||||
v8::Local<v8::String> name,
|
||||
const BIGNUM* bn,
|
||||
int size = 0);
|
||||
v8::Maybe<void> SetEncodedValue(Environment* env,
|
||||
v8::Local<v8::Object> target,
|
||||
v8::Local<v8::String> name,
|
||||
const BIGNUM* bn,
|
||||
int size = 0);
|
||||
|
||||
bool SetRsaOaepLabel(const EVPKeyCtxPointer& rsa, const ByteSource& label);
|
||||
|
||||
|
||||
Reference in new issue
Block a user