Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
VALIDATOR = Schema({
"@context": "https://w3id.org/did/v1",
"id": str,
"publicKey": [PUBLIC_KEY_VALIDATOR],
# This is not fully correct; see:
# https://w3c.github.io/did-core/#authentication
Optional("authentication"): [
{
"type": "Ed25519SignatureAuthentication2018",
"publicKey": str
},
PUBLIC_KEY_VALIDATOR,
str
],
"service": And(
# Service contains at least one agent service
AtLeastOne(
{
'id': Match('.*;{}$'.format(EXPECTED_SERVICE_SUFFIX)),
'type': EXPECTED_SERVICE_TYPE,
'priority': int,
'recipientKeys': [str],
Optional('routingKeys'): [str],
'serviceEndpoint': str
},
msg='DID Communication service missing'
),
# And all services match DID Spec
[
{
"id": str,
def validate_config(_config):
cloud_schema = voluptuous.Schema({
"module": voluptuous.And(six.string_types[0],
vu.NoSpaceCharacter())
}, required=True)
return cloud_schema(_config)
def validate_config(_config):
svc_schema = voluptuous.Schema({
'module': voluptuous.And(six.string_types[0],
NoSpaceCharacter()),
'nb_samples': voluptuous.Or(float, int)
}, required=True)
return svc_schema(_config)
"params": {
"origin_types": voluptuous.And([
{
"origin_type": voluptuous.And(
six.string_types[0],
vu.NoSpaceCharacter()),
"weight": voluptuous.And(
voluptuous.Or(int, float),
voluptuous.Range(
min=0, min_included=False)),
}
], vu.NotEmptyArray()),
voluptuous.Optional("key_causes"): dict
}
},
"alerts_per_burst": voluptuous.And(
int, voluptuous.Range(min=1)),
"idle_time_between_bursts": voluptuous.And(
voluptuous.Or(int, float),
voluptuous.Range(min=0, min_included=False))
}
}, required=True)
return source_schema(_config)
def validate_config(_config):
source_schema = voluptuous.Schema({
"module": voluptuous.And(six.string_types[0],
vu.NoSpaceCharacter()),
"sleep": voluptuous.And(
float,
voluptuous.Range(
min=0, max=1, min_included=False, max_included=False)),
}, required=True)
return source_schema(_config)
def validate_config(_config):
svm_schema = voluptuous.Schema({
"module": voluptuous.And(six.string_types[0],
vu.NoSpaceCharacter()),
"nb_samples": voluptuous.Or(float, int)
}, required=True)
return svm_schema(_config)
def validate_config(_config):
lingam_schema = voluptuous.Schema({
"module": voluptuous.And(six.string_types[0],
vu.NoSpaceCharacter()),
"threshold": float
}, required=True)
return lingam_schema(_config)
def validate_config(_config):
elliptic_schema = voluptuous.Schema({
'module': voluptuous.And(six.string_types[0],
NoSpaceCharacter()),
'nb_samples': voluptuous.Or(float, int)
}, required=True)
return elliptic_schema(_config)
def validate_config(_config):
pick_schema = voluptuous.Schema({
"module": voluptuous.And(
six.string_types[0],
lambda i: not any(c.isspace() for c in i)),
"index": voluptuous.And(
voluptuous.Or(float, int),
lambda i: i >= 0 and math.ceil(i) == math.floor(i)
)
}, required=True)
return pick_schema(_config)