Skip to content

ChainGraph API Documentation / @badaitech/chaingraph-types / deserialize

Function: deserialize()

deserialize<T>(secretType, value): EncryptedSecretValue<T>

Defined in: packages/chaingraph-types/src/port/base/secret.ts:324

Deserialize a secret of supported type.

Type Parameters

T

T extends "string" | "openai" | "0g" | "anthropic" | "gemini" | "coinmarketcap" | "deepseek" | "groq" | "moonshot" | "xAPI" | "xApp" | "OkxDexApi" | "alchemy"

Parameters

secretType

T

type of the secret value.

value

unknown

the JSON to deserialize the value from.

Returns

EncryptedSecretValue<T>

Throws

Error if value has an incorrect JSON type. value must be string.

Throws

Error if secret type is not supported.

Licensed under BUSL-1.1