Ejemplo n.º 1
0
VerificationCredential::VerificationCredential(
    CredentialSet& parent,
    const NymParameters& nymParameters)
        : ot_super(parent, nymParameters)
{
    role_ = proto::CREDROLE_VERIFY;
    nym_id_ = parent.GetNymID();
    master_id_ = parent.GetMasterCredID();
    auto verificationSet = nymParameters.VerificationSet();
    if (verificationSet) {
        data_.reset(new proto::VerificationSet(*verificationSet));
    }
}
Ejemplo n.º 2
0
MasterCredential::MasterCredential(CredentialSet& theOwner, const NymParameters& nymParameters)
    : ot_super(theOwner, nymParameters, proto::CREDROLE_MASTERKEY)
{
    role_ = proto::CREDROLE_MASTERKEY;

    std::shared_ptr<NymIDSource> source;
    std::unique_ptr<proto::SourceProof> sourceProof;
    sourceProof.reset(new proto::SourceProof);

    proto::SourceProofType proofType = nymParameters.SourceProofType();

    if (proto::SOURCETYPE_PUBKEY == nymParameters.SourceType()) {
        OT_ASSERT_MSG(
            proto::SOURCEPROOFTYPE_SELF_SIGNATURE == proofType,
            "non self-signed credentials not yet implemented");

        source = std::make_shared<NymIDSource>(
            nymParameters,
            *(m_SigningKey->GetPublicKey().Serialize()));
        sourceProof->set_version(1);
        sourceProof->set_type(proto::SOURCEPROOFTYPE_SELF_SIGNATURE);

    } else if (proto::SOURCETYPE_BIP47 == nymParameters.SourceType()) {
        sourceProof->set_version(1);
        sourceProof->set_type(proto::SOURCEPROOFTYPE_SIGNATURE);

        std::unique_ptr<PaymentCode> bip47Source;
        bip47Source.reset(new PaymentCode(nymParameters.Nym()));

        source = std::make_shared<NymIDSource>(bip47Source);
    }

    source_proof_.reset(sourceProof.release());
    owner_backlink_->SetSource(source);
    String nymID = owner_backlink_->GetNymID();

    nym_id_ = nymID;
}
VerificationCredential::VerificationCredential(
    const api::Core& api,
    CredentialSet& parent,
    const NymParameters& nymParameters)
    : ot_super(api, parent, VERIFICATION_CREDENTIAL_VERSION, nymParameters)
{
    mode_ = proto::KEYMODE_NULL;
    role_ = proto::CREDROLE_VERIFY;
    nym_id_ = parent.GetNymID();
    master_id_ = parent.GetMasterCredID();
    auto verificationSet = nymParameters.VerificationSet();

    if (verificationSet) {
        data_.reset(new proto::VerificationSet(*verificationSet));
    }
}