add api and tool for query mxpassfiles, fixes
This commit is contained in:
parent
41fa795971
commit
8df08611a9
7 changed files with 95 additions and 20 deletions
20
libmxclient/mxutils/mxpass.go
Normal file
20
libmxclient/mxutils/mxpass.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2026 saces@c-base.org
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
package mxutils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"mxclientlib/determinant/mxpassfile"
|
||||
)
|
||||
|
||||
func GetMXPassItem(mxpassfile_path string, url string, localpart string, domain string) (*mxpassfile.Entry, error) {
|
||||
pf, err := mxpassfile.ReadPassfile(mxpassfile_path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e := pf.FindPasswordFill(url, localpart, domain)
|
||||
if e == nil {
|
||||
return nil, errors.New("no item found.")
|
||||
}
|
||||
return e, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue