30 lines
873 B
JavaScript
30 lines
873 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
|
||
|
},
|
||
|
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;
|
||
|
};
|