-
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.
created models. they won't be used yet
- Loading branch information
1 parent
300a3a7
commit a94951a
Showing
7 changed files
with
163 additions
and
0 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
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,51 @@ | ||
import {DataTypes} from 'sequelize'; | ||
|
||
const defineConfig = (sequelize) => { | ||
const Config = sequelize.define('Config', | ||
{ | ||
parameter: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
value: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
} | ||
}); | ||
|
||
return Config; | ||
}; | ||
|
||
export default defineConfig; | ||
|
||
|
||
|
||
/* | ||
// WDK will available under openpgp.defaultDomain. The public key will be published here so we can receive encrypted mails. | ||
// Verification links will use openpgp.defaultDomain. Because of that you'll need an entry in the Domain table for this domain. | ||
dafaultDomain: positron-it.de | ||
//When enabled the server will accept key for all domain ans will create a directory for each domain | ||
acceptAllKeys: false | ||
// a wks client will get this Submission Address when checking for one. The mail server will only access mails send to this receipient. | ||
submissionAddress: "key-submission@positron-it.de" | ||
// this is the private key for submissinoAddress. the service needs this key to sign mails and to decrypt mails if encrypted | ||
pgpprivkey: "./submission.key" | ||
// password for decrypting the PGPPrivateKey if encrypted | ||
pgppass: | ||
// this ist the public key for the submissionAddress. This key will be automatically publish so we can receive encrypted mails. | ||
pgppubkey: "./positron-it.de/hu/54f6ry7x1qqtpor16txw5gdmdbbh6a73" | ||
// for SMTP server and default web cert if no cert for sni found. typecally it's for the same domains a defaultVerifyDomain | ||
defaultServerKey: "/etc/letsencrypt/live/openpgpkey.positron-it.de/privkey.pem" | ||
defaultServerCert: "/etc/letsencrypt/live/openpgpkey.positron-it.de/cert.pem" | ||
// SMTP Client | ||
// set to true if you wand to use the sendmail to send mails. When set to true other SMTP options will be ignored | ||
SMTPSendmail: true | ||
// if you want to use an external server. | ||
SMTPPort: 25 | ||
SMTPHost: 'postitron-it.de' | ||
SMTPUser: 'yawksuser' | ||
SMTPPassword: 'yakspassword' | ||
*/ |
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,28 @@ | ||
import {DataTypes} from 'sequelize'; | ||
|
||
const defineDomain = (sequelize) => { | ||
const Domain = sequelize.define('Domain', | ||
{ | ||
name: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
cert: { | ||
type: DataTypes.STRING, | ||
}, | ||
privateKey: { | ||
type: DataTypes.STRING, | ||
}, | ||
}); | ||
return Domain; | ||
}; | ||
|
||
export default defineDomain; | ||
|
||
// TODO domain has Many Keys | ||
|
||
/* | ||
name: "positron-it.de" | ||
cert: "/etc/letsencrypt/live/openpgpkey.positron-it.de/privkey.pem" | ||
key: "/etc/letsencrypt/live/openpgpkey.positron-it.de/cert.pem" | ||
*/ |
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,26 @@ | ||
import { Sequelize } from 'sequelize'; | ||
import definePendingRequest from './pendingRequest.js'; | ||
import defineKey from './key.js'; | ||
import defineConfig from './config.js'; | ||
import defineDomain from './domain.js' | ||
|
||
// Initialize Sequelize (you can replace the SQLite connection with your actual database) | ||
const sequelize = new Sequelize({ | ||
dialect: 'sqlite', | ||
storage: ':memory:', // This sets up an in-memory SQLite database | ||
}); | ||
|
||
// Initialize models | ||
const Domain = defineDomain(sequelize); | ||
const Key = defineKey(sequelize); | ||
const pendingRequest = definePendingRequest(sequelize); | ||
const Config = defineConfig(sequelize); | ||
|
||
// Setup associations | ||
pendingRequest.belongsTo(Key, { | ||
foreignKey: 'email', // Foreign key column in pendingRequest | ||
//as: 'key' // Alias for the relationship | ||
}); | ||
|
||
// Export models and sequelize connection | ||
export { sequelize, pendingRequest, Key , Config, Domain}; |
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,31 @@ | ||
import {DataTypes} from 'sequelize'; | ||
|
||
const defineKey = (sequelize) => { | ||
const Key = sequelize.define('Key', | ||
{ | ||
email: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
wkdHash: { | ||
type: DataTypes.STRING, | ||
allowNull: false | ||
}, | ||
domain: { | ||
type: DataTypes.STRING, | ||
allowNull: false | ||
}, | ||
key: { | ||
type: DataTypes.STRING, | ||
allowNull: false | ||
}, | ||
status: { | ||
type: DataTypes.ENUM('pending','published'), | ||
allowNull: false | ||
}, | ||
}); | ||
|
||
return Key; | ||
}; | ||
|
||
export default defineKey; |
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,15 @@ | ||
import { DataTypes } from 'sequelize'; | ||
|
||
const definePendingRequest = (sequelize) => { | ||
const pendingRequest = sequelize.define('pendingRequest', { | ||
token: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
} | ||
}); | ||
|
||
// You won't define associations here directly | ||
return pendingRequest; | ||
}; | ||
|
||
export default definePendingRequest; |