diff --git a/src/naxolotl/naxolotl.nim b/src/naxolotl/naxolotl.nim index 553282c..549b5bd 100644 --- a/src/naxolotl/naxolotl.nim +++ b/src/naxolotl/naxolotl.nim @@ -31,9 +31,6 @@ type Doubleratchet* = object skippedMessageKeys: Table[(PublicKey,MsgCount), MessageKey] const DomainSepKdfRoot = "DoubleRatchet" -const DomainSepKdfMsg = "MessageKey" -const DomainSepKdfChain = "ChainKey" - type DrHeader* = object @@ -68,8 +65,8 @@ func kdfRoot(self: var Doubleratchet, rootKey: RootKey, dhOutput:DhDerivedKey): func kdfChain(self: Doubleratchet, chainKey: ChainKey): (MessageKey, ChainKey) = - let msgKey = hkdfExtract(chainKey, [0x01u8], cast[seq[byte]](DomainSepKdfMsg)) - let chainKey = hkdfExtract(chainKey, [0x02u8], cast[seq[byte]](DomainSepKdfChain)) + let msgKey = hkdfExtract(chainKey, [0x01u8]) + let chainKey = hkdfExtract(chainKey, [0x02u8]) return(msgKey, chainKey) diff --git a/src/naxolotl/utils.nim b/src/naxolotl/utils.nim index 9b6e834..3665931 100644 --- a/src/naxolotl/utils.nim +++ b/src/naxolotl/utils.nim @@ -7,7 +7,7 @@ import errors import types -func hkdfExtract*(salt: openArray[byte], ikm: openArray[byte], info: openArray[byte] ) : GenericArray = +func hkdfExtract*(salt: openArray[byte], ikm: openArray[byte]) : GenericArray = assert GenericArray.len == sha256.digestSize()