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(event: Event, options: LogOptions): Promise<PangeaResponse<LogResponse>>

Create a log entry in the Secure Audit Log.

required parameters

Audit.Event

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

Promise<PangeaResponse<LogResponse>>
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

Promise<PangeaResponse<ResultResponse>>
const response = await audit.results(
  "pas_sqilrhruwu54uggihqj3aie24wrctakr",
  50,
  100
);

Tamperproof verification

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

Returns current root hash and consistency proof.

required parameters

number

The size of the tree (the number of records)

Response Object

Promise<PangeaResponse<RootResult>>
const response = audit.root(7);

Search the log

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

Promise<PangeaResponse<SearchResponse>>
const response = await audit.search(
  "add_employee:Gumby"
);

Interface AuditRecord

AuditRecord

required parameters

Audit.EventEnvelope
string

optional parameters

string
string
string
string
boolean
string

Interface Event

Event

Interface EventEnvelope

EventEnvelope

required parameters

Audit.Event
string

optional parameters

string
string

Interface LogData

LogData

required parameters

Audit.Event

optional parameters

string
string
string
boolean

Interface LogOptions

LogOptions

optional parameters

boolean
boolean
boolean

Interface LogResponse

LogResponse

required parameters

Audit.EventEnvelope
string

optional parameters

Array<string>
string
string
string
string
string

Interface ResultResponse

ResultResponse

required parameters

number

optional parameters

Interface Root

Root

required parameters

Array<string>
string
number
string

optional parameters

string
string

Interface RootParams

RootParams

optional parameters

number

Interface RootRequest

RootRequest

optional parameters

number

Interface RootResult

RootResult

required parameters

Array<string>
string
number
string

optional parameters

string
string

Interface SearchOptions

SearchOptions

optional parameters

boolean
boolean

Interface SearchParams

SearchParams

required parameters

string

optional parameters

string
number
number
string
string
Audit.SearchRestriction
string
boolean

Interface SearchParamsOptions

SearchParamsOptions

optional parameters

string
number
number
string
string
Audit.SearchRestriction
string
boolean

Interface SearchResponse

SearchResponse

required parameters

number
string
string

optional parameters

Audit.Root

Interface SearchRestriction

SearchRestriction

optional parameters

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