@blockchaincommons/provenance-mark - v1.0.0-beta.3
    Preparing search index...

    Class ProvenanceMark

    One link of a provenance chain: a key, the hash committing to the next key, the chain id, a sequence number, a date and optional CBOR info, laid out per its resolution. Frozen: every accessor returns a copy.

    const generator = ProvenanceMarkGenerator.fromPassphrase("low", "Wolf");
    const mark = generator.next(new Date("2023-06-20T12:00:00Z"));
    mark.toUR().toString(); // "ur:provenance/…"

    Implements

    • ToCbor
    • CborTagged
    • ToUR
    • ToEnvelope
    Index
    • get key(): Uint8Array

      A copy of the key.

      Returns Uint8Array

    • get hash(): Uint8Array

      A copy of the hash, which commits to the next mark's key.

      Returns Uint8Array

    • get chainId(): Uint8Array

      A copy of the chain id.

      Returns Uint8Array

    • get seqBytes(): Uint8Array

      A copy of the sequence number's bytes.

      Returns Uint8Array

    • get dateBytes(): Uint8Array

      A copy of the date's bytes.

      Returns Uint8Array

    • get seq(): number

      The sequence number.

      Returns number

    • get date(): Date

      A copy of the date, at the resolution's precision.

      Returns Date

    • get info(): Cbor | undefined

      The info CBOR, freshly decoded, if the mark carries any.

      Returns Cbor | undefined

    • get message(): Uint8Array

      The wire message.

      Returns Uint8Array

    • get isGenesis(): boolean

      Sequence 0 with the key equal to the chain id.

      Returns boolean

    • get id(): Uint8Array

      The 32-byte Mark ID: the hash, filled from the fingerprint at resolutions whose hash is shorter.

      Returns Uint8Array

    • get idHex(): string

      The Mark ID as 64 hex characters.

      Returns string

    • A mark from its parts; the hash is computed. The key, next key and chain id must be Uint8Arrays (a TypeError otherwise) of the resolution's link length, the sequence number must fit the resolution, the date must be one the resolution encodes.

      Parameters

      Returns ProvenanceMark

    • SHA-256 of the tagged CBOR.

      Returns Uint8Array

    • The Mark ID as upper-case bytewords: wordCount words (4 by default, at most 32), led by 🅟 when prefix is set. A wordCount outside 4 to 32, or not an integer, is a RangeError where the reference asserts.

      Parameters

      Returns string

    • The Mark ID as minimal bytewords (two letters a byte), otherwise as idBytewords.

      Parameters

      Returns string

    • Throws Validation, whose details.issue says why next does not follow this mark: a genesis in second place, a sequence gap, a date going backwards, or a hash that does not commit to next's key.

      Parameters

      Returns void

    • Whether each mark precedes the next; at least two marks, a genesis first if at 0.

      Parameters

      Returns boolean

    • The message as bytewords: standard (space-separated words) unless uri (hyphens) or minimal (two letters a word) is given.

      Parameters

      • style: BytewordsStyle = "standard"

      Returns string

    • The provenance query parameter: minimal bytewords of the tagged CBOR.

      Returns string

    • The provenance query parameter, parsed; a decode failure is Bytewords or Cbor.

      Parameters

      • urlEncoding: string

      Returns ProvenanceMark

    • base with the mark appended as a provenance query parameter. The pair is appended to the query text as it stands, as the reference's append_pair does: nothing else is re-encoded, and an existing provenance parameter is kept (fromUrl then reads the first). A base that is not a URL is Url.

      Parameters

      • base: string | URL

      Returns URL

    • The mark in the URL's first provenance query parameter. A string is parsed first (a failure is Url); a URL without the parameter is MissingUrlParameter.

      Parameters

      • url: string | URL

      Returns ProvenanceMark

    • [res, message].

      Returns Cbor

    • Tag provenance (1347571542) over [res, message].

      Returns Cbor

    • [TAG_PROVENANCE_MARK].

      Returns Tag[]

    • The tagged CBOR, decoded; the tag is required. A rejection is Cbor with the dcbor error's message (expected CBOR tag provenance, but got …, the decoded CBOR value was not the expected type, …).

      Parameters

      • cborValue: Cbor

      Returns ProvenanceMark

    • [res, message], decoded; a rejection is Cbor with the dcbor error's message.

      Parameters

      • cborValue: Cbor

      Returns ProvenanceMark

    • ur:provenance/… over the untagged CBOR.

      Returns UR

    • The mark a provenance UR carries. A UR of another type is Cbor (expected UR type provenance, but found …), as is a body that does not decode.

      Parameters

      Returns ProvenanceMark

    • A leaf envelope holding the tagged CBOR.

      Returns Envelope

    • The mark in the envelope's subject leaf. A subject that is not a leaf, or a leaf that is not a mark, is Cbor.

      Parameters

      • envelope: Envelope

      Returns ProvenanceMark

    • seq, date, res, chain_id, key, hash[, info_bytes], as the reference serialises.

      Returns Record<string, unknown>

    • The JSON shape, read strictly: every field required but info_bytes, the resolution its wire number, the date RFC 3339 or YYYY-MM-DD, bytes in base64. Any fault is Json, worded as serde words it.

      Parameters

      • json: unknown

      Returns ProvenanceMark

    • ProvenanceMark(<idHex>).

      Returns string

    • Every field, as the reference's Debug: hex bytes, the sequence, the date display (the date alone at midnight) and the info in diagnostic notation.

      Returns string