|
1 | | -# IOTA Audit Trail (WIP) |
| 1 | + |
| 2 | + |
| 3 | +<p align="center"> |
| 4 | + <a href="https://iota.stackexchange.com/" style="text-decoration:none;"><img src="https://img.shields.io/badge/StackExchange-9cf.svg?logo=stackexchange" alt="StackExchange"></a> |
| 5 | + <a href="https://discord.gg/iota-builders" style="text-decoration:none;"><img src="https://img.shields.io/badge/Discord-9cf.svg?logo=discord" alt="Discord"></a> |
| 6 | + <a href="https://github.com/iotaledger/notarization/blob/develop/LICENSE" style="text-decoration:none;"><img src="https://img.shields.io/github/license/iotaledger/notarization.svg" alt="Apache 2.0 license"></a> |
| 7 | +</p> |
| 8 | + |
| 9 | +<p align="center"> |
| 10 | + <a href="#introduction">Introduction</a> ◈ |
| 11 | + <a href="#documentation-and-resources">Documentation & Resources</a> ◈ |
| 12 | + <a href="#feature-overview">Feature Overview</a> ◈ |
| 13 | + <a href="#bindings">Bindings</a> ◈ |
| 14 | + <a href="#contributing">Contributing</a> |
| 15 | +</p> |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +# IOTA Audit Trail Rust SDK |
| 20 | + |
| 21 | +## Introduction |
| 22 | + |
| 23 | +`audit_trail` is the Rust SDK for reading and writing audit trails on the IOTA ledger. |
| 24 | + |
| 25 | +An audit trail is a shared on-chain object that stores a sequential series of records together with: |
| 26 | + |
| 27 | +- role-based access control backed by capabilities |
| 28 | +- trail-level locking rules for writes and deletions |
| 29 | +- tag registries for record categorization |
| 30 | +- immutable creation metadata and optional updatable metadata |
| 31 | + |
| 32 | +The crate provides: |
| 33 | + |
| 34 | +- read-only and signing client wrappers for the on-chain audit-trail package |
| 35 | +- typed trail handles for records, locking, access control, and tags |
| 36 | +- serializable Rust representations of on-chain objects and emitted events |
| 37 | +- transaction builders that integrate with the shared `product_common` transaction flow |
| 38 | + |
| 39 | +## Documentation And Resources |
| 40 | + |
| 41 | +- [Audit Trail Move Package](https://github.com/iotaledger/notarization/tree/main/audit-trail-move): On-chain contract package that defines the shared object model, permissions, locking, and events. |
| 42 | +- [Wasm SDK](https://github.com/iotaledger/notarization/tree/main/bindings/wasm/audit_trail_wasm): JavaScript and TypeScript bindings for browser and Node.js integrations. |
| 43 | +- [Wasm Examples](https://github.com/iotaledger/notarization/tree/main/bindings/wasm/audit_trail_wasm/examples/README.md): Runnable audit-trail examples for JS and TS consumers. |
| 44 | +- [Repository Examples](https://github.com/iotaledger/notarization/tree/main/examples/README.md): End-to-end examples across the broader repository. |
| 45 | + |
| 46 | +This README is also used as the crate-level rustdoc entry point, while the source files provide detailed API documentation for all public types and methods. |
| 47 | + |
| 48 | +## Feature Overview |
| 49 | + |
| 50 | +The public API is organized around a small set of entry points: |
| 51 | + |
| 52 | +- [`AuditTrailClientReadOnly`] for package resolution, trail-scoped reads, and inspected transactions |
| 53 | +- [`AuditTrailClient`] for signed write flows |
| 54 | +- [`AuditTrailHandle`] for operations scoped to one trail object |
| 55 | +- [`AuditTrailBuilder`] for configuring trail creation |
| 56 | +- [`core::types`] for domain types such as [`Data`], [`Record`], [`LockingConfig`], and [`PermissionSet`] |
| 57 | + |
| 58 | +Typical flow: |
| 59 | + |
| 60 | +1. Construct an [`AuditTrailClientReadOnly`] or [`AuditTrailClient`]. |
| 61 | +2. Resolve a trail with [`AuditTrailClientReadOnly::trail`] or [`AuditTrailClient::trail`]. |
| 62 | +3. Read state with [`AuditTrailHandle::get`] or move into one of the trail subsystems: |
| 63 | + - [`AuditTrailHandle::records`] |
| 64 | + - [`AuditTrailHandle::locking`] |
| 65 | + - [`AuditTrailHandle::access`] |
| 66 | + - [`AuditTrailHandle::tags`] |
| 67 | +4. For writes, build a typed transaction from the client, trail handle, or subsystem handle and execute it through the surrounding transaction infrastructure. |
| 68 | + |
| 69 | +The crate deliberately separates transaction construction from submission so applications can keep signing, sponsorship, gas selection, and batching policy outside the SDK. |
| 70 | + |
| 71 | +Pure value types expose executable doctests where the behavior is self-contained and stable: |
| 72 | + |
| 73 | +```rust |
| 74 | +use audit_trail::core::types::{Data, InitialRecord}; |
| 75 | + |
| 76 | +let record = InitialRecord::new(Data::text("hello"), Some("first write".to_string()), None); |
| 77 | + |
| 78 | +assert_eq!(record.data, Data::text("hello")); |
| 79 | +assert_eq!(record.metadata.as_deref(), Some("first write")); |
| 80 | +assert!(record.tag.is_none()); |
| 81 | +``` |
| 82 | + |
| 83 | +If you are integrating against a custom deployment, use [`PackageOverrides`] during client construction so the crate does not rely on the built-in package registry for that environment. |
| 84 | + |
| 85 | +## Bindings |
| 86 | + |
| 87 | +[Foreign Function Interface (FFI)](https://en.wikipedia.org/wiki/Foreign_function_interface) bindings of this Rust SDK to other programming languages: |
| 88 | + |
| 89 | +- [Web Assembly](https://github.com/iotaledger/notarization/tree/main/bindings/wasm/audit_trail_wasm) (JavaScript/TypeScript) |
| 90 | + |
| 91 | +## Contributing |
| 92 | + |
| 93 | +We would love to have you help us with the development of IOTA Audit Trail. Each and every contribution is greatly valued. |
| 94 | + |
| 95 | +Please review the [contribution](https://docs.iota.org/developer/iota-notarization/contribute) sections in the [IOTA Docs Portal](https://docs.iota.org/developer/iota-notarization/). |
| 96 | + |
| 97 | +To contribute directly to the repository, simply fork the project, push your changes to your fork and create a pull request to get them included. |
| 98 | + |
| 99 | +The best place to get involved in discussions about this library or to look for support at is the `#notarization` channel on the [IOTA Discord](https://discord.gg/iota-builders). You can also ask questions on our [Stack Exchange](https://iota.stackexchange.com/). |
0 commit comments