This repository contains code for the backend used to power Privacybear.
name: {
type: String,
required: true,
trim: true
},
email: {
type: String,
required: true,
unique: true,
},
password: {
type: String,
required: true,
minLength: 7
},
avatar: {
type: String,
required: false
},
timestamp: {
type: String,
default: new Date().getTime()
}
user: {
type: ObjectId,
ref: 'User',
required: true,
},
site: {
type: String,
required: true,
trim: true
},
url: {
type: String,
required: true,
trim: true,
},
permissions: [{
type: String,
required: true,
trim: true
}],
timestamp: {
type: String,
default: new Date().getTime()
}
Requires the authentication token in header (Authorization
, Bearer YOUR_TOKEN_HERE
) and returns a user object or an error. Fetches User information.
Response:
{
"user": {
"name": "Name of the User",
"email": "Email address of the User",
"avatar": "Avatar of the User",
"timestamp": "Timestamp of creation"
}
}
Takes the following fields in JSON(application/json) and returns the user and token for authentication.
name - Name of the user. email - Email of the user. password - Password of the user.
Response:
{
"user":{
"name": ....,
"email": .....,
"password": hashed(....),
"avatar": data:svg,
},
"token": ....
}
Takes the following fields in JSON(application/json) and returns the token for authentication if email/password combination is valid.
email - Email of the user. password - Password of the user.
Response:
{
"user":{
"name": ....,
"email": .....,
"avatar": data:svg,
"timestamp": .....,
}
"token": ....
}
Takes the following fields in JSON(application/json) as well as the authentication token in header (Authorization
, Bearer YOUR_TOKEN_HERE
) and returns a confirmation or an error.
password - Password of the user.
Response:
{
"status" or "error": ....
}
Requires the authentication token in header (Authorization
, Bearer YOUR_TOKEN_HERE
) and returns a JSON object with all the records.
Response:
{
"records": Number of records,
"history": [
{
"permissions": ['LOCATION', 'COOKIES', ...],
"timestamp": "1595312359042",
"_id": "5f1688e7713f243bdccb3734",
"user": "5f167d9c45cbf425c0fda3ff",
"site": "Auxin",
"url": "https://getauxin.com/"
},
...
]
}
Requires the authentication token in header (Authorization
, Bearer YOUR_TOKEN_HERE
) and returns a JSON object with all the records.
Response:
{
"records": Number of records,
"history": [
{
"permissions": ['LOCATION', 'COOKIES', ...],
"timestamp": "1595312359042",
"_id": "5f1688e7713f243bdccb3734",
"user": "5f167d9c45cbf425c0fda3ff",
"site": "Auxin",
"url": "https://getauxin.com/"
},
...
]
}
Takes the following fields in JSON(application/json) as well as the authentication token in header (Authorization
, Bearer YOUR_TOKEN_HERE
) and returns a confirmation or an error.
site - Site name. url - URL of the site. permissions - Permissions stored in an array of strings.
Response:
{
"status" or "error": ....
}
Requires the authentication token in header (Authorization
, Bearer YOUR_TOKEN_HERE
) and returns a confirmation or an error. Deletes all records.
Response:
{
"status" or "error": ....
}
Takes the _id of the record in the URL parameter as well as the authentication token in header (Authorization
, Bearer YOUR_TOKEN_HERE
) and returns a confirmation or an error. Deletes one record.
Response:
{
"status" or "error": ....
}