File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -294,6 +294,37 @@ func (b *Biscuit) Seal(rng io.Reader) (*Biscuit, error) {
294294 }, nil
295295}
296296
297+ func (b * Biscuit ) Lookup (factName string ) []string {
298+ symbols := b .symbols .Clone ()
299+ datalogFactName := symbols .Sym (factName )
300+
301+ if b .authority .facts == nil {
302+ return nil
303+ }
304+
305+ for _ , f := range * b .authority .facts {
306+ if f .Name != datalogFactName {
307+ continue
308+ }
309+
310+ terms := make ([]string , len (f .Terms ))
311+ for i , term := range f .Terms {
312+ switch t := term .(type ) {
313+ case datalog.String :
314+ terms [i ] = symbols .Str (t )
315+ case datalog.Variable :
316+ terms [i ] = symbols .Var (t )
317+ default :
318+ terms [i ] = t .String ()
319+ }
320+ }
321+
322+ return terms
323+ }
324+
325+ return nil
326+ }
327+
297328type (
298329 // A PublickKeyByIDProjection inspects an optional ID for a public key and returns the
299330 // corresponding public key, if any. If it doesn't recognize the ID or can't find the public
You can’t perform that action at this time.
0 commit comments