Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JsPolicyEngine ¶
type JsPolicyEngine struct {
// contains filtered or unexported fields
}
JsPolicyEngine is a javascript implementation of the attestation report generic PolicyValidator interface
func NewJsPolicyEngine ¶
func NewJsPolicyEngine(policies []byte) *JsPolicyEngine
NewJsPolicyEngine creates a new JsPolicyEngine with custom policies. Custom policies are handed over as a byte array. This implementation accepts custom policies as javascript code. The javascript code can parse the VerificationResult in the variable 'json', i.e.:
var obj = JSON.parse(json);
The javascript code must return a single boolean to indicate the success of the parsing. Logs can be output via: console.log() A very simple example of a custom Policy could look as follows:
var obj = JSON.parse(json); var success = true; if (obj.type != "Verification Result") { console.log("Invalid type"); success = false; } success
func (*JsPolicyEngine) Validate ¶
func (p *JsPolicyEngine) Validate(result []byte) bool
Validate uses a javascript engine to validate the JavaScriptValidator's custom javascript policies against the verification result