Vana SDK - v4.1.0
    Preparing search index...

    Function sealJobRequest

    • Encrypts a validated job request envelope for a Personal Server enclave.

      The PS worker verifies auth.bodyHash === sha256(canonicalJobRequestBytes(request)); the Gateway never sees the plaintext.

      Parameters

      • envelope: JobRequestEnvelope

        Request and builder Web3Signed authorization to encrypt.

      • enclavePublicKey: `0x${string}`

        Public key returned by GET /v1/identity?owner=.

      • ecies: ECIESProvider

        Injected ECIES implementation.

      Returns Promise<string>

      Base64 ciphertext encoded as iv || ephemPub || ct || mac.

      If the envelope or request is invalid.

      If ECIES encryption fails or the enclave public key is invalid.

      const identity = await fetch(`/v1/identity?owner=${owner}`).then((response) =>
      response.json(),
      );
      const requestCiphertext = await sealJobRequest(
      requestEnvelope,
      identity.publicKey,
      ecies,
      );
      await fetch("/v1/jobs", {
      method: "POST",
      body: JSON.stringify({ ...submission, requestCiphertext }),
      });