1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/// @file WASM stub for crypto.cc
/// Signature verification is not used in the WASM evaluator (no daemon/substituters).
/// All functions throw if called.

#include "lix/libstore/crypto.hh"
#include "lix/libutil/error.hh"

namespace nix {

// SecretKey
SecretKey::SecretKey(std::string, EvpPkeyPtr) {}
SecretKey::~SecretKey() = default;

std::string SecretKey::signDetached(std::string_view) const
{
    throw Error("crypto not supported in WASM evaluator");
}

PublicKey SecretKey::toPublicKey() const
{
    throw Error("crypto not supported in WASM evaluator");
}

std::string SecretKey::to_string() const
{
    return "";
}

SecretKey SecretKey::generate(std::string_view)
{
    throw Error("crypto not supported in WASM evaluator");
}

SecretKey SecretKey::parse(std::string_view)
{
    throw Error("crypto not supported in WASM evaluator");
}

// PublicKey
PublicKey::PublicKey(std::string, EvpPkeyPtr) {}
PublicKey::~PublicKey() = default;

bool PublicKey::verifyDetached(std::string_view, std::string_view) const
{
    return false;
}

std::string PublicKey::to_string() const
{
    return "";
}

PublicKey PublicKey::fromRaw(std::string_view, std::string_view)
{
    throw Error("crypto not supported in WASM evaluator");
}

PublicKey PublicKey::parse(std::string_view)
{
    throw Error("crypto not supported in WASM evaluator");
}

bool verifyDetached(const std::string &, const std::string &, const PublicKeys &)
{
    return false;
}

PublicKeys getDefaultPublicKeys()
{
    return {};
}

} // namespace nix