SecureKey.fromNativeHandle constructor

  1. @experimental
SecureKey.fromNativeHandle(
  1. Sodium sodium,
  2. dynamic nativeHandle
)

Creates a secure key from a previously extracted SecureKey.nativeHandle.

Dangerous API. Only use if you have no other choice and you know what you are doing. You have been warned!

Convenience factory constructor that redirects to Sodium.secureHandle and calls it with nativeHandle on sodium.

Creating such a secure key will not create a copy of it, but instead operate on the same low-level data. This means, if you take the handle from one key and create a new one using this method, both SecureKey instances will point to the same data.

Important: Since multiple keys to the same handle all operate on the same data, disposing one will dispose all, and changes to one immediatly are reflected to the others. When using a handle across isolate boundaries, make sure the different isolates never access the key at the same time, as that might break the native code.

Implementation

@experimental
factory SecureKey.fromNativeHandle(Sodium sodium, dynamic nativeHandle) =>
    sodium.secureHandle(nativeHandle);