move args int validation to their creation

This commit is contained in:
Fabio Bozzo
2024-12-02 12:24:06 +01:00
parent 105323b989
commit 56eab758ed
3 changed files with 71 additions and 5 deletions

View File

@@ -10,7 +10,6 @@ import (
"github.com/ipld/go-ipld-prime/datamodel"
"github.com/ipld/go-ipld-prime/fluent/qp"
"github.com/ipld/go-ipld-prime/node/basicnode"
"github.com/ucan-wg/go-ucan/pkg/policy/limits"
)
// Selector describes a UCAN policy selector, as specified here:
@@ -23,10 +22,6 @@ type Selector []segment
// - a resolutionerr error if not being able to resolve to a node
// - nil and no errors, if the selector couldn't match on an optional segment (with ?).
func (s Selector) Select(subject ipld.Node) (ipld.Node, error) {
if err := limits.ValidateIntegerBoundsIPLD(subject); err != nil {
return nil, fmt.Errorf("node contains integer values outside safe bounds: %w", err)
}
return resolve(s, subject, nil)
}