
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
@escrow-protocol/contract-generator
Advanced tools
A deterministic contract generator that produces consistent PDFs across different environments and timezones. Perfect for blockchain applications requiring global consensus.
A deterministic TypeScript library for generating PDF contracts from Markdown templates with dynamic content substitution. Produces identical PDFs across all global environments - perfect for blockchain applications and distributed systems requiring consensus.
{{#if}}
blocks and complex conditionsnpm install @escrow-protocol/contract-generator
import { EscrowContractGenerator } from "@escrow-protocol/contract-generator"
const template = `
# Contract Agreement
**Parties:**
- **Buyer**: {{format_party:parties.buyer}}
- **Seller**: {{format_party:parties.seller}}
**Amount**: {{format_currency:terms.amount,terms.currency}}
{{#if exists:terms.delivery_date}}
**Delivery Date**: {{format_date:terms.delivery_date}}
{{/if}}
`
const contractData = {
parties: {
buyer: {
name: "John Doe",
type: "Individual",
jurisdiction: "New York, USA",
address: "123 Main St, New York, NY"
},
seller: {
name: "Acme Corp",
type: "Corporation",
entity_type: "LLC",
jurisdiction: "Delaware, USA",
address: "456 Business Ave, Delaware, DE"
}
},
terms: {
amount: 50000,
currency: "USD",
delivery_date: "2024-12-31"
}
}
const generator = new EscrowContractGenerator(template)
// Generate PDF
const { pdfData, warnings } = await generator.generatePDF(contractData, {
pageSize: "A4",
margins: { top: 50, bottom: 50, left: 50, right: 50 }
})
// Save or serve the PDF
const blob = new Blob([pdfData], { type: "application/pdf" })
{{variable.path}} // Simple variable substitution
{{nested.object.property}} // Nested object access
{{array.0.property}} // Array index access
{{format_party:parties.buyer}} // Format party description
{{format_currency:amount,currency}} // Format currency with locale
{{format_date:delivery_date}} // Format date
{{doc_name:documents.contract}} // Get document name
{{#if exists:variable}}
Content to include if variable exists
{{/if}}
{{#if not_exists:variable}}
Content to include if variable doesn't exist
{{/if}}
{{#if variable == 'value'}}
Content if variable equals value
{{else}}
Alternative content
{{/if}}
new EscrowContractGenerator(template: string)
generatePDF(
data: any,
options?: PDFOptions
): Promise<{ pdfData: ArrayBuffer; warnings: string[] }>
Parameters:
data
: Contract data object with variables for template substitutionoptions
: PDF generation options (optional)Returns: Promise resolving to an object with:
pdfData
: ArrayBuffer containing the generated PDFwarnings
: Array of warning messages for unresolved placeholdersinterface PDFOptions {
margins?: {
top?: number
right?: number
bottom?: number
left?: number
}
defaultStyle?: {
font?: string
fontSize?: number
lineHeight?: number
}
pageSize?: string // Default: 'A4'
pageOrientation?: "portrait" | "landscape" // Default: 'portrait'
header?: (currentPage: number, pageCount: number) => Content
footer?: (currentPage: number, pageCount: number) => Content
watermark?: string
callback?: (pdfData: ArrayBuffer) => void
}
npm run build
# Run basic tests
npm test
# Run comprehensive consensus tests (8 global environments)
npm run test:consensus
# Run all tests
npm run test:all
This library has been specifically designed and tested to produce identical PDF outputs regardless of:
For more details, see CONSENSUS_FIX.md.
MIT License - see LICENSE file for details.
FAQs
A deterministic contract generator that produces consistent PDFs across different environments and timezones. Perfect for blockchain applications requiring global consensus.
The npm package @escrow-protocol/contract-generator receives a total of 12 weekly downloads. As such, @escrow-protocol/contract-generator popularity was classified as not popular.
We found that @escrow-protocol/contract-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.