Skip to main content

Audit | Node.js SDK

The audit API is designed for recording a trail of application-based user activity in a scalable, tamper-proof log.

Log an entry

log(content: Event, options: LogOptions): Promise<PangeaResponse<LogResponse>>

Create a log entry in the Secure Audit Log.

required parameters

Event

A structured event describing an auditable activity. Supported fields are:

  • actor (string): Record who performed the auditable activity.
  • action (string): The auditable action that occurred.
  • status (string): Record whether or not the activity was successful.
  • source (string): Used to record the location from where an activity occurred.
  • target (string): Used to record the specific record that was targeted by the auditable activity.
  • message (string|object): A message describing a detailed account of what happened. This can be recorded as free-form text or as a JSON-formatted string.
  • new (string|object): The value of a record after it was changed.
  • old (string|object): The value of a record before it was changed.
  • tenant_id (string): Used to record the tenant associated with this activity.
LogOptions

Log options. The following log options are supported:

  • verbose (bool): Return a verbose response, including the canonical event hash and received_at time.

Response Object

const auditData = {
   action: "add_employee",
   actor: user,
   target: data.email,
   status: "error",
   message: `Resume denied - sanctioned country from ${clientIp}`,
   source: "web",
 };

 const logResponse = await audit.log(auditData);
results(id: string, limit: number, offset: number, options: SearchOptions): Promise<PangeaResponse<ResultResponse>>

Fetch paginated results of a previously executed search

required parameters

string

The id of a successful search

number

(default 20) - The number of results returned

number

(default 0) - The starting position of the first returned result

Response Object

const response = await audit.results(pxx_asd0987asdas89a8, 50, 100)

Retrieve tamperproof verification

root(size: number): Promise<PangeaResponse<RootResponse>>

Returns current root hash and consistency proof

required parameters

number

The size of the tree (the number of records)

Response Object

const response = audit.root(7);

Search for events

search(query: string, queryOptions: SearchParamsOptions, options: SearchOptions): Promise<PangeaResponse<SearchResponse>>

Search for events that match the provided search criteria.

required parameters

string

Natural search string; list of keywords with optional

Search options. The following search options are supported:

  • limit (number): Maximum number of records to return per page.
  • start (string): The start of the time range to perform the search on.
  • end (string): The end of the time range to perform the search on. All records up to the latest if left out.
  • sources (array): A list of sources that the search can apply to. If empty or not provided, matches only the default source.

Response Object

const response = await audit.search("add_employee:Gumby")

Enumeration SignOptions

enumeration SignOptions

Interface AuditRecord

interface AuditRecord

required parameters

EventEnvelope
string

optional parameters

string
string
string
string
boolean
string

Interface Event

interface Event

required parameters

string | Object

optional parameters

string
string
string | Object
string | Object
string
string
string
string
string | Date

Interface EventEnvelope

interface EventEnvelope

required parameters

Event
string

optional parameters

string
string

Interface LogData

interface LogData

required parameters

Event

optional parameters

string
string
string
boolean

Interface LogOptions

interface LogOptions

optional parameters

SignOptions
Signer
boolean
boolean
boolean

Interface LogResponse

interface LogResponse

required parameters

EventEnvelope
string

optional parameters

Array<string>
string
string
string
string
string

Interface ResultResponse

interface ResultResponse

required parameters

number

optional parameters

Root

Interface Root

interface Root

required parameters

Array<string>
string
number
string

optional parameters

string
string

Interface RootParams

interface RootParams

optional parameters

number

Interface RootRequest

interface RootRequest

optional parameters

number

Interface RootResponse

interface RootResponse

required parameters

Array<string>
Root
string
number
string

optional parameters

string
string

Interface SearchOptions

interface SearchOptions

optional parameters

boolean
boolean

Interface SearchParams

interface SearchParams

required parameters

string

optional parameters

string
number
number
string
string
SearchRestriction
string
boolean

Interface SearchParamsOptions

interface SearchParamsOptions

optional parameters

string
number
number
string
string
SearchRestriction
string
boolean

Interface SearchResponse

interface SearchResponse

required parameters

number
string
string

optional parameters

Root
Root

Interface SearchRestriction

interface SearchRestriction

optional parameters

Array<string>
Array<string>
Array<string>
Array<string>
Array<string>