mirror of
https://github.com/rwinkhart/cmutton.git
synced 2026-08-28 04:46:46 -04:00
Drop LibmuttonInit; clients should implement this manually
This commit is contained in:
@@ -87,7 +87,7 @@ int main() {
|
||||
- [X] EntryRefresh(oldRCWPassword, newRCWPassword []byte, removeOldDir bool) error
|
||||
- [X] GenTOTP(secret string, time time.Time) (string, error)
|
||||
- [X] GetOldEntryData(realPath string, field int, rcwPassword []byte) ([]string, error)
|
||||
- [X] LibmuttonInit(inputCB func(prompt string) string, rcwPassword []byte, ...) error
|
||||
- [X] ~~LibmuttonInit(inputCB func(prompt string) string, rcwPassword []byte, ...) error~~ (should be performed manually)
|
||||
- [X] RCWSanityCheckGen(password []byte) error
|
||||
- [X] VerifyEntries(rcwPassword []byte) error
|
||||
- [X] WriteEntry(realPath string, decSlice []string, passwordIsNew bool, rcwPassword []byte) error
|
||||
|
||||
@@ -4,7 +4,6 @@ package main
|
||||
// #include "types.h"
|
||||
import "C"
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rwinkhart/libmutton/core"
|
||||
@@ -73,38 +72,6 @@ func GetOldEntryData(realPath C.PascalString, field int, rcwPassword C.PascalStr
|
||||
return nil, getCPascalStringArrayFromStringSlice(lines)
|
||||
}
|
||||
|
||||
// LibmuttonInit is a partial implementation that does not allow for client-specific config.
|
||||
// Returns:
|
||||
// r0: err
|
||||
//
|
||||
// Special requirement:
|
||||
// An array of ordered responses to inputCB questions.
|
||||
//
|
||||
//export LibmuttonInit
|
||||
func LibmuttonInit(configSSH, sshKeyPath, sshKeyProtected, sshUser, sshHost, sshPort, rcwPassword C.PascalString, appendMode bool, forceOfflineMode bool, deviceIDPrefix C.PascalString) *C.char {
|
||||
supplyInputForInit := func(prompt string) string {
|
||||
if strings.HasPrefix(prompt, "Configure SSH settings (for synchronization)? (Y/n)") {
|
||||
return C.GoStringN(configSSH.data, configSSH.len)
|
||||
} else if strings.HasPrefix(prompt, "SSH private identity file path (falls back to") {
|
||||
return C.GoStringN(sshKeyPath.data, sshKeyPath.len)
|
||||
} else if strings.HasPrefix(prompt, "Is the identity file password-protected? (y/N)") {
|
||||
return C.GoStringN(sshKeyProtected.data, sshKeyProtected.len)
|
||||
} else if strings.HasPrefix(prompt, "Remote SSH username:") {
|
||||
return C.GoStringN(sshUser.data, sshUser.len)
|
||||
} else if strings.HasPrefix(prompt, "Remote SSH IP/domain:") {
|
||||
return C.GoStringN(sshHost.data, sshHost.len)
|
||||
} else if strings.HasPrefix(prompt, "Remote SSH port:") {
|
||||
return C.GoStringN(sshPort.data, sshPort.len)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
if err := core.LibmuttonInit(supplyInputForInit, []byte(C.GoStringN(rcwPassword.data, rcwPassword.len)), appendMode, forceOfflineMode, C.GoStringN(deviceIDPrefix.data, deviceIDPrefix.len), nil); err != nil {
|
||||
return C.CString(err.Error())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RCWSanityCheckGen returns:
|
||||
// r0: err
|
||||
//
|
||||
|
||||
@@ -3,6 +3,7 @@ module cmutton
|
||||
go 1.26rc2
|
||||
|
||||
require (
|
||||
github.com/rwinkhart/go-boilerplate v0.2.2
|
||||
github.com/rwinkhart/libmutton v0.4.3-0.20260125215941-ec9c6b506232
|
||||
github.com/rwinkhart/rcw v0.2.5
|
||||
)
|
||||
@@ -13,7 +14,6 @@ require (
|
||||
github.com/kr/fs v0.1.0 // indirect
|
||||
github.com/pkg/sftp v1.13.10 // indirect
|
||||
github.com/pquerna/otp v1.5.0 // indirect
|
||||
github.com/rwinkhart/go-boilerplate v0.2.2 // indirect
|
||||
github.com/rwinkhart/peercred-mini v0.1.2 // indirect
|
||||
golang.org/x/crypto v0.47.0 // indirect
|
||||
golang.org/x/sys v0.40.0 // indirect
|
||||
|
||||
Reference in New Issue
Block a user