An SSB utility library for handling and converting SSB URIs
This library provides utilities that recognize SSB URIs according to the spec, and is compatible with ssb-uri (prior work), while adding more support and more utilities.
npm install ssb-uri2
const ssbUri = require('ssb-uri2');
const exampleURI =
'ssb:message/classic/g3hPVPDEO1Aj_uPl0-J2NlhFB2bbFLIHlty-YuqFZ3w=';
ssbUri.isClassicMessageSSBURI(exampleURI);
// true
ssbUri.toMessageSigil(exampleURI);
// '%g3hPVPDEO1Aj/uPl0+J2NlhFB2bbFLIHlty+YuqFZ3w=.sha256'The object {type, format, data} is such that it matches ssb:${type}/${format}/${data}, except the data is always in normal Base64 (i.e. not URI safe).
There is also the case of extraData for special URIs such as ssb:feed/buttwoo-v1/${data}/${extraData}.
LGPL-3.0