Compare commits
No commits in common. "main" and "v0.4.0" have entirely different histories.
1 changed files with 2 additions and 17 deletions
19
pkg.go
19
pkg.go
|
@ -38,15 +38,6 @@ type Manager struct {
|
|||
Initialized bool
|
||||
}
|
||||
|
||||
type KeyError struct {
|
||||
Err error
|
||||
KeyType string // PUBLIC or PRIVATE
|
||||
}
|
||||
|
||||
func (kerr KeyError) Error() string {
|
||||
return fmt.Sprintf("%s [%s]", kerr.Err.Error(), kerr.KeyType)
|
||||
}
|
||||
|
||||
func NewManager(keyType KeyType, private, public string, expireDays int) (mngr Manager, err error) { // {{{
|
||||
var errPriv, errPub error
|
||||
mngr.KeyType = keyType
|
||||
|
@ -70,18 +61,12 @@ func NewManager(keyType KeyType, private, public string, expireDays int) (mngr M
|
|||
}
|
||||
|
||||
if errPriv != nil {
|
||||
err = KeyError{
|
||||
errPriv,
|
||||
"PRIVATE",
|
||||
}
|
||||
err = errPriv
|
||||
return
|
||||
}
|
||||
|
||||
if errPub != nil {
|
||||
err = KeyError {
|
||||
errPub,
|
||||
"PUBLIC",
|
||||
}
|
||||
err = errPub
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue