Skip to main content

Secret

Stores secret data.

Description

A secret is an object that stores a small amount of secret data such as a private key or mnemonic. Objects such as Network often reference Secret objects in places where plain text private keys or mnemonics might otherwise be used. This also means that you would not have to hardcode your secrets in application code.

Even though Secret objects are encrypted at rest and protected by role-based access control, we strongly recommend using test-only credentials that do not hold access to real funds.

Data format

Secret endpoints accept and return base64-encoded raw bytes. If a credential is currently expressed as a hexadecimal string, you must first hex-decode it to its binary form and then base64-encode those bytes. Encoding the ASCII hex text directly (hex to base64) is not valid; it stores the literal characters rather than the underlying key bytes.

Secret type

The type field accepts any string and is intended purely as a hint to clients about how the secret payload should be interpreted. For example, a client might create a Secret with "type": "ethereum-private-key". When that client later retrieves the object, it first inspects type and then applies the corresponding decoding routine (in this case, “Ethereum private key” logic). The system itself does not validate or enforce these values — the convention is entirely client-driven.

Operations

GET /v1alpha/secrets

List all the secrets created by the current requester.

Query parameters

ListOptions

Selectable fields: type, metadata.ownerID

Responses

HTTP CodeResponse
200 OKSecretList
404 Not FoundError

GET /v1alpha/secrets/{id}

Get a secret by ID

Responses

HTTP CodeResponse
200 OKSecret
404 Not FoundError

POST /v1alpha/secrets

Create a secret

Request body

Secret

{
"name": "octonet-private-key",
"type": "ethereum-private-key",
"data": "u9RSIoP5ccN8wTdYcqqpjVu71rAGUu45lt2w1qQDiDU="
}

Responses

HTTP CodeResponse
201 CreatedSecret
400 Bad RequestError

DELETE /v1alpha/secrets/{id}

Coming soon

Responses

HTTP CodeResponse
200 OKSecret
404 Not FoundError
409 ConflictError

API objects

Secret

FieldTypeRequiredNotes
metadataObjectMetaStandard object metadata
typestringYesClient set secret type
datastringYesBase64 encoded secret data

SecretList

FieldTypeRequiredNotes
itemsSecret[]YesThe items of this list
metadataListMeta