blob: 6d73cb45a7f0f477d3d9ed86504a4bc37b1b81c9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package session
// NewDerivedSecrets returns a new RootKey/ChainKey pair from 64 bytes of key material
// generated by the key derivation function.
func NewDerivedSecrets(keyMaterial []byte) *DerivedSecrets {
secrets := DerivedSecrets{
keyMaterial[:32],
keyMaterial[32:],
}
return &secrets
}
// DerivedSecrets is a structure for holding the derived secrets for the
// Root and Chain keys for a session.
type DerivedSecrets struct {
rootKey []byte
chainKey []byte
}
// RootKey returns the RootKey bytes.
func (d *DerivedSecrets) RootKey() []byte {
return d.rootKey
}
// ChainKey returns the ChainKey bytes.
func (d *DerivedSecrets) ChainKey() []byte {
return d.chainKey
}
|