Update siwe-rs

This commit is contained in:
Simon Bihel 2022-02-08 10:36:26 +00:00
parent a9414d5e21
commit 4bce398253
No known key found for this signature in database
GPG Key ID: B7013150BEAA28FD
3 changed files with 211 additions and 295 deletions

474
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -11,8 +11,8 @@ description = "OpenID Connect Identity Provider for Sign-In with Ethereum."
crate-type = ["cdylib", "rlib"]
[dependencies]
anyhow = "1.0.51"
headers = "0.3.5"
anyhow = "1.0.53"
headers = "0.3.6"
hex = "0.4.3"
iri-string = { version = "0.4", features = ["serde-std"] }
# openidconnect = "2.1.2"
@ -20,14 +20,14 @@ openidconnect = { git = "https://github.com/sbihel/openidconnect-rs", branch = "
rand = "0.8.4"
rsa = { version = "0.5.0", features = ["alloc"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.72"
siwe = "0.1.3"
serde_json = "1.0.78"
siwe = "0.2.0"
thiserror = "1.0.30"
tracing = "0.1.29"
tracing = "0.1.30"
url = { version = "2.2", features = ["serde"] }
urlencoding = "2.1.0"
sha2 = "0.9.0"
cookie = "0.15.1"
cookie = "0.16.0"
bincode = "1.3.3"
async-trait = "0.1.52"
ethers-core = "0.6.3"

View File

@ -22,7 +22,7 @@ use openidconnect::{
};
use rsa::{pkcs1::ToRsaPrivateKey, RsaPrivateKey};
use serde::{Deserialize, Serialize};
use siwe::eip4361::{Message, Version};
use siwe::{Message, TimeStamp, Version};
use std::{str::FromStr, time};
use thiserror::Error;
use tracing::{error, info};
@ -400,7 +400,7 @@ struct Web3ModalMessage {
pub statement: String,
pub uri: String,
pub version: String,
pub chain_id: String,
pub chain_id: u64,
pub nonce: String,
pub issued_at: String,
pub expiration_time: Option<String>,
@ -425,14 +425,20 @@ impl Web3ModalMessage {
Ok(Message {
domain: self.domain.clone().try_into()?,
address: self.address.0,
statement: self.statement.to_string(),
statement: Some(self.statement.to_string()),
uri: UriString::from_str(&self.uri)?,
version: Version::from_str(&self.version)?,
chain_id: self.chain_id.to_string(),
chain_id: self.chain_id,
nonce: self.nonce.to_string(),
issued_at: self.issued_at.to_string(),
expiration_time: self.expiration_time.clone(),
not_before: self.not_before.clone(),
issued_at: TimeStamp::from_str(&self.issued_at)?,
expiration_time: match &self.expiration_time {
Some(t) => Some(TimeStamp::from_str(t)?),
None => None,
},
not_before: match &self.not_before {
Some(t) => Some(TimeStamp::from_str(t)?),
None => None,
},
request_id: self.request_id.clone(),
resources: next_resources,
})