Skip to content

Commit ee547aa

Browse files
committed
Merge pull-request #484
2 parents 77b3b96 + f6a7d9d commit ee547aa

File tree

310 files changed

+1976
-1960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+1976
-1960
lines changed

examples/deployer/src/compile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const solc = require("solc");
44

55
const source = fs.readFileSync(
66
path.resolve(__dirname, "./contracts", "HelloWorld.sol"),
7-
"utf8"
7+
"utf8",
88
);
99

1010
const input = {

examples/deployer/src/createNewWallet.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export async function createNewWallet() {
3838
`- Address: ${address}`,
3939
``,
4040
"Now you can take the address, put it in `.env.local` (`SIGN_WITH=<address>`), then re-run the script.",
41-
].join("\n")
41+
].join("\n"),
4242
);
4343
} catch (err: any) {
4444
throw new Error("Failed to create a new Ethereum wallet: " + err);

examples/deployer/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function main() {
3535
// Connect it with a Provider (https://docs.ethers.org/v6/api/providers/)
3636
const network = "goerli";
3737
const connectedSigner = turnkeySigner.connect(
38-
new ethers.InfuraProvider(network)
38+
new ethers.InfuraProvider(network),
3939
);
4040

4141
const chainId = (await connectedSigner.provider?.getNetwork())?.chainId ?? 0;
@@ -76,7 +76,7 @@ async function main() {
7676

7777
print(
7878
`Contract has been deployed:`,
79-
`https://${network}.etherscan.io/tx/${deploymentTransaction?.hash}`
79+
`https://${network}.etherscan.io/tx/${deploymentTransaction?.hash}`,
8080
);
8181
}
8282

examples/deployer/src/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function print(header: string, body: string): void {
44

55
export function refineNonNull<T>(
66
input: T | null | undefined,
7-
errorMessage?: string
7+
errorMessage?: string,
88
): T {
99
if (input == null) {
1010
throw new Error(errorMessage ?? `Unexpected ${JSON.stringify(input)}`);

examples/email-auth-local-storage/src/pages/api/auth.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type ErrorMessage = {
2424

2525
export default async function auth(
2626
req: NextApiRequest,
27-
res: NextApiResponse<AuthResponse | ErrorMessage>
27+
res: NextApiResponse<AuthResponse | ErrorMessage>,
2828
) {
2929
try {
3030
const request = req.body as AuthRequest;

examples/email-auth-local-storage/src/pages/index.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default function AuthPage() {
7575

7676
console.log(
7777
"Using existing target key stored in localStorage: ",
78-
parsedKey.publicKeyUncompressed
78+
parsedKey.publicKeyUncompressed,
7979
);
8080
return;
8181
}
@@ -86,7 +86,7 @@ export default function AuthPage() {
8686
setItemWithExpiry(
8787
TURNKEY_EMBEDDED_KEY,
8888
JSON.stringify(key),
89-
TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS
89+
TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS,
9090
);
9191
setTargetPublicKey(targetPubHex!);
9292

@@ -123,15 +123,15 @@ export default function AuthPage() {
123123
// This is decrypting the user-provided email auth bundle using the locally stored target embedded key
124124
decryptedData = decryptCredentialBundle(
125125
data.authBundle,
126-
parsed.privateKey
126+
parsed.privateKey,
127127
);
128128

129129
// Save the email auth bundle to local storage as well. This can be reused in order for the
130130
// end user to avoid having to email auth repeatedly
131131
setItemWithExpiry(
132132
TURNKEY_CREDENTIAL_BUNDLE,
133133
data.authBundle,
134-
TURNKEY_CREDENTIAL_BUNDLE_TTL_IN_MILLIS
134+
TURNKEY_CREDENTIAL_BUNDLE_TTL_IN_MILLIS,
135135
);
136136
} catch (e) {
137137
const msg = `Error while injecting bundle: ${e}`;
@@ -193,13 +193,13 @@ export default function AuthPage() {
193193
const parsedKey = JSON.parse(embeddedKey);
194194

195195
const localCredentialBundle = getItemWithExpiry(
196-
TURNKEY_CREDENTIAL_BUNDLE
196+
TURNKEY_CREDENTIAL_BUNDLE,
197197
);
198198

199199
// This is decrypting the locally stored email auth bundle using the locally stored target embedded key
200200
decryptedData = decryptCredentialBundle(
201201
localCredentialBundle,
202-
parsedKey.privateKey
202+
parsedKey.privateKey,
203203
);
204204
} catch (e) {
205205
const msg = `Error while injecting bundle: ${e}`;
@@ -349,7 +349,7 @@ export default function AuthPage() {
349349
// ****
350350
const getPublicKeyFromPrivateKeyHex = (privateKey: string): string => {
351351
return uint8ArrayToHexString(
352-
getPublicKey(uint8ArrayFromHexString(privateKey), true)
352+
getPublicKey(uint8ArrayFromHexString(privateKey), true),
353353
);
354354
};
355355

@@ -397,7 +397,7 @@ const setItemWithExpiry = (key: string, value: string, ttl: number) => {
397397

398398
const refineNonNull = <T,>(
399399
input: T | null | undefined,
400-
errorMessage?: string
400+
errorMessage?: string,
401401
): T => {
402402
if (input == null) {
403403
throw new Error(errorMessage ?? `Unexpected ${JSON.stringify(input)}`);

examples/email-auth/src/pages/api/auth.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type ErrorMessage = {
2424

2525
export default async function auth(
2626
req: NextApiRequest,
27-
res: NextApiResponse<AuthResponse | ErrorMessage>
27+
res: NextApiResponse<AuthResponse | ErrorMessage>,
2828
) {
2929
try {
3030
const request = req.body as AuthRequest;

examples/email-auth/src/pages/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export default function AuthPage() {
191191

192192
function refineNonNull<T>(
193193
input: T | null | undefined,
194-
errorMessage?: string
194+
errorMessage?: string,
195195
): T {
196196
if (input == null) {
197197
throw new Error(errorMessage ?? `Unexpected ${JSON.stringify(input)}`);

examples/email-recovery/src/pages/api/initRecovery.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type ErrorMessage = {
2323

2424
export default async function initRecovery(
2525
req: NextApiRequest,
26-
res: NextApiResponse<InitRecoveryResponse | ErrorMessage>
26+
res: NextApiResponse<InitRecoveryResponse | ErrorMessage>,
2727
) {
2828
try {
2929
const request = req.body as InitRecoveryRequest;

examples/email-recovery/src/pages/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default function RecoveryPage() {
118118

119119
// Instead of simply alerting, redirect the user to your app's login page.
120120
alert(
121-
"SUCCESS! Authenticator added. Recovery flow complete. Try logging back in!"
121+
"SUCCESS! Authenticator added. Recovery flow complete. Try logging back in!",
122122
);
123123
};
124124

examples/export-in-node/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async function main() {
6868
});
6969
} else {
7070
throw new Error(
71-
`Invalid export type. Enter "wallet" or "key" or "account"`
71+
`Invalid export type. Enter "wallet" or "key" or "account"`,
7272
);
7373
}
7474
const decryptedBundle = await decryptExportBundle({

examples/import-in-node/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async function main() {
6363
accounts: [],
6464
});
6565
console.log(
66-
`Successfully imported wallet with id: ${walletImportResult.walletId}`
66+
`Successfully imported wallet with id: ${walletImportResult.walletId}`,
6767
);
6868
}
6969
if (importType == "key") {
@@ -101,7 +101,7 @@ async function main() {
101101
: ["ADDRESS_FORMAT_ETHEREUM"],
102102
});
103103
console.log(
104-
`Successfully imported wallet with id: ${privateKeyImportResult.privateKeyId}`
104+
`Successfully imported wallet with id: ${privateKeyImportResult.privateKeyId}`,
105105
);
106106
}
107107
}

examples/kitchen-sink/src/http/createApiKey.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async function main() {
1616
new ApiKeyStamper({
1717
apiPublicKey: process.env.API_PUBLIC_KEY!,
1818
apiPrivateKey: process.env.API_PRIVATE_KEY!,
19-
})
19+
}),
2020
);
2121

2222
const activityPoller = createActivityPoller({
@@ -46,7 +46,7 @@ async function main() {
4646
});
4747

4848
const newApiKeyIds = refineNonNull(
49-
activity.result.createApiKeysResult?.apiKeyIds
49+
activity.result.createApiKeysResult?.apiKeyIds,
5050
);
5151

5252
// Success!
@@ -58,7 +58,7 @@ async function main() {
5858
`- Name: ${apiKeyName}`,
5959
`- User ID: ${userId}`,
6060
``,
61-
].join("\n")
61+
].join("\n"),
6262
);
6363
}
6464

examples/kitchen-sink/src/http/createEthereumPrivateKey.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async function main() {
1818
new ApiKeyStamper({
1919
apiPublicKey: process.env.API_PUBLIC_KEY!,
2020
apiPrivateKey: process.env.API_PRIVATE_KEY!,
21-
})
21+
}),
2222
);
2323

2424
const activityPoller = createActivityPoller({
@@ -45,7 +45,7 @@ async function main() {
4545
});
4646

4747
const privateKeys = refineNonNull(
48-
activity.result.createPrivateKeysResultV2?.privateKeys
48+
activity.result.createPrivateKeysResultV2?.privateKeys,
4949
);
5050
const privateKeyId = refineNonNull(privateKeys?.[0]?.privateKeyId);
5151
const address = refineNonNull(privateKeys?.[0]?.addresses?.[0]?.address);
@@ -59,7 +59,7 @@ async function main() {
5959
`- Address: ${address}`,
6060
``,
6161
"Now you can take the private key ID, put it in `.env.local`, then re-run the script.",
62-
].join("\n")
62+
].join("\n"),
6363
);
6464
}
6565

examples/kitchen-sink/src/http/createEthereumWallet.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async function main() {
1919
new ApiKeyStamper({
2020
apiPublicKey: process.env.API_PUBLIC_KEY!,
2121
apiPrivateKey: process.env.API_PRIVATE_KEY!,
22-
})
22+
}),
2323
);
2424

2525
const activityPoller = createActivityPoller({
@@ -57,7 +57,7 @@ async function main() {
5757
`- Address: ${address}`,
5858
``,
5959
"Now you can take the address, put it in `.env.local` (`SIGN_WITH=<address>`), then re-run the script.",
60-
].join("\n")
60+
].join("\n"),
6161
);
6262
}
6363

examples/kitchen-sink/src/http/createPolicy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async function main() {
1616
new ApiKeyStamper({
1717
apiPublicKey: process.env.API_PUBLIC_KEY!,
1818
apiPrivateKey: process.env.API_PRIVATE_KEY!,
19-
})
19+
}),
2020
);
2121

2222
const activityPoller = createActivityPoller({
@@ -55,7 +55,7 @@ async function main() {
5555
`- Consensus: ${consensus}`,
5656
`- Condition: ${condition}`,
5757
``,
58-
].join("\n")
58+
].join("\n"),
5959
);
6060
}
6161

examples/kitchen-sink/src/http/createPrivateKeyTag.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async function main() {
1616
new ApiKeyStamper({
1717
apiPublicKey: process.env.API_PUBLIC_KEY!,
1818
apiPrivateKey: process.env.API_PRIVATE_KEY!,
19-
})
19+
}),
2020
);
2121

2222
const activityPoller = createActivityPoller({
@@ -38,7 +38,7 @@ async function main() {
3838
});
3939

4040
const privateKeyTagId = refineNonNull(
41-
activity.result.createPrivateKeyTagResult?.privateKeyTagId
41+
activity.result.createPrivateKeyTagResult?.privateKeyTagId,
4242
);
4343

4444
// Success!
@@ -48,7 +48,7 @@ async function main() {
4848
`- Name: ${privateKeyTagName}`,
4949
`- Private key tag ID: ${privateKeyTagId}`,
5050
``,
51-
].join("\n")
51+
].join("\n"),
5252
);
5353
}
5454

examples/kitchen-sink/src/http/createSolanaPrivateKey.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async function main() {
1717
new ApiKeyStamper({
1818
apiPublicKey: process.env.API_PUBLIC_KEY!,
1919
apiPrivateKey: process.env.API_PRIVATE_KEY!,
20-
})
20+
}),
2121
);
2222

2323
console.log("creating a new Solana private key on Turnkey...");
@@ -46,7 +46,7 @@ async function main() {
4646
});
4747

4848
const privateKeys = refineNonNull(
49-
activity.result.createPrivateKeysResultV2?.privateKeys
49+
activity.result.createPrivateKeysResultV2?.privateKeys,
5050
);
5151
const privateKeyId = refineNonNull(privateKeys?.[0]?.privateKeyId);
5252
const address = refineNonNull(privateKeys?.[0]?.addresses?.[0]?.address);
@@ -60,7 +60,7 @@ async function main() {
6060
`- Address: ${address}`,
6161
``,
6262
"Now you can take the private key ID, put it in `.env.local`, then re-run the script.",
63-
].join("\n")
63+
].join("\n"),
6464
);
6565
}
6666

examples/kitchen-sink/src/http/createSolanaWallet.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async function main() {
2020
new ApiKeyStamper({
2121
apiPublicKey: process.env.API_PUBLIC_KEY!,
2222
apiPrivateKey: process.env.API_PRIVATE_KEY!,
23-
})
23+
}),
2424
);
2525

2626
const activityPoller = createActivityPoller({
@@ -59,7 +59,7 @@ async function main() {
5959
`- Address: ${address}`,
6060
``,
6161
"Now you can take the address, put it in `.env.local` (`SIGN_WITH=<address>`), then re-run the script.",
62-
].join("\n")
62+
].join("\n"),
6363
);
6464
}
6565

examples/kitchen-sink/src/http/createUser.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async function main() {
1616
new ApiKeyStamper({
1717
apiPublicKey: process.env.API_PUBLIC_KEY!,
1818
apiPrivateKey: process.env.API_PRIVATE_KEY!,
19-
})
19+
}),
2020
);
2121

2222
const activityPoller = createActivityPoller({
@@ -50,7 +50,7 @@ async function main() {
5050
});
5151

5252
const userId = refineNonNull(
53-
activity.result.createApiOnlyUsersResult?.userIds?.[0]
53+
activity.result.createApiOnlyUsersResult?.userIds?.[0],
5454
);
5555

5656
// Success!
@@ -60,7 +60,7 @@ async function main() {
6060
`- Name: ${userName}`,
6161
`- User ID: ${userId}`,
6262
``,
63-
].join("\n")
63+
].join("\n"),
6464
);
6565
}
6666

0 commit comments

Comments
 (0)