Skip to content

Investigate pure TS client-side implementation #635

@cygnusv

Description

@cygnusv

Let's recall our current stack:

  • ferveo: Core cryptographic implementation (Rust -> WASM)
  • nucypher-core: Protocol API and objects (Rust -> WASM)
  • taco-web: Adopter-facing API (TypeScript)

The scope of this issue is to investigate to what extent we can build a minimal substitution for ferveo and nucypher-core using purely TypeScript primitives. Since browser interactions are currently tied to the creator/encryption and consumer/decryption request steps, let’s investigate what happens underneath and what do we need to replace.

Encryption (taco/src/tdec.ts/encryptMessage()):

  • nucypher_core::encryptForDkg(data: Uint8Array, public_key: DkgPublicKey, conditions: Conditions)
    • ferveo_tdec::api::encrypt(message, aad, public_key, rng):
      • BLS12-381 arithmetic
      • ChaCha20Poly1305 encryption
      • Rust-side serialization
  • nucypher_core::AccessControlPolicy
  • nucypher_core::ThresholdMessageKit

Decryption (taco/src/tdec.ts/retrieveAndDecrypt()):

  • nucypher_core::
    • ThresholdDecryptionRequest
      • .encrypt()
        • EncryptedThresholdDecryptionRequest
          • encrypt_with_shared_secret
            • ChaCha20Poly1305 encryption
    • SessionStaticSecret
      • .new()
        • crate::secret_box::kdf (HKDF)
      • .derive_shared_secret()
        • x25519_dalek::{PublicKey, SharedSecret, StaticSecret}
    • EncryptedThresholdDecryptionRequest
      • encrypt_with_shared_secret
      • decrypt_with_shared_secret
    • ThresholdMessageKit
      • .decryptWithSharedSecret()
        • ferveo::api::decrypt_with_shared_secret
          • SecretBox
          • Chacha20Poly1305
  • ferveo::binding_wasm::combine_decryption_shares_simple
    • ferveo::api::combine_shares_simple
      • BLS12-381 arithmetic

After this preliminary analysis, we can see that we currently depend on these external primitives:

  • BLS12-381 arithmetic
  • ChaCha20Poly1305 encryption
  • HKDF
  • x25519_dalek
  • SecretBox
  • Rust-side serialization

A cursory search I can see several 3rd party libraries that can help us with this process, but we need a more in-depth investigation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions