Port envd from e2b with internalized shared packages and Connect RPC
- 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
This commit is contained in:
25
envd/internal/shared/keys/hmac_sha256.go
Normal file
25
envd/internal/shared/keys/hmac_sha256.go
Normal file
@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user