Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/m0uka/golang-pdf-invoice-generator
This repository is a modified version of the original invoice, featuring extended functionality and support for use as a Go module.
To install the module, use:
go get github.com/m0uka/golang-pdf-invoice-generator
Import it in your Go project:
import "github.com/m0uka/golang-pdf-invoice-generator/invoicepdf"
Here is a basic example of how to generate an invoice:
package main
import (
"log"
"github.com/m0uka/golang-pdf-invoice-generator/invoicepdf"
"os"
"bytes"
)
func main() {
invoice := invoicepdf.Invoice{
Id: "12345",
Number: "INV-1001",
Title: "Invoice Title",
LogoUrl: "http://example.com/logo.png",
From: invoicepdf.InvoiceCompany{
Name: "Your Company Name",
AddressLine1: "Your Company Address Line 1",
AddressLine2: "Your Company Address Line 2",
City: "Your City",
Country: "Your Country",
State: "Your State",
PostalCode: "123456",
TaxID: "TAX123456",
Email: "info@yourcompany.com",
Website: "https://yourcompany.com",
},
To: invoicepdf.InvoiceCompany{
Name: "Customer Name",
AddressLine1: "Customer Address Line 1",
AddressLine2: "Customer Address Line 2",
City: "Customer City",
Country: "Customer Country",
State: "Customer State",
PostalCode: "654321",
TaxID: "CUST123456",
Email: "customer@example.com",
Website: "https://customerwebsite.com",
},
Date: "2024-07-11",
Due: "2024-07-25",
Items: []string{"Product 1", "Product 2"},
Quantities: []int{2, 1},
Rates: []float64{50.0, 75.0},
Tax: 10.0,
Discount: 5.0,
Currency: "USD",
Note: "Thank you for your business.",
HeaderNote: "Invoice Header Note",
}
buffer, err := invoicepdf.GenerateInvoice(&invoice)
if err != nil {
log.Fatalf("Could not generate invoice: %v", err)
}
// Save buffer to file or handle it as needed
err = saveBufferToFile(buffer, "invoice.pdf")
if err != nil {
log.Fatalf("Could not save invoice: %v", err)
}
}
func saveBufferToFile(buffer *bytes.Buffer, filename string) error {
return os.WriteFile(filename, buffer.Bytes(), 0644)
}
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
Unknown package
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 malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.