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

ssb-uri2

Package Overview
Dependencies
Maintainers
1
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.1.0 to 1.2.0

3

lib/index.d.ts

@@ -13,2 +13,3 @@ import { BlobId, FeedId, MsgId } from 'ssb-typescript';

export declare function isMessageSSBURI(uri: string | null): boolean;
export declare function isBendyButtV1MessageSSBURI(uri: string | null): boolean;
export declare function isBlobSSBURI(uri: string | null): boolean;

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

type: 'message';
format: 'sha256';
format: 'sha256' | 'bendybutt-v1';
data: string;

@@ -29,0 +30,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decompose = exports.compose = exports.isSSBURI = exports.isExperimentalSSBURIWithAction = exports.isExperimentalSSBURI = exports.isAddressSSBURI = exports.isBlobSSBURI = exports.isMessageSSBURI = 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.isSSBURI = exports.isExperimentalSSBURIWithAction = exports.isExperimentalSSBURI = exports.isAddressSSBURI = exports.isBlobSSBURI = exports.isBendyButtV1MessageSSBURI = exports.isMessageSSBURI = exports.isBendyButtV1FeedSSBURI = exports.isFeedSSBURI = exports.toMultiserverAddress = exports.toBlobSigil = exports.toMessageSigil = exports.toFeedSigil = exports.fromMultiserverAddress = exports.fromBlobSigil = exports.fromMessageSigil = exports.fromFeedSigil = void 0;
const urlParse = require('url-parse');

@@ -52,2 +52,4 @@ const Base64 = {

function toMessageSigil(uri) {
if (!isMessageSSBURI(uri))
return null;
const sigilData = getSigilData(urlParse(uri, true).pathname);

@@ -97,2 +99,11 @@ if (!sigilData)

exports.isMessageSSBURI = isMessageSSBURI;
function isBendyButtV1MessageSSBURI(uri) {
if (!uri)
return false;
return ((uri.startsWith('ssb:message:bendybutt-v1:') ||
uri.startsWith('ssb:message/bendybutt-v1/') ||
uri.startsWith('ssb://message/bendybutt-v1/')) &&
!!getSigilData(urlParse(uri, true).pathname));
}
exports.isBendyButtV1MessageSSBURI = isBendyButtV1MessageSSBURI;
function isBlobSSBURI(uri) {

@@ -150,9 +161,11 @@ if (!uri)

}
else if (parts.type === 'message' && parts.format !== 'sha256') {
if (parts.type === 'message' &&
parts.format !== 'sha256' &&
parts.format !== 'bendybutt-v1') {
throw new Error('Unknown format for type "message": ' + parts.format);
}
else if (parts.type === 'blob' && parts.format !== 'sha256') {
if (parts.type === 'blob' && parts.format !== 'sha256') {
throw new Error('Unknown format for type "blob": ' + parts.format);
}
else if (parts.type === 'address' && parts.format !== 'multiserver') {
if (parts.type === 'address' && parts.format !== 'multiserver') {
throw new Error('Unknown format for type "address": ' + parts.format);

@@ -159,0 +172,0 @@ }

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

@@ -5,0 +5,0 @@ "repository": {

@@ -38,2 +38,4 @@ # ssb-uri2

### `isBendyButtV1MessageSSBURI(uri: string | null): boolean`
### `isBlobSSBURI(uri: string | null): boolean`

@@ -40,0 +42,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