dpo2u-sdk
Rust client SDK for the DPO2U on-chain compliance programs on Solana.
Provides canonical program IDs, PDA derivers, and PublicValuesStruct parsers for integrators building:
- Anchor programs that CPI into DPO2U (e.g., your RWA platform wants to verify consent before transfer)
- Off-chain clients that build DPO2U transactions directly
Install
[]
= "0.1"
= "2.0"
Quick start
use ;
use Pubkey;
// 1. Canonical program IDs
let consent_mgr = CONSENT_MANAGER;
// 2. Derive a consent PDA (DPDP India §6)
let user = from_str.unwrap;
let fiduciary = issuer_pubkey;
let purpose_hash = purpose_hash;
let = consent_pda;
// 3. Derive an attestation PDA (LGPD Art. 38 / GDPR Art. 35 DPIA)
let commitment = commitment_from_subject;
let = attestation_pda;
// 4. Derive an ART vault PDA (MiCAR Art. 23/35/36/39)
let = art_vault_pda;
// 5. Derive an AI Verify attestation PDA (Singapore AI Verify 2.0)
let model_hash = ; // sha256 of model weights
let = aiverify_pda;
Parsing SP1 PublicValuesStruct
The compliance_registry and consent_manager programs both CPI to the SP1 verifier and amarram the subject_commitment (bytes [32..64]) to the caller-supplied commitment/purpose_hash. This SDK exposes the ABI parser:
use parse;
let pv = parse?;
assert_eq!;
assert_eq!;
assert!;
Programs covered
| Program | Constant | Seeds | PDA deriver |
|---|---|---|---|
| compliance-registry | programs::COMPLIANCE_REGISTRY |
[b"attestation", subject, commitment] |
pdas::attestation_pda |
| consent-manager (DPDP IN) | programs::CONSENT_MANAGER |
[b"consent", user, fiduciary, purpose_hash] |
pdas::consent_pda |
| art-vault (MiCAR EU) | programs::ART_VAULT |
[b"art_vault", authority] |
pdas::art_vault_pda |
| aiverify-attestation (SG) | programs::AIVERIFY_ATTESTATION |
[b"aiverify", model_hash] |
pdas::aiverify_pda |
| agent-registry | programs::AGENT_REGISTRY |
[b"agent", authority, name] |
pdas::agent_pda |
| sp1-verifier | programs::SP1_VERIFIER |
(CPI target, no PDA) | — |
CPI integration example
To call DPO2U's consent_manager::record_consent from your own Anchor program:
use ;
use *;
Features
default: just solana-program typesanchor-derive: (future) re-export Anchor-compatibleBorshSerialize/BorshDeserializederives
License
MIT © DPO2U