Skip to content

Commit

Permalink
Merge pull request #11 from olastor/10-asymmetric-encryption
Browse files Browse the repository at this point in the history
feat: add and implement updated specification v2
  • Loading branch information
olastor authored Apr 21, 2024
2 parents 41cc4b7 + 73ec6bb commit 14671fe
Show file tree
Hide file tree
Showing 39 changed files with 2,471 additions and 1,481 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build and Test

on:
release:
types: [ "published" ]
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- {GOOS: linux, GOARCH: amd64}
- {GOOS: linux, GOARCH: arm, GOARM: 6}
- {GOOS: linux, GOARCH: arm64}
- {GOOS: darwin, GOARCH: amd64}
- {GOOS: darwin, GOARCH: arm64}
- {GOOS: windows, GOARCH: amd64}
- {GOOS: freebsd, GOARCH: amd64}
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Install libfido2
run: sudo apt install libfido2-1 libfido2-dev libfido2-doc fido2-tools

- name: Build
run: |
VERSION="$(git describe --tags --always)"
go build -ldflags "-X main.Version=$VERSION" -v ./cmd/...
- name: Test
run: go test -v ./...

- name: Package
run: |
VERSION="$(git describe --tags --always)"
DIR="$(mktemp -d)"
mkdir "$DIR/age-plugin-fido2-hmac"
cp LICENSE "$DIR/age-plugin-fido2-hmac"
mv age-plugin-fido2-hmac "$DIR/age-plugin-fido2-hmac"
if [ "$GOOS" == "windows" ]; then
( cd "$DIR"; zip age-plugin-fido2-hmac.zip -r age-plugin-fido2-hmac )
mv "$DIR/age-plugin-fido2-hmac.zip" "age-plugin-fido2-hmac-$VERSION-$GOOS-$GOARCH.zip"
else
tar -cvzf "age-plugin-fido2-hmac-$VERSION-$GOOS-$GOARCH.tar.gz" -C "$DIR" age-plugin-fido2-hmac
fi
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
GOARM: ${{ matrix.GOARM }}

- name: Upload workflow artifacts
uses: actions/upload-artifact@v2
with:
name: plugin-binaries
path: age-plugin-fido2-hmac*

release:
name: Upload release binaries
if: github.event_name == 'release'
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Download workflow artifacts
uses: actions/download-artifact@v2
with:
name: plugin-binaries
- name: Upload release artifacts
run: gh release upload "$GITHUB_REF_NAME" age-plugin-fido2-hmac*
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
27 changes: 0 additions & 27 deletions .github/workflows/lint-and-test.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and Test

on:
release:
types: [published]
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- {GOOS: linux, GOARCH: amd64}
- {GOOS: linux, GOARCH: arm, GOARM: 6}
- {GOOS: linux, GOARCH: arm64}
- {GOOS: darwin, GOARCH: amd64}
- {GOOS: darwin, GOARCH: arm64}
- {GOOS: windows, GOARCH: amd64}
- {GOOS: freebsd, GOARCH: amd64}
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Install libfido2
run: sudo apt install libfido2-1 libfido2-dev libfido2-doc fido2-tools

- name: Build
run: go build -v ./cmd/...

- name: Test
run: go test -v ./...
172 changes: 18 additions & 154 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,160 +1,24 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Test binary, built with `go test -c`
*.test

# Pyre type checker
.pyre/
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# pytype static type analyzer
.pytype/
# Dependency directories (remove the comment below to include it)
# vendor/

# Cython debug symbols
cython_debug/
# Go workspace file
go.work

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
./age-plugin-fido2-hmac
*.enc
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 https://github.com/olastor/
Copyright (c) 2024 https://github.com/olastor

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
build:
go build ./cmd/...

test: build
go test -v ./...

test-e2e: build
testscript ./cmd/age-plugin-fido2-hmac/testdata/*.txtar

format:
go fmt ./pkg/... ./cmd/...

clean:
rm -f age-plugin-fido2-hmac
Loading

0 comments on commit 14671fe

Please sign in to comment.