# Struct signed::Signed

> A signed object whose signature has been made or verified, with its exact bytes.

`zaun_community_protocol::signed::Signed` · Struct

```rust
pub struct Signed<T> { … }
```

A signed object whose signature has been made or verified, with its exact bytes.

## Methods

### `verify_and_decode`

```rust
pub fn verify_and_decode(bytes: &[u8], sig: &Signature, key: &PublicKey, min_suite: u8) -> Result<Self, SignedError>
```

Verifies `sig` over `bytes` under `key` with `T`'s context, **then** decodes.

# Errors
`SignedError::Signature` before any decoding, or `SignedError::Decode`.

### `from_json`

```rust
pub fn from_json(json: &SignedJson, key: &PublicKey, min_suite: u8) -> Result<Self, SignedError>
```

`Self::verify_and_decode` for the JSON form `{bytes, sig}`.

# Errors
`SignedError::SignatureEncoding` for a malformed `sig`, else as `verify_and_decode`.

### `object`

```rust
pub const fn object(&self) -> &T
```

The decoded object.

### `into_object`

```rust
pub fn into_object(self) -> T
```

The decoded object, consuming the wrapper.

### `bytes`

```rust
pub fn bytes(&self) -> &[u8]
```

The canonical bytes `B`.

### `signature`

```rust
pub const fn signature(&self) -> &Signature
```

The signature.

### `hash`

```rust
pub fn hash(&self) -> [u8; 32]
```

`SHA3-256(B)`: the object's identity (never the signature, the protocol).

### `to_json`

```rust
pub fn to_json(&self) -> SignedJson
```

The JSON form `{bytes, sig}`.

## Trait implementations

`Clone`, `Debug`, `Eq`, `From<Signed<T>>`, `PartialEq`, `StructuralPartialEq`

[Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/object/struct.Signed.html)
