---
title: SecretFromBytes
summary: FromBytes creates an instance of the Secret type for use with APIs that require it from the provided byte slice.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/secretstore/fn.SecretFromBytes/
---

**Kind:** Function  
**Module:** [secretstore](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/secretstore/)  
**Package:** compute-sdk-go v1.11.0  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/secretstore/secretstore.go#L124

```go
func SecretFromBytes(b []byte) (*Secret, error)
```

FromBytes creates an instance of the [Secret](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/secretstore/struct.Secret/) type for use with APIs
that require it from the provided byte slice.

This function is provided as a way to use data that should be secret,
but is being obtained by some other means than a Fastly Secret Store.
Secret values created this way are plaintext only, and are not shared
via a Store.  This should only be used in situations in which
an API requires a [Secret](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/secretstore/struct.Secret/), but you cannot (for whatever reason) use
a [Store](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/secretstore/struct.Store/) to store them.

It is strongly suggested to store secrets in a [Store](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/secretstore/struct.Store/) and create
Secret values by calling [Store.Get](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/secretstore/struct.Store/#method-Get).

**Parameters**

- `b`: `[]byte`

**Returns**

`(*Secret, error)`
