Skip to content

Commit

Permalink
Rename internal from "fido" to "yafu"
Browse files Browse the repository at this point in the history
- add back .exe creation under a profile
- add --reset to reset authenticator
  • Loading branch information
martinpaljak committed Nov 24, 2024
1 parent bb3b77d commit 7a3880c
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 54 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/robot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
distribution: zulu
cache: maven
- name: Compile and verify
run: ./mvnw -U -B -T1C verify
run: ./mvnw -P exe -U -B -T1C verify
- name: Deploy snapshot
if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/main')
run: ./mvnw -B deploy
Expand All @@ -44,7 +44,8 @@ jobs:
uses: softprops/[email protected]
with:
files: |
tool/target/fido.jar
tool/target/yafu.jar
tool/target/yafu.exe
fail_on_unmatched_files: true
body: Release ${{ github.ref_name }}
prerelease: true # manually promoted
113 changes: 63 additions & 50 deletions tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<artifactId>fido2-toolbox</artifactId>
<version>24.11.23-SNAPSHOT</version>
</parent>
<artifactId>fido-tool</artifactId>
<name>FIDO2/CTAP2 tool</name>
<artifactId>yafu</artifactId>
<name>FIDO2/CTAP2 tool "YAFU"</name>
<properties>
<!-- No javadocs for CLI tool -->
<maven.javadoc.skip>true</maven.javadoc.skip>
Expand Down Expand Up @@ -61,13 +61,13 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>fido-jar</id>
<id>yafu-jar</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>fido</finalName>
<finalName>yafu</finalName>
<!--minimizeJar>true</minimizeJar-->
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
Expand Down Expand Up @@ -109,52 +109,65 @@
</execution>
</executions>
</plugin>
<!-- Package for Windows
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>2.0.1</version>
<executions>
<execution>
<id>fido-exe</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<outfile>target/fido.exe</outfile>
<jar>target/fido.jar</jar>
<errTitle>FIDO</errTitle>
<manifest>src/main/resources/fido.exe.manifest</manifest>
<classPath>
<mainClass>pro.javacard.fido2.cli.FIDOTool</mainClass>
</classPath>
<vars>
<var>FIDO_EXE_WRAPPER=true</var>
</vars>
<jre>
<minVersion>11</minVersion>
</jre>
<versionInfo>
<fileVersion>
${windowsVersion.majorVersion}.${windowsVersion.minorVersion}.${windowsVersion.incrementalVersion}.${windowsVersion.buildNumber}
</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>FIDO tool</fileDescription>
<copyright>(C) 2021 - 2022 Martin Paljak and contributors (LGPL+MIT)</copyright>
<productVersion>
${windowsVersion.majorVersion}.${windowsVersion.minorVersion}.${windowsVersion.incrementalVersion}.${windowsVersion.buildNumber}
</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>FIDO tool</productName>
<internalName>fido</internalName>
<originalFilename>fido.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin> -->
</plugins>
</build>
<profiles>
<profile>
<id>exe</id>
<build>
<plugins>
<!-- Call Windows version number mangler -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<!-- Package for Windows -->
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<id>fido-exe</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<outfile>target/yafu.exe</outfile>
<jar>target/yafu.jar</jar>
<errTitle>YAFU</errTitle>
<manifest>src/main/resources/yafu.exe.manifest</manifest>
<classPath>
<mainClass>pro.javacard.fido2.cli.FIDOTool</mainClass>
</classPath>
<vars>
<var>FIDO_EXE_WRAPPER=true</var>
</vars>
<jre>
<minVersion>17</minVersion>
</jre>
<versionInfo>
<fileVersion>
${windowsVersion.majorVersion}.${windowsVersion.minorVersion}.${windowsVersion.incrementalVersion}.${windowsVersion.buildNumber}
</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>YAFU FIDO tool</fileDescription>
<copyright>(C) 2021 - 2024 Martin Paljak and contributors (LGPL+MIT)</copyright>
<productVersion>
${windowsVersion.majorVersion}.${windowsVersion.minorVersion}.${windowsVersion.incrementalVersion}.${windowsVersion.buildNumber}
</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>YAFU</productName>
<internalName>yafu</internalName>
<originalFilename>yafu.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ abstract class CommandLineInterface {

// Registration/authentication
protected static OptionSpec<Void> OPT_WINK = parser.acceptsAll(Arrays.asList("W", "wink"), "Wink ;)");
protected static OptionSpec<Void> OPT_RESET = parser.acceptsAll(Arrays.asList("reset"), "Reset authenticator");

// PIN options
protected static OptionSpec<String> OPT_PIN = parser.acceptsAll(Arrays.asList("p", "pin"), "Use PIN (FIDO2)").withOptionalArg().describedAs("PIN");
Expand Down
12 changes: 10 additions & 2 deletions tool/src/main/java/pro/javacard/fido2/cli/FIDOTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ else if (filtered.size() > 1) {
System.out.println("PIN code set");
exitWith(0);
} else {
System.err.println("PIN code not set!");
System.err.println("PIN code not set! Set it by specifying PIN value or -p");
exitWith(1);
}
}
}
Expand All @@ -313,7 +314,14 @@ else if (filtered.size() > 1) {
pinToken = PINProtocols.aes256_decrypt(sharedSecret, token.get("pinToken").binaryValue());
}

if (options.has(OPT_CHANGE_PIN)) {
if (options.has(OPT_RESET)) {
if (useU2F(transport, options)) {
System.err.println("U2F devices can not be reset");
exitWith(1);
} else {
ctap2(ctap2command(CTAP2Enums.Command.authenticatorReset, new byte[0]), transport);
}
} else if (options.has(OPT_CHANGE_PIN)) {
ctap2(CTAP2Commands.make_changePIN(options.valueOf(OPT_PIN), options.valueOf(OPT_CHANGE_PIN), deviceKey, ephemeral), transport);
} else if (options.has(OPT_LIST_CREDENTIALS)) {
List<FIDOCredential> credentials = CTAP2ProtocolHelpers.listCredentials(deviceInfo, transport, pinToken);
Expand Down
File renamed without changes.

0 comments on commit 7a3880c

Please sign in to comment.