Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JavaScriptValidator ¶ added in v0.5.0
type JavaScriptValidator struct {
// contains filtered or unexported fields
}
JavaScriptValidator is a javascript implementation of the attestation report generic PolicyValidator interface
func NewPolicyValidator ¶
func NewPolicyValidator(policies []byte) *JavaScriptValidator
NewPolicyValidator creates a new JavaScriptValidator 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 (*JavaScriptValidator) Validate ¶ added in v0.5.0
func (p *JavaScriptValidator) Validate(result ar.VerificationResult) bool
Validate uses a javascript engine to validate the JavaScriptValidator's custom javascript policies against the verification result