@@ -4,6 +4,87 @@ import * as path from "node:path";
44import { Readable } from "node:stream" ;
55import type { ReadableStream } from "node:stream/web" ;
66
7+ import bcrypt from "bcrypt" ;
8+
9+ const saltRounds = 10 ;
10+ const myPlaintextPassword = "s0//P4$$w0rD" ;
11+ const someOtherPlaintextPassword = "not_bacon" ;
12+
13+ bcrypt . genSalt ( saltRounds , function ( err , salt ) {
14+ bcrypt . hash ( myPlaintextPassword , salt , function ( err , hash ) {
15+ // Store hash in your password DB.
16+ } ) ;
17+ } ) ;
18+
19+ import { InfisicalClient } from "@infisical/sdk" ;
20+
21+ const infisicalClient = new InfisicalClient ( {
22+ siteUrl : "https://example.com" ,
23+ } ) ;
24+
25+ import * as mupdf from "mupdf" ;
26+
27+ // Helper function to load document from URL
28+ async function loadDocumentFromUrl ( url : string ) : Promise < mupdf . Document > {
29+ try {
30+ const response = await fetch ( url ) ;
31+ const buffer = await response . arrayBuffer ( ) ;
32+ return mupdf . Document . openDocument ( buffer , "application/pdf" ) ;
33+ } catch ( error ) {
34+ throw new Error ( `Failed to load document from URL: ${ url } ` ) ;
35+ }
36+ }
37+
38+ import zip from "zip-node-addon" ;
39+
40+ function unzip ( inputPath : string , outputPath : string ) {
41+ zip . unzipFile ( inputPath , outputPath ) ;
42+ }
43+
44+ import { createClient } from "@1password/sdk" ;
45+
46+ // Creates an authenticated client.
47+ const client = await createClient ( {
48+ auth : process . env . OP_SERVICE_ACCOUNT_TOKEN ?? "" ,
49+ // Set the following to your own integration name and version.
50+ integrationName : "My 1Password Integration" ,
51+ integrationVersion : "v1.0.0" ,
52+ } ) ;
53+
54+ // Fetches a secret.
55+ // const secret = await client.secrets.resolve("op://vault/item/field");
56+
57+ import sharp from "sharp" ;
58+ import sqlite3 from "sqlite3" ;
59+ import { createCanvas } from "canvas" ;
60+
61+ // Test sharp: create a 1x1 PNG buffer
62+ const sharpBufferPromise = sharp ( {
63+ create : {
64+ width : 1 ,
65+ height : 1 ,
66+ channels : 4 ,
67+ background : { r : 0 , g : 0 , b : 0 , alpha : 0 } ,
68+ } ,
69+ } )
70+ . png ( )
71+ . toBuffer ( ) ;
72+
73+ // Test sqlite3: open an in-memory database
74+ const sqliteDb = new sqlite3 . Database ( ":memory:" , ( err ) => {
75+ if ( err ) {
76+ console . error ( "sqlite3 error:" , err ) ;
77+ } else {
78+ console . log ( "sqlite3 in-memory database opened" ) ;
79+ }
80+ } ) ;
81+
82+ // Test canvas: create a 100x100 canvas and draw a rectangle
83+ const canvas = createCanvas ( 100 , 100 ) ;
84+ const ctx = canvas . getContext ( "2d" ) ;
85+ ctx . fillStyle = "red" ;
86+ ctx . fillRect ( 10 , 10 , 80 , 80 ) ;
87+
788export const convertVideo = task ( {
889 id : "convert-video" ,
990 retry : {
0 commit comments