Skip to content

QuantumGate::UUID::Create

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

Creates a random UUID.

Signature

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

Parameters

Name Description
type The type of UUID to create. See QuantumGate::UUID::Type for details.
salg The digital signature algorithm to use. See QuantumGate::UUID::SignAlgorithm for details. This parameter is only relevant when the type is QuantumGate::UUID::Type::Peer.

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::UUID::Type::Peer) a QuantumGate::PeerKeys object containing a public/private key-pair matching the UUID.

Example

auto [success, uuid, keys] =
    QuantumGate::UUID::Create(QuantumGate::UUID::Type::Peer,
        QuantumGate::UUID::SignAlgorithm::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