Skip to content

Commit

Permalink
Fido2 support (preliminary) (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel authored Apr 29, 2020
1 parent 94fbb29 commit 25e2264
Show file tree
Hide file tree
Showing 23 changed files with 960 additions and 690 deletions.
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

0 comments on commit 25e2264

Please sign in to comment.