A class representing a RecordsWrite DWN message. NOTE: Unable to extend AbstractMessage directly because the incompatible _message type, which is not just a generic <M> type.

Implements

Properties

attesters: string[]

Accessors

  • get author(): undefined | string
  • DID of the logical author of this message. NOTE: we say "logical" author because a message can be signed by a delegate of the actual author, in which case the author DID would not be the same as the signer/delegate DID, but be the DID of the grantor (grantedBy) of the delegated grant presented.

    Returns undefined | string

  • get owner(): undefined | string
  • The owner DID of the message if owner signature is present in the message; undefined otherwise. This is the logical owner of the message, not to be confused with the actual signer of the owner signature, this is because the signer of the owner signature may not be the actual DWN owner, but a delegate authorized by the owner.

    Returns undefined | string

  • get ownerSignatureSigner(): undefined | string
  • Gets the signer of owner signature; undefined if owner signature is not present in the message. This is not to be confused with the logical owner #owner of the message, this is because the signer of the owner signature may not be the actual DWN owner, but a delegate authorized by the owner. In the case that the owner signature is signed by the actual DWN owner, this value will be the same as #owner.

    Returns undefined | string

  • get signer(): undefined | string
  • Gets the signer of this message. This is not to be confused with the logical author of the message.

    Returns undefined | string

Methods

  • Authorizes the author-delegate who signed this message.

    Parameters

    • messageStore: MessageStore

      Used to check if the grant has been revoked.

    Returns Promise<void>

  • Authorizes the owner-delegate who signed this message.

    Parameters

    • messageStore: MessageStore

      Used to check if the grant has been revoked.

    Returns Promise<void>

  • Encrypts the symmetric encryption key using the public keys given and attach the resulting encryption property to the RecordsWrite.

    Parameters

    Returns Promise<void>

  • Signs the RecordsWrite as the DWN owner. This is used when the DWN owner wants to retain a copy of a message that the owner did not author. NOTE: requires the RecordsWrite to already have the author's signature.

    Parameters

    Returns Promise<void>

  • Signs the RecordsWrite as the DWN owner-delegate. This is used when a DWN owner-delegate wants to retain a copy of a message that the owner did not author. NOTE: requires the RecordsWrite to already have the author's signature.

    Parameters

    Returns Promise<void>

  • Creates the attestation property of a RecordsWrite message if given signature inputs; returns undefined otherwise.

    Parameters

    • descriptorCid: string
    • Optionalsigners: Signer[]

    Returns Promise<undefined | GeneralJws>

  • Convenience method that creates a message by:

    1. Copying over immutable properties from the given source message
    2. Copying over mutable properties that are not overwritten from the given source message
    3. Replace the mutable properties that are given new value

    Parameters

    Returns Promise<RecordsWrite>

  • Creates the signature property in the authorization of a RecordsWrite message.

    Parameters

    • input: {
          attestation: undefined | GeneralJws;
          contextId: undefined | string;
          delegatedGrantId?: string;
          descriptorCid: string;
          encryption: undefined | EncryptionProperty;
          permissionGrantId?: string;
          protocolRole?: string;
          recordId: string;
          signer: Signer;
      }
      • attestation: undefined | GeneralJws
      • contextId: undefined | string
      • OptionaldelegatedGrantId?: string
      • descriptorCid: string
      • encryption: undefined | EncryptionProperty
      • OptionalpermissionGrantId?: string
      • OptionalprotocolRole?: string
      • recordId: string
      • signer: Signer

    Returns Promise<GeneralJws>