# Module std::internal

*[Documentation index](/llms.txt) · [Full index](/llms-full.txt)*

Defines the [Permit](../sui_std/internal#std_internal_Permit) type, which can be used to constrain the logic of a
generic function to be authorized only by the module that defines the type
parameter.

```move
module example::use_permit;

public struct MyType \{ /* ... */ \}

public fun test_permit() \{
   let permit = internal::permit<MyType>();
   /* external_module::call_with_permit(permit); */
\}
```

To write a function that is guarded by a [Permit](../sui_std/internal#std_internal_Permit), require it as an argument.

```move
// Silly mockup of a type registry where a type can be registered only by
// the module that defines the type.
module example::type_registry;

public fun register_type<T>(_: internal::Permit<T> /* ... */) {
  /* ... */
}
```

## Struct Permit

A privileged witness of the T type.

Instances can only be created by the module that defines the type T.

```
public struct Permit&lt;phantom T&gt; has drop
```

## Function permit

Construct a new [Permit](../sui_std/internal#std_internal_Permit) for the type T.

Can only be called by the module that defines the type T.

```
public fun permit&lt;T&gt;(): std::internal::Permit&lt;T&gt;
```
