Skip to content

QuantumGate::UUID::Create

Karel Donk edited this page Jun 11, 2018 · 3 revisions

Creates a random UUID.

Signature

static std::tuple<bool, UUID, std::optional<PeerKeys>>
    Create(const UUIDType type, const UUIDSignAlgorithm salg) noexcept;

Parameters

Name Description
type The type of UUID to create. See QuantumGate::UUIDType for details.
salg The digital signature algorithm to use. See QuantumGate::UUIDSignAlgorithm for details.

Return values

Returns a std::tuple containing a bool value indicating whether or not the operation was successful (true if so), the created QuantumGate::UUID and optionally (when the UUID type is QuantumGate::UUIDType::Peer) a QuantumGate::PeerKeys object containing a public/private key-pair matching the UUID.

Example

auto [success, uuid, keys] =
    QuantumGate::UUID::Create(QuantumGate::UUIDType::Peer,
        QuantumGate::UUIDSignAlgorithm::EDDSA_ED25519);
if (success)
{
    std::cout << "Created peer UUID " << uuid << "\r\n";
}
else
{
    std::cout << "Failed to create peer UUID\r\n";
}

Clone this wiki locally