Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d704ba0
feat: modular pkg with authentication middleware
leonbotros Jun 9, 2022
998ab89
use ibe 0.2.2 (via git for now) in irmaseal-core
leonbotros Jun 24, 2022
1481ddb
fix: fix session pointer if ihub pkg is used
leonbotros Jun 24, 2022
f1d771b
feat: include no-auth middleware and tests
leonbotros Jun 24, 2022
2e451ac
update Cargo.lock
leonbotros Jun 24, 2022
12e34bb
fix: retrieve token from path for authentication using tokens
leonbotros Jun 27, 2022
fd3690a
fix: skip serializing USK if not present
leonbotros Jun 27, 2022
21f0503
fix: extract raw usk from response-local extensions
leonbotros Jun 27, 2022
76eabe6
feat: add round and wrong_policy tests
leonbotros Jun 27, 2022
6af7270
fix: rename middlewares -> middleware
leonbotros Jun 27, 2022
b6456ba
feat: bump ibe to 0.2.2
leonbotros Jun 28, 2022
3cc8b5e
fix: do not error when validation fails, rather respond with no key
leonbotros Jun 28, 2022
d809b50
feat: prefix irma endpoints with /irma, update client and docs
leonbotros Jun 30, 2022
9238662
feat: change some comments
leonbotros Jun 30, 2022
2260075
feat: minor changes to documentation warnings
leonbotros Jun 30, 2022
a757b1c
small changes to pkg documentation
leonbotros Oct 24, 2022
2bb343f
feat: backwards compatibility, match both /request and /irma for irma…
leonbotros Oct 24, 2022
e9a1ddb
feat: include pkg tests and cleanup github actions
leonbotros Oct 26, 2022
35abee4
feat: remove unneccesary firefox installation in github actions
leonbotros Oct 31, 2022
d1b1d17
feat: improve documentation irma middleware
leonbotros Oct 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 23 additions & 113 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ on:
name: Continuous integration

jobs:
build-core:
name: Build core
test:
name: Test workspace
strategy:
matrix:
workspace: [core, pkg, cli]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -21,88 +24,14 @@ jobs:
override: true
- uses: actions-rs/cargo@v1
with:
args: --manifest-path irmaseal-core/Cargo.toml --all-features
command: build

build-pkg:
name: Build pkg
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
args: --manifest-path irmaseal-pkg/Cargo.toml
command: build

build-cli:
name: Build CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
args: --manifest-path irmaseal-cli/Cargo.toml
command: build

test-core:
name: Test core
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
args: --manifest-path irmaseal-core/Cargo.toml --all-features
args: --manifest-path irmaseal-${{ matrix.workspace }}/Cargo.toml --all-features
command: test

fmt-core:
name: Format core
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
args: --manifest-path irmaseal-core/Cargo.toml --all -- --check
command: fmt

fmt-pkg:
name: Format pkg
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
args: --manifest-path irmaseal-pkg/Cargo.toml --all -- --check
command: fmt

fmt-cli:
name: Format CLI
format:
name: Format workspace
strategy:
matrix:
workspace: [core, pkg, cli]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -114,42 +43,23 @@ jobs:
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
args: --manifest-path irmaseal-cli/Cargo.toml --all -- --check
args: --manifest-path irmaseal-${{ matrix.workspace }}/Cargo.toml --all -- --check
command: fmt

test-wasm-bindings-chrome:
name: Run wasm tests in Google Chrome
runs-on: ubuntu-latest
env:
WASM_BINDGEN_TEST_TIMEOUT: 120
steps:
- uses: actions/checkout@v2
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- run: wasm-pack test --headless --chrome ./irmaseal-wasm-bindings

test-wasm-bindings-safari:
name: Run wasm tests in Safari
runs-on: macos-latest
test-wasm-browsers:
name: Run wasm tests in browsers
strategy:
matrix:
browser: [chrome, firefox]
os: [ubuntu-latest]
include:
- browser: safari
os: macos-latest
runs-on: ${{ matrix.os }}
env:
WASM_BINDGEN_TEST_TIMEOUT: 120
steps:
- uses: actions/checkout@v2
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- run: wasm-pack test --headless --safari ./irmaseal-wasm-bindings

test-wasm-bindings-firefox:
name: Run wasm tests in Mozilla Firefox
runs-on: ubuntu-latest
env:
WASM_BINDGEN_TEST_TIMEOUT: 120
steps:
- uses: actions/checkout@v2
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- run: sudo apt update && sudo apt install firefox
- run: wasm-pack test --headless --firefox ./irmaseal-wasm-bindings
- run: wasm-pack test --headless --${{ matrix.browser }} ./irmaseal-wasm-bindings
18 changes: 10 additions & 8 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions irmaseal-cli/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl<'a> Client<'a> {

pub async fn request_start(&self, kr: &KeyRequest) -> Result<irma::SessionData, ClientError> {
self.client
.post(self.create_url("v2/request/start"))
.post(self.create_url("v2/irma/start"))
.json(kr)
.send()
.await?
Expand All @@ -55,7 +55,7 @@ impl<'a> Client<'a> {

pub async fn request_jwt(&self, token: &irma::SessionToken) -> Result<String, ClientError> {
self.client
.get(self.create_url(&format!("v2/request/jwt/{}", token.0)))
.get(self.create_url(&format!("v2/irma/jwt/{}", token.0)))
.send()
.await?
.error_for_status()?
Expand All @@ -73,7 +73,7 @@ impl<'a> Client<'a> {
KeyResponse<K>: DeserializeOwned,
{
self.client
.get(self.create_url(&format!("v2/request/key/{timestamp}")))
.get(self.create_url(&format!("v2/irma/key/{timestamp}")))
.bearer_auth(auth)
.send()
.await?
Expand Down
12 changes: 7 additions & 5 deletions irmaseal-cli/src/decrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,17 @@ pub async fn exec(dec_opts: DecOpts) {

let client = Client::new(&pkg).unwrap();
let mut sd: irma::SessionData = client.request_start(&keyrequest).await.unwrap();
sd.session_ptr.u = format!("https://ihub.ru.nl/irma/1/{}", sd.session_ptr.u);

if pkg.contains("ihub.ru.nl") {
sd.session_ptr.u = format!("https://ihub.ru.nl/irma/1/{}", sd.session_ptr.u);
}

eprintln!("Please scan the following QR-code with IRMA:");
print_qr(&sd.session_ptr);

let key_resp: KeyResponse<CGWKV> =
wait_on_session::<CGWKV>(&client, &sd, rec_info.policy.timestamp)
.await
.unwrap();
let key_resp: KeyResponse<CGWKV> = wait_on_session(&client, &sd, rec_info.policy.timestamp)
.await
.unwrap();

let usk = key_resp.key.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion irmaseal-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ categories = ["cryptography"]

[dependencies]
irma = "0.2.1"
ibe = { version = "0.2.0", features = ["cgwkv", "mr"] }
ibe = { version = "0.2.2", features = ["cgwkv", "mkem"] }
rand = { version = "0.8.4" }
subtle = "2.3"
serde = { version = "1.0.126", features = ["derive"] }
Expand Down
8 changes: 4 additions & 4 deletions irmaseal-core/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ pub struct KeyRequest {
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct KeyResponse<K: IBKEM> {
/// The current IRMA session status.
/// The status of the session.
pub status: SessionStatus,

/// The current IRMA session proof status, if there is one.
/// The status of the IRMA proof.
#[serde(skip_serializing_if = "Option::is_none")]
pub proof_status: Option<ProofStatus>,

/// The key will remain `None` until the status is `Done` and the proof is `Valid`.
#[serde(skip_serializing_if = "Option::is_none")]
/// The user secret key (if present).
#[serde(bound(
serialize = "UserSecretKey<K>: Serialize",
deserialize = "UserSecretKey<K>: Deserialize<'de>"
))]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<UserSecretKey<K>>,
}
2 changes: 1 addition & 1 deletion irmaseal-core/src/artifacts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const fn b64len(raw_len: usize) -> usize {
pub struct PublicKey<K: IBKEM>(pub K::Pk);

/// An IRMAseal user private key, as generated by the Private Key Generator (PKG).
#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct UserSecretKey<K: IBKEM>(pub K::Usk);

// Note: We cannot make these implementations generic parameter over the scheme parameter because
Expand Down
Empty file modified irmaseal-core/src/lib.rs
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions irmaseal-core/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::util::generate_iv;
use crate::*;
use crate::{Error, HiddenPolicy, IV_SIZE};
use ibe::kem::cgw_kv::CGWKV;
use ibe::kem::mr::{MultiRecipient, MultiRecipientCiphertext};
use ibe::kem::mkem::{MultiRecipient, MultiRecipientCiphertext};
use ibe::kem::{SharedSecret, IBKEM};
use ibe::Compress;
use rand::{CryptoRng, Rng};
Expand Down Expand Up @@ -70,7 +70,7 @@ impl Metadata {
// Generate all RecipientInfo's.
let recipient_info: BTreeMap<String, RecipientInfo> = policies
.iter()
.zip(cts.iter())
.zip(cts)
.map(|((rid, policy), ct)| {
(
rid.clone(),
Expand Down
27 changes: 19 additions & 8 deletions irmaseal-pkg/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
[package]
authors = [
"Leon Botros <l.botros@cs.ru.nl>",
"Wouter Geraedts <git@woutergeraedts.nl>"
"Leon Botros <l.botros@cs.ru.nl>",
"Wouter Geraedts <git@woutergeraedts.nl>"
]
edition = "2021"
license = "MIT"
name = "irmaseal-pkg"
version = "0.2.0-beta.0"

[dependencies]
actix-rt = "2.7.0"
actix-web = "4.0.1"
actix-cors = "0.6.1"
actix-rt = "2.7.0"
actix-web = "4.1.0"
actix-http = "*"
actix-web-httpauth = "0.6.0"
arrayref = "0.3.5"
clap = { version = "3.0.10", features = ["derive"] }
futures = { version = "0.3", features = ["executor"] }
futures-util = "*"
irma = "0.2.1"
paste = "1.0.5"
rand = "0.8.4"
reqwest = "0.11.10"
serde = "*"
serde_json = "1.0.68"
subtle = "2.1.1"
reqwest = "0.11.10"
jsonwebtoken = { version = "8.0.1", features = ["use_pem"] }

[dependencies.clap]
features = ["derive"]
version = "3.0.10"

[dependencies.futures]
features = ["executor"]
version = "0.3"

[dependencies.irmaseal-core]
path = "../irmaseal-core"

[dependencies.jsonwebtoken]
features = ["use_pem"]
version = "8.0.1"
Loading