> For the complete documentation index, see [llms.txt](https://docs.talus.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.talus.network/talus-docs-v2.1.0/reference/move/nexus_primitives/authorization.md).

# authorization

* [Struct `ProvenValue`](#struct-provenvalue)
* [Struct `CloneableProvenValue`](#struct-cloneableprovenvalue)
* [Struct `Grant`](#struct-grant)
* [Constants](#constants)
* [Function `wrap`](#function-wrap)
* [Function `wrap_for_recipient`](#function-wrap_for_recipient)
* [Function `wrap_cloneable`](#function-wrap_cloneable)
* [Function `wrap_cloneable_for_recipient`](#function-wrap_cloneable_for_recipient)
* [Function `grant`](#function-grant)
* [Function `grant_for_recipient`](#function-grant_for_recipient)
* [Function `unwrap`](#function-unwrap)
* [Function `unwrap_as_recipient`](#function-unwrap_as_recipient)
* [Function `unwrap_cloneable`](#function-unwrap_cloneable)
* [Function `cloneable_into_proven_value`](#function-cloneable_into_proven_value)
* [Function `grant_into_proven_value`](#function-grant_into_proven_value)
* [Function `drop`](#function-drop)
* [Function `by`](#function-by)
* [Function `recipient`](#function-recipient)
* [Function `cloneable_value`](#function-cloneable_value)
* [Function `cloneable_by`](#function-cloneable_by)
* [Function `cloneable_recipient`](#function-cloneable_recipient)
* [Function `grant_value`](#function-grant_value)
* [Function `grant_by`](#function-grant_by)
* [Function `grant_recipient`](#function-grant_recipient)

### Struct `ProvenValue`

Value that can be trusted to have been created by a UID. Optionally, the value can also be locked to be received only by a given recipient.

```move
public struct ProvenValue<T>
```

<details>

<summary>Fields</summary>

`value: T`[`by`](#nexus_primitives_authorization_by)`: sui::object::ID`[`recipient`](#nexus_primitives_authorization_recipient)`: std::option::Option<sui::object::ID>`

</details>

#### Struct `CloneableProvenValue`

Proven value material that can be copied by authorized holder code.

```move
public struct CloneableProvenValue<T: copy, store> has copy, drop, store
```

<details>

<summary>Fields</summary>

`value: T`[`by`](#nexus_primitives_authorization_by)`: sui::object::ID`[`recipient`](#nexus_primitives_authorization_recipient)`: std::option::Option<sui::object::ID>`

</details>

#### Struct `Grant`

Copyable authorization grant backed by proven value material.

```move
public struct Grant<T: copy, store> has copy, drop, store
```

<details>

<summary>Fields</summary>

`proof:` [`nexus_primitives::authorization::CloneableProvenValue`](#nexus_primitives_authorization_CloneableProvenValue)`<T>`

</details>

#### Constants

```move
#[error]
const ENotRecipient: vector<u8> = b"Not the expected recipient";
```

#### Function `wrap`

Proves that the value was wrapped by the given UID. Anyone can unwrap the value.

```move
public fun wrap<T>(by: &sui::object::UID, value: T): nexus_primitives::authorization::ProvenValue<T>
```

#### Function `wrap_for_recipient`

Proves that the value was wrapped by the given UID. Only the recipient UID can unwrap the value.

```move
public fun wrap_for_recipient<T>(by: &sui::object::UID, value: T, recipient: sui::object::ID): nexus_primitives::authorization::ProvenValue<T>
```

#### Function `wrap_cloneable`

Proves that the value was wrapped by the given UID, as copyable material. Anyone can unwrap the value.

```move
public fun wrap_cloneable<T: copy, store>(by: &sui::object::UID, value: T): nexus_primitives::authorization::CloneableProvenValue<T>
```

#### Function `wrap_cloneable_for_recipient`

Proves that the value was wrapped by the given UID, as copyable material. Only the recipient UID can unwrap the value.

```move
public fun wrap_cloneable_for_recipient<T: copy, store>(by: &sui::object::UID, value: T, recipient: sui::object::ID): nexus_primitives::authorization::CloneableProvenValue<T>
```

#### Function `grant`

Wraps the value into a copyable authorization grant unwrappable by anyone.

```move
public fun grant<T: copy, store>(by: &sui::object::UID, value: T): nexus_primitives::authorization::Grant<T>
```

#### Function `grant_for_recipient`

Wraps the value into a copyable authorization grant for a specific recipient.

```move
public fun grant_for_recipient<T: copy, store>(by: &sui::object::UID, value: T, recipient: sui::object::ID): nexus_primitives::authorization::Grant<T>
```

#### Function `unwrap`

Unwraps an unrestricted proven value, discarding the proof metadata. Recipient-bound values abort with `ENotRecipient`; use `unwrap_as_recipient` with the matching UID.

```move
public fun unwrap<T>(self: nexus_primitives::authorization::ProvenValue<T>): T
```

#### Function `unwrap_as_recipient`

Unwraps the proven value on behalf of its recipient. Aborts if the value is locked to a recipient other than the given UID.

```move
public fun unwrap_as_recipient<T>(self: nexus_primitives::authorization::ProvenValue<T>, recipient: &sui::object::UID): T
```

#### Function `unwrap_cloneable`

Unwraps unrestricted copyable proven material, discarding the proof metadata. Recipient-bound material aborts with `ENotRecipient` and must first become a `ProvenValue`.

```move
public fun unwrap_cloneable<T: copy, store>(self: nexus_primitives::authorization::CloneableProvenValue<T>): T
```

#### Function `cloneable_into_proven_value`

Converts copyable proven material into a non-copyable proven value, preserving the wrapper UID and recipient.

```move
public fun cloneable_into_proven_value<T: copy, store>(self: nexus_primitives::authorization::CloneableProvenValue<T>): nexus_primitives::authorization::ProvenValue<T>
```

#### Function `grant_into_proven_value`

Converts an authorization grant into a non-copyable proven value.

```move
public fun grant_into_proven_value<T: copy, store>(self: nexus_primitives::authorization::Grant<T>): nexus_primitives::authorization::ProvenValue<T>
```

#### Function `drop`

Discards a proven value whose inner type can be dropped.

```move
public fun drop<T: drop>(self: nexus_primitives::authorization::ProvenValue<T>)
```

#### Function `by`

Who wrapped the value.

```move
public fun by<T>(self: &nexus_primitives::authorization::ProvenValue<T>): sui::object::ID
```

#### Function `recipient`

Who is the recipient of the value, if any.

```move
public fun recipient<T>(self: &nexus_primitives::authorization::ProvenValue<T>): std::option::Option<sui::object::ID>
```

#### Function `cloneable_value`

The copyable proven material's inner value.

```move
public fun cloneable_value<T: copy, store>(self: &nexus_primitives::authorization::CloneableProvenValue<T>): T
```

#### Function `cloneable_by`

The UID that wrapped the copyable proven material.

```move
public fun cloneable_by<T: copy, store>(self: &nexus_primitives::authorization::CloneableProvenValue<T>): sui::object::ID
```

#### Function `cloneable_recipient`

The recipient the copyable proven material is locked to, if any.

```move
public fun cloneable_recipient<T: copy, store>(self: &nexus_primitives::authorization::CloneableProvenValue<T>): std::option::Option<sui::object::ID>
```

#### Function `grant_value`

The grant's inner value.

```move
public fun grant_value<T: copy, store>(self: &nexus_primitives::authorization::Grant<T>): T
```

#### Function `grant_by`

The UID that issued the grant.

```move
public fun grant_by<T: copy, store>(self: &nexus_primitives::authorization::Grant<T>): sui::object::ID
```

#### Function `grant_recipient`

The recipient the grant is locked to, if any.

```move
public fun grant_recipient<T: copy, store>(self: &nexus_primitives::authorization::Grant<T>): std::option::Option<sui::object::ID>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.talus.network/talus-docs-v2.1.0/reference/move/nexus_primitives/authorization.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
