1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 21:45:26 +01:00
Files
sops/vendor/github.com/lib/pq/uuid.go
AJ Bahnken 038001b3a3 Auditing support
* Implement auditing support

* Document auditing

* Address review comments

* Change log level for errors reading audit config

* Disable auditors during tests

* Make changes to docs suggested by @jvehent

* Code review fixes to init() in audit.go

* Implement encrypt audit event

* Include filepath in Tree created from sops/encrypt/encrypt

* Fix changes in audit.go to stay with current style

* Implement RotateEvent within rotate command

* github.com/lib/pq vendor dependencies

* Always get current user in PostgresAuditor.Handle()

* Initial CR fixes + gofmt

* gofmt

* fixed placement of audit event in rotate()

* Moved to a single table for audit events.

* Revert "Moved to a single table for audit events."

This reverts commit 7e7817e8a1.

* Remove audit tables delete protection rules

* Move to a single audit_event table with action column

* Remove unnecessary tree declaration
2018-04-22 21:21:58 +02:00

24 lines
555 B
Go

package pq
import (
"encoding/hex"
"fmt"
)
// decodeUUIDBinary interprets the binary format of a uuid, returning it in text format.
func decodeUUIDBinary(src []byte) ([]byte, error) {
if len(src) != 16 {
return nil, fmt.Errorf("pq: unable to decode uuid; bad length: %d", len(src))
}
dst := make([]byte, 36)
dst[8], dst[13], dst[18], dst[23] = '-', '-', '-', '-'
hex.Encode(dst[0:], src[0:4])
hex.Encode(dst[9:], src[4:6])
hex.Encode(dst[14:], src[6:8])
hex.Encode(dst[19:], src[8:10])
hex.Encode(dst[24:], src[10:16])
return dst, nil
}