2019-11-26 22:42:26 +02:00

34 lines
963 B
JavaScript

module.exports = function (sequelize, DataTypes, options) {
const model = sequelize.define("key", { // TODO: Rename to wallet
id: {
type: DataTypes.STRING,
defaultValue: function() {
return options.generateUniqueId()
},
primaryKey: true,
unique: true
},
encryptedPrivateKey: {
type: DataTypes.STRING,
allowNull: false
},
iv: {
type: DataTypes.STRING,
allowNull: false
},
name: {
type: DataTypes.STRING,
unique: true
}
// TODO: Add order to allow for user to set default keys
}, {
comment: "The keys we are using in our system (seedphrase)."
});
model.associate = (db) => {
model.Locks = model.hasMany(db.Lock);
model.ExtendedPublicKeys = model.hasMany(db.ExtendedPublicKey);
}
return model;
};