Skip to content

ToolApprovalSignatures

Namespace: Vercel.AI.GenerateText

public static class ToolApprovalSignatures

HMAC approval signatures. Maps to signToolApproval and verifyToolApprovalSignature.

Inheritance: object

View source

MaybeSignApproval(string?, string, string, string, JsonElement)

Section titled “MaybeSignApproval(string?, string, string, string, JsonElement)”
public static string? MaybeSignApproval(string? secret, string approvalId, string toolCallId, string toolName, JsonElement input)

Returns a signature when <code class=“paramref”>secret</code> is set, and null when it is not.

Parameters

Name Type Description
secret string
approvalId string
toolCallId string
toolName string
input JsonElement

Returns: string

View source

SignToolApproval(byte[], string, string, string, JsonElement)

Section titled “SignToolApproval(byte[], string, string, string, JsonElement)”
public static string SignToolApproval(byte[] secret, string approvalId, string toolCallId, string toolName, JsonElement input)

Signs a tool approval with a raw secret.

Parameters

Name Type Description
secret byte[]
approvalId string
toolCallId string
toolName string
input JsonElement

Returns: string

View source

SignToolApproval(string, string, string, string, JsonElement)

Section titled “SignToolApproval(string, string, string, string, JsonElement)”
public static string SignToolApproval(string secret, string approvalId, string toolCallId, string toolName, JsonElement input)

Signs a tool approval. Equivalent inputs with different key order produce the same signature.

Parameters

Name Type Description
secret string
approvalId string
toolCallId string
toolName string
input JsonElement

Returns: string

View source

VerifyToolApprovalSignature(byte[], string, string, string, string, JsonElement)

Section titled “VerifyToolApprovalSignature(byte[], string, string, string, string, JsonElement)”
public static bool VerifyToolApprovalSignature(byte[] secret, string signature, string approvalId, string toolCallId, string toolName, JsonElement input)

Verifies a signature with a raw secret.

Parameters

Name Type Description
secret byte[]
signature string
approvalId string
toolCallId string
toolName string
input JsonElement

Returns: bool

View source

VerifyToolApprovalSignature(string, string, string, string, string, JsonElement)

Section titled “VerifyToolApprovalSignature(string, string, string, string, string, JsonElement)”
public static bool VerifyToolApprovalSignature(string secret, string signature, string approvalId, string toolCallId, string toolName, JsonElement input)

Verifies a signature. Accepts the current JSON payload and, when no field contains a newline, a legacy newline-joined payload.

Parameters

Name Type Description
secret string
signature string
approvalId string
toolCallId string
toolName string
input JsonElement

Returns: bool

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product