|
| 1 | +import env from "./utils/env"; |
1 | 2 | import { encryptData, decrypt as shutterDecrypt } from "@shutter-network/shutter-sdk"; |
2 | 3 | import { Hex, stringToHex, hexToString } from "viem"; |
3 | 4 | import crypto from "crypto"; |
4 | 5 | import "isomorphic-fetch"; |
5 | 6 |
|
| 7 | +const SHUTTER_API = env.optionalNoDefault("SHUTTER_API"); |
6 | 8 | // Time in seconds to wait before the message can be decrypted |
7 | 9 | export const DECRYPTION_DELAY = 5; |
8 | 10 |
|
@@ -38,7 +40,7 @@ async function fetchShutterData(decryptionTimestamp: number): Promise<ShutterApi |
38 | 40 | const identityPrefix = generateRandomBytes32(); |
39 | 41 | console.log(`Generated identity prefix: ${identityPrefix}`); |
40 | 42 |
|
41 | | - const response = await fetch("https://shutter-api.shutter.network/api/register_identity", { |
| 43 | + const response = await fetch(`${SHUTTER_API}/register_identity`, { |
42 | 44 | method: "POST", |
43 | 45 | headers: { |
44 | 46 | accept: "application/json", |
@@ -88,7 +90,7 @@ async function fetchShutterData(decryptionTimestamp: number): Promise<ShutterApi |
88 | 90 | async function fetchDecryptionKey(identity: string): Promise<ShutterDecryptionKeyData> { |
89 | 91 | console.log(`Fetching decryption key for identity: ${identity}`); |
90 | 92 |
|
91 | | - const response = await fetch(`https://shutter-api.shutter.network/api/get_decryption_key?identity=${identity}`, { |
| 93 | + const response = await fetch(`${SHUTTER_API}/get_decryption_key?identity=${identity}`, { |
92 | 94 | method: "GET", |
93 | 95 | headers: { |
94 | 96 | accept: "application/json", |
|
0 commit comments