Class containing useful utilities related to the Records interface.

Constructors

Methods

  • This will create individual keys for each of the tags that look like tag.tag_property

    Parameters

    Returns KeyValues

  • Constructs the full key derivation path using dataFormats scheme.

    Parameters

    • schema: undefined | string
    • dataFormat: string

    Returns string[]

  • Constructs the full key derivation path using protocolContext scheme.

    Parameters

    • contextId: undefined | string

    Returns string[]

  • Constructs the full key derivation path using protocolPath scheme.

    Parameters

    Returns string[]

  • Constructs the full key derivation path using schemas scheme.

    Parameters

    • schema: undefined | string

    Returns string[]

  • Converts an incoming RecordsFilter into a Filter usable by MessageStore.

    Parameters

    • filter: RecordsFilter

      A RecordsFilter

    • Optional dateSort: DateSort

    Returns Filter

    a generic Filter able to be used with MessageStore.

  • Decrypts the encrypted data in a message reply using the given ancestor private key.

    Parameters

    Returns Promise<Readable>

  • Derives a descendant private key given an ancestor private key and the full absolute derivation path. NOTE: right now only ECIES-ES256K algorithm is supported for asymmetric encryption, so we will only derive SECP256K1 key without additional conditional checks

    Parameters

    Returns Promise<Uint8Array>

  • Checks if the filter supports returning published records.

    Parameters

    • filter: RecordsFilter

    Returns boolean

  • Checks if the filter supports returning unpublished records.

    Parameters

    • filter: RecordsFilter

    Returns boolean

  • Extracts the parent context ID from the given context ID.

    Parameters

    • contextId: undefined | string

    Returns undefined | string

  • Parameters

    • filter: string | number | boolean | {
          gt: RangeValue;
      } & {
          gte?: undefined;
      } & Partial<{
          gt: RangeValue;
      } & {
          gte?: undefined;
      }> & Partial<{
          lt: RangeValue;
      } & {
          lte?: undefined;
      }> | {
          gt: RangeValue;
      } & {
          gte?: undefined;
      } & Partial<{
          gt: RangeValue;
      } & {
          gte?: undefined;
      }> & Partial<{
          lt?: undefined;
      } & {
          lte: RangeValue;
      }> | never | never | never | never | {
          gt?: undefined;
      } & {
          gte: RangeValue;
      } & Partial<{
          gt?: undefined;
      } & {
          gte: RangeValue;
      }> & Partial<{
          lt: RangeValue;
      } & {
          lte?: undefined;
      }> | {
          gt?: undefined;
      } & {
          gte: RangeValue;
      } & Partial<{
          gt?: undefined;
      } & {
          gte: RangeValue;
      }> & Partial<{
          lt?: undefined;
      } & {
          lte: RangeValue;
      }> | {
          lt: RangeValue;
      } & {
          lte?: undefined;
      } & Partial<{
          gt: RangeValue;
      } & {
          gte?: undefined;
      }> & Partial<{
          lt: RangeValue;
      } & {
          lte?: undefined;
      }> | never | {
          lt: RangeValue;
      } & {
          lte?: undefined;
      } & Partial<{
          gt?: undefined;
      } & {
          gte: RangeValue;
      }> & Partial<{
          lt: RangeValue;
      } & {
          lte?: undefined;
      }> | never | never | {
          lt?: undefined;
      } & {
          lte: RangeValue;
      } & Partial<{
          gt: RangeValue;
      } & {
          gte?: undefined;
      }> & Partial<{
          lt?: undefined;
      } & {
          lte: RangeValue;
      }> | never | {
          lt?: undefined;
      } & {
          lte: RangeValue;
      } & Partial<{
          gt?: undefined;
      } & {
          gte: RangeValue;
      }> & Partial<{
          lt?: undefined;
      } & {
          lte: RangeValue;
      }> | StartsWithFilter

    Returns filter is StartsWithFilter

  • Normalizes the protocol and schema URLs within a provided RecordsFilter and returns a copy of RecordsFilter with the modified values.

    Parameters

    • filter: RecordsFilter

      incoming RecordsFilter to normalize.

    Returns RecordsFilter

    a copy of the incoming RecordsFilter with the normalized properties.

  • Determines if signature payload contains a protocolRole and should be authorized as such.

    Parameters

    • signaturePayload: GenericSignaturePayload

    Returns boolean

  • Validates that ancestor derivation path matches the descendant derivation path completely.

    Parameters

    • ancestorKeyDerivationPath: string[]
    • descendantKeyDerivationPath: string[]

    Returns void

    Throws

    with DwnErrorCode.RecordsInvalidAncestorKeyDerivationSegment if fails validation.

  • Validates the referential integrity of both author-delegated grant and owner-delegated grant.

    Parameters

    • message: RecordsWriteMessage | RecordsQueryMessage | RecordsDeleteMessage | RecordsSubscribeMessage | RecordsReadMessage
    • authorSignaturePayload: undefined | GenericSignaturePayload

      Decoded payload of the author signature of the message. Pass undefined if message is not signed. Passed purely as a performance optimization so we don't have to decode the signature payload again.

    • Optional ownerSignaturePayload: GenericSignaturePayload

      Decoded payload of the owner signature of the message. Pass undefined if no owner signature is present. Passed purely as a performance optimization so we don't have to decode the owner signature payload again.

    Returns Promise<void>