Comparing version 2.3.0 to 2.4.0
@@ -7,3 +7,3 @@ import { BlobId, FeedId, MsgId } from 'ssb-typescript'; | ||
declare type EncryptionKeyTF = ['encryption-key', 'box2-dm-dh']; | ||
declare type IdentityTF = ['identity', 'po-box'] | ['identity', 'fusion']; | ||
declare type IdentityTF = ['identity', 'po-box'] | ['identity', 'group'] | ['identity', 'fusion']; | ||
declare type TF = FeedTF | MessageTF | BlobTF | AddressTF | EncryptionKeyTF | IdentityTF; | ||
@@ -35,3 +35,5 @@ export declare function fromFeedSigil(sigil: FeedId): string; | ||
export declare function isIdentityPOBoxSSBURI(uri: string | null): boolean; | ||
export declare function isIdentityGroupSSBURI(uri: string | null): boolean; | ||
export declare function isIdentityFusionSSBURI(uri: string | null): boolean; | ||
export declare function isIdentitySSBURI(uri: string | null): boolean; | ||
export declare function isExperimentalSSBURI(uri: string | null): boolean; | ||
@@ -38,0 +40,0 @@ export declare function isExperimentalSSBURIWithAction(action: string): (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.isMessageSSBURI = exports.isCloakedV1MessageSSBURI = exports.isIndexedV1MessageSSBURI = exports.isButtwooV1MessageSSBURI = exports.isGabbyGroveV1MessageSSBURI = exports.isBendyButtV1MessageSSBURI = exports.isClassicMessageSSBURI = exports.isFeedSSBURI = 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; | ||
exports.decompose = exports.compose = exports.getMessageSSBURIRegex = exports.getFeedSSBURIRegex = exports.isSSBURI = exports.isExperimentalSSBURIWithAction = exports.isExperimentalSSBURI = exports.isIdentitySSBURI = exports.isIdentityFusionSSBURI = exports.isIdentityGroupSSBURI = exports.isIdentityPOBoxSSBURI = exports.isEncryptionKeyBox2DMDiffieHellmanSSBURI = exports.isAddressSSBURI = exports.isClassicBlobSSBURI = exports.isMessageSSBURI = exports.isCloakedV1MessageSSBURI = exports.isIndexedV1MessageSSBURI = exports.isButtwooV1MessageSSBURI = exports.isGabbyGroveV1MessageSSBURI = exports.isBendyButtV1MessageSSBURI = exports.isClassicMessageSSBURI = exports.isFeedSSBURI = 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 = { | ||
@@ -166,2 +166,6 @@ unsafeToSafe(input) { | ||
exports.isIdentityPOBoxSSBURI = isIdentityPOBoxSSBURI; | ||
function isIdentityGroupSSBURI(uri) { | ||
return checkTypeFormat(uri, 'identity', 'group'); | ||
} | ||
exports.isIdentityGroupSSBURI = isIdentityGroupSSBURI; | ||
function isIdentityFusionSSBURI(uri) { | ||
@@ -171,2 +175,8 @@ return checkTypeFormat(uri, 'identity', 'fusion'); | ||
exports.isIdentityFusionSSBURI = isIdentityFusionSSBURI; | ||
function isIdentitySSBURI(uri) { | ||
return (isIdentityPOBoxSSBURI(uri) || | ||
isIdentityGroupSSBURI(uri) || | ||
isIdentityFusionSSBURI(uri)); | ||
} | ||
exports.isIdentitySSBURI = isIdentitySSBURI; | ||
function isExperimentalSSBURI(uri) { | ||
@@ -193,4 +203,3 @@ if (!uri) | ||
isEncryptionKeyBox2DMDiffieHellmanSSBURI(uri) || | ||
isIdentityPOBoxSSBURI(uri) || | ||
isIdentityFusionSSBURI(uri) || | ||
isIdentitySSBURI(uri) || | ||
isExperimentalSSBURI(uri)); | ||
@@ -231,2 +240,3 @@ } | ||
'indexed-v1', | ||
'cloaked', | ||
]; | ||
@@ -293,3 +303,3 @@ return new RegExp(`ssb:(\/\/)?` + | ||
if (type === 'identity') { | ||
if (format !== 'po-box' && format !== 'fusion') { | ||
if (format !== 'po-box' && format !== 'group' && format !== 'fusion') { | ||
throw new Error('Unknown format for type "identity": ' + format); | ||
@@ -296,0 +306,0 @@ } |
{ | ||
"name": "ssb-uri2", | ||
"version": "2.3.0", | ||
"version": "2.4.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### `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### `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### `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" | ||
} |
@@ -16,6 +16,6 @@ # ssb-uri2 | ||
```js | ||
const ssbUri = require("ssb-uri2"); | ||
const ssbUri = require('ssb-uri2'); | ||
const exampleURI = | ||
"ssb:message/classic/g3hPVPDEO1Aj_uPl0-J2NlhFB2bbFLIHlty-YuqFZ3w="; | ||
'ssb:message/classic/g3hPVPDEO1Aj_uPl0-J2NlhFB2bbFLIHlty-YuqFZ3w='; | ||
@@ -65,4 +65,8 @@ ssbUri.isClassicMessageSSBURI(exampleURI); | ||
### `isIdentityGroupSSBURI(uri: string | null): boolean` | ||
### `isIdentityFusionSSBURI(uri: string | null): boolean` | ||
### `isIdentitySSBURI(uri: string | null): boolean` | ||
### `isExperimentalSSBURI(uri: string | null): boolean` | ||
@@ -69,0 +73,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30859
402
109