forked from mtusi2026/mtusi2026lab3
Реализовать lab3 в общем Helm-релизе с Traefik, TLS и HPA
This commit is contained in:
@@ -106,3 +106,14 @@ func decodeCursorPosition(payload []byte, resource string) (Position, error) {
|
||||
}
|
||||
return Position{CreatedAt: cursor.Time, ID: cursor.ID}, nil
|
||||
}
|
||||
|
||||
// NewShared creates a codec from the common 256-bit key provisioned to every replica.
|
||||
func NewShared(encoded string) (*Codec, error) {
|
||||
key, err := base64.StdEncoding.DecodeString(encoded)
|
||||
if err != nil || len(key) != cursorSigningKeyBytes {
|
||||
return nil, fmt.Errorf("CURSOR_SIGNING_KEY must encode exactly 32 bytes as base64")
|
||||
}
|
||||
codec := &Codec{}
|
||||
copy(codec.key[:], key)
|
||||
return codec, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user