takePointer<T extends NativeType> method

SodiumPointer<T> takePointer<T extends NativeType>(
  1. SodiumPointer<T> pointer
)

Returns pointer to the caller live and stops tracking it, so scope exit does not free it.

Covers pointers that become long-lived state, such as a secret stream crypto state or the raw bytes of an ip address. The caller becomes responsible for disposing the returned SodiumPointer. pointer must be a pointer this scope owns.

Unlike takeBytes, the pointer is handed back as-is: it keeps its finalizer and its memory protection, and no list view is created.

Implementation

SodiumPointer<T> takePointer<T extends NativeType>(SodiumPointer<T> pointer) {
  _untrack(pointer);
  return pointer;
}