moneyloverkeychain
uses system keyring as a storage for
persisting/getting credentials and token. It supports OS X, Linux
(dbus) and Windows.
Go >= 1.16
go get github.com/nhatthm/moneyloverkeychain
Examples
Build moneyloverapi.Client
:
package mypackage
import (
"github.com/nhatthm/moneyloverapi"
"github.com/nhatthm/moneyloverkeychain/credentials"
)
func buildClient(username string) (*moneyloverapi.Client, error) {
c := moneyloverapi.NewClient(
credentials.WithCredentialsProvider(username),
)
return c, nil
}
Persist credentials in system keyring:
package mypackage
import (
"github.com/nhatthm/moneyloverkeychain/credentials"
)
func persist(username, password string) error {
c := credentials.New(username)
return c.Update(password)
}
package mypackage
import (
"github.com/nhatthm/moneyloverapi"
"github.com/nhatthm/moneyloverkeychain/token"
)
func buildClient() *moneyloverapi.Client {
return moneyloverapi.NewClient(
token.WithTokenStorage(),
)
}
If this project help you reduce time to develop, you can give me a cup of coffee :)
or scan this