Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dangfan committed May 4, 2024
0 parents commit a38136e
Show file tree
Hide file tree
Showing 157 changed files with 6,814 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/example-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build Example App

on: [push, pull_request]

jobs:
build:
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}

strategy:
fail-fast: false
matrix:
target: [apk, linux, windows, macos]
variant: [debug, release]
include:
- target: apk
os: ubuntu-latest
pre-build-script: ""
debug-artifact-path: build/app/outputs/flutter-apk/app-debug.apk
release-artifact-path: build/app/outputs/flutter-apk/app-release.apk
- target: linux
os: ubuntu-latest
pre-build-script: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
debug-artifact-path: build/linux/x64/debug/bundle
release-artifact-path: build/linux/x64/release/bundle
- target: windows
os: windows-latest
pre-build-script: ""
debug-artifact-path: build/windows/x64/runner/Debug
release-artifact-path: build/windows/x64/runner/Release
- target: macos
os: macos-latest
pre-build-script: ""
debug-artifact-path: build/macos/Build/Products/Debug/*.app
release-artifact-path: build/macos/Build/Products/Release/*.app
# - target: ios
# os: macos-latest
# pre-build-script: ""
# artifact-path: |
# build/ios/iphoneos/Runner.app

runs-on: ${{ matrix.os }}
name: ${{ matrix.target }}-${{ matrix.variant }}

steps:

# setup environment
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
if: ${{ matrix.target == 'apk' }}
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: pre-build-script script for ${{ matrix.target }}
run: ${{ matrix.pre-build-script }}

# basic format & linting check
- run: dart pub get
# - run: dart format --output=none --set-exit-if-changed .
- run: dart analyze

# build flutter app
- run: flutter pub get
working-directory: example/
- name: Run flutter ${{ matrix.variant }} build on ${{ matrix.target }}
run: flutter build ${{ matrix.target }} --${{ matrix.variant }} --verbose
working-directory: example/

# upload build artifacts
- uses: actions/upload-artifact@v4
with:
name: example-${{ matrix.target }}-${{ matrix.variant }}
path: |
example/${{ matrix.debug-artifact-path }}
example/${{ matrix.release-artifact-path }}
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
build/
42 changes: 42 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "300451adae589accbece3490f4396f10bdf15e6e"
channel: "stable"

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
- platform: android
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
- platform: ios
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
- platform: linux
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
- platform: macos
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
- platform: windows
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
base_revision: 300451adae589accbece3490f4396f10bdf15e6e

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0

* Add basic support for Windows / Linux (via PCSC), macOS / iOS (via CryptoTokenKit), and Android (via USB operations).
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 nfcim

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ccid

[![Build Example App](https://github.com/nfcim/ccid/actions/workflows/example-app.yaml/badge.svg)](https://github.com/nfcim/ccid/actions/workflows/example-app.yaml)

A Flutter plugin for reading and writing smart cards using the CCID protocol with PC/SC-like APIs.

## Installation


### Linux

This plugin uses `dart_pcsc`, thus has a runtime dependency on `pcsc-lite`: `sudo apt-get install pcscd libpcsclite1`.
4 changes: 4 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
9 changes: 9 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx
57 changes: 57 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}

allprojects {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}

group 'im.nfc.ccid'

android {
if (project.android.hasProperty("namespace")) {
namespace 'im.nfc.ccid'
}

compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
}

defaultConfig {
minSdkVersion 29
}

dependencies {
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.mockito:mockito-core:5.0.0'
}

testOptions {
unitTests.all {
useJUnitPlatform()

testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
}
5 changes: 5 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
AGPVersion=7.4.2
KotlinVersion=1.9.23
13 changes: 13 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
plugins {
id 'com.android.library' version "${AGPVersion}"
id 'org.jetbrains.kotlin.android' version "${KotlinVersion}"
}
}

rootProject.name = 'ccid'
3 changes: 3 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="im.nfc.ccid">
</manifest>
Loading

0 comments on commit a38136e

Please sign in to comment.