credential_entity

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypePassword = "password"
	TypeSSHKey   = "ssh_key"
)

凭证类型常量

View Source
const (
	KeyTypeRSA     = "rsa"
	KeyTypeED25519 = "ed25519"
	KeyTypeECDSA   = "ecdsa"
)

SSH 密钥类型常量

Variables

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential struct {
	ID          int64  `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
	Name        string `gorm:"column:name;type:varchar(255);not null" json:"name"`
	Type        string `gorm:"column:type;type:varchar(50);not null" json:"type"` // "password" | "ssh_key"
	Username    string `gorm:"column:username;type:varchar(255)" json:"username,omitempty"`
	Password    string `gorm:"column:password;type:text" json:"-"`    // 加密后的密码(type=password)
	PrivateKey  string `gorm:"column:private_key;type:text" json:"-"` // 加密后的私钥(type=ssh_key)
	Passphrase  string `gorm:"column:passphrase;type:text" json:"-"`  // 加密后的私钥密码(type=ssh_key)
	PublicKey   string `gorm:"column:public_key;type:text" json:"publicKey,omitempty"`
	KeyType     string `gorm:"column:key_type;type:varchar(50)" json:"keyType,omitempty"` // rsa/ed25519/ecdsa
	KeySize     int    `gorm:"column:key_size" json:"keySize,omitempty"`
	Fingerprint string `gorm:"column:fingerprint;type:varchar(255)" json:"fingerprint,omitempty"`
	Comment     string `gorm:"column:comment;type:varchar(255)" json:"comment,omitempty"`
	Description string `gorm:"column:description;type:text" json:"description,omitempty"`
	Createtime  int64  `gorm:"column:createtime" json:"createtime"`
	Updatetime  int64  `gorm:"column:updatetime" json:"updatetime"`
}

Credential 统一凭证实体

func (*Credential) IsPassword

func (c *Credential) IsPassword() bool

IsPassword 判断是否密码类型

func (*Credential) IsSSHKey

func (c *Credential) IsSSHKey() bool

IsSSHKey 判断是否 SSH 密钥类型

func (Credential) TableName

func (Credential) TableName() string

TableName GORM 表名

func (*Credential) Validate

func (c *Credential) Validate() error

Validate 校验

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL