Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fido2 support (preliminary) #7

Merged
merged 7 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 0 additions & 14 deletions fido2/cmds/cmds.go

This file was deleted.

50 changes: 19 additions & 31 deletions fido2/cmds/fido2/main.go
Original file line number Diff line number Diff line change
@@ -1,49 +1,37 @@
package main

import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"time"

"github.com/keys-pub/keysd/fido2"
"github.com/keys-pub/keysd/fido2/cmds"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)

func main() {
app := cli.NewApp()
app.Name = "fido2"
app.Version = "1.4.0"
app.Usage = "Manage FIDO2 devices"

app.Flags = []cli.Flag{}

logger := logrus.StandardLogger()
formatter := &logrus.TextFormatter{
FullTimestamp: true,
TimestampFormat: time.RFC3339Nano,
if len(os.Args) < 2 {
log.Fatal("specify fido2 library")
}
logger.SetFormatter(formatter)

server := fido2.NewAuthenticatorsServer()

cliCmds := []cli.Command{
cmds.Devices(server),
cmds.DeviceInfo(server),
cmds.MakeCredential(server),
server, err := fido2.OpenPlugin(os.Args[1])
if err != nil {
log.Fatal(err)
}
// sort.Slice(cliCmds, func(i, j int) bool {
// return cliCmds[i].Name < cliCmds[j].Name
// })

app.Commands = cliCmds

app.Before = func(c *cli.Context) error {
return nil
req := &fido2.DevicesRequest{}
resp, err := server.Devices(context.TODO(), req)
if err != nil {
log.Fatal(err)
}
printResponse(resp)
}

if err := app.Run(os.Args); err != nil {
log.Fatal(err)
func printResponse(i interface{}) {
b, err := json.MarshalIndent(i, "", " ")
if err != nil {
panic(err)
}
fmt.Println(string(b))
}
144 changes: 0 additions & 144 deletions fido2/cmds/rpc.go

This file was deleted.

Loading