- Copy envd source from e2b-dev/infra, internalize shared dependencies
into envd/internal/shared/ (keys, filesystem, id, smap, utils)
- Switch from gRPC to Connect RPC for all envd services
- Update module paths to git.omukk.dev/wrenn/{sandbox,sandbox/envd}
- Add proto specs (process, filesystem) with buf-based code generation
- Implement full envd: process exec, filesystem ops, port forwarding,
cgroup management, MMDS integration, and HTTP API
- Update main module dependencies (firecracker SDK, pgx, goose, etc.)
- Remove placeholder .gitkeep files replaced by real implementations
31 lines
525 B
Go
31 lines
525 B
Go
package keys
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
"encoding/base64"
|
|
"fmt"
|
|
)
|
|
|
|
type Sha256Hashing struct{}
|
|
|
|
func NewSHA256Hashing() *Sha256Hashing {
|
|
return &Sha256Hashing{}
|
|
}
|
|
|
|
func (h *Sha256Hashing) Hash(key []byte) string {
|
|
hashBytes := sha256.Sum256(key)
|
|
|
|
hash64 := base64.RawStdEncoding.EncodeToString(hashBytes[:])
|
|
|
|
return fmt.Sprintf(
|
|
"$sha256$%s",
|
|
hash64,
|
|
)
|
|
}
|
|
|
|
func (h *Sha256Hashing) HashWithoutPrefix(key []byte) string {
|
|
hashBytes := sha256.Sum256(key)
|
|
|
|
return base64.RawStdEncoding.EncodeToString(hashBytes[:])
|
|
}
|