@looptail/sdk
Advanced tools
+6
-0
@@ -38,4 +38,10 @@ export declare const FORMAT_VERSION = "0.1"; | ||
| signHash(hexHash: string): string; | ||
| /** Sign raw bytes — server receipts sign the canonical JSON of their | ||
| * payload, not a hex hash. Loop events use signHash. */ | ||
| signBytes(data: Uint8Array): string; | ||
| } | ||
| export declare function verifySignature(hexHash: string, sigB64url: string, keyB64url: string): boolean; | ||
| /** Verify an Ed25519 signature over raw bytes (the counterpart of | ||
| * SigningKey.signBytes; used for server anchor receipts). */ | ||
| export declare function verifyBytes(data: Uint8Array, sigB64url: string, keyB64url: string): boolean; | ||
| export interface VerifyResult { | ||
@@ -42,0 +48,0 @@ ok: boolean; |
+15
-0
@@ -101,2 +101,7 @@ /** | ||
| } | ||
| /** Sign raw bytes — server receipts sign the canonical JSON of their | ||
| * payload, not a hex hash. Loop events use signHash. */ | ||
| signBytes(data) { | ||
| return b64url(edSign(null, Buffer.from(data), this.privateKey)); | ||
| } | ||
| } | ||
@@ -111,2 +116,12 @@ export function verifySignature(hexHash, sigB64url, keyB64url) { | ||
| } | ||
| /** Verify an Ed25519 signature over raw bytes (the counterpart of | ||
| * SigningKey.signBytes; used for server anchor receipts). */ | ||
| export function verifyBytes(data, sigB64url, keyB64url) { | ||
| try { | ||
| return edVerify(null, Buffer.from(data), publicFromRaw(b64urlDecode(keyB64url)), b64urlDecode(sigB64url)); | ||
| } | ||
| catch { | ||
| return false; | ||
| } | ||
| } | ||
| /** Verify a list of events in file order per spec §4. */ | ||
@@ -113,0 +128,0 @@ export function verifyChain(events) { |
+1
-1
@@ -17,3 +17,3 @@ /** | ||
| import { TrailStore } from './store.js'; | ||
| export { canonical, eventHash, SigningKey, ulid, verifyChain, verifySignature, FORMAT_VERSION, KINDS, } from './chain.js'; | ||
| export { canonical, eventHash, SigningKey, ulid, verifyBytes, verifyChain, verifySignature, FORMAT_VERSION, KINDS, } from './chain.js'; | ||
| export type { Kind, TrailEvent, VerifyResult } from './chain.js'; | ||
@@ -20,0 +20,0 @@ export { TrailStore } from './store.js'; |
+1
-1
@@ -18,3 +18,3 @@ /** | ||
| import { Transport } from './transport.js'; | ||
| export { canonical, eventHash, SigningKey, ulid, verifyChain, verifySignature, FORMAT_VERSION, KINDS, } from './chain.js'; | ||
| export { canonical, eventHash, SigningKey, ulid, verifyBytes, verifyChain, verifySignature, FORMAT_VERSION, KINDS, } from './chain.js'; | ||
| export { TrailStore } from './store.js'; | ||
@@ -21,0 +21,0 @@ const MAX_REPR = 2048; |
+13
-3
| { | ||
| "name": "@looptail/sdk", | ||
| "version": "0.1.0", | ||
| "version": "0.2.0", | ||
| "description": "Record every AI decision as a signed, append-only trail. Every loop leaves a tail.", | ||
@@ -15,3 +15,6 @@ "license": "Apache-2.0", | ||
| }, | ||
| "files": ["dist", "README.md"], | ||
| "files": [ | ||
| "dist", | ||
| "README.md" | ||
| ], | ||
| "engines": { | ||
@@ -25,3 +28,10 @@ "node": ">=18" | ||
| }, | ||
| "keywords": ["ai", "audit-trail", "llm", "evals", "observability", "eu-ai-act"], | ||
| "keywords": [ | ||
| "ai", | ||
| "audit-trail", | ||
| "llm", | ||
| "evals", | ||
| "observability", | ||
| "eu-ai-act" | ||
| ], | ||
| "homepage": "https://looptail.ai", | ||
@@ -28,0 +38,0 @@ "repository": { |
33591
3.3%522
4.19%