disk: new type LUKSContainer
Representation for the encrypted storage container of the same name. Implements the following disk interfaces: - Entity - Container Co-Authored-By: Christian Kellner <christian@kellner.me>
This commit is contained in:
parent
250116638c
commit
ef2fdf16a7
1 changed files with 40 additions and 0 deletions
40
internal/disk/luks.go
Normal file
40
internal/disk/luks.go
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package disk
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Argon2id struct {
|
||||
Iterations uint
|
||||
Memory uint
|
||||
Parallelism uint
|
||||
}
|
||||
type LUKSContainer struct {
|
||||
Passphrase string
|
||||
UUID string
|
||||
Cipher string
|
||||
Label string
|
||||
Subsystem string
|
||||
SectorSize uint64
|
||||
|
||||
// password-based key derivation function
|
||||
PBKDF Argon2id
|
||||
|
||||
Payload Entity
|
||||
}
|
||||
|
||||
func (lc *LUKSContainer) IsContainer() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (lc *LUKSContainer) GetItemCount() uint {
|
||||
if lc.Payload == nil {
|
||||
return 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
func (lc *LUKSContainer) GetChild(n uint) Entity {
|
||||
if n != 0 {
|
||||
panic(fmt.Sprintf("invalid child index for LUKSContainer: %d != 0", n))
|
||||
}
|
||||
return lc.Payload
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue