@@ -100,7 +100,7 @@ function getTurnkeyClient(): Turnkey {
100100 if ( ! apiPublicKey || ! apiPrivateKey || ! organizationId ) {
101101 throw new Error (
102102 "Missing required environment variables: API_PUBLIC_KEY, API_PRIVATE_KEY, ORGANIZATION_ID\n" +
103- "Please copy .env.local.example to .env.local and fill in your credentials."
103+ "Please copy .env.local.example to .env.local and fill in your credentials." ,
104104 ) ;
105105 }
106106
@@ -214,9 +214,15 @@ async function mainMenu(): Promise<void> {
214214 message : "Press Enter to continue..." ,
215215 } ) ;
216216 console . clear ( ) ;
217- console . log ( "╔════════════════════════════════════════════════════════════╗" ) ;
218- console . log ( "║ TURNKEY DISASTER RECOVERY TOOLKIT ║" ) ;
219- console . log ( "╚════════════════════════════════════════════════════════════╝" ) ;
217+ console . log (
218+ "╔════════════════════════════════════════════════════════════╗" ,
219+ ) ;
220+ console . log (
221+ "║ TURNKEY DISASTER RECOVERY TOOLKIT ║" ,
222+ ) ;
223+ console . log (
224+ "╚════════════════════════════════════════════════════════════╝" ,
225+ ) ;
220226 console . log ( ) ;
221227 }
222228}
@@ -399,7 +405,7 @@ async function generateMnemonicWallet(): Promise<{
399405 const row = words
400406 . slice ( i , i + columns )
401407 . map (
402- ( word , idx ) => `${ String ( i + idx + 1 ) . padStart ( 2 ) } . ${ word . padEnd ( 10 ) } `
408+ ( word , idx ) => `${ String ( i + idx + 1 ) . padStart ( 2 ) } . ${ word . padEnd ( 10 ) } ` ,
403409 )
404410 . join ( " " ) ;
405411 console . log ( ` ${ row } ` ) ;
@@ -463,15 +469,15 @@ async function importHDWallet(): Promise<void> {
463469
464470 if ( ! organizationId || ! userId ) {
465471 throw new Error (
466- "Missing required environment variables: ORGANIZATION_ID, USER_ID"
472+ "Missing required environment variables: ORGANIZATION_ID, USER_ID" ,
467473 ) ;
468474 }
469475
470476 const turnkeyClient = getTurnkeyClient ( ) ;
471477
472478 console . log ( "Step 1: Initialize import bundle from Turnkey" ) ;
473479 console . log (
474- "This creates a temporary public key in Turnkey's enclave for encrypting your mnemonic."
480+ "This creates a temporary public key in Turnkey's enclave for encrypting your mnemonic." ,
475481 ) ;
476482 console . log ( ) ;
477483
@@ -484,7 +490,7 @@ async function importHDWallet(): Promise<void> {
484490
485491 console . log ( "Step 2: Encrypt wallet material" ) ;
486492 console . log (
487- "SECURITY WARNING: In production, perform this step on an air-gapped machine!"
493+ "SECURITY WARNING: In production, perform this step on an air-gapped machine!" ,
488494 ) ;
489495 console . log ( ) ;
490496
@@ -629,7 +635,7 @@ async function importPrivateKey(): Promise<void> {
629635
630636 if ( ! organizationId || ! userId ) {
631637 throw new Error (
632- "Missing required environment variables: ORGANIZATION_ID, USER_ID"
638+ "Missing required environment variables: ORGANIZATION_ID, USER_ID" ,
633639 ) ;
634640 }
635641
@@ -662,7 +668,7 @@ async function importPrivateKey(): Promise<void> {
662668
663669 console . log ( "Step 2: Encrypt private key material" ) ;
664670 console . log (
665- "SECURITY WARNING: In production, perform this step on an air-gapped machine!"
671+ "SECURITY WARNING: In production, perform this step on an air-gapped machine!" ,
666672 ) ;
667673 console . log ( ) ;
668674
@@ -812,13 +818,13 @@ async function sweepFunds(): Promise<void> {
812818
813819 if ( ! signWith ) {
814820 throw new Error (
815- "Missing SIGN_WITH - set this to the imported wallet/key address in .env.local"
821+ "Missing SIGN_WITH - set this to the imported wallet/key address in .env.local" ,
816822 ) ;
817823 }
818824
819825 if ( ! safeTreasury ) {
820826 throw new Error (
821- "Missing SAFE_TREASURY_ADDRESS - set this to your safe destination address in .env.local"
827+ "Missing SAFE_TREASURY_ADDRESS - set this to your safe destination address in .env.local" ,
822828 ) ;
823829 }
824830
@@ -933,7 +939,9 @@ async function sweepFunds(): Promise<void> {
933939 console . log ( ) ;
934940
935941 console . log ( "Waiting for transaction confirmation..." ) ;
936- const receipt = await publicClient . waitForTransactionReceipt ( { hash : txHash } ) ;
942+ const receipt = await publicClient . waitForTransactionReceipt ( {
943+ hash : txHash ,
944+ } ) ;
937945
938946 if ( receipt . status === "success" ) {
939947 console . log ( ) ;
@@ -976,7 +984,9 @@ async function escrowSetup(): Promise<void> {
976984 console . log ( "2. Encrypt your recovery material with Turnkey's public key" ) ;
977985 console . log ( "3. Save the encrypted bundle locally (you store this securely)" ) ;
978986 console . log ( ) ;
979- console . log ( "Note: The encrypted bundle should be stored in YOUR infrastructure," ) ;
987+ console . log (
988+ "Note: The encrypted bundle should be stored in YOUR infrastructure," ,
989+ ) ;
980990 console . log ( "not on Turnkey. This creates a 2-of-2 security model." ) ;
981991 console . log ( ) ;
982992
@@ -1069,7 +1079,11 @@ async function escrowSetup(): Promise<void> {
10691079 let addMore = true ;
10701080 while ( addMore ) {
10711081 const { service, apiKey } = await prompts ( [
1072- { type : "text" , name : "service" , message : "Service name (e.g., AWS, Alchemy):" } ,
1082+ {
1083+ type : "text" ,
1084+ name : "service" ,
1085+ message : "Service name (e.g., AWS, Alchemy):" ,
1086+ } ,
10731087 { type : "password" , name : "apiKey" , message : "API Key/Secret:" } ,
10741088 ] ) ;
10751089
@@ -1141,8 +1155,8 @@ async function escrowSetup(): Promise<void> {
11411155 createdAt : new Date ( ) . toISOString ( ) ,
11421156 } ,
11431157 null ,
1144- 2
1145- )
1158+ 2 ,
1159+ ) ,
11461160 ) ;
11471161
11481162 console . log ( ) ;
@@ -1162,7 +1176,7 @@ async function escrowSetup(): Promise<void> {
11621176}
11631177
11641178async function createNewEncryptionKey (
1165- turnkeyClient : Turnkey
1179+ turnkeyClient : Turnkey ,
11661180) : Promise < { privateKeyId: string ; publicKey: string } > {
11671181 console. log ( ) ;
11681182 console . log ( "Step 1: Create encryption keypair in Turnkey" ) ;
@@ -1258,7 +1272,7 @@ async function escrowRecovery(): Promise<void> {
12581272
12591273 const bundleContents = fs . readFileSync (
12601274 path . resolve ( process . cwd ( ) , bundlePath ) ,
1261- "utf-8"
1275+ "utf-8" ,
12621276 ) ;
12631277 const storedBundle : StoredBundle = JSON . parse ( bundleContents ) ;
12641278
@@ -1271,7 +1285,7 @@ async function escrowRecovery(): Promise<void> {
12711285
12721286 if ( ! keyIdToUse ) {
12731287 throw new Error (
1274- "No encryption key ID found in bundle or ENCRYPTION_KEY_ID environment variable"
1288+ "No encryption key ID found in bundle or ENCRYPTION_KEY_ID environment variable" ,
12751289 ) ;
12761290 }
12771291
@@ -1323,7 +1337,7 @@ async function escrowRecovery(): Promise<void> {
13231337
13241338 const decryptedRecoveryJson = await decryptWithPrivateKey (
13251339 encryptionPrivateKey ,
1326- storedBundle . encryptedData
1340+ storedBundle . encryptedData ,
13271341 ) ;
13281342
13291343 const recoveryBundle : RecoveryBundle = JSON . parse ( decryptedRecoveryJson ) ;
@@ -1334,7 +1348,9 @@ async function escrowRecovery(): Promise<void> {
13341348 console . log ( "═" . repeat ( 60 ) ) ;
13351349 console . log ( ) ;
13361350
1337- console . log ( "WARNING: Sensitive data displayed below. Clear your terminal after use." ) ;
1351+ console . log (
1352+ "WARNING: Sensitive data displayed below. Clear your terminal after use." ,
1353+ ) ;
13381354 console . log ( ) ;
13391355
13401356 const { showData } = await prompts ( {
@@ -1352,8 +1368,14 @@ async function escrowRecovery(): Promise<void> {
13521368 console . log ( "Created at: " , recoveryBundle . createdAt ) ;
13531369
13541370 if ( recoveryBundle . metadata ) {
1355- console . log ( "Description:" , recoveryBundle . metadata . description || "N/A" ) ;
1356- console . log ( "Organization:" , recoveryBundle . metadata . organization || "N/A" ) ;
1371+ console . log (
1372+ "Description:" ,
1373+ recoveryBundle . metadata . description || "N/A" ,
1374+ ) ;
1375+ console . log (
1376+ "Organization:" ,
1377+ recoveryBundle . metadata . organization || "N/A" ,
1378+ ) ;
13571379 }
13581380
13591381 console . log ( ) ;
@@ -1376,7 +1398,10 @@ async function escrowRecovery(): Promise<void> {
13761398 console . log ( ` ${ cred . service } : ${ cred . apiKey } ` ) ;
13771399 }
13781400 console . log ( ) ;
1379- } else if ( recoveryBundle . type === "custom" && recoveryBundle . data . custom ) {
1401+ } else if (
1402+ recoveryBundle . type === "custom" &&
1403+ recoveryBundle . data . custom
1404+ ) {
13801405 console . log ( ) ;
13811406 console . log ( "CUSTOM DATA:" ) ;
13821407 console . log ( recoveryBundle . data . custom ) ;
@@ -1420,8 +1445,12 @@ async function escrowRecovery(): Promise<void> {
14201445 console . log ( "QUORUM APPROVAL REQUIRED" ) ;
14211446 console . log ( "═" . repeat ( 60 ) ) ;
14221447 console . log ( ) ;
1423- console . log ( "This export requires additional approvals based on your policy." ) ;
1424- console . log ( "Please coordinate with other key holders to complete the export." ) ;
1448+ console . log (
1449+ "This export requires additional approvals based on your policy." ,
1450+ ) ;
1451+ console . log (
1452+ "Please coordinate with other key holders to complete the export." ,
1453+ ) ;
14251454 console . log ( ) ;
14261455 } else {
14271456 throw error ;
0 commit comments