Class containing useful utilities related to the Records interface.

Constructors

Methods

  • Checks if the given RecordsDelete message can be performed against a record with the given newest existing state.

    Parameters

    Returns boolean

  • 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

    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

    Returns boolean

  • Checks if the filter supports returning unpublished records.

    Parameters

    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

    Returns RecordsFilter

    a copy of the incoming RecordsFilter with the normalized properties.

  • Checks whether or not the incoming records query filter should build an unpublished author MessageStore filter.

    Parameters

    • filter: RecordsFilter

      The incoming RecordsFilter to evaluate against.

    • author: string

      The author to check against the filter, typically the query/subscribe message author.

    Returns boolean

    True if the filter contains the author, or if the author filter is undefined/empty.

  • Checks whether or not the incoming records query filter should build an unpublished recipient MessageStore filter.

    Parameters

    • filter: RecordsFilter

      The incoming RecordsFilter to evaluate against.

    • recipient: string

      The recipient to check against the filter, typically the query/subscribe message author.

    Returns boolean

    True if the filter contains the recipient, or if the recipient filter is undefined/empty.

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

    Parameters

    Returns boolean

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

    Parameters

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

    Returns void

    with DwnErrorCode.RecordsInvalidAncestorKeyDerivationSegment if fails validation.

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

    Parameters

    Returns Promise<void>