persona_did Class

namespace keychainclass persona_did

Overview

The persona_did class combines two keychain DIDs since personas track two keychains - one for encryption and one for signature operations. This provides a unified identifier that encompasses both cryptographic capabilities of a persona.

Class Hierarchy

namespace keychain {
    class persona_did : public did {
        // Persona-specific DID combining encryption and signature keychains
    };
}

Constructor

persona_did();
persona_did(const std::string& did_string);
persona_did(const keychain_did& encr_keychain_did, const keychain_did& sign_keychain_did);
persona_did(const persona_did& other);

Properties

Component DIDs

keychain_did get_encryption_keychain_did() const;
keychain_did get_signature_keychain_did() const;

Returns the encryption and signature keychain DIDs that make up this persona DID.

DID String Representation

std::string to_string() const override;

Returns the string representation of the persona DID in W3C DID format.

Methods

Validation

bool is_valid() const override;
bool has_encryption_keychain() const;
bool has_signature_keychain() const;

Validates the persona DID and checks for component keychains.

Comparison

bool operator==(const persona_did& other) const;
bool operator!=(const persona_did& other) const;

Example Usage

#include <keychain/keychain.hpp>

// Create from component keychain DIDs
keychain::keychain_did encr_did("did:kc:encr:...");
keychain::keychain_did sign_did("did:kc:sign:...");
keychain::persona_did persona_did(encr_did, sign_did);

// Parse from string
keychain::persona_did parsed_did("did:kc:persona:...");

// Access components
auto encryption_did = persona_did.get_encryption_keychain_did();
auto signature_did = persona_did.get_signature_keychain_did();

See Also