Skip to content

TimeleapLabs/watermark-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

watermark-plugin

Installation

Install dependencies with:

bun install

And then:

cd shared/models && mkdir dist && bun run --filter @shared/models build

Running Timeleap

Initialize the project:

tlp init

Choose ./timeleap as the location of nodes and select both broker and worker.

Now you’ll have secrets generated in:

./timeleap/secrets/worker_secrets.yaml
./timeleap/secrets/broker_secrets.yaml

and a base config at:

./timeleap/config.yaml

Environment Files

Each app has its own .env file:

  • apps/client/.env
  • apps/plugin/.env

Client Environment

Create apps/client/.env:

cp apps/client/.env.example apps/client/.env

Fill BROKER_PUBLIC_KEY from ./timeleap/secrets/broker_secrets.yaml And BROKER_URI from ./timeleap/config.yaml:

BROKER_PUBLIC_KEY=91sP4tqxy7rA6hN8mVbLDp2XwEoFUQnJ5kC3iYgTHZMz
BROKER_URI=ws://broker:9123/1.0.0

Plugin Environment

Create apps/plugin/.env:

cp apps/plugin/.env.example apps/plugin/.env

Fill in values using:

  • WORKER_PUBLIC_KEY → from worker_secrets.yaml
  • BROKER_PUBLIC_KEY → from broker_secrets.yaml
  • PLUGIN_PRIVATE_KEY → generated by the plugin utility (see below)
  • PLUGIN_PUBLIC_KEY → generated by the plugin utility (see below)
  • APP_ID → optional (can be null)

Example:

WORKER_PUBLIC_KEY=EN1N19wf6uoGWtNydVDF6L9MpgT7yQGyvyj2tSCgJdp1
PLUGIN_PRIVATE_KEY=8vAco6ppdLSVLdMgeqLptSXtaeM6Kbqtqu3X7ePsGSAi
BROKER_PUBLIC_KEY=37iPtisyYXSQoCTUtsFWX4mwAMtKmFYStcX9QZxzVDnA
PLUGIN_PUBLIC_KEY=91sP4tqxy7rA6hN8mVbLDp2XwEoFUQnJ5kC3iYgTHZMz
APP_ID=1337

Generating a Plugin Key

The apps/plugin package provides a utility for generating a key.

From the root of the repository, run:

bun run --filter @apps/plugin generate:key

You’ll get two keys:

  • sk → your plugin private key (PLUGIN_PRIVATE_KEY)
  • the other → public key (used in PLUGIN_PUBLIC_KEY or for sharing)

Save these keys securely.

Attaching The Plugin To Worker

Raplce this with plugins: [] inside the config.yaml:

plugins:
  - type: websocket
    name: swiss.timeleap.watermarker
    endpoint: ws://swiss.timeleap.watermarker
    publicKey: ${PLUGIN_PUBLIC_KEY}
    functions:
      - name: addWatermarkToImage
        fee:
          amount: 1
          currency: USD

Either add Broker and Plugin's public key manually in config.yaml or make .env in root directory containing:

WORKER_PUBLIC_KEY=
PLUGIN_PRIVATE_KEY=
BROKER_URI=
BROKER_PUBLIC_KEY=

Starting the Stack

Once your environment files are ready:

tlp compose up --build

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published