Giter VIP home page Giter VIP logo

Comments (5)

philips77 avatar philips77 commented on September 2, 2024

Hi,
Yes, it is possible. For that you have to send ConfigNetKeyUpdate or ConfigAppKeyUpdate message to [local Node](

func sendToLocalNode(_ message: ConfigMessage) throws -> MessageHandle {
, just like to any other Node.

The message will be handled here:

if networkKey.phase == .normalOperation {
// Update the key data (observer will set the `oldKey` automatically).
networkKey.key = request.key
// And mark the key in the local Node as updated.
localNode.update(networkKeyWithIndex: keyIndex)
}
return ConfigNetKeyStatus(confirm: networkKey)

Setting the key in line 141 does the following:
public internal(set) var key: Data {
willSet {
oldKey = key
oldNetworkId = networkId
oldKeys = keys
}
didSet {
phase = .keyDistribution
regenerateKeyDerivatives()
}
}

The update(networkKeyWithIndex sets the updated flag in the Node's key list:
/// Marks the Network Key in the Node as updated.
///
/// - parameter networkKeyIndex: The Network Key index to add.
func update(networkKeyWithIndex networkKeyIndex: KeyIndex) {
if let key = netKeys[networkKeyIndex] {
key.updated = true
meshNetwork?.timestamp = Date()
}
}

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on September 2, 2024

You may find some info here: #314

from ios-nrf-mesh-library.

eanderlind avatar eanderlind commented on September 2, 2024

Thanks - that explains the 2nd half of the process. The remaining part is how to instantiate the two messages with the new key. Looks like only way is to generate a newkey bytestring and then hand craft a msg using the ConfigNetKeyUpdate(parameters:Data) initializer.

Not intuitive, but we will try it out... Thanks. Closing the issue since there is a workaround.

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on September 2, 2024

Great that you pointed it out. That needs improvement. I'll fix it in the next (big!) release.

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on September 2, 2024

@eanderlind I fixed the API. The 2 config messages now allow to pass the new key as Data.

from ios-nrf-mesh-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.