-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
278 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ | |
target | ||
/node_modules/ | ||
.env | ||
|
||
|
||
/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Copyright (c) 2023-2024, Built on KILT. | ||
All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
3. All advertising materials mentioning features or use of this software must display the following acknowledgement: Built on KILT. | ||
4. Neither the name of KILT Protocol nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY KILT PROTOCOL AND ITS CONTRIBUTORS ‘’AS IS’' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
IN NO EVENT SHALL KILT PROTOCOL OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,71 @@ | ||
# Hello | ||
# Attester Service | ||
|
||
send help! | ||
The Attester Service is responsible for generating various credentials for users, with an authentication mechanism that distinguishes between regular users and employees. Users can request different types of credentials, which can then be approved by employees. The service implements the KILT [Credential API](https://github.com/KILTprotocol/spec-ext-credential-api), allowing users to store their credentials in their identity wallet. Authentication is facilitated by fetching a JWT token from [OpenDID](https://github.com/KILTprotocol/opendid). Users can log in with a DID, while employees require additional credentials. | ||
|
||
A demonstration deployment for Peregrine can be accessed [here](https://dena-attester-dev.kilt.io/#/login), and a Spiritnet deployment is available [here](https://dena-attester.kilt.io/#/login). | ||
|
||
## Usage | ||
|
||
All environment variables must be configured in a `config.yaml` file. An example `config.yaml` file is provided [here](./config_example.yaml), with explanations of the variables included. | ||
|
||
### Local Debugging Frontend | ||
|
||
The frontend utilizes Vite as a bundler. To develop, simply run `yarn dev`. To build the frontend, execute `yarn build`. | ||
|
||
### Local Debugging Backend VsCode | ||
|
||
Create a `.vscode/launch.json` file and paste the following content: | ||
|
||
```json | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "lldb", | ||
"request": "launch", | ||
"name": "Debug executable 'attester-backend'", | ||
"cargo": { | ||
"args": ["build", "--bins"], | ||
"filter": { | ||
"name": "attester_peregrine", | ||
"kind": "bin" | ||
} | ||
}, | ||
"args": [], | ||
"cwd": "${workspaceFolder}", | ||
"env": { | ||
"CONFIG": "./config.yaml" | ||
} | ||
}, | ||
{ | ||
"type": "lldb", | ||
"request": "launch", | ||
"name": "Debug unit tests in executable 'attester-backend'", | ||
"cargo": { | ||
"args": [ | ||
"test", | ||
"--no-run", | ||
"--bin=attester-backend", | ||
"--package=attester-backend" | ||
], | ||
"filter": { | ||
"name": "attester-backend", | ||
"kind": "bin" | ||
} | ||
}, | ||
"args": [], | ||
"cwd": "${workspaceFolder}" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Please note that the above configuration is tailored for Peregrine. If debugging on Spiritnet, adjust the filter accordingly. | ||
|
||
### Docker | ||
|
||
A docker-compose file is provided. To start the containers, run `docker-compose up`. | ||
|
||
### Database | ||
|
||
The Rust backend utilizes sqlx for database interactions. If a query is modified, update the metadata to support offline compile-time verification using the command `cargo sqlx prepare`. New migrations can be added with `cargo sqlx migrate add`, and existing migrations can be executed via CLI with `cargo sqlx migrate run`. The source code manages migrations automatically. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Port on which the server runs | ||
port: 5656 | ||
|
||
# The path to the bundled frontend. | ||
frontEndPath: /path/to/your/frontend | ||
|
||
# The socket connection to the Kilt endpoint. | ||
endpoint: wss://spiritnet.api.onfinality.io:443/public-ws | ||
|
||
# The application name required for the credential API. | ||
appName: dena-attester | ||
|
||
# The PostgreSQL database URL. | ||
databaseUrl: | ||
|
||
# The redirect URL which is needed by OpenDID. | ||
redirectUrls: | ||
|
||
# Seed used for creating credentials. | ||
attesterDidSeed: | ||
|
||
# Seed used for the attestation keys by the Attester DID. | ||
attesterAttestationSeed: | ||
|
||
# The secret used to verify the JWT token from OpenDID. | ||
jwtSecret: super-secret-jwt-secret | ||
|
||
# A payer seed, who pays to anchor the credentials to the blockchain. | ||
payerSeed: | ||
|
||
# The URL endpoint for login. | ||
authUrl: "https://opendid.kilt.io/api/v1/authorize" | ||
|
||
# Session variables for creating a secure session needed by the credential API. | ||
session: | ||
keyUri: | ||
naclSecretKey: | ||
naclPublicKey: | ||
sessionKey: | ||
|
||
# The well-known DID configuration required by Sporran. | ||
wellKnownDid: | ||
did: | ||
origin: | ||
keyUri: | ||
seed: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.