Enable CI

This patch adds a CI config that builds and tests the library and runs
clippy and rustfmt.  To make the CI pass, it also fixes the formatting
and two clippy lints.  One of them is a breaking change:  We remove
AuthenticatorDataFlags::EMPTY.  Instead, AuthenticatorDataFlags::empty()
should be used.
This commit is contained in:
Robin Krahl
2023-11-16 00:08:09 +01:00
parent c424155340
commit 9324f0094b
4 changed files with 62 additions and 9 deletions
+58
View File
@@ -0,0 +1,58 @@
name: CI
on: [push, pull_request]
jobs:
build:
name: Build library
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build library
run: cargo build
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Run tests
run: cargo test
clippy:
name: Run clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: "clippy"
- name: Run clippy
run: cargo clippy -- -D warnings
fmt:
name: Run rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: "rustfmt"
- name: Run rustfmt
run: cargo fmt -- --check
+1
View File
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Use references rather owned byte vectors to reduce the size of structs ([#16][])
- Accept more than 12 algorithms ([#17][])
- Add support for the `largeBlobKey` extension ([#18][])
- Remove `AuthenticatorDataFlags::EMPTY` (use `AuthenticatorDataFlags::empty()` instead)
[#9]: https://github.com/solokeys/ctap-types/issues/9
[#30]: https://github.com/solokeys/fido-authenticator/issues/30
+1 -2
View File
@@ -158,7 +158,7 @@ impl Response {
} else {
cbor_serialize(response, data)
}
},
}
GetAssertion(response) | GetNextAssertion(response) => cbor_serialize(response, data),
CredentialManagement(response) => cbor_serialize(response, data),
LargeBlobs(response) => cbor_serialize(response, data),
@@ -281,7 +281,6 @@ pub struct AuthenticatorOptions {
bitflags! {
pub struct AuthenticatorDataFlags: u8 {
const EMPTY = 0;
const USER_PRESENCE = 1 << 0;
const USER_VERIFIED = 1 << 2;
const ATTESTED_CREDENTIAL_DATA = 1 << 6;
+2 -7
View File
@@ -12,12 +12,13 @@ use crate::{
type Bytes16 = Bytes<16>;
type Bytes32 = Bytes<32>;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize_repr, Deserialize_repr)]
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Serialize_repr, Deserialize_repr)]
// #[derive(Clone,Debug,Eq,PartialEq,Serialize, Deserialize)]
// #[serde(tag = "credProtect")]
#[repr(u8)]
pub enum CredentialProtectionPolicy {
// #[serde(rename = "userVerificationOptional")]
#[default]
Optional = 1,
// #[serde(rename = "userVerificationOptionalWithCredentialIDList")] // <-- len = 44
OptionalWithCredentialIdList = 2,
@@ -25,12 +26,6 @@ pub enum CredentialProtectionPolicy {
Required = 3,
}
impl core::default::Default for CredentialProtectionPolicy {
fn default() -> Self {
CredentialProtectionPolicy::Optional
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize_repr, Deserialize_repr)]
#[repr(u8)]
pub enum Subcommand {