Crypto_core_hsalsa20 with Swift

I use ‘TweetNacl’ (https://github.com/bitmark-inc/tweetnacl-swiftwrap) for this step:
“Both sides derive a long term shared secret key s from k using function kdf1”
And I use SL public key and CL secret key from example 1.

I get three different values. But all of them iare wrong.
1)
54D205AEFC500782A62F8C1CD89FB159BBBD03FA925A1BDE3E225FAA98E4E9A4B7FD880A1C1344C144B321CD4FC3B4B7ADDB4AE054B31F507018FEB0EC78B7C4
2)
CE577D44BF2E914555665091895E6D85D9EE4BF841BF209FD743F83F6BD5A8B3833B072603DF39587078D37347E7EA3C49A52C6D4A1D3CE114C3A10CD927EA3D
3)
4909F31645FED0CF329C8C1CBCD58C278408246E40200FFC3F2DA328A1A866A03FE09D636B87291037880E395C70003428D75BA6B7C23437F80EBCFF636777E1

Could anybody explain how it do right?

There are only for params: result buffer (64 bytes), random number from 64 to 128, SL and CL keys.

My code

func method1(mySecretKey:Data, theirPublicKey:Data) {
    var bytes = UnsafeMutablePointer(mutating: [UInt8](Data(count: 64)))
    let secretCodePointer = UnsafePointer([UInt8](mySecretKey))
    let theirPublicKeyPointer = UnsafePointer([UInt8](theirPublicKey))

    crypto_stream_salsa20_tweet(bytes, 64, secretCodePointer, theirPublicKeyPointer)
    
    print("\(Data(bytes:bytes, count: 64))")
}

No direct answer to your question, but maybe one of this two Nuki Fob implementations are of help for you:


Unfortunately, no one from these answers doesn’t allow me to know how can I achieve right result with kdf1 function.