refactor: format code and add more constants
Some checks failed
Go Build Multi-Platform / build (amd64, darwin) (push) Failing after 12s
Go Build Multi-Platform / build (amd64, freebsd) (push) Successful in 51s
Go Build Multi-Platform / build (amd64, linux) (push) Successful in 49s
Go Build Multi-Platform / build (arm, freebsd) (push) Successful in 49s
Go Build Multi-Platform / build (amd64, windows) (push) Successful in 57s
Go Build Multi-Platform / build (arm, windows) (push) Failing after 19s
Go Build Multi-Platform / build (arm, linux) (push) Failing after 21s
Go Build Multi-Platform / build (arm64, darwin) (push) Successful in 44s
Go Build Multi-Platform / build (arm64, freebsd) (push) Successful in 48s
Go Build Multi-Platform / build (arm64, linux) (push) Successful in 47s
Go Build Multi-Platform / build (arm64, windows) (push) Successful in 46s
Run Gosec / tests (push) Successful in 45s
Go Build Multi-Platform / Create Release (push) Has been skipped
Go Revive Lint / lint (push) Successful in 9m48s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 19m13s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 19m19s
Some checks failed
Go Build Multi-Platform / build (amd64, darwin) (push) Failing after 12s
Go Build Multi-Platform / build (amd64, freebsd) (push) Successful in 51s
Go Build Multi-Platform / build (amd64, linux) (push) Successful in 49s
Go Build Multi-Platform / build (arm, freebsd) (push) Successful in 49s
Go Build Multi-Platform / build (amd64, windows) (push) Successful in 57s
Go Build Multi-Platform / build (arm, windows) (push) Failing after 19s
Go Build Multi-Platform / build (arm, linux) (push) Failing after 21s
Go Build Multi-Platform / build (arm64, darwin) (push) Successful in 44s
Go Build Multi-Platform / build (arm64, freebsd) (push) Successful in 48s
Go Build Multi-Platform / build (arm64, linux) (push) Successful in 47s
Go Build Multi-Platform / build (arm64, windows) (push) Successful in 46s
Run Gosec / tests (push) Successful in 45s
Go Build Multi-Platform / Create Release (push) Has been skipped
Go Revive Lint / lint (push) Successful in 9m48s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 19m13s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 19m19s
This commit is contained in:
@@ -240,7 +240,7 @@ func (i *Identity) String() string {
|
||||
|
||||
func Recall(hash []byte) (*Identity, error) {
|
||||
hashStr := hex.EncodeToString(hash)
|
||||
|
||||
|
||||
if data, exists := knownDestinations[hashStr]; exists {
|
||||
// data is [packet, destHash, identity, appData]
|
||||
if len(data) >= 3 {
|
||||
@@ -249,7 +249,7 @@ func Recall(hash []byte) (*Identity, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return nil, fmt.Errorf("identity not found for hash %x", hash)
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ func FromFile(path string) (*Identity, error) {
|
||||
ratchetExpiry: make(map[string]int64),
|
||||
mutex: &sync.RWMutex{},
|
||||
}
|
||||
|
||||
|
||||
if err := ident.loadPrivateKey(privateKey, signingSeed); err != nil {
|
||||
return nil, fmt.Errorf("failed to load private key: %w", err)
|
||||
}
|
||||
@@ -547,7 +547,7 @@ func LoadOrCreateTransportIdentity() (*Identity, error) {
|
||||
}
|
||||
|
||||
transportIdentityPath := fmt.Sprintf("%s/transport_identity", storagePath)
|
||||
|
||||
|
||||
if ident, err := FromFile(transportIdentityPath); err == nil {
|
||||
debug.Log(debug.DEBUG_INFO, "Loaded transport identity from storage")
|
||||
return ident, nil
|
||||
@@ -610,7 +610,7 @@ func (i *Identity) saveRatchets(path string) error {
|
||||
}
|
||||
|
||||
debug.Log(debug.DEBUG_PACKETS, "Saving ratchets", "count", len(i.ratchets), "path", path)
|
||||
|
||||
|
||||
// Convert ratchets to list format for msgpack
|
||||
ratchetList := make([][]byte, 0, len(i.ratchets))
|
||||
for _, ratchet := range i.ratchets {
|
||||
@@ -750,7 +750,7 @@ func (i *Identity) loadRatchets(path string) error {
|
||||
|
||||
signature, hasSignature := persistedData["signature"]
|
||||
packedRatchets, hasRatchets := persistedData["ratchets"]
|
||||
|
||||
|
||||
if !hasSignature || !hasRatchets {
|
||||
return fmt.Errorf("invalid ratchet file format: missing signature or ratchets")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user