-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update siwe deps and integration #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
siwe.rs
needs corresponding updates.
siwe module isn't being loaded; it's conditional in src/lib.rs
with #[cfg(feature = "siwe")]
, but siwe
feature is not enabled.
If I try to enable it like this...
diff --git a/Cargo.toml b/Cargo.toml
index 61b088a..9b6bc02 100755
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,3 +12,3 @@ repository = "https://github.com/spruceid/cacao/"
[features]
-eip4361 = ["hex", "ethers-core"]
+eip4361 = ["hex", "ethers-core", "siwe"]
zcap = ["ssi"]
@@ -17,3 +17,3 @@ default = ["eip4361", "zcap"]
[dependencies]
-siwe = { version = "0.2" }
+siwe = { version = "0.2", optional = true }
iri-string = { version = "0.4", features = ["serde", "serde-std"] }
... I get errors:
errors
error[E0432]: unresolved import `siwe::TimeStamp`
--> src/lib.rs:5:5
|
5 | use siwe::TimeStamp;
| ^^^^^^^^^^^^^^^ no `TimeStamp` in `siwe`
error[E0659]: `siwe` is ambiguous
--> src/lib.rs:5:5
|
5 | use siwe::TimeStamp;
| ^^^^ ambiguous name
|
= note: ambiguous because of multiple potential import sources
= note: `siwe` could refer to a crate passed with `--extern`
= help: use `::siwe` to refer to this crate unambiguously
note: `siwe` could also refer to the module defined here
--> src/lib.rs:12:1
|
12 | pub mod siwe;
| ^^^^^^^^^^^^^
= help: use `crate::siwe` to refer to this module unambiguously
warning: unused import: `std::str::FromStr`
--> src/lib.rs:6:5
|
6 | use std::str::FromStr;
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
error[E0432]: unresolved import `siwe::eip4361`
--> src/siwe.rs:108:15
|
108 | use siwe::eip4361::Message;
| ^^^^^^^ could not find `eip4361` in `siwe`
error[E0308]: mismatched types
--> src/siwe.rs:44:13
|
44 | chain_id,
| ^^^^^^^^ expected `u64`, found struct `std::string::String`
error[E0308]: mismatched types
--> src/siwe.rs:45:24
|
45 | statement: self.statement,
| ^^^^^^^^^^^^^^ expected enum `Option`, found struct `std::string::String`
|
= note: expected enum `Option<std::string::String>`
found struct `std::string::String`
help: try wrapping the expression in `Some`
|
45 | statement: Some(self.statement),
| +++++ +
error[E0308]: mismatched types
--> src/siwe.rs:46:18
|
46 | uri: self.aud,
| ^^^^^^^^ expected struct `RiString`, found struct `RiAbsoluteString`
|
= note: expected struct `RiString<UriSpec>`
found struct `RiAbsoluteString<UriSpec>`
error[E0308]: mismatched types
--> src/siwe.rs:65:35
|
65 | to_checksum(&H160(&m.address), None)
| ^^^^^^^^^^ expected array `[u8; 20]`, found `&[u8; 20]`
|
help: consider removing the borrow
|
65 - to_checksum(&H160(&m.address), None)
65 + to_checksum(&H160(m.address), None)
|
error[E0308]: mismatched types
--> src/siwe.rs:69:24
|
69 | statement: m.statement,
| ^^^^^^^^^^^ expected struct `std::string::String`, found enum `Option`
|
= note: expected struct `std::string::String`
found enum `Option<std::string::String>`
error[E0308]: mismatched types
--> src/siwe.rs:70:18
|
70 | aud: m.uri,
| ^^^^^ expected struct `RiAbsoluteString`, found struct `RiString`
|
= note: expected struct `RiAbsoluteString<UriSpec>`
found struct `RiString<UriSpec>`
error[E0308]: mismatched types
--> src/siwe.rs:98:25
|
98 | m.verify_eip191(sig.s)?;
| ^^^^^
| |
| expected `&[u8; 65]`, found array `[u8; 65]`
| help: consider borrowing here: `&sig.s`
|
note: return type inferred to be `&[u8; 65]` here
--> src/siwe.rs:90:96
|
90 | async fn verify(payload: &Payload, sig: &Self::Signature) -> Result<(), VerificationError> {
| ________________________________________________________________________________________________^
91 | | if !payload.valid_now() {
92 | | return Err(VerificationError::NotCurrentlyValid);
93 | | };
... |
99 | | Ok(())
100 | | }
| |_____^
Some errors have detailed explanations: E0308, E0432, E0659.
For more information about an error, try `rustc --explain E0308`.
warning: `cacao` (lib) generated 1 warning
error: could not compile `cacao` due to 9 previous errors; 1 warning emitted
warning: build failed, waiting for other jobs to finish...
error[E0308]: mismatched types
--> src/siwe.rs:45:24
|
45 | statement: self.statement,
| ^^^^^^^^^^^^^^ expected enum `Option`, found struct `std::string::String`
|
= note: expected enum `Option<std::string::String>`
found struct `std::string::String`
help: try wrapping the expression in `futures_util::__private::Some`
|
45 | statement: futures_util::__private::Some(self.statement),
| ++++++++++++++++++++++++++++++ +
warning: `cacao` (lib test) generated 1 warning (1 duplicate)
error: build failed
Edit: fixed in 07b8a11; thanks!
had history issues, should be fixed now. removed the feature gate and had to rename the |
uses the
TimeStamp
struct from SIWE and closes #3.