Skip to content

Commit

Permalink
Merge pull request #48 from holochain/support-client-or-lair-signing
Browse files Browse the repository at this point in the history
Support client or Lair signing
  • Loading branch information
ThetaSinner authored Mar 5, 2024
2 parents 013ecf8 + 78b89b8 commit 80b9761
Show file tree
Hide file tree
Showing 17 changed files with 743 additions and 277 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,19 @@ jobs:
- name: Build client
run: cargo build -p holochain_client

- name: Lint
run: cargo clippy --all-features -- -D warnings

- name: Check formatting
run: cargo fmt --all --check

- name: Run tests
run: cargo test

- name: Verify feature independence
run: |
cargo build --no-default-features
cargo build --no-default-features --features "lair_signing"
- name: Setup tmate session if build and test run failed
if: ${{ failure() }}
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## \[Unreleased\]

### Removed
- The utilities crate, it is now replaced by signing built into the client. Please see the updated tests for examples of how to use this.
- `sign_zome_call_with_client` which was used internally but also exposed in the public interface. You probably don't need to call this but if you wish to for some reason then use one of the two new `*Signer` types, and convert them to a `Arc<Box<dyn AgentSigner>>`, then use the `sign` method to compute a signature. The logic to prepare the data to be signed is no longer public so you would have to set this up yourself following the `sign_zome_call` function in the `signer` module.

### Added
- Capability to create zome call signing credentials with the `AdminWebsocket` using `authorize_signing_credentials`.
- `ClientAgentSigner` type which can store (in memory) signing credentials created with `authorize_signing_credentials`.
- `LairAgentSigner` which is analagous to the `ClientAgentSigner` but is a wrapper around a Lair client instead so that private keys are stored in Lair.
- `from_existing` method to the `AppAgentWebsocket` which allows it to wrap an existing `AppWebsocket` instead of having to open a new connection. This is useful if you already have an `AppWebsocket` but otherwise you should just use the `connect` method of the `AppAgentWebsocket` rather than two steps.

### Changed
- `AppAgentWebsocket::connect` now takes an `Arc<Box<dyn AgentSigner>>` instead of a `LairClient`. The `Arc<Box<dyn AgentSigner>>` can be created from a `.into()` on either a `ClientAgentSigner` or a `LairAgentSigner`. Use the latter to restore the previous behaviour.
- `AppAgentWebsocket::call_zome` used to take a `RoleName` as its first parameter. This is now a `ZomeCallTarget`. There is a `.into()` which restores the previous behaviour. Now you can also pass a `CloneCellId` or a `CellId`, also using a `.into()`. Using `CellId` is stronly recommended for now. Please see the doc comments on `ZomeCallTarget` if you intend to use the other options.

### Added
### Changed
### Fixed
Expand Down
137 changes: 118 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 16 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ resolver = "2"
version = "0.5.0-dev.28"

[workspace]
members = ["fixture/zomes/foo", "utilities"]
members = ["fixture/zomes/foo"]

[workspace.dependencies]
holochain_zome_types = "0.3.0-beta-dev.25"
holochain_zome_types = "0.3.0-beta-dev.28"

[dependencies]
again = "0.1"
anyhow = "1.0"
ed25519-dalek = "1"
ed25519-dalek = { version = "2.1", features = ["rand_core"] }
serde = "1.0.193"
url = "2.2"
event-emitter-rs = "0.1"
futures = "0.3"
rand = { version = "0.8" }
async-trait = "0.1"
parking_lot = "0.12.1"

holo_hash = { version = "0.3.0-beta-dev.20", features = ["encoding"] }
holochain_conductor_api = "0.3.0-beta-dev.34"
Expand All @@ -34,12 +37,18 @@ holochain_types = "0.3.0-beta-dev.31"
holochain_nonce = "0.3.0-beta-dev.22"
holochain_zome_types = { workspace = true }

lair_keystore_api = "0.4.0"
lair_keystore_api = { version = "0.4.0", optional = true }

[dev-dependencies]
arbitrary = "1.2"
holochain = { version = "0.3.0-beta-dev.32", features = ["test_utils"] }
rand = "0.7"
holochain = { version = "0.3.0-beta-dev.38", features = ["test_utils"] }
rand = "0.8"
tokio = { version = "1.3", features = ["full"] }
utilities = { path = "utilities" }
kitsune_p2p_types = "0.3.0-beta-dev.14"

[features]
default = ["lair_signing"]

lair_signing = [
"dep:lair_keystore_api",
]
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 80b9761

Please sign in to comment.