src,crypto: remove `AllocatedBuffer`s from `crypto_spkac` · nodejs/node@51b8655 · GitHub
Skip to content

Commit 51b8655

Browse files
RaisinTendanielleadams
authored andcommitted
src,crypto: remove AllocatedBuffers from crypto_spkac
Signed-off-by: Darshan Sen <darshan.sen@postman.com> PR-URL: #40752 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
1 parent c5d0b3c commit 51b8655

3 files changed

Lines changed: 18 additions & 24 deletions

File tree

src/crypto/crypto_spkac.cc

Lines changed: 11 additions & 24 deletions

src/crypto/crypto_util.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ Local<ArrayBuffer> ByteSource::ToArrayBuffer(Environment* env) {
340340
return ArrayBuffer::New(env->isolate(), std::move(store));
341341
}
342342

343+
MaybeLocal<Uint8Array> ByteSource::ToBuffer(Environment* env) {
344+
Local<ArrayBuffer> ab = ToArrayBuffer(env);
345+
return Buffer::New(env, ab, 0, ab->ByteLength());
346+
}
347+
343348
const char* ByteSource::get() const {
344349
return data_;
345350
}

src/crypto/crypto_util.h

Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)