mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
Add UserCertificate model with tests
- Create UserCertificate model with validations and certificate renewal logic - Add tests for UserCertificate model functionality - Add user certificates fixtures for testing - Add association between ApiUser and UserCertificates - Add required gems: dry-types, dry-struct, openssl - Add /certs to .gitignore This commit implements the base model for storing user certificates in the database, including private keys, CSRs, certificates and P12 files. The model includes basic validation and certificate renewal functionality, with comprehensive test coverage.
This commit is contained in:
parent
c192d3bf08
commit
51035d1ddf
11 changed files with 403 additions and 3 deletions
19
db/migrate/20250218115707_create_user_certificates.rb
Normal file
19
db/migrate/20250218115707_create_user_certificates.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
class CreateUserCertificates < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :user_certificates do |t|
|
||||
t.references :user, null: false, foreign_key: true
|
||||
t.binary :private_key, null: false
|
||||
t.text :csr
|
||||
t.text :certificate
|
||||
t.binary :p12
|
||||
t.string :status
|
||||
t.datetime :expires_at
|
||||
t.datetime :revoked_at
|
||||
t.string :p12_password_digest
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :user_certificates, [:user_id, :status]
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue