chore: move the go code into a subfolder

This commit is contained in:
Florian Forster
2025-08-05 15:20:32 -07:00
parent 4ad22ba456
commit cd2921de26
2978 changed files with 373 additions and 300 deletions

View File

@@ -0,0 +1,41 @@
package user
import (
"github.com/zitadel/zitadel/internal/crypto"
"github.com/zitadel/zitadel/internal/v2/eventstore"
"github.com/zitadel/zitadel/internal/zerrors"
)
type machineSecretSetPayload struct {
// New events only use EncodedHash. However, the ClientSecret field
// is preserved to handle events older than the switch to Passwap.
ClientSecret *crypto.CryptoValue `json:"clientSecret,omitempty"`
HashedSecret string `json:"hashedSecret,omitempty"`
}
type MachineSecretHashSetEvent eventstore.Event[machineSecretSetPayload]
const MachineSecretHashSetType = machinePrefix + ".secret.set"
var _ eventstore.TypeChecker = (*MachineSecretHashSetEvent)(nil)
// ActionType implements eventstore.Typer.
func (c *MachineSecretHashSetEvent) ActionType() string {
return MachineSecretHashSetType
}
func MachineSecretHashSetEventFromStorage(event *eventstore.StorageEvent) (e *MachineSecretHashSetEvent, _ error) {
if event.Type != e.ActionType() {
return nil, zerrors.ThrowInvalidArgument(nil, "USER-DzycT", "Errors.Invalid.Event.Type")
}
payload, err := eventstore.UnmarshalPayload[machineSecretSetPayload](event.Payload)
if err != nil {
return nil, err
}
return &MachineSecretHashSetEvent{
StorageEvent: event,
Payload: payload,
}, nil
}