MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / kxDh

Method kxDh

plugins/wasi_crypto/kx/ctx.cpp:11–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace WasiCrypto {
10
11WasiCryptoExpect<__wasi_array_output_t>
12Context::kxDh(__wasi_kx_publickey_t PkHandle,
13 __wasi_kx_secretkey_t SkHandle) noexcept {
14 auto Sk = SecretKeyManager.getAs<Kx::SkVariant>(SkHandle);
15 if (!Sk) {
16 return WasiCryptoUnexpect(Sk);
17 }
18
19 auto Pk = PublicKeyManager.getAs<Kx::PkVariant>(PkHandle);
20 if (!Pk) {
21 return WasiCryptoUnexpect(Pk);
22 }
23
24 return Kx::dh(*Pk, *Sk).and_then([this](auto &&Data) {
25 return ArrayOutputManager.registerManager(
26 std::forward<decltype(Data)>(Data));
27 });
28}
29
30WasiCryptoExpect<std::tuple<__wasi_array_output_t, __wasi_array_output_t>>
31Context::kxEncapsulate(__wasi_kx_publickey_t PkHandle) noexcept {

Callers 1

bodyMethod · 0.45

Calls 3

WasiCryptoUnexpectFunction · 0.85
dhFunction · 0.85
registerManagerMethod · 0.80

Tested by

no test coverage detected