ssb-uri2
Version:
Utilities for recognizing and converting SSB URIs
52 lines (51 loc) • 3.68 kB
TypeScript
import { BlobId, FeedId, MsgId } from 'ssb-typescript';
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'] | ['message', 'cloaked'];
declare type BlobTF = ['blob', 'classic'] | ['blob', 'sha256'];
declare type AddressTF = ['address', 'multiserver'];
declare type EncryptionKeyTF = ['encryption-key', 'box2-dm-dh'];
declare type IdentityTF = ['identity', 'po-box'] | ['identity', 'group'] | ['identity', 'fusion'];
declare type TF = FeedTF | MessageTF | BlobTF | AddressTF | EncryptionKeyTF | IdentityTF;
export declare function fromFeedSigil(sigil: FeedId): string | null;
export declare function fromMessageSigil(sigil: MsgId): string | null;
export declare function fromBlobSigil(sigil: BlobId): string | null;
export declare function fromMultiserverAddress(msaddr: string): string;
export declare function toFeedSigil(uri: string): FeedId | null;
export declare function toMessageSigil(uri: string): MsgId | null;
export declare function toBlobSigil(uri: string): BlobId | null;
export declare function toMultiserverAddress(uri: string): string | null;
export declare function isClassicFeedSSBURI(uri: string | null): boolean;
export declare function isBendyButtV1FeedSSBURI(uri: string | null): boolean;
export declare function isGabbyGroveV1FeedSSBURI(uri: string | null): boolean;
export declare function isButtwooV1FeedSSBURI(uri: string | null): boolean;
export declare function isIndexedV1FeedSSBURI(uri: string | null): boolean;
export declare function isFeedSSBURI(uri: string | null): boolean;
export declare function isClassicMessageSSBURI(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 isIndexedV1MessageSSBURI(uri: string | null): boolean;
export declare function isCloakedV1MessageSSBURI(uri: string | null): boolean;
export declare function isMessageSSBURI(uri: string | null): boolean;
export declare function isClassicBlobSSBURI(uri: string | null): boolean;
export declare function isAddressSSBURI(uri: string | null): boolean;
export declare function isEncryptionKeyBox2DMDiffieHellmanSSBURI(uri: string | null): boolean;
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;
export declare function isExperimentalSSBURIWithAction(action: string): (uri: string | null) => boolean;
export declare function isSSBURI(uri: string | null): boolean;
export declare function getFeedSSBURIRegex(): RegExp;
export declare function getMessageSSBURIRegex(): RegExp;
declare type PartsFor<X extends TF> = {
type: X[0];
format: X[1];
data: string;
extraData?: string;
};
declare type CanonicalParts = PartsFor<FeedTF> | PartsFor<MessageTF> | PartsFor<BlobTF> | PartsFor<AddressTF> | PartsFor<EncryptionKeyTF> | PartsFor<IdentityTF>;
export declare function compose(parts: Partial<CanonicalParts>): string;
export declare function decompose(uri: string): CanonicalParts;
export {};