SpruceID
Search…
Running the Example
The following is a guide on how to run the Rebase frontend demo. A hosted example can be found here.
rebase/demo/witness at main · spruceid/rebase
GitHub
This is a guide to running the Cloudflare Worker which acts as a witness for Rebase claims.

Running the Witness

Requires
  • Wrangler
  • API keys for any relevant social APIs
You need a Cloudflare account, and the Account ID needs to go in the wrangler.toml.
The worker needs two things: the private key to issue the VC after verifying the tweet, and an API token for the relevant social APIs. You can add these as secrets with:
wrangler secret put REBASE_SK
wrangler secret put TWITTER_BEARER_TOKEN
The private key is expected to be a JWK. You can generate one with didkit generate-ed25519-key.
This key is also expected to have a corresponding did:web outlined
wrangler publish
For development, you should use wrangler dev. This will launch the worker to listen on localhost:8787.
Regardless of where it's deployed, the worker responds to two routes /statement and /witness, both expect a POST. The former expects the POST body to conform to:
#[derive(Deserialize, Serialize)]
pub struct StatementReq {
pub opts: StatementTypes,
}
for Statement and for Witness:
#[derive(Deserialize, Serialize)]
pub struct WitnessReq {
pub proof: ProofTypes,
}
Details on StatementTypes and ProofTypes can be found in the top-level README and their implementations can be found in rebase/rust/src.

Running the Example Dapp

rebase/demo/dapp at main · spruceid/rebase
GitHub
This is a thin client for usage with the witness service found in rebase/demo/witness. To run it locally:
cd rebase/demo/dapp
npm i
npm run dev
Then the UI should be running on localhost:3000 and simple to operate. Signers (currently limited to Ethereum) can be connected through the header and claims can be created by visiting the available option at the top of the body.
The witness flows should contain sufficient instructions for a user to follow. If using the default configuration, rebase/demo/witness will need to be running on localhost:8787.
If using a different witness, change the const witnessUrl in demo/dapp/src/components/claims/WitnessForm.svelte to the location of the witness you want to use.
In the future, there may be a more abstract way of handling witness flows, but for now, WitnessForm switches on the type and changes the instructions accordingly.