Files
a301_server/internal/chain/model.go

23 lines
1.0 KiB
Go

package chain
import (
"time"
"gorm.io/gorm"
)
// UserWallet stores an encrypted ed25519 keypair linked to a user.
type UserWallet struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
UserID uint `json:"userId" gorm:"uniqueIndex;not null"`
PubKeyHex string `json:"pubKeyHex" gorm:"type:varchar(64);uniqueIndex;not null"`
Address string `json:"address" gorm:"type:varchar(40);uniqueIndex;not null"`
EncryptedPrivKey string `json:"-" gorm:"type:varchar(512);not null"`
EncNonce string `json:"-" gorm:"type:varchar(48);not null"`
KeyVersion int `json:"-" gorm:"type:tinyint;default:1;not null"`
HKDFSalt string `json:"-" gorm:"type:varchar(32)"` // 16 bytes hex, nullable for v1
}