Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the
Account
: internal state, one identity (#453)
* Refactor `Account` to handle just one identity (#436) * Partial impl to use did as storage identifier * Move `CreateIdentity` into a separate type Update Account API to return IdentityState from find_identity and create_identity (#414) * Update Account::create_identity() to return IdentityState. * Update Account::find_identity() to return IdentityState. Update `IdentityUpdater` to only use account ref Remove resolve, find and list Replace `IdentityId` with `IotaDID` in account Use `IotaDID` over `IdentityId` in stronghold More replacement of id with did Remove index from account Fix stream impl Fix stronghold impl, migrate `MemStore` Re-add `resolve_identity` so tests can run Fix Wasm network calls, pin reqwest to 0.11.4 (#439) Rename `Command` -> `Update` Rearrange `process_update` * Fix clippy lints in memstore * Let `RemoteKey` take a `dyn Storage` * Implement `AccountConfig` * Impl create_identity and load_identity in builder * Rename JSON serialization field name to match spec. (#412) * Rename JSON serialization field name to match spec. * Rename notSupported -> representationNotSupported * Reduce WASM build size (#427) * reduce wasm build size * Enable lto for Wasm release Add `build-dev` task for Wasm for debugging. Co-authored-by: Craig Bester <[email protected]> * Chore/combine examples (#420) * Merged Stronghold with basic examples in account * Updated explorer to identity resolver * Added explorer URL after basic example * Renamed examples * Completed manipulate did example * Fixed suggestions, removed replaced examples. * Improved example readme * Consistently use Stronghold and Resolver URL * Fix examples * Merged config example with private tangle * low-level-api private-network example runs * cargo fmt * cargo fmt with nightly * Impl suggestions * Refactor config once more * Update examples to use single-id account * Don't pass did into `load_snapshot` * Fix clippy lints * Partially update `update` tests * Fix update tests * Ensure did exists in storage in `load` * Remote `State` in account * Rename `load` -> `load_identity` * Remove `Identity{Id,Index,Key,Name,Tag}` * Let `update_identity` take `&mut self` * Document new and existing types * Update top-level README example * Fix visibility on `CreateIdentity` * Add try_from implementation for ed25519 keypair * Combine account tests * Rename updates > commands for better reviewability * Also rename in mod.rs * Impl `AccountBuilder` without pub async fns * Update README example with latest builder change * Change visibility of setup, config, constructors * Revert to the old `create_did` example * Save to disk when creating identity, fix doc fmt Co-authored-by: Craig Bester <[email protected]> * Use `authority` instead of `tag` in stronghold * Rename `Config` -> `AccountConfig` * Prevent two accounts from managing the same did * Impl `IdentityBuilder` * Only impl `IdentityCreate` under `#[cfg(test)]` * Use `IdentityBuilder` in examples * Remove unused `name` field * Run workflow for `epic/*` branches * Relase the lease in account tests * Also run format, clippy and coverage workflows * Revert "Use `IdentityBuilder` in examples" This reverts commit 3d1b716. * Revert "Only impl `IdentityCreate` under `#[cfg(test)]`" This reverts commit 08ada09. * Revert "Impl `IdentityBuilder`" This reverts commit 1a5d645. * Rename `IdentityCreate` -> `IdentitySetup` * Add multi-identity example * Simplify README example * Rename `identity_setup` module * Implement the `IdentityLease` newtype * Rename `IdentityLease` -> `DIDLease` * Update `resolve_identity` docstring Co-authored-by: Matt Renaud <[email protected]> Co-authored-by: Thoralf-M <[email protected]> Co-authored-by: Craig Bester <[email protected]> Co-authored-by: Jelle Femmo Millenaar <[email protected]> * Apply new fmt granularity * Refactor the `Account` state (#462) * Get rid of `IdentitySnapshot` * Start replacing parts of `IdentityState` * Create identity document from core structures * Impl int/diff update determination * Remove `Deref` impls for IdentityState * Implement `CreateMethod` update * Impl attach/detach `MethodRelationship` * Update to cap inv refactor * Use `IotaDocument` directly to construct the doc * Update tests for account updates * Remove unused types & variables * Return to unified publish method * Implement & test attaching relationships * Fix attach/detach tests post-merge * Implement detach relationship test * Implement insert and remove service * Move `Publish` to low-level API * Remove did field from account * Refactor publishing & storing * Rename int/diff generations * Change fresh id detection & fix `store_state` call * Factor out `ChainState` from `IdentityState` * Remove `this_message_id` from chain state * Test the chain state * Fix some error TODOs * Fix some TODOs * Fix some storage todos/errors * Make `IotaDocument::remove_method` fallible again * Use name instead of identifier to call from_did * Move state loading into the else clause * Remove `persist` flag on `process_update` * Remove unnecessary cloning * Rename `as_document` -> `document` * Improve `ChainState` docs * Fix post-merge things & clippy lint * Remove `Tiny*` and other unused state types * `InvalidMethodTarget` -> `InvalidTargetMethod` * `as_document_mut` -> `document_mut` * Expand lazy test * Rename impl_command_builder to update * Remove event context * Rename `events` module to `updates` * Apply fmt * Rename `commands` -> `updates` * Remove `UnixTimestamp` * Remove unused errors in account & update * Change `fromDID` method in Wasm * Return `Option<Publish>` from constructor * Use strum, add todo!(), rename `PublishType` Co-authored-by: Craig Bester <[email protected]> * Move attach/detach relationship to `CoreDocument` * Return bool from `detach_method_relationship` * Use `MethodQuery` in attach/detach Co-authored-by: Craig Bester <[email protected]> * Revert "Change `fromDID` method in Wasm" This reverts commit cb0cf35. * Nest `MethodRelationship` in `MethodScope` * Move some chain state logic to publish_diff_change * Don't expect, bubble up * Return early if there's nothing to publish * Add todo about error handling * Remove mut state methods * Move account constructors to the top * Use `try_resolve_method_with_scope` in tests * Remove todos, inline code, explicitly ignore res. * Remove todo comments, `unwrap` * Rename chain state fields to `last_*` * Improve `InvalidTargetMethod` Error name * Increment actions when updating * check for updated referenced method in publish * Enable diff updates for merkle cap. inv. methods * Only attach relationship on non-embedded methods * Add proper type annotations in publish * Improve chain state docs & variable naming Co-authored-by: Craig Bester <[email protected]> * Fix READMEs * Deduplicate setup code in builder * Remove tangle dependency in autopublish test * Add docs for attach/detach relationship * Deduplicate signing key extraction * Fix documentation & annotate types in examples Co-authored-by: Matt Renaud <[email protected]> Co-authored-by: Thoralf-M <[email protected]> Co-authored-by: Craig Bester <[email protected]> Co-authored-by: Jelle Femmo Millenaar <[email protected]>
- Loading branch information