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 1.8.0 to 1.8.1

6

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

@@ -20,5 +20,7 @@ declare type AddressTF = ['address', 'multiserver'];

export declare function isGabbyGroveV1FeedSSBURI(uri: string | null): boolean;
export declare function isButtwooV1FeedSSBURI(uri: string | null): boolean;
export declare function isMessageSSBURI(uri: string | null): boolean;
export declare function isBendyButtV1MessageSSBURI(uri: string | null): boolean;
export declare function isGabbyGroveV1MessageSSBURI(uri: string | null): boolean;
export declare function isButtwooV1MessageSSBURI(uri: string | null): boolean;
export declare function isBlobSSBURI(uri: string | null): boolean;

@@ -25,0 +27,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.isBlobSSBURI = exports.isGabbyGroveV1MessageSSBURI = exports.isBendyButtV1MessageSSBURI = exports.isMessageSSBURI = exports.isGabbyGroveV1FeedSSBURI = exports.isBendyButtV1FeedSSBURI = exports.isFeedSSBURI = 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.isBlobSSBURI = exports.isButtwooV1MessageSSBURI = exports.isGabbyGroveV1MessageSSBURI = exports.isBendyButtV1MessageSSBURI = exports.isMessageSSBURI = exports.isButtwooV1FeedSSBURI = exports.isGabbyGroveV1FeedSSBURI = exports.isBendyButtV1FeedSSBURI = exports.isFeedSSBURI = exports.toMultiserverAddress = exports.toBlobSigil = exports.toMessageSigil = exports.toFeedSigil = exports.fromMultiserverAddress = exports.fromBlobSigil = exports.fromMessageSigil = exports.fromFeedSigil = void 0;
const Base64 = {

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

exports.isGabbyGroveV1FeedSSBURI = isGabbyGroveV1FeedSSBURI;
function isButtwooV1FeedSSBURI(uri) {
return checkTypeFormat(uri, 'feed', 'buttwoo-v1');
}
exports.isButtwooV1FeedSSBURI = isButtwooV1FeedSSBURI;
function isMessageSSBURI(uri) {

@@ -104,2 +108,6 @@ return checkTypeFormat(uri, 'message', 'sha256');

exports.isGabbyGroveV1MessageSSBURI = isGabbyGroveV1MessageSSBURI;
function isButtwooV1MessageSSBURI(uri) {
return checkTypeFormat(uri, 'message', 'buttwoo-v1');
}
exports.isButtwooV1MessageSSBURI = isButtwooV1MessageSSBURI;
function isBlobSSBURI(uri) {

@@ -149,5 +157,7 @@ return checkTypeFormat(uri, 'blob', 'sha256');

isGabbyGroveV1FeedSSBURI(uri) ||
isButtwooV1FeedSSBURI(uri) ||
isMessageSSBURI(uri) ||
isBendyButtV1MessageSSBURI(uri) ||
isGabbyGroveV1MessageSSBURI(uri) ||
isButtwooV1MessageSSBURI(uri) ||
isBlobSSBURI(uri) ||

@@ -163,3 +173,3 @@ isAddressSSBURI(uri) ||

const type = 'feed';
const format = ['ed25519', 'bendybutt-v1', 'gabbygrove-v1'];
const format = ['ed25519', 'bendybutt-v1', 'gabbygrove-v1', 'buttwoo-v1'];
return new RegExp(`ssb:(\/\/)?` +

@@ -177,2 +187,3 @@ `${type}(\/|:)` +

'gabbygrove-v1',
'buttwoo-v1'
];

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

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

@@ -205,3 +217,4 @@ }

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

@@ -208,0 +221,0 @@ }

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

@@ -39,4 +39,3 @@ "repository": {

"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/sha256/g3hPVPDEO1Aj_uPl0-J2NlhFB2bbFLIHlty-YuqFZ3w=';\n\nssbUri.isMessageSSBURI(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### `isFeedSSBURI(uri: string | null): boolean`\n\n### `isBendyButtV1FeedSSBURI(uri: string | null): boolean`\n\n### `isGabbyGroveV1FeedSSBURI(uri: string | null): boolean`\n\n### `isMessageSSBURI(uri: string | null): boolean`\n\n### `isBendyButtV1MessageSSBURI(uri: string | null): boolean`\n\n### `isGabbyGroveV1MessageSSBURI(uri: string | null): boolean`\n\n### `isBlobSSBURI(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}): string`\n\n### `decompose(uri: string): {type, format, data}`\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\n## License\n\nLGPL-3.0\n"
}
}
}
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