mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
06e8619a37
Align channel identity and bind flow across backend and app-facing layers, including generated swagger artifacts and package lock updates while excluding docs content changes.
21 lines
596 B
Go
21 lines
596 B
Go
package identity
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
ctr "github.com/memohai/memoh/internal/containerd"
|
|
)
|
|
|
|
// ValidateChannelIdentityID enforces a conservative ID charset for isolation.
|
|
func ValidateChannelIdentityID(channelIdentityID string) error {
|
|
if channelIdentityID == "" {
|
|
return fmt.Errorf("%w: channel identity id required", ctr.ErrInvalidArgument)
|
|
}
|
|
for _, r := range channelIdentityID {
|
|
if !(r == '-' || r == '_' || (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9')) {
|
|
return fmt.Errorf("%w: invalid channel identity id", ctr.ErrInvalidArgument)
|
|
}
|
|
}
|
|
return nil
|
|
}
|