- 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
26 lines
439 B
Go
26 lines
439 B
Go
package keys
|
|
|
|
import (
|
|
"crypto/hmac"
|
|
"crypto/sha256"
|
|
"encoding/hex"
|
|
)
|
|
|
|
type HMACSha256Hashing struct {
|
|
key []byte
|
|
}
|
|
|
|
func NewHMACSHA256Hashing(key []byte) *HMACSha256Hashing {
|
|
return &HMACSha256Hashing{key: key}
|
|
}
|
|
|
|
func (h *HMACSha256Hashing) Hash(content []byte) (string, error) {
|
|
mac := hmac.New(sha256.New, h.key)
|
|
_, err := mac.Write(content)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return hex.EncodeToString(mac.Sum(nil)), nil
|
|
}
|