Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ssb-uri2

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-uri2 - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

6

lib/index.d.ts
import { BlobId, FeedId, MsgId } from 'ssb-typescript';
declare type FeedTF = ['feed', 'classic'] | ['feed', 'ed25519'] | ['feed', 'bendybutt-v1'] | ['feed', 'gabbygrove-v1'] | ['feed', 'buttwoo-v1'];
declare type MessageTF = ['message', 'classic'] | ['message', 'sha256'] | ['message', 'bendybutt-v1'] | ['message', 'gabbygrove-v1'] | ['message', 'buttwoo-v1'];
declare type FeedTF = ['feed', 'classic'] | ['feed', 'ed25519'] | ['feed', 'bendybutt-v1'] | ['feed', 'gabbygrove-v1'] | ['feed', 'buttwoo-v1'] | ['feed', 'indexed-v1'];
declare type MessageTF = ['message', 'classic'] | ['message', 'sha256'] | ['message', 'bendybutt-v1'] | ['message', 'gabbygrove-v1'] | ['message', 'buttwoo-v1'] | ['message', 'indexed-v1'];
declare type BlobTF = ['blob', 'classic'] | ['blob', 'sha256'];

@@ -21,2 +21,3 @@ declare type AddressTF = ['address', 'multiserver'];

export declare function isButtwooV1FeedSSBURI(uri: string | null): boolean;
export declare function isIndexedV1FeedSSBURI(uri: string | null): boolean;
export declare function isClassicMessageSSBURI(uri: string | null): boolean;

@@ -26,2 +27,3 @@ export declare function isBendyButtV1MessageSSBURI(uri: string | null): boolean;

export declare function isButtwooV1MessageSSBURI(uri: string | null): boolean;
export declare function isIndexedV1MessageSSBURI(uri: string | null): boolean;
export declare function isClassicBlobSSBURI(uri: string | null): boolean;

@@ -28,0 +30,0 @@ export declare function isAddressSSBURI(uri: string | null): boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decompose = exports.compose = exports.getMessageSSBURIRegex = exports.getFeedSSBURIRegex = exports.isSSBURI = exports.isExperimentalSSBURIWithAction = exports.isExperimentalSSBURI = exports.isIdentityFusionSSBURI = exports.isIdentityPOBoxSSBURI = exports.isEncryptionKeyBox2DMDiffieHellmanSSBURI = exports.isAddressSSBURI = exports.isClassicBlobSSBURI = exports.isButtwooV1MessageSSBURI = exports.isGabbyGroveV1MessageSSBURI = exports.isBendyButtV1MessageSSBURI = exports.isClassicMessageSSBURI = exports.isButtwooV1FeedSSBURI = exports.isGabbyGroveV1FeedSSBURI = exports.isBendyButtV1FeedSSBURI = exports.isClassicFeedSSBURI = exports.toMultiserverAddress = exports.toBlobSigil = exports.toMessageSigil = exports.toFeedSigil = exports.fromMultiserverAddress = exports.fromBlobSigil = exports.fromMessageSigil = exports.fromFeedSigil = void 0;
exports.decompose = exports.compose = exports.getMessageSSBURIRegex = exports.getFeedSSBURIRegex = exports.isSSBURI = exports.isExperimentalSSBURIWithAction = exports.isExperimentalSSBURI = exports.isIdentityFusionSSBURI = exports.isIdentityPOBoxSSBURI = exports.isEncryptionKeyBox2DMDiffieHellmanSSBURI = exports.isAddressSSBURI = exports.isClassicBlobSSBURI = exports.isIndexedV1MessageSSBURI = exports.isButtwooV1MessageSSBURI = exports.isGabbyGroveV1MessageSSBURI = exports.isBendyButtV1MessageSSBURI = exports.isClassicMessageSSBURI = exports.isIndexedV1FeedSSBURI = exports.isButtwooV1FeedSSBURI = exports.isGabbyGroveV1FeedSSBURI = exports.isBendyButtV1FeedSSBURI = exports.isClassicFeedSSBURI = exports.toMultiserverAddress = exports.toBlobSigil = exports.toMessageSigil = exports.toFeedSigil = exports.fromMultiserverAddress = exports.fromBlobSigil = exports.fromMessageSigil = exports.fromFeedSigil = void 0;
const Base64 = {

@@ -98,2 +98,6 @@ unsafeToSafe(input) {

exports.isButtwooV1FeedSSBURI = isButtwooV1FeedSSBURI;
function isIndexedV1FeedSSBURI(uri) {
return checkTypeFormat(uri, 'feed', 'indexed-v1');
}
exports.isIndexedV1FeedSSBURI = isIndexedV1FeedSSBURI;
function isClassicMessageSSBURI(uri) {

@@ -116,2 +120,6 @@ return (checkTypeFormat(uri, 'message', 'classic') ||

exports.isButtwooV1MessageSSBURI = isButtwooV1MessageSSBURI;
function isIndexedV1MessageSSBURI(uri) {
return checkTypeFormat(uri, 'message', 'indexed-v1');
}
exports.isIndexedV1MessageSSBURI = isIndexedV1MessageSSBURI;
function isClassicBlobSSBURI(uri) {

@@ -163,2 +171,3 @@ return (checkTypeFormat(uri, 'blob', 'classic') ||

isButtwooV1FeedSSBURI(uri) ||
isIndexedV1FeedSSBURI(uri) ||
isClassicMessageSSBURI(uri) ||

@@ -168,2 +177,3 @@ isBendyButtV1MessageSSBURI(uri) ||

isButtwooV1MessageSSBURI(uri) ||
isIndexedV1MessageSSBURI(uri) ||
isClassicBlobSSBURI(uri) ||

@@ -185,2 +195,3 @@ isAddressSSBURI(uri) ||

'buttwoo-v1',
'indexed-v1',
];

@@ -208,2 +219,3 @@ const formatsWith4Parts = ['buttwoo-v1'];

'buttwoo-v1',
'indexed-v1',
];

@@ -228,3 +240,4 @@ return new RegExp(`ssb:(\/\/)?` +

format !== 'gabbygrove-v1' &&
format !== 'buttwoo-v1') {
format !== 'buttwoo-v1' &&
format !== 'indexed-v1') {
throw new Error('Unknown format for type "feed": ' + format);

@@ -240,3 +253,4 @@ }

format !== 'gabbygrove-v1' &&
format !== 'buttwoo-v1') {
format !== 'buttwoo-v1' &&
format !== 'indexed-v1') {
throw new Error('Unknown format for type "message": ' + format);

@@ -243,0 +257,0 @@ }

{
"name": "ssb-uri2",
"version": "2.0.2",
"version": "2.1.0",
"description": "Utilities for recognizing and converting SSB URIs",

@@ -40,3 +40,3 @@ "repository": {

},
"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### `isGabbyGroveV1FeedSSBURI(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### `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### `isIdentityFusionSSBURI(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"
"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### `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### `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### `isIdentityFusionSSBURI(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"
}

@@ -36,2 +36,6 @@ # ssb-uri2

### `isButtwooV1FeedSSBURI(uri: string | null): boolean`
### `isIndexedV1FeedSSBURI(uri: string | null): boolean`
### `isGabbyGroveV1FeedSSBURI(uri: string | null): boolean`

@@ -45,2 +49,6 @@

### `isButtwooV1MessageSSBURI(uri: string | null): boolean`
### `isIndexedV1MessageSSBURI(uri: string | null): boolean`
### `isClassicBlobSSBURI(uri: string | null): boolean`

@@ -47,0 +55,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc