Skip to content

Commit

Permalink
Merge pull request #6 from Concordium/identity-recovery-request
Browse files Browse the repository at this point in the history
Implement identity (recovery) request
  • Loading branch information
bisgardo authored Mar 19, 2024
2 parents 955b2fe + 8e02aeb commit 8656822
Show file tree
Hide file tree
Showing 6 changed files with 1,326 additions and 113 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Build-time environment variable `CONCORDIUM_WALLET_CRYPTO_FRAMEWORK_PATH`
for resolving the framework to a path instead of using the released one.

- Functions and associated types for creating identity issuance and recovery requests as well as account credential (deployment).

UDL signatures:

- `string identity_issuance_request_json(IdentityIssuanceRequestParameters params)`
- `string identity_recovery_request_json(IdentityRecoveryRequestParameters params)`
- `AccountCredentialResult account_credential(AccountCredentialParameters params)`
- `string account_credential_deployment_hash_hex(AccountCredential credential, u64 expiry_unix)`
- `string account_credential_deployment_signed_payload_hex(SignedAccountCredential credential)`

The parameter types mirror the corresponding "input" types from `wallet_library` but use only types supported by UniFFI.
The values are translated into these library types via JSON encoding/decoding.
This is in contrast to the Java SDK where the value is passed as a JSON encoded string
which is then decoded directly into the library input type.
Doing it this way ensures that the conversions that are only checked at runtime happen internally in this library is easily tested,
rather than across the FFI boundary.
So it makes the FFI boundary statically typed and of course also generates the Swift types that we do need on the SDK side anyway.

The identity request functions return their result as JSON encoded strings
because the protocol actually is to just send the object as JSON in a URL parameter.
So there's no point in decoding them into structured types - they would just be converted right back to JSON on the SDK side.
We do decode the payload in a unit test to verify the format.

### Changed

- Rename crate from "crypto" to "concordium-wallet-crypto-uniffi" and verify on CI that project works on all platforms.
- Rename generated framework from "RustFramework" to "ConcordiumWalletCryptoUniffi".
- Ensure that library builds on macOS 11+ and verify on CI.
- Bump UniFFI from v0.25.x to v0.26.x.
- Rename functions to match the usage and conventions on the SDK side.

## [1.0.0] - 2024-02-06

Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

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

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ crate-type = ["staticlib", "lib"]
[dependencies]
thiserror = "1"
uniffi = { version = "0.26", features = ["cli"] }
wallet_library = { path = "./concordium-base/rust-src/wallet_library" }
serde = "1.0"
serde_json = "1.0"

[dependencies.concordium_base]
path = "./concordium-base/rust-src/concordium_base"

[dependencies.wallet_library]
path = "./concordium-base/rust-src/wallet_library"

[build-dependencies]
uniffi = { version = "0.26", features = ["build"] }
Expand Down
Loading

0 comments on commit 8656822

Please sign in to comment.