Skip to main content

Crate dig_social_profile

Crate dig_social_profile 

Source
Expand description

§dig-social-profile — the DIG Network social-identity profile SCHEMA composite

A DIG social identity is an identity anchor (a Chia did:chia: singleton in v1) PAIRED with a DataLayer store that holds the anchor’s profile. The profile is a sparse merkle tree of standard SLOTS — one fixed 256-bit position per field — so any implementation reads and writes the same bytes, and any field can be proved (or proved absent) against a single 32-byte root.

This crate is the profile SCHEMA + composite. It defines the standard slots, the deterministic value encoding, the DID anchoring/pairing predicate, the chain-independent resolve seam, and the DID->store IdentityProfile::mint_from_did launch driver — and it CONSUMES the lower layers:

  • dig_smt — the generic sparse-merkle-tree MECHANISM (tree, proof, sha256 hasher). The profile root is byte-identical to what dig-identity historically produced (§5.1 / NC-9), proven by the golden vectors in tests/golden_vectors.rs.
  • dig_did — the did:chia:1… string codec (did parses through it).
  • dig_store — the DataLayer store lifecycle (IdentityProfile::mint_from_did builds the UNSIGNED launch spend through it; this crate never holds a key, never signs, never broadcasts).
  • dig_identity — the BLS identity-KEY primitive (slot derives slot keys with its canonical sha256 so the derivation shares one hash source with the key layer).

The schema core is CHAIN-INDEPENDENT (no chain calls in slot/value/profile/proof/ pairing/verify): on-chain DID resolution is a caller-supplied resolve::ChainSource TRAIT seam, so the schema layer still builds for wasm / no-network targets. Only IdentityProfile::mint_from_did reaches into dig-store to build the on-chain launch spend.

§What lives here

ConcernModule
Slot ids, the v2 slot map, slot-key derivationslot
The tag ‖ len ‖ bytes value encodingvalue
The portable DPB profile body (bytes <-> root)body
The mutable tree (over dig_smt): set/get/root/provetree
Serializable proofs + root-only verification (over dig_smt)proof
The profile reader/writer + key resolutionprofile / keys
The identity anchor (DID) + discovery parse (via dig_did)did
The canonical XCH receive-address field codecxch
The DID<->store bidirectional-pairing predicate + ownership proofpairing
Composed “this datum belongs to this DID” verificationverify
On-chain DID->profile resolution over a caller resolve::ChainSourceresolve
The managed profile object + DID->store mintingidentity_profile

§Cargo features

  • chia (default) — the chia-anchored half: DID parsing/anchoring, the DID<->store pairing predicate, the on-chain resolve seam, IdentityProfile minting, store update authority, composed verifyication, xch address validation, and the Bytes32/Coin re-exports.
  • no default features — the pure BYTE CORE: slot, value, tree, proof, profile and the portable body format, whose entire dependency set is dig-smt, sha2 and thiserror. A host riding a DIFFERENT chia-protocol line (dig-node patches it to dig-gossip’s vendored 0.26 fork, while this crate pins 0.36.1) can read and write profile bytes without a second chia line in its build.

Both surfaces compute byte-identical slot keys, values and roots — that is what the frozen golden vectors in tests/golden_vectors.rs assert.

§Proving a field against a root

use dig_social_profile::{Profile, Value, slot::standard, proof};

let mut profile = Profile::with_schema_v2();
profile.set(standard::DISPLAY_NAME, Value::Utf8("Ada".into()));

let tree = profile.build_tree().unwrap();
let root = tree.root();

// Prove the display name equals "Ada" using only (root, proof).
let membership = tree.prove_membership(standard::DISPLAY_NAME).unwrap();
let claim = Value::Utf8("Ada".into());
assert!(proof::verify_membership(&root, standard::DISPLAY_NAME, &claim, &membership).unwrap());

// Prove no peer id is present.
let absent = tree.prove_non_membership(standard::PEER_ID).unwrap();
assert!(proof::verify_non_membership(&root, standard::PEER_ID, &absent).unwrap());

Re-exports§

pub use authority::ProfileUpdate;
pub use authority::StoreAuthoritySource;
pub use body::AnchoredRoot;
pub use body::VerifiedBody;
pub use did::parse_did_from_description;
pub use did::Did;
pub use error::Error;
pub use error::Result;
pub use identity_profile::IdentityProfile;
pub use identity_profile::IdentityProfileMint;
pub use keys::DidKeys;
pub use pairing::evaluate_pairing;
pub use pairing::is_authoritative_profile;
pub use pairing::store_belongs_to_did;
pub use pairing::IdentitySingleton;
pub use pairing::PairingOutcome;
pub use pairing::SingletonLineage;
pub use pairing::StoreOwnershipProof;
pub use pairing::StoreRecord;
pub use profile::resolve_did_keys;
pub use profile::Profile;
pub use profile::SlotEdit;
pub use proof::verify_membership;
pub use proof::verify_non_membership;
pub use proof::ProfileProof;
pub use resolve::resolve_bls_public_key;
pub use resolve::resolve_identity_profile;
pub use resolve::ChainSource;
pub use resolve::ChainStoreState;
pub use resolve::ResolveError;
pub use slot::SlotId;
pub use tree::ProfileTree;
pub use value::Value;
pub use value::ValueTag;
pub use verify::verify_profile_field_absent_for_did;
pub use verify::verify_profile_field_for_did;
pub use xch::is_valid_xch_address;
pub use xch::parse_xch_address;

Modules§

authority
The chain-reading seam and the spend output for a profile’s DataLayer store update path (#1361 / #908).
body
DPB — the portable on-disk/on-wire profile BODY: the slot bytes a profile root commits to.
did
The identity-anchor identifier (a DID) and how it is discovered from a store description.
error
The crate’s single error type.
identity_profile
The IdentityProfile primitive — the managed DIG Network “Profile” object — and the DID->store IdentityProfile::mint_from_did launch driver.
keys
The cryptographic-key view of a profile — the dig-message / dig-chat / dig-node resolution seam.
pairing
The DID<->store bidirectional-pairing predicate, as pure types over supplied Chia records.
profile
The Profile reader/writer — a slot map that materializes into a ProfileTree.
proof
The serializable profile proof and the root-only verification functions.
resolve
On-chain DID resolution: from a did:chia: string to its chain-authenticated profile.
slot
Slot identifiers, the v2 standard slot map, and the deterministic slot-key derivation.
tree
The mutable profile tree: set/get slots, compute the root, and produce proofs.
value
The deterministic tag ‖ len ‖ bytes slot-value encoding.
verify
Composed “this profile datum belongs to this DID” verification — THE consumer seam.
xch
The canonical mainnet XCH receive-address profile field (slot 0x0008).

Structs§

Coin
Datastore
Everything that is required to spend a Datastore coin.
DigDataStoreMetadata
The DIG DataLayer metadata: the SDK’s DatastoreMetadata shape with the exact byte count ("b") REPLACED by a power-of-2 size_bucket ("sz"), plus the additive program_hash ("p").
MerkleCoinSpend
The result of building a DataLayer-coin operation: the unsigned coin spends plus the recreated child Datastore.
SizeBucket
A .dig store size quantised to a power-of-2 bucket: exponent k ∈ 0..=10 ↔ 2^k MiB (1 MB..1 GB). See the module docs for the full ladder and the canonical unit (1 MB = 1 MiB).
StoreUpdateAuthority
The store singleton’s CURRENT on-chain update authority — everything needed to DECIDE whether a caller may advance the store root, as resolved from chain by a higher-level chain source.
WriterDelegation
A CHIP-0035 delegation recorded on the store singleton, as read from current chain state.

Enums§

DelegationKind
The kind of a CHIP-0035 delegation, which determines whether it grants WRITE authority.
StoreOwner
Who is authorized to spend a store coin — the p2 (“inner”) puzzle that guards it.

Constants§

DID_CHIA_PREFIX
The bech32m human-readable prefix of a v1 Chia DID (did:chia:1...). The bech32m human-readable prefix of a v1 Chia DID (did:chia:1...).

Type Aliases§

Bytes32