Utility class for generating data for testing.

Constructors

Methods

  • Generates a encrypted RecordsWrite message for testing.

    Parameters

    • input: {
          author: Persona;
          encryptSymmetricKeyWithProtocolContextDerivedKey: boolean;
          encryptSymmetricKeyWithProtocolPathDerivedKey: boolean;
          plaintextBytes: Uint8Array;
          protocolContextDerivedPublicJwk?: PublicJwk;
          protocolContextDerivingRootKeyId?: string;
          protocolDefinition: ProtocolDefinition;
          protocolParentContextId?: string;
          protocolPath: string;
          recipient?: string;
      }
      • author: Persona
      • encryptSymmetricKeyWithProtocolContextDerivedKey: boolean

        Set to true to attach the symmetric key encrypted by the protocol context derived public key

      • encryptSymmetricKeyWithProtocolPathDerivedKey: boolean

        Set to true to attach the symmetric key encrypted by the protocol path derived public key

      • plaintextBytes: Uint8Array
      • OptionalprotocolContextDerivedPublicJwk?: PublicJwk
      • OptionalprotocolContextDerivingRootKeyId?: string
      • protocolDefinition: ProtocolDefinition

        Protocol definition used to generate the RecordsWrite. Must be the RECIPIENT's protocol definition if encryptSymmetricKeyWithProtocolPathDerivedKey is true, because the recipient's public keys will be needed to encrypt the symmetric key.

      • OptionalprotocolParentContextId?: string
      • protocolPath: string
      • Optionalrecipient?: string

    Returns Promise<{
        dataStream: Readable;
        encryptedDataBytes: Uint8Array;
        encryptionInput: EncryptionInput;
        message: RecordsWriteMessage;
        recordsWrite: RecordsWrite;
    }>

  • Generates a random within a range (inclusive).

    Parameters

    • min: number

      lowest potential value.

    • max: number

      greatest potential value.

    Returns number

  • Generates a random timestamp. Optionally allows you to set specific non-randomized values for the timestamp.

    Parameters

    • Optionaloptions: {
          day?: number;
          hour?: number;
          microsecond?: number;
          millisecond?: number;
          minute?: number;
          month?: number;
          second?: number;
          year?: number;
      }
      • Optionalday?: number
      • Optionalhour?: number
      • Optionalmicrosecond?: number
      • Optionalmillisecond?: number
      • Optionalminute?: number
      • Optionalmonth?: number
      • Optionalsecond?: number
      • Optionalyear?: number

    Returns string

    random UTC ISO-8601 timestamp