Getting Started
@skyware/labeler
is a lightweight library for operating a labeler.
Before you start, you will need:
- An existing Bluesky account that will act as the labeler
- A domain
- An SSL certificate for your domain
Setup
If you already have a labeler set up, via Ozone or otherwise, you can skip this step.
To initialize the Bluesky account as a labeler, run the following command:
The command will walk you through logging in, then ask for the URL where your labeler server will be located. This must be an HTTPS URL. A confirmation code will then be sent to your email. Once you’ve entered the code, a signing key will be generated if you did not provide one. Be sure to save this key, as you will need it to operate the labeler.
Once complete, you’ll have the option to begin defining labels that your labeler will apply. You can also do this later by running npx @skyware/labeler label add
. For each label, you must define the following information:
Running the Labeler
The LabelerServer
class takes an object argument with the following properties:
did
: The DID of the labeler account.signingKey
: The signing key used to sign labels. This should be the same key you received when setting up the labeler, if you used the setup CLI command.auth
(optional): A function that takes a DID and returns a boolean indicating whether the DID is authorized to emit labels. If not provided, only the labeler account can emit labels.dbPath
(optional): The path to the database file. Defaults to./labels.db
.dbUrl
(optional): The URL of the database. Use this instead ofdbPath
if you want to use a remote libSQL database.dbToken
(optional): The authentication token for the database. Required if a remotedbUrl
is provided.
After initializing the server, call the start
method with the port number to listen on and a callback that will be called when the server starts. If an error occurs, the callback will be called with the error.
Once your labeler is running, you will need to point your labeler’s domain to the server and set up SSL. You can use a tool like Caddy to do this.
If all has gone well, you’re ready to start labeling content!
To undo a label, emit the same label with the neg
property set to true
to neg
ate the label.
Next, read on to learn about Automated Labeling.