diff --git a/examples/eyewear_canonical_example.json b/examples/eyewear_canonical_example.json new file mode 100644 index 00000000..edfbb546 --- /dev/null +++ b/examples/eyewear_canonical_example.json @@ -0,0 +1,30 @@ +{ + "schema_version": "0.3", + "pid": "a1b2c3d4e5f678901234567890abcdef12345678", + "category": "eyewear", + "product_name": "Luxury Polarized Sunglasses Model X", + "manufacturer": { + "id": "LUXE-OPTICS-001", + "name": "Luxe Optics", + "country": "Italy" + }, + "timestamp_registered": "2026-03-25T15:00:00Z", + "verification": { + "method": "NFC", + "security_level": "high" + }, + "auth": { + "signature": "0x1234...abcd (ECDSA)", + "public_key_ref": "issuer:luxoptics-public-key", + "chip_uid": "04:AB:CD:EF:12:34:56:78", + "signed_payload": "signed(pid + chip_uid)" + }, + "metadata_uri": "https://pi-rwa.example/metadata/eyewear-001", + "eyewear": { + "lens_type": "polarized", + "frame_material": "titanium", + "serial_number": "LX-2026-001234", + "uv_protection": "UV400", + "certifications": ["ISO 12312-2", "Brand Warranty"] + } +} diff --git a/examples/verification_demo_v0.3.py b/examples/verification_demo_v0.3.py new file mode 100644 index 00000000..86db30f5 --- /dev/null +++ b/examples/verification_demo_v0.3.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 + +import json +import hashlib +from datetime import datetime + +def load_schema(): + with open('../spec/rwa_auth_schema_v0.3.json', 'r', encoding='utf-8') as f: + return json.load(f) + +def simulate_verification(product_id: str, method: str = "NFC"): + print(f"šŸš€ RWA v0.3 Demo – Scanning {method}: {product_id}") + + load_schema() + + with open('eyewear_canonical_example.json', 'r', encoding='utf-8') as f: + data = json.load(f) + + data["pid"] = hashlib.sha256( + f"{product_id}-{datetime.now().isoformat()}".encode() + ).hexdigest() + + data["timestamp_registered"] = datetime.now().isoformat() + + if method == "NFC": + data["auth"]["chip_uid"] = "04:AB:CD:EF:12:34:56:78" + data["auth"]["signed_payload"] = "signed(pid + chip_uid)" + + print("\nšŸ“‹ Product Metadata:") + print(json.dumps(data, indent=2, ensure_ascii=False)) + + result = { + "status": "AUTHENTIC", + "confidence_score": 98, + "issuer_verified": True, + "signature_valid": True + } + + print("\nāœ… Verification Result:") + print(json.dumps(result, indent=2)) + + return data, result + +if __name__ == "__main__": + print("PiRC RWA v0.3 – Verification Demo") + + pid = input("Enter Product ID (or press Enter): ") or "EYEWEAR-LUXE-001" + method = input("Scan method (QR or NFC): ") or "NFC" + + simulate_verification(pid, method.upper())