feat: implement Foundation V1 walking skeleton
CI / test (push) Successful in 7m31s

This commit is contained in:
m
2026-08-16 15:22:49 +03:00
commit 9b136621ef
205 changed files with 6345 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package domain
import (
"errors"
"git.cin.su/m/Assistant/contracts/authority"
"git.cin.su/m/Assistant/contracts/identity"
)
var ErrInvalidCreatorGrant = errors.New("creator grant must be active, global, and revisioned")
// ValidateCreatorGrant validates the narrow bootstrap authority used by
// Domovoy. Execution paths must still perform their own target/revision checks.
func ValidateCreatorGrant(binding identity.PrincipalBinding, scope authority.Scope, grant authority.AuthorityGrant) error {
if binding.ActorID == "" || binding.PrincipalID == "" || !binding.Active ||
!scope.Global || scope.ID == "" ||
grant.ID == "" || grant.Class != authority.GrantClassCreator || !grant.Active || grant.Revision == 0 ||
grant.ActorID != binding.ActorID || grant.PrincipalID != binding.PrincipalID || grant.ScopeID != scope.ID {
return ErrInvalidCreatorGrant
}
return nil
}
+3
View File
@@ -0,0 +1,3 @@
package domain
// Package domain contains authority domain meaning only. It must not import adapters or runtime packages.
+19
View File
@@ -0,0 +1,19 @@
package domain
import (
"errors"
"git.cin.su/m/Assistant/contracts/authority"
"git.cin.su/m/Assistant/contracts/identity"
)
var ErrInvalidGrant = errors.New("authority grant is not currently valid for actor, principal, and scope")
func ValidateGrant(binding identity.PrincipalBinding, scope authority.Scope, grant authority.AuthorityGrant) error {
if binding.ActorID == "" || binding.PrincipalID == "" || !binding.Active ||
scope.ID == "" || grant.ID == "" || grant.Revision == 0 || !grant.Active ||
grant.ActorID != binding.ActorID || grant.PrincipalID != binding.PrincipalID || grant.ScopeID != scope.ID {
return ErrInvalidGrant
}
return nil
}