Initial code commit

This commit is contained in:
2026-01-20 23:17:25 -05:00
parent 6f1c18901e
commit 2268a7a6c3
6 changed files with 125 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
/cmutton.a
/cmutton.h
/test.c
/a.out
+60
View File
@@ -0,0 +1,60 @@
# cmutton
Official C bindings for [libmutton](https://github.com/rwinkhart/libmutton).
# Usage
Build the C library + headers w/`go build -buildmode=c-archive`.
# Progress
- [ ] age
- [ ] AllPasswordEntries(forceReage bool) error
- [ ] Entry(vanityPath string, timestamp int64) error
- [ ] TranslateAgeTimestamp(timestamp *int64) uint8
- [ ] clip
- [ ] ClearArgument() error
- [ ] ClearProcess(assignedContents string) error
- [ ] CopyShortcut(realPath string, field int) error
- [ ] CopyString(clearClipboardAutomatically bool, copySubject string) error
- [ ] LaunchClearProcess(copySubject string)
- [ ] TOTPCopier(secret string, errorChan chan<- error, done <-chan bool)
- [ ] config
- [ ] Write(cfg *CfgT, appendMode bool) error
- [ ] Load() (*CfgT, error)
- [ ] core
- [ ] ClampTrailingWhitespace(note []string)
- [ ] EntryAddPrecheck(realPath string) (uint8, error)
- [ ] EntryIsNotEmpty(entryData []string) bool
- [ ] EntryRefresh(oldRCWPassword, newRCWPassword []byte, removeOldDir bool) error
- [ ] GenTOTP(secret string, time time.Time) (string, error)
- [ ] GetOldEntryData(realPath string, field int) ([]string, error)
- [ ] LibmuttonInit(inputCB func(prompt string) string, rcwPassword []byte, ...) error
- [ ] RCWSanityCheckGen(password []byte) error
- [ ] WriteEntry(realPath string, decSlice []string, passwordIsNew bool) error
- [ ] crypt
- [ ] DecryptFileToSlice(realPath string) ([]string, error)
- [ ] EncryptBytes(decBytes []byte) []byte
- [ ] RCWDArgument()
- [ ] global
- [X] DirInit(preserveOldCfgDir bool) (string, error)
- [ ] GenDeviceIDList() ([]fs.DirEntry, error)
- [ ] GetCurrentDeviceID() (string, error)
- [ ] GetRealAgePath(vanityPath string) string
- [ ] GetRealPath(vanityPath string) string
- [ ] GetSysProcAttr() *syscall.SysProcAttr
- [ ] GetVanityPath(realPath string) string
- [ ] syncclient
- [ ] AddFolderRemote(vanityPath string) error
- [ ] GenDeviceID(oldDeviceID, prefix string) (string, string, bool, error)
- [ ] GetSSHClient() (*ssh.Client, bool, *bool, *string, *string, error)
- [ ] GetSSHOutput(sshClient *ssh.Client, cmd, stdin string) ([]byte, error)
- [ ] RenameRemote(oldVanityPath, newVanityPath string) error
- [ ] ShearRemote(vanityPath string, onlyShearAgeFile bool) error
- [ ] RunJob() (*syncListsT, error)
- [ ] synccommon
- [ ] AddFolderLocal(vanityPath string) error
- [ ] RenameLocal(oldVanityPath, newVanityPath string) error
- [ ] ShearAgeFileLocal(vanityPath string) error
- [ ] ShearLocal(vanityPath, clientDeviceID string, onlyShearAgeFile bool) (string, bool, error)
- [ ] WalkEntryDir() ([]string, []string, error)
- [ ] GetAllEntryData() (EntryMapT, error)
- [ ] syncserver
- [ ] GetRemoteDataFromServer(clientDeviceID string)
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Get all packages in libmutton
mapfile -s 1 -t packages < <(go list github.com/rwinkhart/libmutton/... 2>/dev/null | sed 's|github.com/rwinkhart/libmutton/||')
# If no packages found, exit
if [ ${#packages[@]} -eq 0 ]; then
echo "No packages found in libmutton"
exit 1
fi
# Iterate through each package
for package in "${packages[@]}"; do
echo "- [ ] $package"
mapfile -t lines < <(go doc -short "github.com/rwinkhart/libmutton/$package" 2>/dev/null | grep "func ")
for line in "${lines[@]}"; do
line="${line#"${line%%[![:space:]]*}"}"
echo " - [ ] ${line:5}"
done
done
+25
View File
@@ -0,0 +1,25 @@
package main
/*
#include <stdlib.h>
*/
import "C"
import (
"github.com/rwinkhart/libmutton/global"
)
// DirInit returns:
// r0: oldDeviceID (special case: see libmutton docs)
//
// r1: err
//
//export DirInit
func DirInit(preserveOldCfgDir bool) (*C.char, *C.char) {
oldDeviceID, err := global.DirInit(preserveOldCfgDir)
if err != nil {
return nil, C.CString(err.Error())
}
return C.CString(oldDeviceID), nil
}
func main() {}
+10
View File
@@ -0,0 +1,10 @@
module cmutton
go 1.25.6
require github.com/rwinkhart/libmutton v0.4.3-0.20260111043639-f82b35bc4398
require (
github.com/rwinkhart/go-boilerplate v0.1.1 // indirect
golang.org/x/sys v0.40.0 // indirect
)
+6
View File
@@ -0,0 +1,6 @@
github.com/rwinkhart/go-boilerplate v0.1.1 h1:C+yyscGWeqvNpR91iw0i91zqX0LcxnCr1VOyT7iM4JY=
github.com/rwinkhart/go-boilerplate v0.1.1/go.mod h1:/NVRKGslU20E5xU5YOgXzWxA6aa94BMtv5MtHRTb5Ek=
github.com/rwinkhart/libmutton v0.4.3-0.20260111043639-f82b35bc4398 h1:QufX3nG3H1N986Xh7NZWsVELxmGms1yhNP7/fejBeHY=
github.com/rwinkhart/libmutton v0.4.3-0.20260111043639-f82b35bc4398/go.mod h1:qInUv19lzX1adFNI6Ih/IEVy+pktSTh/yA7cRTdVPH8=
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=