
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
is-my-ssb-valid
Advanced tools
Build message validators for scuttlebutt using JSON schema.
Uses is-my-json-valid under the hood
const Validator = require('is-my-ssb-valid')
const profileSchema = require('ssb-profile/spec/profile/schema')
const isProfile = Validator(profileSchema)
const A = {
  //....
}
isProfile(A)
// => true | false
console.log(isProfile.errors)
// => null | [Error]
console.log(isProfile.errorsString)
// => '' | 'data.type is required'  (example)
const pull = require('pull-stream')
pull(
  sbot.messagesByType({ type: 'profile/person', reverse: true }),
  pull.filter(isProfile),
  pull.take(50),
  pull.collect((err, profileUpdates) => {
    // ...
  })
)
Validator(schema) => isValidwhere:
schema Object is a JSON schemaextras Array (optional) is an Array of additional custom validation functions.
true (no problem) or an Error (a problem) was found.isValid.errors and isValid.errorsString for you (see below)isValid(msg) => Booleanwhere msg can be any of
{ key, value, timestamp }value of a message (msg.value)content field of a message (msg.value.content)If the last message tested came back invalid ("false"), then you can also check out the specific errors:
isValid.errors will be populated with those errorsisValid.errorsString will be populated with a (crudely) flattened version in case you need a StringFAQs
build scuttlebutt message validators from JSON Schema
We found that is-my-ssb-valid demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.