How to use the ssb-ref.isMsgLink function in ssb-ref

To help you get started, we’ve selected a few ssb-ref examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ssbc / ssb-db / create.js View on Github external
if (isPrivate && unbox) {
          data = db.unbox(data, unbox)
        }

        let result

        if (isPrivate) {
          result = data.value
        } else {
          result = u.originalValue(data.value)
        }

        cb(null, !meta ? result : {key: data.key, value: result, timestamp: data.timestamp})
      })
    } else if (ref.isMsgLink(key)) {
      var link = ref.parseLink(key)
      return db.get({
        id: link.link,
        private: true,
        unbox: link.query.unbox.replace(/\s/g, '+'),
        meta: link.query.meta
      }, cb)
    } else if (Number.isInteger(key)) {
      _get(key, cb) // seq
    } else {
      throw new Error('ssb-db.get: key *must* be a ssb message id or a flume offset')
    }
  }
github ssbc / ssb-db / lib / validators.js View on Github external
msgLink: function (v) {
    if (!ref.isMsgLink(v))
      return 'type'
  },
  feedId: function (v) {
github ssbc / ssb-server / lib / validators.js View on Github external
msgLink: function (v) {
    if (!ref.isMsgLink(v))
      return 'type'
  },
  feedId: function (v) {