@blockchaincommons/envelope - v1.0.0-beta.4
    Preparing search index...

    Class EnvelopeError

    The error every envelope operation throws. code names the condition (one of EnvelopeErrorCode), details is discriminated by it, and cause carries the underlying error when a lower layer (CBOR, components, crypto) failed.

    try {
    envelope.decryptSubject(key);
    } catch (e) {
    if (EnvelopeError.isEnvelopeError(e) && e.is("NotEncrypted")) { … }
    }

    Hierarchy

    • Error
      • EnvelopeError
    Index
    name: "EnvelopeError"

    Always "EnvelopeError"; what isEnvelopeError checks across module graphs.

    Which condition was raised.

    Structured information, discriminated by code.

    cause?: Error

    The lower-layer error this one wraps, when any.

    • Returned when attempting to compress or encrypt an envelope that has already been elided.

      This error occurs because an elided envelope only contains a digest reference and no longer has a subject that can be compressed or encrypted.

      Returns EnvelopeError

    • Returned when attempting to retrieve an assertion by predicate, but multiple matching assertions exist.

      For queries that expect a single result (like objectForPredicate), having multiple matching assertions is ambiguous and requires more specific targeting.

      Returns EnvelopeError

    • Returned when a digest validation fails.

      This can occur when unwrapping an envelope, verifying signatures, or other operations that rely on the integrity of envelope digests.

      Returns EnvelopeError

    • Returned when a digest is expected but not found.

      This can occur when working with envelope structures that require digest information, such as when working with elided envelopes.

      Returns EnvelopeError

    • Returned when attempting to retrieve an assertion by predicate, but no matching assertion exists.

      This error occurs with functions like objectForPredicate when the specified predicate doesn't match any assertion in the envelope.

      Returns EnvelopeError

    • Returned when attempting to unwrap an envelope that wasn't wrapped.

      This error occurs when calling Envelope.tryUnwrap on an envelope that doesn't have the wrapped format.

      Returns EnvelopeError

    • Returned when expecting an envelope's subject to be a leaf, but it isn't.

      This error occurs when calling methods that require access to a leaf value but the envelope's subject is an assertion, node, or elided.

      Returns EnvelopeError

    • Returned when expecting an envelope's subject to be an assertion, but it isn't.

      This error occurs when calling methods that require an assertion structure but the envelope's subject has a different format.

      Returns EnvelopeError

    • Returned when an attachment's structure is invalid according to the Envelope Attachment specification (BCR-2023-006): the envelope is not an assertion, or its parts do not rebuild an equivalent attachment.

      Returns EnvelopeError

    • Returned when an attachment is requested but does not exist.

      This error occurs when attempting to retrieve an attachment by ID that doesn't exist in the envelope.

      Returns EnvelopeError

    • Returned when multiple attachments match a single query.

      The message is the reference's #[error] text, misspelling included (abiguous attachment), so both implementations report the same text.

      Returns EnvelopeError

    • Returned when attempting to compress an envelope that is already compressed.

      This error occurs when calling compression functions on an envelope that already has compressed content, as defined in BCR-2023-005.

      Returns EnvelopeError

    • Returned when attempting to decompress an envelope that is not compressed.

      This error occurs when calling decompression functions on an envelope that doesn't contain compressed content.

      Returns EnvelopeError

    • Returned when attempting to encrypt an envelope that is already encrypted or compressed.

      This error occurs to prevent multiple layers of encryption or encryption of compressed data, which could reduce security, as defined in BCR-2023-004.

      Returns EnvelopeError

    • Returned when attempting to decrypt an envelope that is not encrypted.

      This error occurs when calling decryption functions on an envelope that doesn't contain encrypted content.

      Returns EnvelopeError

    • Returned when expecting an envelope's subject to be a known value, but it isn't.

      This error occurs when calling methods that require a known value (as defined in BCR-2023-003) but the envelope's subject is a different type.

      Returns EnvelopeError

    • Returned when attempting to decrypt an envelope with a recipient that doesn't match.

      This error occurs when trying to use a private key to decrypt an envelope that wasn't encrypted for the corresponding public key.

      Returns EnvelopeError

    • Returned when attempting to decrypt an envelope with a secret that doesn't match.

      This error occurs when trying to use a secret that does not correspond to the expected recipient, preventing successful decryption.

      Returns EnvelopeError

    • Returned when a signature verification fails.

      This error occurs when a signature does not validate against its purported public key.

      Returns EnvelopeError

    • Returned when SSKR shares are invalid or insufficient for reconstruction.

      This error occurs when attempting to join SSKR shares that are malformed, from different splits, or insufficient to meet the recovery threshold.

      Returns EnvelopeError

    • Returned when an envelope contains an invalid type.

      This error occurs when an envelope's type information doesn't match the expected format or value.

      Returns EnvelopeError

    • Returned when an envelope contains ambiguous type information.

      This error occurs when multiple type assertions exist that conflict with each other or create ambiguity about the envelope's type.

      Returns EnvelopeError

    • Returned when a response envelope has an unexpected ID.

      This error occurs when processing a response envelope and the ID doesn't match the expected request ID, as defined in BCR-2023-012.

      Returns EnvelopeError

    • Cbor as an internal site reports it: dcbor error: <message>, the reference's Error::Cbor Display, with the dcbor error as cause.

      Parameters

      • message: string
      • Optionalcause: Error

      Returns EnvelopeError

    • Cbor as a decoder reports it: the message is the dcbor Display of cause with no prefix, because the reference's try_from_cbor_data, TryFrom<CBOR>, from_untagged_cbor and Expression::try_from return a dcbor::Error; cause is that CborError.

      Parameters

      • cause: Error

      Returns EnvelopeError

    • InvalidParameter: parameter did not meet expected (the JS-only input domain: a fractional position, an invalid Date, undefined).

      Parameters

      • parameter: string
      • expected: string
      • Optionalvalue: unknown
      • Optionalcause: Error

      Returns EnvelopeError