ssb-uri2
Version:
Utilities for recognizing and converting SSB URIs
41 lines • 3.9 kB
JSON
{
"name": "ssb-uri2",
"version": "2.4.1",
"description": "Utilities for recognizing and converting SSB URIs",
"repository": {
"type": "git",
"url": "git+https://github.com/staltz/ssb-uri2.git"
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib/*"
],
"author": "Andre Staltz <contact@staltz.com>",
"license": "LGPL-3.0",
"keywords": [
"ssb",
"uri"
],
"engines": {
"node": ">=10"
},
"dependencies": {
"ssb-typescript": "^2.5.0"
},
"devDependencies": {
"@types/node": "^14.14.39",
"nyc": "^15.0.0",
"ssb-ref": "^2.14.3",
"tap-arc": "^0.3.4",
"tape": "^5.2.0",
"typescript": "~4.2.4"
},
"scripts": {
"compile": "tsc",
"test": "npm run compile && npm run tape",
"tape": "tape test/*.js | tap-arc --bail",
"coverage": "nyc npm run test"
},
"readme": "# ssb-uri2\n\n> An SSB utility library for handling and converting SSB URIs\n\nThis library provides utilities that recognize SSB URIs according to the [spec](https://github.com/ssb-ngi-pointer/ssb-uri-spec), and is compatible with [ssb-uri](https://github.com/fraction/ssb-uri) (prior work), while adding more support and more utilities.\n\n## Install\n\n```\nnpm install ssb-uri2\n```\n\n## Example\n\n```js\nconst ssbUri = require('ssb-uri2');\n\nconst exampleURI =\n 'ssb:message/classic/g3hPVPDEO1Aj_uPl0-J2NlhFB2bbFLIHlty-YuqFZ3w=';\n\nssbUri.isClassicMessageSSBURI(exampleURI);\n// true\n\nssbUri.toMessageSigil(exampleURI);\n// '%g3hPVPDEO1Aj/uPl0+J2NlhFB2bbFLIHlty+YuqFZ3w=.sha256'\n```\n\n## Boolean APIs\n\n### `isSSBURI(uri: string | uri): boolean`\n\n### `isClassicFeedSSBURI(uri: string | null): boolean`\n\n### `isBendyButtV1FeedSSBURI(uri: string | null): boolean`\n\n### `isButtwooV1FeedSSBURI(uri: string | null): boolean`\n\n### `isIndexedV1FeedSSBURI(uri: string | null): boolean`\n\n### `isGabbyGroveV1FeedSSBURI(uri: string | null): boolean`\n\n### `isFeedSSBURI(uri: string | null): boolean`\n\n### `isClassicMessageSSBURI(uri: string | null): boolean`\n\n### `isBendyButtV1MessageSSBURI(uri: string | null): boolean`\n\n### `isGabbyGroveV1MessageSSBURI(uri: string | null): boolean`\n\n### `isButtwooV1MessageSSBURI(uri: string | null): boolean`\n\n### `isIndexedV1MessageSSBURI(uri: string | null): boolean`\n\n### `isMessageSSBURI(uri: string | null): boolean`\n\n### `isClassicBlobSSBURI(uri: string | null): boolean`\n\n### `isAddressSSBURI(uri: string | null): boolean`\n\n### `isEncryptionKeyBox2DMDiffieHellmanSSBURI(uri: string | null): boolean`\n\n### `isIdentityPOBoxSSBURI(uri: string | null): boolean`\n\n### `isIdentityGroupSSBURI(uri: string | null): boolean`\n\n### `isIdentityFusionSSBURI(uri: string | null): boolean`\n\n### `isIdentitySSBURI(uri: string | null): boolean`\n\n### `isExperimentalSSBURI(uri: string | null): boolean`\n\n### `isExperimentalSSBURIWithAction(action: string): (uri: string) => boolean`\n\n## Regular Expressions\n\n### `getFeedSSBURIRegex() => RegExp`\n\n### `getMessageSSBURIRegex() => RegExp`\n\n## Conversion APIs\n\n### `fromFeedSigil(sigil: string): string`\n\n### `fromMessageSigil(sigil: string): string`\n\n### `fromBlobSigil(sigil: string): string`\n\n### `fromMultiserverAddress(msaddr: string): string`\n\n### `toFeedSigil(uri: string): string | null`\n\n### `toMessageSigil(uri: string): string | null`\n\n### `toBlobSigil(uri: string): string | null`\n\n### `toMultiserverAddress(uri: string): string | null`\n\n### `compose(parts: {type, format, data, extraData}): string`\n\n### `decompose(uri: string): {type, format, data, extraData}`\n\nThe 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).\n\nThere is also the case of `extraData` for special URIs such as `ssb:feed/buttwoo-v1/${data}/${extraData}`.\n\n## License\n\nLGPL-3.0\n"
}