Skip to content

Commit 7d9e994

Browse files
tniessenRafaelGSS
authored andcommitted
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: #54443 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 66ae9f4 commit 7d9e994

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

src/crypto/crypto_ec.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -828,12 +828,7 @@ Maybe<void> ExportJWKEcKey(
828828

829829
if (key->GetKeyType() == kKeyTypePrivate) {
830830
const BIGNUM* pvt = EC_KEY_get0_private_key(ec);
831-
return SetEncodedValue(
832-
env,
833-
target,
834-
env->jwk_d_string(),
835-
pvt,
836-
degree_bytes).IsJust() ? JustVoid() : Nothing<void>();
831+
return SetEncodedValue(env, target, env->jwk_d_string(), pvt, degree_bytes);
837832
}
838833

839834
return JustVoid();

src/crypto/crypto_util.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -604,22 +604,22 @@ MaybeLocal<Value> EncodeBignum(
604604
error);
605605
}
606606

607-
Maybe<bool> SetEncodedValue(
608-
Environment* env,
609-
Local<Object> target,
610-
Local<String> name,
611-
const BIGNUM* bn,
612-
int size) {
607+
Maybe<void> SetEncodedValue(Environment* env,
608+
Local<Object> target,
609+
Local<String> name,
610+
const BIGNUM* bn,
611+
int size) {
613612
Local<Value> value;
614613
Local<Value> error;
615614
CHECK_NOT_NULL(bn);
616615
if (size == 0) size = BignumPointer::GetByteCount(bn);
617616
if (!EncodeBignum(env, bn, size, &error).ToLocal(&value)) {
618617
if (!error.IsEmpty())
619618
env->isolate()->ThrowException(error);
620-
return Nothing<bool>();
619+
return Nothing<void>();
621620
}
622-
return target->Set(env->context(), name, value);
621+
return target->Set(env->context(), name, value).IsJust() ? JustVoid()
622+
: Nothing<void>();
623623
}
624624

625625
bool SetRsaOaepLabel(const EVPKeyCtxPointer& ctx, const ByteSource& label) {

src/crypto/crypto_util.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -713,12 +713,11 @@ v8::MaybeLocal<v8::Value> EncodeBignum(
713713
int size,
714714
v8::Local<v8::Value>* error);
715715

716-
v8::Maybe<bool> SetEncodedValue(
717-
Environment* env,
718-
v8::Local<v8::Object> target,
719-
v8::Local<v8::String> name,
720-
const BIGNUM* bn,
721-
int size = 0);
716+
v8::Maybe<void> SetEncodedValue(Environment* env,
717+
v8::Local<v8::Object> target,
718+
v8::Local<v8::String> name,
719+
const BIGNUM* bn,
720+
int size = 0);
722721

723722
bool SetRsaOaepLabel(const EVPKeyCtxPointer& rsa, const ByteSource& label);
724723

0 commit comments

Comments
 (0)