@ceramic-sdk/identifiers v0.2.0 • Docs
Ceramic SDK / @ceramic-sdk/identifiers / StreamID
Stream identifier, no commit information included.
Contains stream type and CID of genesis commit.
Encoded as <multibase-prefix><multicodec-streamid><type><genesis-cid-bytes>.
String representation is base36-encoding of the bytes above.
new StreamID(
type,cid):StreamID
Create a new StreamID.
• type: StreamType
the stream type
• cid: string | CID<unknown, number, number, Version>
new StreamID('MID', 'bagcqcerakszw2vsovxznyp5gfnpdj4cqm2xiv76yd24wkjewhhykovorwo6a');
new StreamID('MID', cid);
new StreamID(3, cid);
protectedreadonly_tag:symbol=TAG
staticfromBytes: (bytes) =>StreamID
Parse StreamID from bytes representation.
• bytes: Uint8Array
bytes representation of StreamID.
error on invalid input
StreamID#bytes
staticfromString: (input) =>StreamID
Parse StreamID from string representation.
• input: string
string representation of StreamID, be it base36-encoded string or URL.
- StreamID#toString
- StreamID#toUrl
getbaseID():StreamID
Copy of self. Exists to maintain compatibility with CommitID.
getbytes():Uint8Array
Bytes representation of StreamID.
Uint8Array
getcid():CID<unknown,number,number,Version>
Genesis commits CID
CID<unknown, number, number, Version>
gettype():StreamTypeCode
Stream type code
gettypeName():"tile"|"caip10-link"|"model"|"MID"|"UNLOADABLE"
Stream type name
"tile" | "caip10-link" | "model" | "MID" | "UNLOADABLE"
equals(
other):boolean
Compare equality with another StreamID.
• other: StreamID
boolean
toString():
string
Encode the StreamID into a string.
string
toUrl():
string
Encode the StreamID into a base36 url.
string
staticfromPayload(type,value):StreamID
Create a streamId from an init event payload.
• type: StreamType
the stream type
• value: unknown
the init event payload
const streamId = StreamID.fromPayload('MID', {
header: {
controllers: ['did:3:kjz...'],
model: '...',
}
});
staticisInstance(instance):instance is StreamID
• instance: unknown
instance is StreamID