SamClinckspoor / ykmango

πŸ”‘ Prompt a YubiKey device to generate an OATH code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

License GoDoc Go Report Card CircleCI CodeCov

YKManGo

πŸ”‘ Prompt a YubiKey device to generate an OATH code

Installing

You can fetch this library by running the following

go get -u github.com/joshdk/ykmango

Additionally, this library has a runtime dependency on ykman which must be installed before use.

Usage

import (
	"fmt"
	"github.com/joshdk/ykmango"
)

// List the currently configured OATH slot names.
names, err := ykman.List()
if err != nil {
	panic(err.Error())
}

for _, name := range names {
	fmt.Printf("Found code named: %s\n", name)
	// Found code named: aws-mfa
}

// Generate an OATH code using the given slot name.
// You may need to touch your YubiKey device if the
// slot is configured to require touch.
code, err := ykman.Generate("aws-mfa")
if err != nil {
	panic(err.Error())
}

fmt.Printf("Your code is: %s\n", code)
// Your code is: 150509

License

This library is distributed under the MIT License, see LICENSE.txt for more information.

About

πŸ”‘ Prompt a YubiKey device to generate an OATH code

License:MIT License


Languages

Language:Go 60.2%Language:Shell 39.8%