diff options
| author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-06-14 02:30:32 +0200 |
|---|---|---|
| committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-06-17 12:02:37 +0200 |
| commit | ae7045f67efede5eafa5af3279ab1d88c0facec5 (patch) | |
| tree | 623c29944c3f4b284f0583c8b333bae51691be31 /core | |
| parent | 8c70c18132441d11a88dd96b462d89d8eba4c2f5 (diff) | |
| download | redot-engine-ae7045f67efede5eafa5af3279ab1d88c0facec5.tar.gz | |
[Crypto] Expose OS.get_entropy
Diffstat (limited to 'core')
| -rw-r--r-- | core/core_bind.cpp | 9 | ||||
| -rw-r--r-- | core/core_bind.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index d6719e715f..a1b7b81111 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -194,6 +194,14 @@ void ResourceSaver::_bind_methods() { ////// OS ////// +PackedByteArray OS::get_entropy(int p_bytes) { + PackedByteArray pba; + pba.resize(p_bytes); + Error err = ::OS::get_singleton()->get_entropy(pba.ptrw(), p_bytes); + ERR_FAIL_COND_V(err != OK, PackedByteArray()); + return pba; +} + String OS::get_system_ca_certificates() { return ::OS::get_singleton()->get_system_ca_certificates(); } @@ -577,6 +585,7 @@ String OS::get_unique_id() const { OS *OS::singleton = nullptr; void OS::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_entropy", "size"), &OS::get_entropy); ClassDB::bind_method(D_METHOD("get_system_ca_certificates"), &OS::get_system_ca_certificates); ClassDB::bind_method(D_METHOD("get_connected_midi_inputs"), &OS::get_connected_midi_inputs); ClassDB::bind_method(D_METHOD("open_midi_inputs"), &OS::open_midi_inputs); diff --git a/core/core_bind.h b/core/core_bind.h index 1452368f60..b142a2fbbd 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -134,6 +134,7 @@ public: RENDERING_DRIVER_D3D12, }; + PackedByteArray get_entropy(int p_bytes); String get_system_ca_certificates(); virtual PackedStringArray get_connected_midi_inputs(); |
