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