0.0
The project is in a healthy, maintained state
Customer-facing Ruby SDK for Tripwire Sessions, Fingerprints, Teams, and sealed token verification.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Tripwire Ruby Library

Preview Ruby 2.6+ License: MIT

The Tripwire Ruby library provides convenient access to the Tripwire API from applications written in Ruby. It includes a client for Sessions, visitor fingerprints, Teams, Team API key management, and sealed token verification.

The library also provides:

  • a fast configuration path using TRIPWIRE_SECRET_KEY
  • lazy helpers for cursor-based pagination
  • structured API errors and built-in sealed token verification

Documentation

See the Tripwire docs and API reference.

Installation

You don't need this source code unless you want to modify the gem. If you just want to use the package, run:

bundle add tripwire-server

Requirements

  • Ruby 2.6+

Usage

The library needs to be configured with your account's secret key. Set TRIPWIRE_SECRET_KEY in your environment or pass secret_key directly:

require "tripwire/server"

client = Tripwire::Server::Client.new(secret_key: "sk_live_...")

page = client.sessions.list(verdict: "bot", limit: 25)
session = client.sessions.get("sid_0123456789abcdefghjkmnpqrs")

puts "#{session[:decision][:automation_status]} #{session[:highlights].first&.fetch(:summary, nil)}"

Sealed token verification

result = Tripwire::Server.safe_verify_tripwire_token(sealed_token, "sk_live_...")

if result[:ok]
  puts "#{result[:data][:decision][:verdict]} #{result[:data][:decision][:risk_score]}"
else
  warn result[:error].message
end

Pagination

client.sessions.iter(search: "signup").each do |session|
  puts "#{session[:id]} #{session[:latest_decision][:verdict]}"
end

Visitor fingerprints

fingerprint = client.fingerprints.get("vid_0123456789abcdefghjkmnpqrs")
puts fingerprint[:id]

Teams

team = client.teams.get("team_0123456789abcdefghjkmnpqrs")
updated = client.teams.update("team_0123456789abcdefghjkmnpqrs", name: "New Name")

puts updated[:name]

Team API keys

created = client.teams.api_keys.create("team_0123456789abcdefghjkmnpqrs", name: "Production", environment: "live")
client.teams.api_keys.revoke("team_0123456789abcdefghjkmnpqrs", created[:id])

Error handling

begin
  client.sessions.list(limit: 999)
rescue Tripwire::Server::ApiError => error
  warn "#{error.status} #{error.code} #{error.message}"
end

Support

If you need help integrating Tripwire, start with tripwirejs.com/docs.