@secrecy/lib 1.7.0-integration-mixed-feats.3 → 1.7.0-integration-trpc-client.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/base-client.js +85 -0
- package/dist/lib/cache.js +4 -0
- package/dist/lib/client/SecrecyAppClient.js +81 -0
- package/dist/lib/client/SecrecyCloudClient.js +475 -0
- package/dist/lib/client/SecrecyDbClient.js +46 -0
- package/dist/lib/client/SecrecyMailClient.js +283 -0
- package/dist/lib/client/SecrecyPayClient.js +34 -0
- package/dist/lib/client/SecrecyWalletClient.js +50 -0
- package/dist/lib/client/convert/file.js +29 -0
- package/dist/lib/client/convert/mail.js +42 -0
- package/dist/lib/client/convert/node.js +98 -0
- package/dist/lib/client/helpers.js +107 -0
- package/dist/lib/client/index.js +43 -0
- package/dist/lib/client/storage.js +7 -0
- package/dist/lib/client/types/file.js +1 -0
- package/dist/lib/client/types/index.js +19 -0
- package/dist/lib/client/types/mail.js +1 -0
- package/dist/lib/client/types/node.js +1 -0
- package/dist/lib/client/types/user.js +1 -0
- package/dist/lib/client.js +38 -0
- package/dist/lib/crypto/file.js +184 -0
- package/dist/lib/crypto/index.js +41 -0
- package/dist/lib/error/client.js +10 -0
- package/dist/lib/error/index.js +10 -0
- package/dist/lib/error/server.js +27 -0
- package/dist/lib/index.js +10 -0
- package/dist/lib/minify/index.js +23 -0
- package/dist/lib/minify/lz4.js +517 -0
- package/dist/lib/sodium.js +5 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/utils/array.js +25 -0
- package/dist/lib/utils/base64.js +2 -0
- package/dist/lib/utils/popup-tools.js +180 -0
- package/dist/lib/utils/promise.js +20 -0
- package/dist/lib/utils/store-buddy.js +60 -0
- package/dist/lib/utils/time.js +13 -0
- package/dist/lib/worker/md5.js +18 -0
- package/dist/lib/worker/sodium.js +95 -0
- package/dist/{worker → lib/worker}/workerCodes.js +4 -4
- package/dist/types/base-client.d.ts +29 -0
- package/dist/types/cache.d.ts +9 -0
- package/dist/types/client/SecrecyAppClient.d.ts +18 -0
- package/dist/types/client/SecrecyCloudClient.d.ts +88 -0
- package/dist/types/client/SecrecyDbClient.d.ts +30 -0
- package/dist/types/client/SecrecyMailClient.d.ts +42 -0
- package/dist/types/client/SecrecyPayClient.d.ts +27 -0
- package/dist/types/client/SecrecyWalletClient.d.ts +27 -0
- package/dist/types/client/convert/file.d.ts +4 -0
- package/dist/types/client/convert/mail.d.ts +8 -0
- package/dist/types/client/convert/node.d.ts +7 -0
- package/dist/types/client/helpers.d.ts +25 -0
- package/dist/types/client/index.d.ts +25 -0
- package/dist/types/client/storage.d.ts +7 -0
- package/dist/types/client/types/file.d.ts +6 -0
- package/dist/types/client/types/index.d.ts +45 -0
- package/dist/types/client/types/mail.d.ts +87 -0
- package/dist/types/client/types/node.d.ts +51 -0
- package/dist/types/client/types/user.d.ts +3 -0
- package/dist/types/client.d.ts +9149 -0
- package/dist/types/crypto/file.d.ts +14 -0
- package/dist/types/crypto/index.d.ts +9 -0
- package/dist/types/error/client.d.ts +22 -0
- package/dist/types/error/index.d.ts +40 -0
- package/dist/types/error/server.d.ts +26 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/minify/index.d.ts +2 -0
- package/dist/types/minify/lz4.d.ts +35 -0
- package/dist/types/sodium.d.ts +3 -0
- package/dist/types/types.d.ts +10 -0
- package/dist/types/utils/array.d.ts +3 -0
- package/dist/types/utils/base64.d.ts +1 -0
- package/dist/types/utils/popup-tools.d.ts +52 -0
- package/dist/types/utils/promise.d.ts +1 -0
- package/dist/types/utils/store-buddy.d.ts +130 -0
- package/dist/{utils → types/utils}/time.d.ts +2 -4
- package/dist/types/worker/md5.d.ts +1 -0
- package/dist/types/worker/sodium.d.ts +3 -0
- package/dist/types/worker/workerCodes.d.ts +2 -0
- package/package.json +48 -73
- package/dist/BaseClient-2af8a400.d.ts +0 -405
- package/dist/BaseClient.cjs +0 -2
- package/dist/BaseClient.cjs.map +0 -1
- package/dist/BaseClient.d.ts +0 -16
- package/dist/BaseClient.js +0 -2
- package/dist/BaseClient.js.map +0 -1
- package/dist/PopupTools.cjs +0 -2
- package/dist/PopupTools.cjs.map +0 -1
- package/dist/PopupTools.d.ts +0 -18
- package/dist/PopupTools.js +0 -2
- package/dist/PopupTools.js.map +0 -1
- package/dist/ZeusThunder.cjs +0 -2
- package/dist/ZeusThunder.cjs.map +0 -1
- package/dist/ZeusThunder.d.ts +0 -6
- package/dist/ZeusThunder.js +0 -2
- package/dist/ZeusThunder.js.map +0 -1
- package/dist/cache.cjs +0 -2
- package/dist/cache.cjs.map +0 -1
- package/dist/cache.d.ts +0 -24
- package/dist/cache.js +0 -2
- package/dist/cache.js.map +0 -1
- package/dist/client/SecrecyAppClient.cjs +0 -2
- package/dist/client/SecrecyAppClient.cjs.map +0 -1
- package/dist/client/SecrecyAppClient.d.ts +0 -16
- package/dist/client/SecrecyAppClient.js +0 -2
- package/dist/client/SecrecyAppClient.js.map +0 -1
- package/dist/client/SecrecyCloudClient.cjs +0 -2
- package/dist/client/SecrecyCloudClient.cjs.map +0 -1
- package/dist/client/SecrecyCloudClient.d.ts +0 -16
- package/dist/client/SecrecyCloudClient.js +0 -2
- package/dist/client/SecrecyCloudClient.js.map +0 -1
- package/dist/client/SecrecyDbClient.cjs +0 -2
- package/dist/client/SecrecyDbClient.cjs.map +0 -1
- package/dist/client/SecrecyDbClient.d.ts +0 -16
- package/dist/client/SecrecyDbClient.js +0 -2
- package/dist/client/SecrecyDbClient.js.map +0 -1
- package/dist/client/SecrecyMailClient.cjs +0 -2
- package/dist/client/SecrecyMailClient.cjs.map +0 -1
- package/dist/client/SecrecyMailClient.d.ts +0 -16
- package/dist/client/SecrecyMailClient.js +0 -2
- package/dist/client/SecrecyMailClient.js.map +0 -1
- package/dist/client/SecrecyPayClient.cjs +0 -2
- package/dist/client/SecrecyPayClient.cjs.map +0 -1
- package/dist/client/SecrecyPayClient.d.ts +0 -16
- package/dist/client/SecrecyPayClient.js +0 -2
- package/dist/client/SecrecyPayClient.js.map +0 -1
- package/dist/client/SecrecyWalletClient.cjs +0 -2
- package/dist/client/SecrecyWalletClient.cjs.map +0 -1
- package/dist/client/SecrecyWalletClient.d.ts +0 -16
- package/dist/client/SecrecyWalletClient.js +0 -2
- package/dist/client/SecrecyWalletClient.js.map +0 -1
- package/dist/client/convert/file.cjs +0 -2
- package/dist/client/convert/file.cjs.map +0 -1
- package/dist/client/convert/file.d.ts +0 -11
- package/dist/client/convert/file.js +0 -2
- package/dist/client/convert/file.js.map +0 -1
- package/dist/client/convert/mail.cjs +0 -2
- package/dist/client/convert/mail.cjs.map +0 -1
- package/dist/client/convert/mail.d.ts +0 -13
- package/dist/client/convert/mail.js +0 -2
- package/dist/client/convert/mail.js.map +0 -1
- package/dist/client/convert/node.cjs +0 -2
- package/dist/client/convert/node.cjs.map +0 -1
- package/dist/client/convert/node.d.ts +0 -18
- package/dist/client/convert/node.js +0 -2
- package/dist/client/convert/node.js.map +0 -1
- package/dist/client/helpers.cjs +0 -2
- package/dist/client/helpers.cjs.map +0 -1
- package/dist/client/helpers.d.ts +0 -16
- package/dist/client/helpers.js +0 -2
- package/dist/client/helpers.js.map +0 -1
- package/dist/client/index.cjs +0 -2
- package/dist/client/index.cjs.map +0 -1
- package/dist/client/index.d.ts +0 -16
- package/dist/client/index.js +0 -2
- package/dist/client/index.js.map +0 -1
- package/dist/client/storage.cjs +0 -2
- package/dist/client/storage.cjs.map +0 -1
- package/dist/client/storage.d.ts +0 -10
- package/dist/client/storage.js +0 -2
- package/dist/client/storage.js.map +0 -1
- package/dist/client/types/File.cjs +0 -1
- package/dist/client/types/File.cjs.map +0 -1
- package/dist/client/types/File.d.ts +0 -18
- package/dist/client/types/File.js +0 -1
- package/dist/client/types/File.js.map +0 -1
- package/dist/client/types/Inputs.cjs +0 -1
- package/dist/client/types/Inputs.cjs.map +0 -1
- package/dist/client/types/Inputs.d.ts +0 -18
- package/dist/client/types/Inputs.js +0 -1
- package/dist/client/types/Inputs.js.map +0 -1
- package/dist/client/types/Node.cjs +0 -1
- package/dist/client/types/Node.cjs.map +0 -1
- package/dist/client/types/Node.d.ts +0 -9
- package/dist/client/types/Node.js +0 -1
- package/dist/client/types/Node.js.map +0 -1
- package/dist/client/types/UserAppNotifications.cjs +0 -1
- package/dist/client/types/UserAppNotifications.cjs.map +0 -1
- package/dist/client/types/UserAppNotifications.d.ts +0 -8
- package/dist/client/types/UserAppNotifications.js +0 -1
- package/dist/client/types/UserAppNotifications.js.map +0 -1
- package/dist/client/types/UserAppSettings.cjs +0 -1
- package/dist/client/types/UserAppSettings.cjs.map +0 -1
- package/dist/client/types/UserAppSettings.d.ts +0 -7
- package/dist/client/types/UserAppSettings.js +0 -1
- package/dist/client/types/UserAppSettings.js.map +0 -1
- package/dist/client/types/index.cjs +0 -2
- package/dist/client/types/index.cjs.map +0 -1
- package/dist/client/types/index.d.ts +0 -176
- package/dist/client/types/index.js +0 -2
- package/dist/client/types/index.js.map +0 -1
- package/dist/client/types/selectors.cjs +0 -2
- package/dist/client/types/selectors.cjs.map +0 -1
- package/dist/client/types/selectors.d.ts +0 -402
- package/dist/client/types/selectors.js +0 -2
- package/dist/client/types/selectors.js.map +0 -1
- package/dist/crypto/file.cjs +0 -2
- package/dist/crypto/file.cjs.map +0 -1
- package/dist/crypto/file.d.ts +0 -16
- package/dist/crypto/file.js +0 -2
- package/dist/crypto/file.js.map +0 -1
- package/dist/crypto/index.cjs +0 -2
- package/dist/crypto/index.cjs.map +0 -1
- package/dist/crypto/index.d.ts +0 -14
- package/dist/crypto/index.js +0 -2
- package/dist/crypto/index.js.map +0 -1
- package/dist/error.cjs +0 -1
- package/dist/error.cjs.map +0 -1
- package/dist/error.d.ts +0 -38
- package/dist/error.js +0 -1
- package/dist/error.js.map +0 -1
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/minify/index.cjs +0 -2
- package/dist/minify/index.cjs.map +0 -1
- package/dist/minify/index.d.ts +0 -4
- package/dist/minify/index.js +0 -2
- package/dist/minify/index.js.map +0 -1
- package/dist/minify/lz4.cjs +0 -3
- package/dist/minify/lz4.cjs.map +0 -1
- package/dist/minify/lz4.d.ts +0 -7
- package/dist/minify/lz4.js +0 -3
- package/dist/minify/lz4.js.map +0 -1
- package/dist/sodium.cjs +0 -2
- package/dist/sodium.cjs.map +0 -1
- package/dist/sodium.d.ts +0 -5
- package/dist/sodium.js +0 -2
- package/dist/sodium.js.map +0 -1
- package/dist/utils/encoders.cjs +0 -2
- package/dist/utils/encoders.cjs.map +0 -1
- package/dist/utils/encoders.d.ts +0 -28
- package/dist/utils/encoders.js +0 -2
- package/dist/utils/encoders.js.map +0 -1
- package/dist/utils/store-buddy.cjs +0 -2
- package/dist/utils/store-buddy.cjs.map +0 -1
- package/dist/utils/store-buddy.d.ts +0 -15
- package/dist/utils/store-buddy.js +0 -2
- package/dist/utils/store-buddy.js.map +0 -1
- package/dist/utils/time.cjs +0 -2
- package/dist/utils/time.cjs.map +0 -1
- package/dist/utils/time.js +0 -2
- package/dist/utils/time.js.map +0 -1
- package/dist/utils/utils.cjs +0 -2
- package/dist/utils/utils.cjs.map +0 -1
- package/dist/utils/utils.d.ts +0 -6
- package/dist/utils/utils.js +0 -2
- package/dist/utils/utils.js.map +0 -1
- package/dist/worker/md5.cjs +0 -2
- package/dist/worker/md5.cjs.map +0 -1
- package/dist/worker/md5.d.ts +0 -3
- package/dist/worker/md5.js +0 -2
- package/dist/worker/md5.js.map +0 -1
- package/dist/worker/sodium.cjs +0 -2
- package/dist/worker/sodium.cjs.map +0 -1
- package/dist/worker/sodium.d.ts +0 -6
- package/dist/worker/sodium.js +0 -2
- package/dist/worker/sodium.js.map +0 -1
- package/dist/worker/workerCodes.cjs +0 -254
- package/dist/worker/workerCodes.cjs.map +0 -1
- package/dist/worker/workerCodes.d.ts +0 -4
- package/dist/worker/workerCodes.js.map +0 -1
- package/dist/zeus/const.cjs +0 -2
- package/dist/zeus/const.cjs.map +0 -1
- package/dist/zeus/const.d.ts +0 -9
- package/dist/zeus/const.js +0 -2
- package/dist/zeus/const.js.map +0 -1
- package/dist/zeus/index.cjs +0 -5
- package/dist/zeus/index.cjs.map +0 -1
- package/dist/zeus/index.d.ts +0 -9428
- package/dist/zeus/index.js +0 -5
- package/dist/zeus/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/SecrecyMailClient.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { generate } from \"shortid\";\nimport { filesCache, usersCache } from \"../cache.js\";\nimport type { ErrorAccessDenied, ErrorBasic, ErrorNotFound } from \"../error.js\";\nimport type {\n SuccessResponse,\n KeyPair,\n NewMail,\n SecrecyClient\n} from \"../index.js\";\nimport { encryptCryptoBox, sodium } from \"../index.js\";\nimport type { MailType, Thunder } from \"../zeus/index.js\";\nimport { convertInternalMailToExternal } from \"./convert/mail.js\";\nimport type {\n DraftMail,\n Mail,\n MailFileInput,\n MailRecipientInput,\n ReceivedMail,\n SentMail,\n WaitingReceivedMail\n} from \"./types/index.js\";\nimport { mailSelector } from \"./types/selectors.js\";\n\nexport class SecrecyMailClient {\n #client: SecrecyClient;\n\n #keys: KeyPair;\n\n #thunder: ReturnType<typeof Thunder>;\n\n constructor(\n client: SecrecyClient,\n keys: KeyPair,\n thunder: ReturnType<typeof Thunder>\n ) {\n this.#client = client;\n this.#keys = keys;\n this.#thunder = thunder;\n }\n\n async get({\n id\n }: {\n id: string;\n }): Promise<SuccessResponse<Mail> | ErrorAccessDenied | null> {\n const { mail } = await this.#thunder(\"query\", {\n scalars: {\n DateTime: {\n decode: (e: unknown) => new Date(e as string),\n encode: (e: unknown) => (e as Date).toISOString()\n }\n }\n })({\n mail: [\n {\n id\n },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on QueryMailResponse\": {\n __typename: true,\n mail: mailSelector\n }\n }\n ]\n });\n\n if (!mail) {\n return null;\n }\n\n if (mail.__typename === \"ErrorAccessDenied\") {\n return mail;\n }\n\n if (!mail.mail) {\n return null;\n }\n\n const result = convertInternalMailToExternal(mail.mail, this.#keys);\n\n if (!result) {\n return null;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: result\n };\n }\n\n async recover({\n mailId\n }: {\n mailId: string;\n }): Promise<\n SuccessResponse<boolean> | ErrorAccessDenied | ErrorBasic | null\n > {\n const { recoverMail } = await this.#thunder(\"mutation\")({\n recoverMail: [\n { mailId },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on ErrorBasic\": {\n __typename: true,\n message: true\n },\n \"...on RecoverMailResponse\": {\n __typename: true,\n recoverMail: true\n }\n }\n ]\n });\n\n if (!recoverMail) {\n return null;\n }\n\n if (recoverMail.__typename === \"ErrorAccessDenied\") {\n return recoverMail;\n }\n\n if (recoverMail.__typename === \"ErrorBasic\") {\n return recoverMail;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: recoverMail.recoverMail\n };\n }\n\n async deletedMails({\n mailType\n }: {\n mailType: MailType;\n }): Promise<SuccessResponse<Mail[]> | ErrorAccessDenied | null> {\n const { deletedMails } = await this.#thunder(\"query\", {\n scalars: {\n DateTime: {\n decode: (e: unknown) => new Date(e as string),\n encode: (e: unknown) => (e as Date).toISOString()\n }\n }\n })({\n deletedMails: [\n { mailType },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on DeletedMailsResponse\": {\n __typename: true,\n deletedMails: mailSelector\n }\n }\n ]\n });\n\n if (!deletedMails) {\n return null;\n }\n\n if (deletedMails.__typename === \"ErrorAccessDenied\") {\n return deletedMails;\n }\n\n const mails = new Array<Mail>();\n\n for (const m of deletedMails.deletedMails) {\n const mail = convertInternalMailToExternal(m, this.#keys);\n if (mail) {\n mails.push(mail);\n }\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: mails\n };\n }\n\n async create(\n data: NewMail,\n customMessage?: string | null | undefined\n ): Promise<SuccessResponse<boolean> | ErrorBasic | ErrorAccessDenied | null> {\n const mail = await this.createDraft(data);\n if (!mail) {\n return {\n __typename: \"SuccessResponse\",\n data: false\n };\n }\n\n if (mail.__typename === \"ErrorBasic\") {\n return mail;\n }\n\n if (mail.__typename === \"ErrorAccessDenied\") {\n return mail;\n }\n\n const result = await this.sendDraft(\n mail.data.mailIntegrityId,\n customMessage\n );\n\n if (!result) {\n return null;\n }\n\n if (result.__typename === \"ErrorAccessDenied\") {\n return result;\n }\n\n if (result.__typename === \"ErrorBasic\") {\n return result;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: result.data\n };\n }\n\n async waitingReceivedMails(): Promise<\n SuccessResponse<WaitingReceivedMail[]> | ErrorNotFound | null\n > {\n const { user } = await this.#thunder(\"query\")({\n user: [\n {},\n {\n \"...on ErrorNotFound\": {\n __typename: true,\n message: true\n },\n \"...on UserResponse\": {\n __typename: true,\n user: {\n waitingReceivedMails: {\n date: true,\n attachmentsCount: true,\n sender: {\n id: true,\n firstname: true,\n lastname: true,\n email: true,\n publicKey: true\n },\n recipients: {\n id: true,\n firstname: true,\n lastname: true,\n email: true,\n publicKey: true\n },\n temporaryRecipients: {\n email: true\n }\n }\n }\n }\n }\n ]\n });\n\n if (!user) {\n return null;\n }\n\n if (user.__typename === \"ErrorNotFound\") {\n return user;\n }\n\n if (!user.user) {\n return null;\n }\n\n const result = user.user.waitingReceivedMails.map(m => ({\n id: generate(),\n ...m,\n date: new Date(m.date as string)\n }));\n\n return {\n __typename: \"SuccessResponse\",\n data: result\n };\n }\n\n async updateDraft(\n draftId: string,\n { body, subject, files, recipientsIds, replyTo }: Partial<NewMail>\n ): Promise<\n | SuccessResponse<DraftMail>\n | ErrorNotFound\n | ErrorAccessDenied\n | ErrorBasic\n | null\n > {\n const drafts = await this.draftMails();\n if (!drafts) {\n return null;\n }\n\n if (drafts.__typename !== \"SuccessResponse\") {\n return drafts;\n }\n const draft = drafts.data.find(d => d.mailIntegrityId === draftId);\n if (!draft) {\n throw new Error(`Invalid draft ${draftId}`);\n }\n let hashKey: string | null = null;\n let hash: string | null = null;\n if (body || subject) {\n hashKey = sodium.randombytes_buf(\n sodium.crypto_generichash_KEYBYTES,\n \"hex\"\n );\n hash = sodium.crypto_generichash(\n sodium.crypto_generichash_BYTES,\n JSON.stringify({ body, subject }),\n hashKey,\n \"hex\"\n );\n }\n const senderFiles = new Array<MailFileInput>();\n if (files) {\n for (const f of files) {\n let file = filesCache.get(f.id);\n if (!file) {\n await this.#client.cloud.fileMetadata({ id: f.id });\n file = filesCache.get(f.id);\n if (!file) {\n throw new Error(`File ${f.name} (${f.id}) does not exists`);\n }\n }\n senderFiles.push({\n id: file.id,\n fileKey: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(file.key),\n this.#keys.publicKey,\n this.#keys.privateKey\n )\n ),\n name: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(f.name),\n this.#keys.publicKey,\n this.#keys.privateKey\n )\n )\n });\n }\n }\n\n const { updateDraftMail } = await this.#thunder(\"mutation\", {\n scalars: {\n Json: {\n encode: (e: unknown) => JSON.stringify(e),\n decode: (e: unknown) => JSON.parse(e as string)\n },\n DateTime: {\n decode: (e: unknown) => new Date(e as string),\n encode: (e: unknown) => (e as Date).toISOString()\n },\n BigInt: {\n decode: (e: unknown) => BigInt(e as string),\n encode: (e: unknown) => (e as bigint).toString()\n }\n }\n })({\n updateDraftMail: [\n {\n draftId,\n recipients: recipientsIds,\n replyTo,\n body: body\n ? sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(body),\n this.#keys.publicKey,\n this.#keys.privateKey\n )\n )\n : null,\n subject: subject\n ? sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(subject),\n this.#keys.publicKey,\n this.#keys.privateKey\n )\n )\n : null,\n senderFiles,\n hash,\n hashKey\n },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on ErrorBasic\": {\n __typename: true,\n message: true\n },\n \"...on UpdateDraftMailResponse\": {\n __typename: true,\n updateDraftMail: mailSelector\n }\n }\n ]\n });\n\n if (!updateDraftMail) {\n return null;\n }\n\n if (updateDraftMail.__typename === \"ErrorAccessDenied\") {\n return updateDraftMail;\n }\n\n if (updateDraftMail.__typename === \"ErrorBasic\") {\n return updateDraftMail;\n }\n\n if (!updateDraftMail.updateDraftMail) {\n return null;\n }\n\n const result = convertInternalMailToExternal(\n updateDraftMail.updateDraftMail,\n this.#keys\n ) as DraftMail;\n\n return {\n __typename: \"SuccessResponse\",\n data: result\n };\n }\n\n async deleteDraft(\n draftId: string\n ): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null> {\n const { deleteDraftMail } = await this.#thunder(\"mutation\")({\n deleteDraftMail: [\n {\n draftId\n },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on DeleteDraftMailResponse\": {\n __typename: true,\n deleteDraftMail: true\n }\n }\n ]\n });\n\n if (!deleteDraftMail) {\n return null;\n }\n\n if (deleteDraftMail.__typename === \"ErrorAccessDenied\") {\n return deleteDraftMail;\n }\n\n if (!deleteDraftMail.deleteDraftMail) {\n return null;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: deleteDraftMail.deleteDraftMail ?? false\n };\n }\n\n async deleteTrash({\n ids\n }: {\n ids: Array<string>;\n }): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null> {\n const { deleteMailTrash } = await this.#thunder(\"mutation\")({\n deleteMailTrash: [\n {\n ids\n },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on DeleteMailTrashResponse\": {\n __typename: true,\n deleteMailTrash: true\n }\n }\n ]\n });\n\n if (!deleteMailTrash) {\n return null;\n }\n\n if (deleteMailTrash.__typename === \"ErrorAccessDenied\") {\n return deleteMailTrash;\n }\n\n if (!deleteMailTrash.deleteMailTrash) {\n return null;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: deleteMailTrash.deleteMailTrash\n };\n }\n\n async emptyTrash(): Promise<\n SuccessResponse<boolean> | ErrorAccessDenied | null\n > {\n const { emptyMailTrash } = await this.#thunder(\"mutation\")({\n emptyMailTrash: {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on EmptyMailTrashResponse\": {\n __typename: true,\n emptyMailTrash: true\n }\n }\n });\n\n if (!emptyMailTrash) {\n return null;\n }\n\n if (emptyMailTrash.__typename === \"ErrorAccessDenied\") {\n return emptyMailTrash;\n }\n\n if (!emptyMailTrash.emptyMailTrash) {\n return null;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: emptyMailTrash.emptyMailTrash\n };\n }\n\n async delete({\n mailId\n }: {\n mailId: string;\n }): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null> {\n const { deleteMail } = await this.#thunder(\"mutation\")({\n deleteMail: [\n {\n mailId\n },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on DeleteMailResponse\": {\n __typename: true,\n deleteMail: true\n }\n }\n ]\n });\n\n if (!deleteMail) {\n return null;\n }\n\n if (deleteMail.__typename === \"ErrorAccessDenied\") {\n return deleteMail;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: deleteMail.deleteMail\n };\n }\n\n async sendDraft(\n draftId: string,\n customMessage?: string | null | undefined\n ): Promise<SuccessResponse<boolean> | ErrorAccessDenied | ErrorBasic | null> {\n const drafts = await this.draftMails();\n\n if (!drafts) {\n return {\n __typename: \"SuccessResponse\",\n data: false\n };\n }\n if (drafts.__typename !== \"SuccessResponse\") {\n return {\n __typename: \"SuccessResponse\",\n data: false\n };\n }\n\n const draft = drafts.data.find(d => d.mailIntegrityId === draftId);\n if (!draft) {\n return {\n __typename: \"SuccessResponse\",\n data: false\n };\n }\n const recipients = new Array<MailRecipientInput>();\n\n const temporaryRecipients = new Array<string>();\n\n for (const { email } of draft.temporaryRecipients) {\n if (!email) {\n continue;\n }\n const input = await this._eachUser(\n draft.files,\n draft.subject,\n draft.body,\n email\n );\n\n if (!input) {\n temporaryRecipients.push(email);\n } else {\n recipients.push(input);\n }\n }\n\n for (const { id } of draft.recipients) {\n const input = await this._eachUser(\n draft.files,\n draft.subject,\n draft.body,\n id\n );\n\n if (!input) {\n temporaryRecipients.push(id);\n } else {\n recipients.push(input);\n }\n }\n\n const { sendDraftMail } = await this.#thunder(\"mutation\")({\n sendDraftMail: [\n {\n temporaryRecipients,\n recipients,\n draftMailId: draft.mailIntegrityId,\n customMessage\n },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on ErrorBasic\": {\n __typename: true,\n message: true\n },\n \"...on SendDraftMailResponse\": {\n __typename: true,\n sendDraftMail: true\n }\n }\n ]\n });\n\n if (!sendDraftMail) {\n return null;\n }\n\n if (sendDraftMail.__typename === \"ErrorAccessDenied\") {\n return sendDraftMail;\n }\n\n if (sendDraftMail.__typename === \"ErrorBasic\") {\n return sendDraftMail;\n }\n\n if (!sendDraftMail.sendDraftMail) {\n return null;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: sendDraftMail.sendDraftMail\n };\n }\n\n async sendWaitingEmails(): Promise<\n SuccessResponse<boolean> | ErrorAccessDenied | ErrorBasic | null\n > {\n // TODO opti this\n const mails = await this.sentMails();\n\n if (!mails) {\n return {\n __typename: \"SuccessResponse\",\n data: false\n };\n }\n if (mails.__typename !== \"SuccessResponse\") {\n return {\n __typename: \"SuccessResponse\",\n data: false\n };\n }\n const filtered = mails.data.filter(m => m.temporaryRecipients.length > 0);\n\n for (const mail of filtered) {\n for (const { email } of mail.temporaryRecipients) {\n if (!email) {\n continue;\n }\n try {\n const input = await this._eachUser(\n mail.files,\n mail.subject,\n mail.body,\n email\n );\n\n if (!input) {\n continue;\n }\n await this.#thunder(\"mutation\")({\n sendOneMail: [\n {\n mailIntegrityId: mail.mailIntegrityId,\n recipient: input\n },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on ErrorBasic\": {\n __typename: true,\n message: true\n },\n \"...on RecoverNodeResponse\": {\n __typename: true,\n recoverNode: true\n }\n }\n ]\n });\n } catch {\n continue;\n }\n }\n }\n return {\n __typename: \"SuccessResponse\",\n data: false\n };\n }\n\n async createDraft({\n body,\n subject,\n files,\n recipientsIds,\n replyTo\n }: NewMail): Promise<\n SuccessResponse<DraftMail> | ErrorAccessDenied | ErrorBasic | null\n > {\n const hashKey = sodium.randombytes_buf(\n sodium.crypto_generichash_KEYBYTES,\n \"hex\"\n );\n const hash = sodium.crypto_generichash(\n sodium.crypto_generichash_BYTES,\n JSON.stringify({ body, subject }),\n hashKey,\n \"hex\"\n );\n const senderFiles = new Array<MailFileInput>();\n for (const f of files) {\n let file = filesCache.get(f.id);\n if (!file) {\n await this.#client.cloud.fileMetadata({ id: f.id });\n file = filesCache.get(f.id);\n if (!file) {\n throw new Error(`File ${f.name} (${f.id}) does not exists`);\n }\n }\n senderFiles.push({\n id: file.id,\n fileKey: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(file.key),\n this.#keys.publicKey,\n this.#keys.privateKey\n )\n ),\n name: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(f.name),\n this.#keys.publicKey,\n this.#keys.privateKey\n )\n )\n });\n }\n\n const { createDraftMail } = await this.#thunder(\"mutation\", {\n scalars: {\n DateTime: {\n decode: (e: unknown) => new Date(e as string),\n encode: (e: unknown) => (e as Date).toISOString()\n }\n }\n })({\n createDraftMail: [\n {\n recipients: recipientsIds,\n replyTo,\n body: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(body),\n this.#keys.publicKey,\n this.#keys.privateKey\n )\n ),\n subject: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(subject),\n this.#keys.publicKey,\n this.#keys.privateKey\n )\n ),\n senderFiles,\n hash,\n hashKey\n },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on ErrorBasic\": {\n __typename: true,\n message: true\n },\n \"...on CreateDraftMailResponse\": {\n __typename: true,\n createDraftMail: mailSelector\n }\n }\n ]\n });\n\n if (!createDraftMail) {\n return null;\n }\n\n if (createDraftMail.__typename === \"ErrorAccessDenied\") {\n return createDraftMail;\n }\n\n if (createDraftMail.__typename === \"ErrorBasic\") {\n return createDraftMail;\n }\n\n if (!createDraftMail.createDraftMail) {\n return null;\n }\n\n const result = convertInternalMailToExternal(\n createDraftMail.createDraftMail,\n this.#keys\n ) as DraftMail;\n\n return {\n __typename: \"SuccessResponse\",\n data: result\n };\n }\n\n async read({\n mailId\n }: {\n mailId: string;\n }): Promise<\n | SuccessResponse<boolean>\n | ErrorAccessDenied\n | ErrorBasic\n | ErrorNotFound\n | null\n > {\n const { readMail } = await this.#thunder(\"mutation\")({\n readMail: [\n { mailId },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on ErrorBasic\": {\n __typename: true,\n message: true\n },\n \"...on ErrorNotFound\": {\n __typename: true,\n message: true\n },\n \"...on ReadMailResponse\": {\n __typename: true,\n readMail: true\n }\n }\n ]\n });\n\n if (!readMail) {\n return null;\n }\n\n if (readMail.__typename === \"ErrorAccessDenied\") {\n return readMail;\n }\n\n if (readMail.__typename === \"ErrorBasic\") {\n return readMail;\n }\n\n if (readMail.__typename === \"ErrorNotFound\") {\n return readMail;\n }\n\n if (!readMail.readMail) {\n return null;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: readMail.readMail\n };\n }\n\n async unread({\n mailId\n }: {\n mailId: string;\n }): Promise<\n | SuccessResponse<boolean>\n | ErrorAccessDenied\n | ErrorBasic\n | ErrorNotFound\n | null\n > {\n const { unreadMail } = await this.#thunder(\"mutation\")({\n unreadMail: [\n { mailId },\n {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on ErrorBasic\": {\n __typename: true,\n message: true\n },\n \"...on ErrorNotFound\": {\n __typename: true,\n message: true\n },\n \"...on UnreadMailResponse\": {\n __typename: true,\n unreadMail: true\n }\n }\n ]\n });\n\n if (!unreadMail) {\n return null;\n }\n\n if (unreadMail.__typename === \"ErrorAccessDenied\") {\n return unreadMail;\n }\n\n if (unreadMail.__typename === \"ErrorBasic\") {\n return unreadMail;\n }\n\n if (unreadMail.__typename === \"ErrorNotFound\") {\n return unreadMail;\n }\n\n if (!unreadMail.unreadMail) {\n return null;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: unreadMail.unreadMail\n };\n }\n\n async receivedMails(): Promise<\n SuccessResponse<ReceivedMail[]> | ErrorNotFound | null\n > {\n const { user } = await this.#thunder(\"query\", {\n scalars: {\n DateTime: {\n decode: (e: unknown) => new Date(e as string),\n encode: (e: unknown) => (e as Date).toISOString()\n }\n }\n })({\n user: [\n {},\n {\n \"...on ErrorNotFound\": {\n __typename: true,\n message: true\n },\n \"...on UserResponse\": {\n __typename: true,\n user: {\n receivedMails: mailSelector\n }\n }\n }\n ]\n });\n\n if (!user) {\n return null;\n }\n\n if (user.__typename === \"ErrorNotFound\") {\n return user;\n }\n\n if (!user.user) {\n return null;\n }\n\n // TODO get actual mails on this app only\n\n const receivedMails = new Array<ReceivedMail>();\n\n for (const m of user.user.receivedMails) {\n const mail = convertInternalMailToExternal(m, this.#keys);\n if (mail) {\n receivedMails.push(mail as ReceivedMail);\n }\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: receivedMails\n };\n }\n\n async sentMails(): Promise<\n SuccessResponse<SentMail[]> | ErrorNotFound | null\n > {\n const { user } = await this.#thunder(\"query\", {\n scalars: {\n DateTime: {\n decode: (e: unknown) => new Date(e as string),\n encode: (e: unknown) => (e as Date).toISOString()\n }\n }\n })({\n user: [\n {},\n {\n \"...on ErrorNotFound\": {\n __typename: true,\n message: true\n },\n \"...on UserResponse\": {\n __typename: true,\n user: {\n sentMails: mailSelector\n }\n }\n }\n ]\n });\n\n if (!user) {\n return null;\n }\n\n if (user.__typename === \"ErrorNotFound\") {\n return user;\n }\n\n if (!user.user) {\n return null;\n }\n\n // TODO get actual mails on this app only\n\n const sentMails = new Array<SentMail>();\n\n for (const m of user.user.sentMails) {\n const mail = convertInternalMailToExternal(m, this.#keys);\n if (mail) {\n sentMails.push(mail as SentMail);\n }\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: sentMails\n };\n }\n\n async draftMails(): Promise<\n SuccessResponse<DraftMail[]> | ErrorNotFound | null\n > {\n const { user } = await this.#thunder(\"query\", {\n scalars: {\n DateTime: {\n decode: (e: unknown) => new Date(e as string),\n encode: (e: unknown) => (e as Date).toISOString()\n }\n }\n })({\n user: [\n {},\n {\n \"...on ErrorNotFound\": {\n __typename: true,\n message: true\n },\n \"...on UserResponse\": {\n __typename: true,\n user: {\n draftMails: mailSelector\n }\n }\n }\n ]\n });\n\n if (!user) {\n return null;\n }\n\n if (user.__typename === \"ErrorNotFound\") {\n return user;\n }\n\n if (!user.user) {\n return null;\n }\n\n // TODO get actual mails on this app only\n\n const draftMails = new Array<DraftMail>();\n\n for (const m of user.user.draftMails) {\n const draft = convertInternalMailToExternal(m, this.#keys) as DraftMail;\n if (draft) {\n draftMails.push(draft);\n }\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: draftMails\n };\n }\n\n async unreadReceivedMailsCount(): Promise<\n SuccessResponse<number> | ErrorAccessDenied | null\n > {\n const { unreadReceivedMailsCount } = await this.#thunder(\"query\")({\n unreadReceivedMailsCount: {\n \"...on ErrorAccessDenied\": {\n __typename: true,\n message: true\n },\n \"...on UnreadReceivedMailsCountResponse\": {\n __typename: true,\n count: true\n }\n }\n });\n\n if (!unreadReceivedMailsCount) {\n return null;\n }\n\n if (unreadReceivedMailsCount.__typename === \"ErrorAccessDenied\") {\n return unreadReceivedMailsCount;\n }\n\n return {\n __typename: \"SuccessResponse\",\n data: unreadReceivedMailsCount.count\n };\n }\n\n private _eachUser = async (\n files: { id: string; name: string }[],\n subject: string,\n body: string,\n idOrMail: string\n ): Promise<MailRecipientInput | null> => {\n let u = usersCache.get(idOrMail);\n\n if (!u || !(\"publicKey\" in u)) {\n try {\n const req = await this.#client.user({\n userId: idOrMail,\n withPublicKey: true\n });\n if (!req) {\n return null;\n }\n if (req.__typename !== \"SuccessResponse\") {\n return null;\n }\n u = req.data;\n } catch {\n return null;\n }\n\n if (!u) {\n return null;\n }\n }\n\n if (!(\"publicKey\" in u)) {\n throw new Error(`User ${idOrMail} have no public key`);\n }\n\n const recipientsFiles = new Array<MailFileInput>();\n\n for (const f of files) {\n let fileInHistory = filesCache.get(f.id);\n if (!fileInHistory) {\n await this.#client.cloud.fileMetadata({ id: f.id });\n fileInHistory = filesCache.get(f.id);\n if (!fileInHistory) {\n throw new Error(`File ${f.name} (${f.id}) does not exists`);\n }\n }\n const key = fileInHistory.key;\n recipientsFiles.push({\n id: f.id,\n name: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(f.name),\n u.publicKey,\n this.#keys.privateKey\n )\n ),\n fileKey: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_hex(key),\n u.publicKey,\n this.#keys.privateKey\n )\n )\n });\n }\n\n return {\n recipientId: u.id,\n body: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(body),\n u.publicKey,\n this.#keys.privateKey\n )\n ),\n subject: sodium.to_hex(\n encryptCryptoBox(\n sodium.from_string(subject),\n u.publicKey,\n this.#keys.privateKey\n )\n ),\n files: recipientsFiles\n };\n };\n}\n"],"mappings":"AACA,OAAS,YAAAA,MAAgB,UACzB,OAAS,cAAAC,EAAY,cAAAC,MAAkB,cAQvC,OAAS,oBAAAC,EAAkB,UAAAC,MAAc,cAEzC,OAAS,iCAAAC,MAAqC,oBAU9C,OAAS,gBAAAC,MAAoB,uBAEtB,MAAMC,CAAkB,CAC7BC,GAEAC,GAEAC,GAEA,YACEC,EACAC,EACAC,EACA,CACA,KAAKL,GAAUG,EACf,KAAKF,GAAQG,EACb,KAAKF,GAAWG,CAClB,CAEA,MAAM,IAAI,CACR,GAAAC,CACF,EAE8D,CAC5D,KAAM,CAAE,KAAAC,CAA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B,EAGvD,MAAMG,EAAkB,IAAI,MAE5B,UAAWzB,KAAKR,EAAO,CACrB,IAAIkC,EAAgB/D,EAAW,IAAIqC,EAAE,EAAE,EACvC,GAAI,CAAC0B,IACH,MAAM,KAAKxD,GAAQ,MAAM,aAAa,CAAE,GAAI8B,EAAE,EAAG,CAAC,EAClD0B,EAAgB/D,EAAW,IAAIqC,EAAE,EAAE,EAC/B,CAAC0B,GACH,MAAM,IAAI,MAAM,QAAQ1B,EAAE,SAASA,EAAE,qBAAqB,EAG9D,MAAM2B,EAAMD,EAAc,IAC1BD,EAAgB,KAAK,CACnB,GAAIzB,EAAE,GACN,KAAMlC,EAAO,OACXD,EACEC,EAAO,YAAYkC,EAAE,IAAI,EACzBuB,EAAE,UACF,KAAKpD,GAAM,UACb,CACF,EACA,QAASL,EAAO,OACdD,EACEC,EAAO,SAAS6D,CAAG,EACnBJ,EAAE,UACF,KAAKpD,GAAM,UACb,CACF,CACF,CAAC,CACH,CAEA,MAAO,CACL,YAAaoD,EAAE,GACf,KAAMzD,EAAO,OACXD,EACEC,EAAO,YAAYwB,CAAI,EACvBiC,EAAE,UACF,KAAKpD,GAAM,UACb,CACF,EACA,QAASL,EAAO,OACdD,EACEC,EAAO,YAAYyB,CAAO,EAC1BgC,EAAE,UACF,KAAKpD,GAAM,UACb,CACF,EACA,MAAOsD,CACT,CACF,CACF","names":["generate","filesCache","usersCache","encryptCryptoBox","sodium","convertInternalMailToExternal","mailSelector","SecrecyMailClient","#client","#keys","#thunder","client","keys","thunder","id","mail","e","result","mailId","recoverMail","mailType","deletedMails","mails","m","data","customMessage","user","draftId","body","subject","files","recipientsIds","replyTo","drafts","d","hashKey","hash","senderFiles","f","file","updateDraftMail","deleteDraftMail","ids","deleteMailTrash","emptyMailTrash","deleteMail","draft","recipients","temporaryRecipients","email","input","sendDraftMail","filtered","createDraftMail","readMail","unreadMail","receivedMails","sentMails","draftMails","unreadReceivedMailsCount","idOrMail","u","req","recipientsFiles","fileInHistory","key"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _indexjs = require('../index.js');var _PopupToolsjs = require('../PopupTools.js');class S{#e;#r;#t;constructor(e,r,t){this.#e=e,this.#r=r,this.#t=t}async confirmPaymentIntent({env:e="prod",paymentIntentId:r,secrecyIdWhoCreatedPaymentIntent:t,secrecyIdWhoNeedToConfirmPaymentIntent:s,amount:c,currency:o}){const y=_indexjs.getUrl.call(void 0, {env:e,hash:Buffer.from(JSON.stringify({appSession:this.#e.sessionId,paymentIntentId:r,secrecyIdWhoCreatedPaymentIntent:t,secrecyIdWhoNeedToConfirmPaymentIntent:s,amount:c,currency:o})).toString("base64"),path:"/account/iframe/pay-confirm"});return new Promise((i,a)=>_PopupToolsjs.popup.call(void 0, y,"Secrecy Pay - Confirm Payment Intent",{width:500},(n,p)=>n?a(n):i(p)))}}exports.SecrecyPayClient = S;
|
|
2
|
-
//# sourceMappingURL=SecrecyPayClient.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/SecrecyPayClient.ts"],"names":["getUrl","popup","SecrecyPayClient","#client","#keys","#thunder","client","keys","thunder","env","paymentIntentId","secrecyIdWhoCreatedPaymentIntent","secrecyIdWhoNeedToConfirmPaymentIntent","amount","currency","url","resolve","reject","err","data"],"mappings":"AAEA,OAAS,UAAAA,MAAc,cAGvB,OAAS,SAAAC,MAAa,mBAcf,MAAMC,CAAiB,CAG5BC,GAIAC,GAIAC,GAEA,YACEC,EACAC,EACAC,EACA,CACA,KAAKL,GAAUG,EACf,KAAKF,GAAQG,EACb,KAAKF,GAAWG,CAClB,CAEA,MAAM,qBAAqB,CACzB,IAAAC,EAAM,OACN,gBAAAC,EACA,iCAAAC,EACA,uCAAAC,EACA,OAAAC,EACA,SAAAC,CACF,EAOiE,CAC/D,MAAMC,EAAMf,EAAO,CACjB,IAAAS,EACA,KAAM,OAAO,KACX,KAAK,UAAU,CACb,WAAY,KAAKN,GAAQ,UACzB,gBAAAO,EACA,iCAAAC,EACA,uCAAAC,EACA,OAAAC,EACA,SAAAC,CACF,CAAC,CACH,EAAE,SAAS,QAAQ,EACnB,KAAM,6BACR,CAAC,EACD,OAAO,IAAI,QAAQ,CAACE,EAASC,IAC3BhB,EACEc,EACA,uCACA,CACE,MAAO,GACT,EACA,CAACG,EAAKC,IACAD,EACKD,EAAOC,CAAG,EAEZF,EACLG,CACF,CAEJ,CACF,CACF,CACF","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { SecrecyClient, SecrecyEnv } from \"../index.js\";\nimport { getUrl } from \"../index.js\";\nimport type { KeyPair } from \"../crypto/index.js\";\nimport type { Thunder } from \"../zeus/index.js\";\nimport { popup } from \"../PopupTools.js\";\n\ntype SuccessPayResponse<T> = {\n success: true;\n data: T;\n};\n\ntype ErrorPayResponse = {\n success: false;\n error: string;\n};\n\nexport type SecrecyPayResponse<T> = SuccessPayResponse<T> | ErrorPayResponse;\n\nexport class SecrecyPayClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n #client: SecrecyClient;\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n #keys: KeyPair;\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n #thunder: ReturnType<typeof Thunder>;\n\n constructor(\n client: SecrecyClient,\n keys: KeyPair,\n thunder: ReturnType<typeof Thunder>\n ) {\n this.#client = client;\n this.#keys = keys;\n this.#thunder = thunder;\n }\n\n async confirmPaymentIntent({\n env = \"prod\",\n paymentIntentId,\n secrecyIdWhoCreatedPaymentIntent,\n secrecyIdWhoNeedToConfirmPaymentIntent,\n amount,\n currency\n }: {\n env?: SecrecyEnv;\n paymentIntentId: string;\n secrecyIdWhoCreatedPaymentIntent: string;\n secrecyIdWhoNeedToConfirmPaymentIntent: string;\n amount: number;\n currency: \"eur\" | \"usd\";\n }): Promise<SecrecyPayResponse<{ id: string; message: string }>> {\n const url = getUrl({\n env,\n hash: Buffer.from(\n JSON.stringify({\n appSession: this.#client.sessionId,\n paymentIntentId,\n secrecyIdWhoCreatedPaymentIntent,\n secrecyIdWhoNeedToConfirmPaymentIntent,\n amount,\n currency\n })\n ).toString(\"base64\"),\n path: \"/account/iframe/pay-confirm\"\n });\n return new Promise((resolve, reject) =>\n popup(\n url,\n \"Secrecy Pay - Confirm Payment Intent\",\n {\n width: 500\n },\n (err, data) => {\n if (err) {\n return reject(err);\n }\n return resolve(\n data as SecrecyPayResponse<{ id: string; message: string }>\n );\n }\n )\n );\n }\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { s as SecrecyPayClient, r as SecrecyPayResponse } from '../BaseClient-2af8a400.js';
|
|
2
|
-
import '../crypto/index.js';
|
|
3
|
-
import '../zeus/index.js';
|
|
4
|
-
import 'ky';
|
|
5
|
-
import '../error.js';
|
|
6
|
-
import '../crypto/file.js';
|
|
7
|
-
import './types/File.js';
|
|
8
|
-
import './types/selectors.js';
|
|
9
|
-
import '../zeus/const.js';
|
|
10
|
-
import './types/index.js';
|
|
11
|
-
import './types/UserAppSettings.js';
|
|
12
|
-
import './types/UserAppNotifications.js';
|
|
13
|
-
import './types/Inputs.js';
|
|
14
|
-
import 'jsonwebtoken';
|
|
15
|
-
import 'bson';
|
|
16
|
-
import 'ethers';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{getUrl as m}from"../index.js";import{popup as u}from"../PopupTools.js";class S{#e;#r;#t;constructor(e,r,t){this.#e=e,this.#r=r,this.#t=t}async confirmPaymentIntent({env:e="prod",paymentIntentId:r,secrecyIdWhoCreatedPaymentIntent:t,secrecyIdWhoNeedToConfirmPaymentIntent:s,amount:c,currency:o}){const y=m({env:e,hash:Buffer.from(JSON.stringify({appSession:this.#e.sessionId,paymentIntentId:r,secrecyIdWhoCreatedPaymentIntent:t,secrecyIdWhoNeedToConfirmPaymentIntent:s,amount:c,currency:o})).toString("base64"),path:"/account/iframe/pay-confirm"});return new Promise((i,a)=>u(y,"Secrecy Pay - Confirm Payment Intent",{width:500},(n,p)=>n?a(n):i(p)))}}export{S as SecrecyPayClient};
|
|
2
|
-
//# sourceMappingURL=SecrecyPayClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/SecrecyPayClient.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { SecrecyClient, SecrecyEnv } from \"../index.js\";\nimport { getUrl } from \"../index.js\";\nimport type { KeyPair } from \"../crypto/index.js\";\nimport type { Thunder } from \"../zeus/index.js\";\nimport { popup } from \"../PopupTools.js\";\n\ntype SuccessPayResponse<T> = {\n success: true;\n data: T;\n};\n\ntype ErrorPayResponse = {\n success: false;\n error: string;\n};\n\nexport type SecrecyPayResponse<T> = SuccessPayResponse<T> | ErrorPayResponse;\n\nexport class SecrecyPayClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n #client: SecrecyClient;\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n #keys: KeyPair;\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n #thunder: ReturnType<typeof Thunder>;\n\n constructor(\n client: SecrecyClient,\n keys: KeyPair,\n thunder: ReturnType<typeof Thunder>\n ) {\n this.#client = client;\n this.#keys = keys;\n this.#thunder = thunder;\n }\n\n async confirmPaymentIntent({\n env = \"prod\",\n paymentIntentId,\n secrecyIdWhoCreatedPaymentIntent,\n secrecyIdWhoNeedToConfirmPaymentIntent,\n amount,\n currency\n }: {\n env?: SecrecyEnv;\n paymentIntentId: string;\n secrecyIdWhoCreatedPaymentIntent: string;\n secrecyIdWhoNeedToConfirmPaymentIntent: string;\n amount: number;\n currency: \"eur\" | \"usd\";\n }): Promise<SecrecyPayResponse<{ id: string; message: string }>> {\n const url = getUrl({\n env,\n hash: Buffer.from(\n JSON.stringify({\n appSession: this.#client.sessionId,\n paymentIntentId,\n secrecyIdWhoCreatedPaymentIntent,\n secrecyIdWhoNeedToConfirmPaymentIntent,\n amount,\n currency\n })\n ).toString(\"base64\"),\n path: \"/account/iframe/pay-confirm\"\n });\n return new Promise((resolve, reject) =>\n popup(\n url,\n \"Secrecy Pay - Confirm Payment Intent\",\n {\n width: 500\n },\n (err, data) => {\n if (err) {\n return reject(err);\n }\n return resolve(\n data as SecrecyPayResponse<{ id: string; message: string }>\n );\n }\n )\n );\n }\n}\n"],"mappings":"AAEA,OAAS,UAAAA,MAAc,cAGvB,OAAS,SAAAC,MAAa,mBAcf,MAAMC,CAAiB,CAG5BC,GAIAC,GAIAC,GAEA,YACEC,EACAC,EACAC,EACA,CACA,KAAKL,GAAUG,EACf,KAAKF,GAAQG,EACb,KAAKF,GAAWG,CAClB,CAEA,MAAM,qBAAqB,CACzB,IAAAC,EAAM,OACN,gBAAAC,EACA,iCAAAC,EACA,uCAAAC,EACA,OAAAC,EACA,SAAAC,CACF,EAOiE,CAC/D,MAAMC,EAAMf,EAAO,CACjB,IAAAS,EACA,KAAM,OAAO,KACX,KAAK,UAAU,CACb,WAAY,KAAKN,GAAQ,UACzB,gBAAAO,EACA,iCAAAC,EACA,uCAAAC,EACA,OAAAC,EACA,SAAAC,CACF,CAAC,CACH,EAAE,SAAS,QAAQ,EACnB,KAAM,6BACR,CAAC,EACD,OAAO,IAAI,QAAQ,CAACE,EAASC,IAC3BhB,EACEc,EACA,uCACA,CACE,MAAO,GACT,EACA,CAACG,EAAKC,IACAD,EACKD,EAAOC,CAAG,EAEZF,EACLG,CACF,CAEJ,CACF,CACF,CACF","names":["getUrl","popup","SecrecyPayClient","#client","#keys","#thunder","client","keys","thunder","env","paymentIntentId","secrecyIdWhoCreatedPaymentIntent","secrecyIdWhoNeedToConfirmPaymentIntent","amount","currency","url","resolve","reject","err","data"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _indexjs = require('../index.js');var _indexjs3 = require('../zeus/index.js');var _PopupToolsjs = require('../PopupTools.js');class m{#e;constructor(e){this.#e=e}async createTransaction({env:e="prod",network:t=_indexjs3.InfuraNetwork.mainnet,tx:s}){const n=_indexjs.getUrl.call(void 0, {env:e,hash:Buffer.from(JSON.stringify({appSession:this.#e.sessionId,network:t,tx:s})).toString("base64"),path:"/account/iframe/wallet-transaction"});return new Promise((o,a)=>_PopupToolsjs.popup.call(void 0, n,"Secrecy Wallet - Transaction",{width:500},(r,i)=>r?a(r):o(i)))}async createSignature({env:e="prod",network:t=_indexjs3.InfuraNetwork.mainnet,message:s}){const n=_indexjs.getUrl.call(void 0, {env:e,hash:Buffer.from(JSON.stringify({appSession:this.#e.sessionId,network:t,message:s})).toString("base64"),path:"/account/iframe/wallet-signature"});return new Promise((o,a)=>_PopupToolsjs.popup.call(void 0, n,"Secrecy Wallet - Signature",{width:500},(r,i)=>r?a(r):o(i)))}}exports.SecrecyWalletClient = m;
|
|
2
|
-
//# sourceMappingURL=SecrecyWalletClient.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/SecrecyWalletClient.ts"],"names":["getUrl","InfuraNetwork","popup","SecrecyWalletClient","#client","client","env","network","tx","url","resolve","reject","err","data","message"],"mappings":"AAEA,OAAS,UAAAA,MAAc,cACvB,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,SAAAC,MAAa,mBAiBf,MAAMC,CAAoB,CAC/BC,GAMA,YACEC,EAGA,CACA,KAAKD,GAAUC,CAGjB,CAEA,MAAM,kBAAkB,CACtB,IAAAC,EAAM,OACN,QAAAC,EAAUN,EAAc,QACxB,GAAAO,CACF,EAIiE,CAC/D,MAAMC,EAAMT,EAAO,CACjB,IAAAM,EACA,KAAM,OAAO,KACX,KAAK,UAAU,CACb,WAAY,KAAKF,GAAQ,UACzB,QAAAG,EACA,GAAAC,CACF,CAAC,CACH,EAAE,SAAS,QAAQ,EACnB,KAAM,oCACR,CAAC,EACD,OAAO,IAAI,QAAQ,CAACE,EAASC,IAC3BT,EACEO,EACA,+BACA,CACE,MAAO,GACT,EACA,CAACG,EAAKC,IACAD,EACKD,EAAOC,CAAG,EAEZF,EACLG,CACF,CAEJ,CACF,CACF,CAEA,MAAM,gBAAgB,CACpB,IAAAP,EAAM,OACN,QAAAC,EAAUN,EAAc,QACxB,QAAAa,CACF,EAI2C,CACzC,MAAML,EAAMT,EAAO,CACjB,IAAAM,EACA,KAAM,OAAO,KACX,KAAK,UAAU,CACb,WAAY,KAAKF,GAAQ,UACzB,QAAAG,EACA,QAAAO,CACF,CAAC,CACH,EAAE,SAAS,QAAQ,EACnB,KAAM,kCACR,CAAC,EACD,OAAO,IAAI,QAAQ,CAACJ,EAASC,IAC3BT,EACEO,EACA,6BACA,CACE,MAAO,GACT,EACA,CAACG,EAAKC,IACAD,EACKD,EAAOC,CAAG,EAEZF,EAAQG,CAAqC,CAExD,CACF,CACF,CACF","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { SecrecyClient, SecrecyEnv } from \"../index.js\";\nimport { getUrl } from \"../index.js\";\nimport { InfuraNetwork } from \"../zeus/index.js\";\nimport { popup } from \"../PopupTools.js\";\nimport type { providers } from \"ethers\";\n\ntype SuccessWalletResponse<T> = {\n success: true;\n data: T;\n};\n\ntype ErrorWalletResponse = {\n success: false;\n error: string;\n};\n\nexport type SecrecyWalletResponse<T> =\n | SuccessWalletResponse<T>\n | ErrorWalletResponse;\n\nexport class SecrecyWalletClient {\n #client: SecrecyClient;\n\n // #keys: KeyPair;\n\n // #thunder: ReturnType<typeof Thunder>;\n\n constructor(\n client: SecrecyClient\n // _keys: KeyPair,\n // _thunder: ReturnType<typeof Thunder>\n ) {\n this.#client = client;\n // this.#keys = keys;\n // this.#thunder = thunder;\n }\n\n async createTransaction({\n env = \"prod\",\n network = InfuraNetwork.mainnet,\n tx\n }: {\n env?: SecrecyEnv;\n network?: InfuraNetwork;\n tx: providers.TransactionRequest;\n }): Promise<SecrecyWalletResponse<{ id: string; hash: string }>> {\n const url = getUrl({\n env,\n hash: Buffer.from(\n JSON.stringify({\n appSession: this.#client.sessionId,\n network,\n tx\n })\n ).toString(\"base64\"),\n path: \"/account/iframe/wallet-transaction\"\n });\n return new Promise((resolve, reject) =>\n popup(\n url,\n \"Secrecy Wallet - Transaction\",\n {\n width: 500\n },\n (err, data) => {\n if (err) {\n return reject(err);\n }\n return resolve(\n data as SecrecyWalletResponse<{ id: string; hash: string }>\n );\n }\n )\n );\n }\n\n async createSignature({\n env = \"prod\",\n network = InfuraNetwork.mainnet,\n message\n }: {\n env?: SecrecyEnv;\n network?: InfuraNetwork;\n message: string;\n }): Promise<SecrecyWalletResponse<string>> {\n const url = getUrl({\n env,\n hash: Buffer.from(\n JSON.stringify({\n appSession: this.#client.sessionId,\n network,\n message\n })\n ).toString(\"base64\"),\n path: \"/account/iframe/wallet-signature\"\n });\n return new Promise((resolve, reject) =>\n popup(\n url,\n \"Secrecy Wallet - Signature\",\n {\n width: 500\n },\n (err, data) => {\n if (err) {\n return reject(err);\n }\n return resolve(data as SecrecyWalletResponse<string>);\n }\n )\n );\n }\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { q as SecrecyWalletClient, o as SecrecyWalletResponse } from '../BaseClient-2af8a400.js';
|
|
2
|
-
import '../zeus/index.js';
|
|
3
|
-
import 'ethers';
|
|
4
|
-
import 'ky';
|
|
5
|
-
import '../error.js';
|
|
6
|
-
import '../crypto/file.js';
|
|
7
|
-
import '../crypto/index.js';
|
|
8
|
-
import './types/File.js';
|
|
9
|
-
import './types/selectors.js';
|
|
10
|
-
import '../zeus/const.js';
|
|
11
|
-
import './types/index.js';
|
|
12
|
-
import './types/UserAppSettings.js';
|
|
13
|
-
import './types/UserAppNotifications.js';
|
|
14
|
-
import './types/Inputs.js';
|
|
15
|
-
import 'jsonwebtoken';
|
|
16
|
-
import 'bson';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{getUrl as c}from"../index.js";import{InfuraNetwork as l}from"../zeus/index.js";import{popup as p}from"../PopupTools.js";class m{#e;constructor(e){this.#e=e}async createTransaction({env:e="prod",network:t=l.mainnet,tx:s}){const n=c({env:e,hash:Buffer.from(JSON.stringify({appSession:this.#e.sessionId,network:t,tx:s})).toString("base64"),path:"/account/iframe/wallet-transaction"});return new Promise((o,a)=>p(n,"Secrecy Wallet - Transaction",{width:500},(r,i)=>r?a(r):o(i)))}async createSignature({env:e="prod",network:t=l.mainnet,message:s}){const n=c({env:e,hash:Buffer.from(JSON.stringify({appSession:this.#e.sessionId,network:t,message:s})).toString("base64"),path:"/account/iframe/wallet-signature"});return new Promise((o,a)=>p(n,"Secrecy Wallet - Signature",{width:500},(r,i)=>r?a(r):o(i)))}}export{m as SecrecyWalletClient};
|
|
2
|
-
//# sourceMappingURL=SecrecyWalletClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/SecrecyWalletClient.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { SecrecyClient, SecrecyEnv } from \"../index.js\";\nimport { getUrl } from \"../index.js\";\nimport { InfuraNetwork } from \"../zeus/index.js\";\nimport { popup } from \"../PopupTools.js\";\nimport type { providers } from \"ethers\";\n\ntype SuccessWalletResponse<T> = {\n success: true;\n data: T;\n};\n\ntype ErrorWalletResponse = {\n success: false;\n error: string;\n};\n\nexport type SecrecyWalletResponse<T> =\n | SuccessWalletResponse<T>\n | ErrorWalletResponse;\n\nexport class SecrecyWalletClient {\n #client: SecrecyClient;\n\n // #keys: KeyPair;\n\n // #thunder: ReturnType<typeof Thunder>;\n\n constructor(\n client: SecrecyClient\n // _keys: KeyPair,\n // _thunder: ReturnType<typeof Thunder>\n ) {\n this.#client = client;\n // this.#keys = keys;\n // this.#thunder = thunder;\n }\n\n async createTransaction({\n env = \"prod\",\n network = InfuraNetwork.mainnet,\n tx\n }: {\n env?: SecrecyEnv;\n network?: InfuraNetwork;\n tx: providers.TransactionRequest;\n }): Promise<SecrecyWalletResponse<{ id: string; hash: string }>> {\n const url = getUrl({\n env,\n hash: Buffer.from(\n JSON.stringify({\n appSession: this.#client.sessionId,\n network,\n tx\n })\n ).toString(\"base64\"),\n path: \"/account/iframe/wallet-transaction\"\n });\n return new Promise((resolve, reject) =>\n popup(\n url,\n \"Secrecy Wallet - Transaction\",\n {\n width: 500\n },\n (err, data) => {\n if (err) {\n return reject(err);\n }\n return resolve(\n data as SecrecyWalletResponse<{ id: string; hash: string }>\n );\n }\n )\n );\n }\n\n async createSignature({\n env = \"prod\",\n network = InfuraNetwork.mainnet,\n message\n }: {\n env?: SecrecyEnv;\n network?: InfuraNetwork;\n message: string;\n }): Promise<SecrecyWalletResponse<string>> {\n const url = getUrl({\n env,\n hash: Buffer.from(\n JSON.stringify({\n appSession: this.#client.sessionId,\n network,\n message\n })\n ).toString(\"base64\"),\n path: \"/account/iframe/wallet-signature\"\n });\n return new Promise((resolve, reject) =>\n popup(\n url,\n \"Secrecy Wallet - Signature\",\n {\n width: 500\n },\n (err, data) => {\n if (err) {\n return reject(err);\n }\n return resolve(data as SecrecyWalletResponse<string>);\n }\n )\n );\n }\n}\n"],"mappings":"AAEA,OAAS,UAAAA,MAAc,cACvB,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,SAAAC,MAAa,mBAiBf,MAAMC,CAAoB,CAC/BC,GAMA,YACEC,EAGA,CACA,KAAKD,GAAUC,CAGjB,CAEA,MAAM,kBAAkB,CACtB,IAAAC,EAAM,OACN,QAAAC,EAAUN,EAAc,QACxB,GAAAO,CACF,EAIiE,CAC/D,MAAMC,EAAMT,EAAO,CACjB,IAAAM,EACA,KAAM,OAAO,KACX,KAAK,UAAU,CACb,WAAY,KAAKF,GAAQ,UACzB,QAAAG,EACA,GAAAC,CACF,CAAC,CACH,EAAE,SAAS,QAAQ,EACnB,KAAM,oCACR,CAAC,EACD,OAAO,IAAI,QAAQ,CAACE,EAASC,IAC3BT,EACEO,EACA,+BACA,CACE,MAAO,GACT,EACA,CAACG,EAAKC,IACAD,EACKD,EAAOC,CAAG,EAEZF,EACLG,CACF,CAEJ,CACF,CACF,CAEA,MAAM,gBAAgB,CACpB,IAAAP,EAAM,OACN,QAAAC,EAAUN,EAAc,QACxB,QAAAa,CACF,EAI2C,CACzC,MAAML,EAAMT,EAAO,CACjB,IAAAM,EACA,KAAM,OAAO,KACX,KAAK,UAAU,CACb,WAAY,KAAKF,GAAQ,UACzB,QAAAG,EACA,QAAAO,CACF,CAAC,CACH,EAAE,SAAS,QAAQ,EACnB,KAAM,kCACR,CAAC,EACD,OAAO,IAAI,QAAQ,CAACJ,EAASC,IAC3BT,EACEO,EACA,6BACA,CACE,MAAO,GACT,EACA,CAACG,EAAKC,IACAD,EACKD,EAAOC,CAAG,EAEZF,EAAQG,CAAqC,CAExD,CACF,CACF,CACF","names":["getUrl","InfuraNetwork","popup","SecrecyWalletClient","#client","client","env","network","tx","url","resolve","reject","err","data","message"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _cachejs = require('../../cache.js');var _indexjs = require('../../crypto/index.js');var _sodiumjs = require('../../sodium.js');function d(e,t){if(!e.access||!e.access.sharedBy.keyPair)throw`File ${e.id} doesn't have access`;const i={id:e.id,md5:e.md5,md5Encrypted:e.md5Encrypted,createdAt:new Date(e.createdAt),size:BigInt(e.size),sizeBefore:BigInt(e.sizeBefore),key:_sodiumjs.sodium.to_hex(_indexjs.decryptCryptoBox.call(void 0, _sodiumjs.sodium.from_hex(e.access.key),e.access.sharedBy.keyPair.pub,t.privateKey))};return _cachejs.filesCache.set(i.id,i),i}function o(e){return{id:e.id,md5:e.md5,md5Encrypted:e.md5Encrypted,createdAt:e.createdAt,size:e.size,sizeBefore:e.sizeBefore}}function p(e,t){return o(d(e,t))}exports.gqlFileToExternal = p; exports.gqlFileToInternal = d; exports.internalFileToFile = o;
|
|
2
|
-
//# sourceMappingURL=file.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/convert/file.ts"],"names":["filesCache","decryptCryptoBox","sodium","gqlFileToInternal","gql","keyPair","file","internalFileToFile","internal","gqlFileToExternal"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,iBAE3B,OAAS,oBAAAC,MAAwB,wBACjC,OAAS,UAAAC,MAAc,kBAGhB,SAASC,EACdC,EACAC,EACc,CACd,GAAI,CAACD,EAAI,QAAU,CAACA,EAAI,OAAO,SAAS,QACtC,KAAM,QAAQA,EAAI,yBAGpB,MAAME,EAAqB,CACzB,GAAIF,EAAI,GACR,IAAKA,EAAI,IACT,aAAcA,EAAI,aAClB,UAAW,IAAI,KAAKA,EAAI,SAAmB,EAC3C,KAAM,OAAOA,EAAI,IAAc,EAC/B,WAAY,OAAOA,EAAI,UAAoB,EAC3C,IAAKF,EAAO,OACVD,EACEC,EAAO,SAASE,EAAI,OAAO,GAAG,EAC9BA,EAAI,OAAO,SAAS,QAAQ,IAC5BC,EAAQ,UACV,CACF,CACF,EAEA,OAAAL,EAAW,IAAIM,EAAK,GAAIA,CAAI,EAErBA,CACT,CAEO,SAASC,EAAmBC,EAAsC,CACvE,MAAO,CACL,GAAIA,EAAS,GACb,IAAKA,EAAS,IACd,aAAcA,EAAS,aACvB,UAAWA,EAAS,UACpB,KAAMA,EAAS,KACf,WAAYA,EAAS,UACvB,CACF,CAEO,SAASC,EACdL,EACAC,EACc,CACd,OAAOE,EAAmBJ,EAAkBC,EAAKC,CAAO,CAAC,CAC3D","sourcesContent":["import { filesCache } from \"../../cache.js\";\nimport type { KeyPair } from \"../../crypto/index.js\";\nimport { decryptCryptoBox } from \"../../crypto/index.js\";\nimport { sodium } from \"../../sodium.js\";\nimport type { GQLFile, InternalFile, FileMetadata } from \"../types/index.js\";\n\nexport function gqlFileToInternal(\n gql: GQLFile,\n keyPair: KeyPair\n): InternalFile {\n if (!gql.access || !gql.access.sharedBy.keyPair) {\n throw `File ${gql.id} doesn't have access`;\n }\n\n const file: InternalFile = {\n id: gql.id,\n md5: gql.md5,\n md5Encrypted: gql.md5Encrypted,\n createdAt: new Date(gql.createdAt as string),\n size: BigInt(gql.size as string),\n sizeBefore: BigInt(gql.sizeBefore as string),\n key: sodium.to_hex(\n decryptCryptoBox(\n sodium.from_hex(gql.access.key),\n gql.access.sharedBy.keyPair.pub,\n keyPair.privateKey\n )\n )\n };\n\n filesCache.set(file.id, file);\n\n return file;\n}\n\nexport function internalFileToFile(internal: InternalFile): FileMetadata {\n return {\n id: internal.id,\n md5: internal.md5,\n md5Encrypted: internal.md5Encrypted,\n createdAt: internal.createdAt,\n size: internal.size,\n sizeBefore: internal.sizeBefore\n };\n}\n\nexport function gqlFileToExternal(\n gql: GQLFile,\n keyPair: KeyPair\n): FileMetadata {\n return internalFileToFile(gqlFileToInternal(gql, keyPair));\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { KeyPair } from '../../crypto/index.js';
|
|
2
|
-
import { GQLFile, InternalFile, FileMetadata } from '../types/File.js';
|
|
3
|
-
import '../../zeus/index.js';
|
|
4
|
-
import '../../zeus/const.js';
|
|
5
|
-
import '../types/selectors.js';
|
|
6
|
-
|
|
7
|
-
declare function gqlFileToInternal(gql: GQLFile, keyPair: KeyPair): InternalFile;
|
|
8
|
-
declare function internalFileToFile(internal: InternalFile): FileMetadata;
|
|
9
|
-
declare function gqlFileToExternal(gql: GQLFile, keyPair: KeyPair): FileMetadata;
|
|
10
|
-
|
|
11
|
-
export { gqlFileToExternal, gqlFileToInternal, internalFileToFile };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{filesCache as a}from"../../cache.js";import{decryptCryptoBox as s}from"../../crypto/index.js";import{sodium as r}from"../../sodium.js";function d(e,t){if(!e.access||!e.access.sharedBy.keyPair)throw`File ${e.id} doesn't have access`;const i={id:e.id,md5:e.md5,md5Encrypted:e.md5Encrypted,createdAt:new Date(e.createdAt),size:BigInt(e.size),sizeBefore:BigInt(e.sizeBefore),key:r.to_hex(s(r.from_hex(e.access.key),e.access.sharedBy.keyPair.pub,t.privateKey))};return a.set(i.id,i),i}function o(e){return{id:e.id,md5:e.md5,md5Encrypted:e.md5Encrypted,createdAt:e.createdAt,size:e.size,sizeBefore:e.sizeBefore}}function p(e,t){return o(d(e,t))}export{p as gqlFileToExternal,d as gqlFileToInternal,o as internalFileToFile};
|
|
2
|
-
//# sourceMappingURL=file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/convert/file.ts"],"sourcesContent":["import { filesCache } from \"../../cache.js\";\nimport type { KeyPair } from \"../../crypto/index.js\";\nimport { decryptCryptoBox } from \"../../crypto/index.js\";\nimport { sodium } from \"../../sodium.js\";\nimport type { GQLFile, InternalFile, FileMetadata } from \"../types/index.js\";\n\nexport function gqlFileToInternal(\n gql: GQLFile,\n keyPair: KeyPair\n): InternalFile {\n if (!gql.access || !gql.access.sharedBy.keyPair) {\n throw `File ${gql.id} doesn't have access`;\n }\n\n const file: InternalFile = {\n id: gql.id,\n md5: gql.md5,\n md5Encrypted: gql.md5Encrypted,\n createdAt: new Date(gql.createdAt as string),\n size: BigInt(gql.size as string),\n sizeBefore: BigInt(gql.sizeBefore as string),\n key: sodium.to_hex(\n decryptCryptoBox(\n sodium.from_hex(gql.access.key),\n gql.access.sharedBy.keyPair.pub,\n keyPair.privateKey\n )\n )\n };\n\n filesCache.set(file.id, file);\n\n return file;\n}\n\nexport function internalFileToFile(internal: InternalFile): FileMetadata {\n return {\n id: internal.id,\n md5: internal.md5,\n md5Encrypted: internal.md5Encrypted,\n createdAt: internal.createdAt,\n size: internal.size,\n sizeBefore: internal.sizeBefore\n };\n}\n\nexport function gqlFileToExternal(\n gql: GQLFile,\n keyPair: KeyPair\n): FileMetadata {\n return internalFileToFile(gqlFileToInternal(gql, keyPair));\n}\n"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,iBAE3B,OAAS,oBAAAC,MAAwB,wBACjC,OAAS,UAAAC,MAAc,kBAGhB,SAASC,EACdC,EACAC,EACc,CACd,GAAI,CAACD,EAAI,QAAU,CAACA,EAAI,OAAO,SAAS,QACtC,KAAM,QAAQA,EAAI,yBAGpB,MAAME,EAAqB,CACzB,GAAIF,EAAI,GACR,IAAKA,EAAI,IACT,aAAcA,EAAI,aAClB,UAAW,IAAI,KAAKA,EAAI,SAAmB,EAC3C,KAAM,OAAOA,EAAI,IAAc,EAC/B,WAAY,OAAOA,EAAI,UAAoB,EAC3C,IAAKF,EAAO,OACVD,EACEC,EAAO,SAASE,EAAI,OAAO,GAAG,EAC9BA,EAAI,OAAO,SAAS,QAAQ,IAC5BC,EAAQ,UACV,CACF,CACF,EAEA,OAAAL,EAAW,IAAIM,EAAK,GAAIA,CAAI,EAErBA,CACT,CAEO,SAASC,EAAmBC,EAAsC,CACvE,MAAO,CACL,GAAIA,EAAS,GACb,IAAKA,EAAS,IACd,aAAcA,EAAS,aACvB,UAAWA,EAAS,UACpB,KAAMA,EAAS,KACf,WAAYA,EAAS,UACvB,CACF,CAEO,SAASC,EACdL,EACAC,EACc,CACd,OAAOE,EAAmBJ,EAAkBC,EAAKC,CAAO,CAAC,CAC3D","names":["filesCache","decryptCryptoBox","sodium","gqlFileToInternal","gql","keyPair","file","internalFileToFile","internal","gqlFileToExternal"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _indexjs = require('../../index.js');function d(e,r){let n=e.type;e.mailIntegrityDraft&&(n="draft");const i=n==="draft"?e.mailIntegrityDraft:e.mailIntegrity;if(!i)return null;const o=e.type==="received"?e.sender.publicKey:r.publicKey,s=_indexjs.sodium.to_string(_indexjs.decryptCryptoBox.call(void 0, _indexjs.sodium.from_hex(e.body),o,r.privateKey)),y=_indexjs.sodium.to_string(_indexjs.decryptCryptoBox.call(void 0, _indexjs.sodium.from_hex(e.subject),o,r.privateKey)),c=_indexjs.sodium.crypto_generichash(_indexjs.sodium.crypto_generichash_BYTES,JSON.stringify({body:s,subject:y}),i.hashKey,"hex");return{type:n,id:e.id,mailIntegrityId:i.id,replyTo:_optionalChain([i, 'access', _ => _.replyTo, 'optionalAccess', _2 => _2.id]),body:s,subject:y,createdAt:new Date(e.createdAt),deletedAt:e.deletedAt?new Date(e.deletedAt):null,openedAt:e.openedAt?new Date(e.openedAt):null,isAltered:c!==i.hash,temporaryRecipients:i.temporaryRecipients,recipients:n==="draft"?i.recipients:e.recipients,sender:e.sender,files:e.files.map(p=>{const m=_indexjs.sodium.to_string(_indexjs.decryptCryptoBox.call(void 0, _indexjs.sodium.from_hex(p.filename),o,r.privateKey));return{id:p.file.id,name:m,key:p.fileKey}})}}exports.convertInternalMailToExternal = d;
|
|
2
|
-
//# sourceMappingURL=mail.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/convert/mail.ts"],"names":["sodium","decryptCryptoBox","convertInternalMailToExternal","data","keys","type","mI","pubKey","body","subject","hash","f","name"],"mappings":"AAEA,OAAS,UAAAA,EAAQ,oBAAAC,MAAwB,iBAElC,SAASC,EACdC,EACAC,EACa,CACb,IAAIC,EAAiBF,EAAK,KACtBA,EAAK,qBACPE,EAAO,SAGT,MAAMC,EAAKD,IAAS,QAAUF,EAAK,mBAAqBA,EAAK,cAE7D,GAAI,CAACG,EACH,OAAO,KAGT,MAAMC,EACJJ,EAAK,OAAS,WAAaA,EAAK,OAAO,UAAYC,EAAK,UAEpDI,EAAOR,EAAO,UAClBC,EAAiBD,EAAO,SAASG,EAAK,IAAI,EAAGI,EAAQH,EAAK,UAAU,CACtE,EAEMK,EAAUT,EAAO,UACrBC,EAAiBD,EAAO,SAASG,EAAK,OAAO,EAAGI,EAAQH,EAAK,UAAU,CACzE,EAEMM,EAAOV,EAAO,mBAClBA,EAAO,yBACP,KAAK,UAAU,CAAE,KAAAQ,EAAM,QAAAC,CAAQ,CAAC,EAChCH,EAAG,QACH,KACF,EAEA,MAAO,CACL,KAAAD,EACA,GAAIF,EAAK,GACT,gBAAiBG,EAAG,GACpB,QAASA,EAAG,SAAS,GACrB,KAAAE,EACA,QAAAC,EACA,UAAW,IAAI,KAAKN,EAAK,SAAmB,EAC5C,UAAWA,EAAK,UAAY,IAAI,KAAKA,EAAK,SAAmB,EAAI,KACjE,SAAUA,EAAK,SAAW,IAAI,KAAKA,EAAK,QAAkB,EAAI,KAC9D,UAAWO,IAASJ,EAAG,KACvB,oBAAqBA,EAAG,oBACxB,WAAYD,IAAS,QAAUC,EAAG,WAAaH,EAAK,WACpD,OAAQA,EAAK,OACb,MAAOA,EAAK,MAAM,IAAIQ,GAAK,CACzB,MAAMC,EAAOZ,EAAO,UAClBC,EAAiBD,EAAO,SAASW,EAAE,QAAQ,EAAGJ,EAAQH,EAAK,UAAU,CACvE,EAEA,MAAO,CACL,GAAIO,EAAE,KAAK,GACX,KAAAC,EACA,IAAKD,EAAE,OACT,CACF,CAAC,CACH,CACF","sourcesContent":["import type { KeyPair } from \"../../crypto/index.js\";\nimport type { GQLMail, Mail, MailType } from \"../types/index.js\";\nimport { sodium, decryptCryptoBox } from \"../../index.js\";\n\nexport function convertInternalMailToExternal(\n data: GQLMail,\n keys: KeyPair\n): Mail | null {\n let type: MailType = data.type;\n if (data.mailIntegrityDraft) {\n type = \"draft\";\n }\n\n const mI = type === \"draft\" ? data.mailIntegrityDraft : data.mailIntegrity;\n\n if (!mI) {\n return null;\n }\n\n const pubKey =\n data.type === \"received\" ? data.sender.publicKey : keys.publicKey;\n\n const body = sodium.to_string(\n decryptCryptoBox(sodium.from_hex(data.body), pubKey, keys.privateKey)\n );\n\n const subject = sodium.to_string(\n decryptCryptoBox(sodium.from_hex(data.subject), pubKey, keys.privateKey)\n );\n\n const hash = sodium.crypto_generichash(\n sodium.crypto_generichash_BYTES,\n JSON.stringify({ body, subject }),\n mI.hashKey,\n \"hex\"\n );\n\n return {\n type,\n id: data.id,\n mailIntegrityId: mI.id,\n replyTo: mI.replyTo?.id,\n body,\n subject,\n createdAt: new Date(data.createdAt as string),\n deletedAt: data.deletedAt ? new Date(data.deletedAt as string) : null,\n openedAt: data.openedAt ? new Date(data.openedAt as string) : null,\n isAltered: hash !== mI.hash,\n temporaryRecipients: mI.temporaryRecipients,\n recipients: type === \"draft\" ? mI.recipients : data.recipients,\n sender: data.sender,\n files: data.files.map(f => {\n const name = sodium.to_string(\n decryptCryptoBox(sodium.from_hex(f.filename), pubKey, keys.privateKey)\n );\n\n return {\n id: f.file.id,\n name,\n key: f.fileKey\n };\n })\n };\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { KeyPair } from '../../crypto/index.js';
|
|
2
|
-
import { GQLMail, Mail } from '../types/index.js';
|
|
3
|
-
import '../../zeus/index.js';
|
|
4
|
-
import '../../zeus/const.js';
|
|
5
|
-
import '../types/selectors.js';
|
|
6
|
-
import '../types/File.js';
|
|
7
|
-
import '../types/UserAppSettings.js';
|
|
8
|
-
import '../types/UserAppNotifications.js';
|
|
9
|
-
import '../types/Inputs.js';
|
|
10
|
-
|
|
11
|
-
declare function convertInternalMailToExternal(data: GQLMail, keys: KeyPair): Mail | null;
|
|
12
|
-
|
|
13
|
-
export { convertInternalMailToExternal };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{sodium as t,decryptCryptoBox as l}from"../../index.js";function d(e,r){let n=e.type;e.mailIntegrityDraft&&(n="draft");const i=n==="draft"?e.mailIntegrityDraft:e.mailIntegrity;if(!i)return null;const o=e.type==="received"?e.sender.publicKey:r.publicKey,s=t.to_string(l(t.from_hex(e.body),o,r.privateKey)),y=t.to_string(l(t.from_hex(e.subject),o,r.privateKey)),c=t.crypto_generichash(t.crypto_generichash_BYTES,JSON.stringify({body:s,subject:y}),i.hashKey,"hex");return{type:n,id:e.id,mailIntegrityId:i.id,replyTo:i.replyTo?.id,body:s,subject:y,createdAt:new Date(e.createdAt),deletedAt:e.deletedAt?new Date(e.deletedAt):null,openedAt:e.openedAt?new Date(e.openedAt):null,isAltered:c!==i.hash,temporaryRecipients:i.temporaryRecipients,recipients:n==="draft"?i.recipients:e.recipients,sender:e.sender,files:e.files.map(p=>{const m=t.to_string(l(t.from_hex(p.filename),o,r.privateKey));return{id:p.file.id,name:m,key:p.fileKey}})}}export{d as convertInternalMailToExternal};
|
|
2
|
-
//# sourceMappingURL=mail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/convert/mail.ts"],"sourcesContent":["import type { KeyPair } from \"../../crypto/index.js\";\nimport type { GQLMail, Mail, MailType } from \"../types/index.js\";\nimport { sodium, decryptCryptoBox } from \"../../index.js\";\n\nexport function convertInternalMailToExternal(\n data: GQLMail,\n keys: KeyPair\n): Mail | null {\n let type: MailType = data.type;\n if (data.mailIntegrityDraft) {\n type = \"draft\";\n }\n\n const mI = type === \"draft\" ? data.mailIntegrityDraft : data.mailIntegrity;\n\n if (!mI) {\n return null;\n }\n\n const pubKey =\n data.type === \"received\" ? data.sender.publicKey : keys.publicKey;\n\n const body = sodium.to_string(\n decryptCryptoBox(sodium.from_hex(data.body), pubKey, keys.privateKey)\n );\n\n const subject = sodium.to_string(\n decryptCryptoBox(sodium.from_hex(data.subject), pubKey, keys.privateKey)\n );\n\n const hash = sodium.crypto_generichash(\n sodium.crypto_generichash_BYTES,\n JSON.stringify({ body, subject }),\n mI.hashKey,\n \"hex\"\n );\n\n return {\n type,\n id: data.id,\n mailIntegrityId: mI.id,\n replyTo: mI.replyTo?.id,\n body,\n subject,\n createdAt: new Date(data.createdAt as string),\n deletedAt: data.deletedAt ? new Date(data.deletedAt as string) : null,\n openedAt: data.openedAt ? new Date(data.openedAt as string) : null,\n isAltered: hash !== mI.hash,\n temporaryRecipients: mI.temporaryRecipients,\n recipients: type === \"draft\" ? mI.recipients : data.recipients,\n sender: data.sender,\n files: data.files.map(f => {\n const name = sodium.to_string(\n decryptCryptoBox(sodium.from_hex(f.filename), pubKey, keys.privateKey)\n );\n\n return {\n id: f.file.id,\n name,\n key: f.fileKey\n };\n })\n };\n}\n"],"mappings":"AAEA,OAAS,UAAAA,EAAQ,oBAAAC,MAAwB,iBAElC,SAASC,EACdC,EACAC,EACa,CACb,IAAIC,EAAiBF,EAAK,KACtBA,EAAK,qBACPE,EAAO,SAGT,MAAMC,EAAKD,IAAS,QAAUF,EAAK,mBAAqBA,EAAK,cAE7D,GAAI,CAACG,EACH,OAAO,KAGT,MAAMC,EACJJ,EAAK,OAAS,WAAaA,EAAK,OAAO,UAAYC,EAAK,UAEpDI,EAAOR,EAAO,UAClBC,EAAiBD,EAAO,SAASG,EAAK,IAAI,EAAGI,EAAQH,EAAK,UAAU,CACtE,EAEMK,EAAUT,EAAO,UACrBC,EAAiBD,EAAO,SAASG,EAAK,OAAO,EAAGI,EAAQH,EAAK,UAAU,CACzE,EAEMM,EAAOV,EAAO,mBAClBA,EAAO,yBACP,KAAK,UAAU,CAAE,KAAAQ,EAAM,QAAAC,CAAQ,CAAC,EAChCH,EAAG,QACH,KACF,EAEA,MAAO,CACL,KAAAD,EACA,GAAIF,EAAK,GACT,gBAAiBG,EAAG,GACpB,QAASA,EAAG,SAAS,GACrB,KAAAE,EACA,QAAAC,EACA,UAAW,IAAI,KAAKN,EAAK,SAAmB,EAC5C,UAAWA,EAAK,UAAY,IAAI,KAAKA,EAAK,SAAmB,EAAI,KACjE,SAAUA,EAAK,SAAW,IAAI,KAAKA,EAAK,QAAkB,EAAI,KAC9D,UAAWO,IAASJ,EAAG,KACvB,oBAAqBA,EAAG,oBACxB,WAAYD,IAAS,QAAUC,EAAG,WAAaH,EAAK,WACpD,OAAQA,EAAK,OACb,MAAOA,EAAK,MAAM,IAAIQ,GAAK,CACzB,MAAMC,EAAOZ,EAAO,UAClBC,EAAiBD,EAAO,SAASW,EAAE,QAAQ,EAAGJ,EAAQH,EAAK,UAAU,CACvE,EAEA,MAAO,CACL,GAAIO,EAAE,KAAK,GACX,KAAAC,EACA,IAAKD,EAAE,OACT,CACF,CAAC,CACH,CACF","names":["sodium","decryptCryptoBox","convertInternalMailToExternal","data","keys","type","mI","pubKey","body","subject","hash","f","name"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _sodiumjs = require('../../sodium.js');var _indexjs = require('../../crypto/index.js');var _cachejs = require('../../cache.js');var _filejs = require('../../crypto/file.js');var _filejs3 = require('./file.js');async function a(e,r){if(!e.access)throw`Can't access Node ${e.id}`;const n={id:e.id,type:e.type,access:e.access,name:e.name,isFavorite:e.isFavorite,breadcrumb:e.breadcrumb,createdBy:e.createdBy.user,sizes:{size:BigInt(e.sizes.size),sizeBefore:BigInt(e.sizes.sizeBefore)},createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt),deletedAt:e.deletedAt?new Date(e.deletedAt):null,users:e.accesses.map(t=>[t.userApp.user,t.rights]),parentId:_nullishCoalesce(e.parentId, () => (null)),currentFileId:_nullishCoalesce(e.currentFileId, () => (null))};if(n.access={...e.access},e.access.nameKey){if(!e.access.sharedBy.keyPair)throw new Error("Can't find keyPair for access");const t=_indexjs.decryptCryptoBox.call(void 0, _sodiumjs.sodium.from_hex(e.access.nameKey),e.createdBy.user.publicKey,r.privateKey);n.name=_sodiumjs.sodium.to_string(await _filejs.decryptSecretstream.call(void 0, t,_sodiumjs.sodium.from_hex(n.name))),n.access.nameKey=_sodiumjs.sodium.to_hex(t)}for(const t of n.breadcrumb){if(!t.nameKey)continue;const d=_indexjs.decryptCryptoBox.call(void 0, _sodiumjs.sodium.from_hex(t.nameKey),t.pubKey,r.privateKey);t.nameKey=_sodiumjs.sodium.to_hex(d),t.name=_sodiumjs.sodium.to_string(await _filejs.decryptSecretstream.call(void 0, d,_sodiumjs.sodium.from_hex(t.name)))}return _cachejs.nodesCache.set(n.id,n),n}async function l(e,r){return{...await a(e,r),current:e.current?_filejs3.gqlFileToInternal.call(void 0, e.current,r):void 0,parent:e.parent?await a(e.parent,r):null,children:await Promise.all(e.children.map(t=>a(t,r))),history:e.history.map(t=>_filejs3.gqlFileToInternal.call(void 0, t,r))}}function s(e){const r={...e,access:e.access?{...e.access}:void 0};for(const n of r.breadcrumb)delete n.pubKey;return _optionalChainDelete([r, 'access', _ => _.access, 'optionalAccess', _2 => delete _2.nameKey]),r}function y(e){return{...s(e),parent:e.parent?s(e.parent):null,children:e.children.map(s),history:e.history.map(r=>_filejs3.internalFileToFile.call(void 0, r)),current:e.current?_filejs3.internalFileToFile.call(void 0, e.current):void 0}}async function K(e,r){return y(await l(e,r))}async function I(e,r){return s(await a(e,r))}exports.gqlNodeFullToInternalFull = l; exports.gqlNodeToExternal = I; exports.gqlNodeToExternalNodeFull = K; exports.gqlNodeToInternal = a; exports.internalNodeFullToNodeFull = y; exports.internalNodeToNode = s;
|
|
2
|
-
//# sourceMappingURL=node.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/convert/node.ts"],"names":["sodium","decryptCryptoBox","nodesCache","decryptSecretstream","gqlFileToInternal","internalFileToFile","gqlNodeToInternal","gql","keyPair","internal","u","key","b","gqlNodeFullToInternalFull","s","f","internalNodeToNode","node","internalNodeFullToNodeFull","gqlNodeToExternalNodeFull","gqlNodeToExternal"],"mappings":"AAAA,OAAS,UAAAA,MAAc,kBAEvB,OAAS,oBAAAC,MAAwB,wBASjC,OAAS,cAAAC,MAAkB,iBAC3B,OAAS,uBAAAC,MAA2B,uBACpC,OAAS,qBAAAC,EAAmB,sBAAAC,MAA0B,YAEtD,eAAsBC,EACpBC,EACAC,EACuB,CACvB,GAAI,CAACD,EAAI,OACP,KAAM,qBAAqBA,EAAI,KAGjC,MAAME,EAAyB,CAC7B,GAAIF,EAAI,GACR,KAAMA,EAAI,KACV,OAAQA,EAAI,OACZ,KAAMA,EAAI,KACV,WAAYA,EAAI,WAChB,WAAYA,EAAI,WAChB,UAAWA,EAAI,UAAU,KACzB,MAAO,CACL,KAAM,OAAOA,EAAI,MAAM,IAAc,EACrC,WAAY,OAAOA,EAAI,MAAM,UAAoB,CACnD,EACA,UAAW,IAAI,KAAKA,EAAI,SAAmB,EAC3C,UAAW,IAAI,KAAKA,EAAI,SAAmB,EAC3C,UAAWA,EAAI,UAAY,IAAI,KAAKA,EAAI,SAAmB,EAAI,KAC/D,MAAOA,EAAI,SAAS,IAAIG,GAAK,CAACA,EAAE,QAAQ,KAAMA,EAAE,MAAM,CAAC,EACvD,SAAUH,EAAI,UAAY,KAC1B,cAAeA,EAAI,eAAiB,IACtC,EAIA,GAFAE,EAAS,OAAS,CAAE,GAAGF,EAAI,MAAO,EAE9BA,EAAI,OAAO,QAAS,CACtB,GAAI,CAACA,EAAI,OAAO,SAAS,QACvB,MAAM,IAAI,MAAM,+BAA+B,EAEjD,MAAMI,EAAMV,EACVD,EAAO,SAASO,EAAI,OAAO,OAAO,EAClCA,EAAI,UAAU,KAAK,UACnBC,EAAQ,UAC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IO,CAAkB,EAClD,QAASP,EAAS,QAAQ,IAAIM,GAAKV,EAAmBU,CAAC,CAAC,EACxD,QAASN,EAAS,QAAUJ,EAAmBI,EAAS,OAAO,EAAI,MACrE,CACF,CAEA,eAAsBU,EACpBZ,EACAC,EACmB,CACnB,OAAOU,EACL,MAAML,EAA0BN,EAAKC,CAAO,CAC9C,CACF,CAEA,eAAsBY,EACpBb,EACAC,EACe,CACf,OAAOQ,EAAmB,MAAMV,EAAkBC,EAAKC,CAAO,CAAC,CACjE","sourcesContent":["import { sodium } from \"../../sodium.js\";\nimport type { KeyPair } from \"../../crypto/index.js\";\nimport { decryptCryptoBox } from \"../../crypto/index.js\";\nimport type { Node } from \"../types/index.js\";\nimport type {\n GQLNode,\n InternalNode,\n GQLNodeFull,\n InternalNodeFull,\n NodeFull\n} from \"../types/index.js\";\nimport { nodesCache } from \"../../cache.js\";\nimport { decryptSecretstream } from \"../../crypto/file.js\";\nimport { gqlFileToInternal, internalFileToFile } from \"./file.js\";\n\nexport async function gqlNodeToInternal(\n gql: GQLNode,\n keyPair: KeyPair\n): Promise<InternalNode> {\n if (!gql.access) {\n throw `Can't access Node ${gql.id}`;\n }\n\n const internal: InternalNode = {\n id: gql.id,\n type: gql.type,\n access: gql.access,\n name: gql.name,\n isFavorite: gql.isFavorite,\n breadcrumb: gql.breadcrumb,\n createdBy: gql.createdBy.user,\n sizes: {\n size: BigInt(gql.sizes.size as string),\n sizeBefore: BigInt(gql.sizes.sizeBefore as string)\n },\n createdAt: new Date(gql.createdAt as string),\n updatedAt: new Date(gql.updatedAt as string),\n deletedAt: gql.deletedAt ? new Date(gql.deletedAt as string) : null,\n users: gql.accesses.map(u => [u.userApp.user, u.rights]),\n parentId: gql.parentId ?? null,\n currentFileId: gql.currentFileId ?? null\n };\n\n internal.access = { ...gql.access };\n\n if (gql.access.nameKey) {\n if (!gql.access.sharedBy.keyPair) {\n throw new Error(`Can't find keyPair for access`);\n }\n const key = decryptCryptoBox(\n sodium.from_hex(gql.access.nameKey),\n gql.createdBy.user.publicKey,\n keyPair.privateKey\n );\n internal.name = sodium.to_string(\n await decryptSecretstream(key, sodium.from_hex(internal.name))\n );\n\n internal.access.nameKey = sodium.to_hex(key);\n }\n\n for (const b of internal.breadcrumb) {\n if (!b.nameKey) {\n continue;\n }\n const key = decryptCryptoBox(\n sodium.from_hex(b.nameKey),\n b.pubKey,\n keyPair.privateKey\n );\n\n b.nameKey = sodium.to_hex(key);\n\n b.name = sodium.to_string(\n await decryptSecretstream(key, sodium.from_hex(b.name))\n );\n }\n\n nodesCache.set(internal.id, internal);\n return internal;\n}\n\nexport async function gqlNodeFullToInternalFull(\n gql: GQLNodeFull,\n keyPair: KeyPair\n): Promise<InternalNodeFull> {\n const f = await gqlNodeToInternal(gql, keyPair);\n return {\n ...f,\n current: gql.current ? gqlFileToInternal(gql.current, keyPair) : undefined,\n parent: gql.parent ? await gqlNodeToInternal(gql.parent, keyPair) : null,\n children: await Promise.all(\n gql.children.map(s => gqlNodeToInternal(s, keyPair))\n ),\n history: gql.history.map(f => gqlFileToInternal(f, keyPair))\n };\n}\n\nexport function internalNodeToNode(internal: InternalNode): Node {\n const node: Node = {\n ...internal,\n access: internal.access ? { ...internal.access } : undefined\n };\n\n for (const b of node.breadcrumb) {\n // @ts-ignore\n delete b.pubKey;\n }\n // @ts-ignore\n delete node.access?.nameKey;\n return node;\n}\n\nexport function internalNodeFullToNodeFull(\n internal: InternalNodeFull\n): NodeFull {\n return {\n ...internalNodeToNode(internal),\n parent: internal.parent ? internalNodeToNode(internal.parent) : null,\n children: internal.children.map(internalNodeToNode),\n history: internal.history.map(f => internalFileToFile(f)),\n current: internal.current ? internalFileToFile(internal.current) : undefined\n };\n}\n\nexport async function gqlNodeToExternalNodeFull(\n gql: GQLNodeFull,\n keyPair: KeyPair\n): Promise<NodeFull> {\n return internalNodeFullToNodeFull(\n await gqlNodeFullToInternalFull(gql, keyPair)\n );\n}\n\nexport async function gqlNodeToExternal(\n gql: GQLNode,\n keyPair: KeyPair\n): Promise<Node> {\n return internalNodeToNode(await gqlNodeToInternal(gql, keyPair));\n}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { KeyPair } from '../../crypto/index.js';
|
|
2
|
-
import { GQLNode, InternalNode, GQLNodeFull, InternalNodeFull, Node, NodeFull } from '../types/index.js';
|
|
3
|
-
import '../../zeus/index.js';
|
|
4
|
-
import '../../zeus/const.js';
|
|
5
|
-
import '../types/selectors.js';
|
|
6
|
-
import '../types/File.js';
|
|
7
|
-
import '../types/UserAppSettings.js';
|
|
8
|
-
import '../types/UserAppNotifications.js';
|
|
9
|
-
import '../types/Inputs.js';
|
|
10
|
-
|
|
11
|
-
declare function gqlNodeToInternal(gql: GQLNode, keyPair: KeyPair): Promise<InternalNode>;
|
|
12
|
-
declare function gqlNodeFullToInternalFull(gql: GQLNodeFull, keyPair: KeyPair): Promise<InternalNodeFull>;
|
|
13
|
-
declare function internalNodeToNode(internal: InternalNode): Node;
|
|
14
|
-
declare function internalNodeFullToNodeFull(internal: InternalNodeFull): NodeFull;
|
|
15
|
-
declare function gqlNodeToExternalNodeFull(gql: GQLNodeFull, keyPair: KeyPair): Promise<NodeFull>;
|
|
16
|
-
declare function gqlNodeToExternal(gql: GQLNode, keyPair: KeyPair): Promise<Node>;
|
|
17
|
-
|
|
18
|
-
export { gqlNodeFullToInternalFull, gqlNodeToExternal, gqlNodeToExternalNodeFull, gqlNodeToInternal, internalNodeFullToNodeFull, internalNodeToNode };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{sodium as o}from"../../sodium.js";import{decryptCryptoBox as i}from"../../crypto/index.js";import{nodesCache as p}from"../../cache.js";import{decryptSecretstream as c}from"../../crypto/file.js";import{gqlFileToInternal as u,internalFileToFile as m}from"./file.js";async function a(e,r){if(!e.access)throw`Can't access Node ${e.id}`;const n={id:e.id,type:e.type,access:e.access,name:e.name,isFavorite:e.isFavorite,breadcrumb:e.breadcrumb,createdBy:e.createdBy.user,sizes:{size:BigInt(e.sizes.size),sizeBefore:BigInt(e.sizes.sizeBefore)},createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt),deletedAt:e.deletedAt?new Date(e.deletedAt):null,users:e.accesses.map(t=>[t.userApp.user,t.rights]),parentId:e.parentId??null,currentFileId:e.currentFileId??null};if(n.access={...e.access},e.access.nameKey){if(!e.access.sharedBy.keyPair)throw new Error("Can't find keyPair for access");const t=i(o.from_hex(e.access.nameKey),e.createdBy.user.publicKey,r.privateKey);n.name=o.to_string(await c(t,o.from_hex(n.name))),n.access.nameKey=o.to_hex(t)}for(const t of n.breadcrumb){if(!t.nameKey)continue;const d=i(o.from_hex(t.nameKey),t.pubKey,r.privateKey);t.nameKey=o.to_hex(d),t.name=o.to_string(await c(d,o.from_hex(t.name)))}return p.set(n.id,n),n}async function l(e,r){return{...await a(e,r),current:e.current?u(e.current,r):void 0,parent:e.parent?await a(e.parent,r):null,children:await Promise.all(e.children.map(t=>a(t,r))),history:e.history.map(t=>u(t,r))}}function s(e){const r={...e,access:e.access?{...e.access}:void 0};for(const n of r.breadcrumb)delete n.pubKey;return delete r.access?.nameKey,r}function y(e){return{...s(e),parent:e.parent?s(e.parent):null,children:e.children.map(s),history:e.history.map(r=>m(r)),current:e.current?m(e.current):void 0}}async function K(e,r){return y(await l(e,r))}async function I(e,r){return s(await a(e,r))}export{l as gqlNodeFullToInternalFull,I as gqlNodeToExternal,K as gqlNodeToExternalNodeFull,a as gqlNodeToInternal,y as internalNodeFullToNodeFull,s as internalNodeToNode};
|
|
2
|
-
//# sourceMappingURL=node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/convert/node.ts"],"sourcesContent":["import { sodium } from \"../../sodium.js\";\nimport type { KeyPair } from \"../../crypto/index.js\";\nimport { decryptCryptoBox } from \"../../crypto/index.js\";\nimport type { Node } from \"../types/index.js\";\nimport type {\n GQLNode,\n InternalNode,\n GQLNodeFull,\n InternalNodeFull,\n NodeFull\n} from \"../types/index.js\";\nimport { nodesCache } from \"../../cache.js\";\nimport { decryptSecretstream } from \"../../crypto/file.js\";\nimport { gqlFileToInternal, internalFileToFile } from \"./file.js\";\n\nexport async function gqlNodeToInternal(\n gql: GQLNode,\n keyPair: KeyPair\n): Promise<InternalNode> {\n if (!gql.access) {\n throw `Can't access Node ${gql.id}`;\n }\n\n const internal: InternalNode = {\n id: gql.id,\n type: gql.type,\n access: gql.access,\n name: gql.name,\n isFavorite: gql.isFavorite,\n breadcrumb: gql.breadcrumb,\n createdBy: gql.createdBy.user,\n sizes: {\n size: BigInt(gql.sizes.size as string),\n sizeBefore: BigInt(gql.sizes.sizeBefore as string)\n },\n createdAt: new Date(gql.createdAt as string),\n updatedAt: new Date(gql.updatedAt as string),\n deletedAt: gql.deletedAt ? new Date(gql.deletedAt as string) : null,\n users: gql.accesses.map(u => [u.userApp.user, u.rights]),\n parentId: gql.parentId ?? null,\n currentFileId: gql.currentFileId ?? null\n };\n\n internal.access = { ...gql.access };\n\n if (gql.access.nameKey) {\n if (!gql.access.sharedBy.keyPair) {\n throw new Error(`Can't find keyPair for access`);\n }\n const key = decryptCryptoBox(\n sodium.from_hex(gql.access.nameKey),\n gql.createdBy.user.publicKey,\n keyPair.privateKey\n );\n internal.name = sodium.to_string(\n await decryptSecretstream(key, sodium.from_hex(internal.name))\n );\n\n internal.access.nameKey = sodium.to_hex(key);\n }\n\n for (const b of internal.breadcrumb) {\n if (!b.nameKey) {\n continue;\n }\n const key = decryptCryptoBox(\n sodium.from_hex(b.nameKey),\n b.pubKey,\n keyPair.privateKey\n );\n\n b.nameKey = sodium.to_hex(key);\n\n b.name = sodium.to_string(\n await decryptSecretstream(key, sodium.from_hex(b.name))\n );\n }\n\n nodesCache.set(internal.id, internal);\n return internal;\n}\n\nexport async function gqlNodeFullToInternalFull(\n gql: GQLNodeFull,\n keyPair: KeyPair\n): Promise<InternalNodeFull> {\n const f = await gqlNodeToInternal(gql, keyPair);\n return {\n ...f,\n current: gql.current ? gqlFileToInternal(gql.current, keyPair) : undefined,\n parent: gql.parent ? await gqlNodeToInternal(gql.parent, keyPair) : null,\n children: await Promise.all(\n gql.children.map(s => gqlNodeToInternal(s, keyPair))\n ),\n history: gql.history.map(f => gqlFileToInternal(f, keyPair))\n };\n}\n\nexport function internalNodeToNode(internal: InternalNode): Node {\n const node: Node = {\n ...internal,\n access: internal.access ? { ...internal.access } : undefined\n };\n\n for (const b of node.breadcrumb) {\n // @ts-ignore\n delete b.pubKey;\n }\n // @ts-ignore\n delete node.access?.nameKey;\n return node;\n}\n\nexport function internalNodeFullToNodeFull(\n internal: InternalNodeFull\n): NodeFull {\n return {\n ...internalNodeToNode(internal),\n parent: internal.parent ? internalNodeToNode(internal.parent) : null,\n children: internal.children.map(internalNodeToNode),\n history: internal.history.map(f => internalFileToFile(f)),\n current: internal.current ? internalFileToFile(internal.current) : undefined\n };\n}\n\nexport async function gqlNodeToExternalNodeFull(\n gql: GQLNodeFull,\n keyPair: KeyPair\n): Promise<NodeFull> {\n return internalNodeFullToNodeFull(\n await gqlNodeFullToInternalFull(gql, keyPair)\n );\n}\n\nexport async function gqlNodeToExternal(\n gql: GQLNode,\n keyPair: KeyPair\n): Promise<Node> {\n return internalNodeToNode(await gqlNodeToInternal(gql, keyPair));\n}\n"],"mappings":"AAAA,OAAS,UAAAA,MAAc,kBAEvB,OAAS,oBAAAC,MAAwB,wBASjC,OAAS,cAAAC,MAAkB,iBAC3B,OAAS,uBAAAC,MAA2B,uBACpC,OAAS,qBAAAC,EAAmB,sBAAAC,MAA0B,YAEtD,eAAsBC,EACpBC,EACAC,EACuB,CACvB,GAAI,CAACD,EAAI,OACP,KAAM,qBAAqBA,EAAI,KAGjC,MAAME,EAAyB,CAC7B,GAAIF,EAAI,GACR,KAAMA,EAAI,KACV,OAAQA,EAAI,OACZ,KAAMA,EAAI,KACV,WAAYA,EAAI,WAChB,WAAYA,EAAI,WAChB,UAAWA,EAAI,UAAU,KACzB,MAAO,CAC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AAO,EAAI,OACjE,OAAQD,EAAI,OAAS,MAAMD,EAAkBC,EAAI,OAAQC,CAAO,EAAI,KACpE,SAAU,MAAM,QAAQ,IACtBD,EAAI,SAAS,IAAIO,GAAKR,EAAkBQ,EAAGN,CAAO,CAAC,CACrD,EACA,QAASD,EAAI,QAAQ,IAAIQ,GAAKX,EAAkBW,EAAGP,CAAO,CAAC,CAC7D,CACF,CAEO,SAASQ,EAAmBP,EAA8B,CAC/D,MAAMQ,EAAa,CACjB,GAAGR,EACH,OAAQA,EAAS,OAAS,CAAE,GAAGA,EAAS,MAAO,EAAI,MACrD,EAEA,UAAWG,KAAKK,EAAK,WAEnB,OAAOL,EAAE,OAGX,cAAOK,EAAK,QAAQ,QACbA,CACT,CAEO,SAASC,EACdT,EACU,CACV,MAAO,CACL,GAAGO,EAAmBP,CAAQ,EAC9B,OAAQA,EAAS,OAASO,EAAmBP,EAAS,MAAM,EAAI,KAChE,SAAUA,EAAS,SAAS,IAAIO,CAAkB,EAClD,QAASP,EAAS,QAAQ,IAAIM,GAAKV,EAAmBU,CAAC,CAAC,EACxD,QAASN,EAAS,QAAUJ,EAAmBI,EAAS,OAAO,EAAI,MACrE,CACF,CAEA,eAAsBU,EACpBZ,EACAC,EACmB,CACnB,OAAOU,EACL,MAAML,EAA0BN,EAAKC,CAAO,CAC9C,CACF,CAEA,eAAsBY,EACpBb,EACAC,EACe,CACf,OAAOQ,EAAmB,MAAMV,EAAkBC,EAAKC,CAAO,CAAC,CACjE","names":["sodium","decryptCryptoBox","nodesCache","decryptSecretstream","gqlFileToInternal","internalFileToFile","gqlNodeToInternal","gql","keyPair","internal","u","key","b","gqlNodeFullToInternalFull","s","f","internalNodeToNode","node","internalNodeFullToNodeFull","gqlNodeToExternalNodeFull","gqlNodeToExternal"]}
|
package/dist/client/helpers.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _indexjs = require('./index.js');var _PopupToolsjs = require('../PopupTools.js');var _storagejs = require('./storage.js');function g(){if(!window.location.hash)return null;const s=window.location.hash.substr(1);try{const o=JSON.parse(atob(s));return window.location.hash="",o}catch (e2){return null}}const x=({env:s,hash:o,path:e})=>{let a="";s==="dev"&&(a="dev.");const t=document.documentElement.lang;return process.env.NEXT_PUBLIC_SECRECY_API_URL?`http://localhost:3002${t?`/${t}`:""}${e.startsWith("/")?e:`/${e}`}#${o}`:`https://auth.${a}secrecy.me${t?`/${t}`:""}${e.startsWith("/")?e:`/${e}`}#${o}`};function A(s,o){const e=_storagejs.getStorage.call(void 0, o),a=e.userAppSession.load(),t=e.userAppKeys.load(),i=e.jwt.load();if(!a||!t||!i){const r=g();return r?(e.userAppKeys.save(r.keys),e.userAppSession.save(r.uaSession),e.jwt.save(r.jwt),new (0, _indexjs.SecrecyClient)(r.uaSession,r.keys,r.jwt,s)):null}return new (0, _indexjs.SecrecyClient)(a,t,i,s)}function T({appCode:s,path:o,redirect:e,scopes:a,backPath:t,env:i,session:r}={}){return new Promise((l,p)=>{const d=window.location.origin;if(s&&!d.includes("localhost"))return p("Can't use appCode if not in localhost");const y=A(i);if(y)return l(y);{const m={appUrl:d,appCode:s,redirect:e,path:o,scopes:a,backPath:t},v=btoa(JSON.stringify(m)).replaceAll("=",""),S=x({env:i,hash:v,path:"login"}),f=n=>{const c=_storagejs.getStorage.call(void 0, r);return c.userAppSession.save(n.uaSession),c.userAppKeys.save(n.keys),c.jwt.save(n.jwt),l(new (0, _indexjs.SecrecyClient)(n.uaSession,n.keys,n.jwt,i))};if(e){const n=g();return n?f(n):(window.location.href=S,l(null))}else _PopupToolsjs.popup.call(void 0, S,"Secrecy Login",{width:500,height:750,resizable:"no",menubar:"no",location:"no",centered:!0,scrollbars:"no"},(n,c)=>{if(n)return p(n);{const h=c;if(h)return f(h)}})}})}exports.getSecrecyClient = A; exports.getUrl = x; exports.login = T; exports.parseInfos = g;
|
|
2
|
-
//# sourceMappingURL=helpers.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/helpers.ts"],"names":["SecrecyClient","popup","getStorage","parseInfos","hash","res","getUrl","env","path","envStr","lang","getSecrecyClient","session","storage","uaSession","uaKeys","uaJwt","infos","login","appCode","redirect","scopes","backPath","resolve","reject","appUrl","client","data","url","validate","err"],"mappings":"AAAA,OAAS,iBAAAA,MAAqB,aAC9B,OAAS,SAAAC,MAAa,mBAEtB,OAAS,cAAAC,MAAkB,eAEpB,SAASC,GAAoC,CAClD,GAAI,CAAC,OAAO,SAAS,KACnB,OAAO,KAET,MAAMC,EAAO,OAAO,SAAS,KAAK,OAAO,CAAC,EAC1C,GAAI,CACF,MAAMC,EAAM,KAAK,MAAM,KAAKD,CAAI,CAAC,EACjC,cAAO,SAAS,KAAO,GAEhBC,CACT,MAAE,CACA,OAAO,IACT,CACF,CAEO,MAAMC,EAAS,CAAC,CACrB,IAAAC,EACA,KAAAH,EACA,KAAAI,CACF,IAIc,CACZ,IAAIC,EAAS,GACTF,IAAQ,QACVE,EAAS,QAEX,MAAMC,EAAO,SAAS,gBAAgB,KACtC,OAAO,QAAQ,IAAI,4BACf,wBAAwBA,EAAO,IAAIA,IAAS,KAC1CF,EAAK,WAAW,GAAG,EAAIA,EAAO,IAAIA,OAChCJ,IACJ,gBAAgBK,cAAmBC,EAAO,IAAIA,IAAS,KACrDF,EAAK,WAAW,GAAG,EAAIA,EAAO,IAAIA,OAChCJ,GACV,EAsBO,SAASO,EACdJ,EACAK,EACsB,CACtB,MAAMC,EAAUX,EAAWU,CAAO,EAC5BE,EAAYD,EAAQ,eAAe,KAAK,EACxCE,EAASF,EAAQ,YAAY,KAAK,EAClCG,EAAQH,EAAQ,IAAI,KAAK,EAC/B,GAAI,CAACC,GAAa,CAACC,GAAU,CAACC,EAAO,CACnC,MAAMC,EAAQd,EAAW,EACzB,OAAIc,GACFJ,EAAQ,YAAY,KAAKI,EAAM,IAAI,EACnCJ,EAAQ,eAAe,KAAKI,EAAM,S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,OAAQ,IACR,UAAW,KACX,QAAS,KACT,SAAU,KACV,SAAU,GACV,WAAY,IACd,EACA,CAACE,EAAKH,IAAS,CACb,GAAIG,EACF,OAAON,EAAOM,CAAG,EACZ,CACL,MAAMb,EAAQU,EACd,GAAIV,EACF,OAAOY,EAASZ,CAAK,CAEzB,CACF,CACF,CAEJ,CAGF,CAAC,CACH","sourcesContent":["import { SecrecyClient } from \"./index.js\";\nimport { popup } from \"../PopupTools.js\";\nimport type { SecrecyUserApp } from \"./types/index.js\";\nimport { getStorage } from \"./storage.js\";\n\nexport function parseInfos(): SecrecyUserApp | null {\n if (!window.location.hash) {\n return null;\n }\n const hash = window.location.hash.substr(1);\n try {\n const res = JSON.parse(atob(hash));\n window.location.hash = \"\";\n // TODO Add object content validation\n return res;\n } catch {\n return null;\n }\n}\n\nexport const getUrl = ({\n env,\n hash,\n path\n}: {\n env: string;\n hash: string;\n path: string;\n}): string => {\n let envStr = \"\";\n if (env === \"dev\") {\n envStr = \"dev.\";\n }\n const lang = document.documentElement.lang;\n return process.env.NEXT_PUBLIC_SECRECY_API_URL\n ? `http://localhost:3002${lang ? `/${lang}` : \"\"}${\n path.startsWith(\"/\") ? path : `/${path}`\n }#${hash}`\n : `https://auth.${envStr}secrecy.me${lang ? `/${lang}` : \"\"}${\n path.startsWith(\"/\") ? path : `/${path}`\n }#${hash}`;\n};\n\nexport type HashInfos = {\n appUrl: string;\n backPath?: string;\n appCode?: string | null | undefined;\n path?: string | null | undefined;\n redirect?: boolean;\n scopes?: {\n email: boolean;\n };\n};\nexport type SecrecyEnv = \"dev\" | \"prod\";\nexport type UseSecrecyParams = Omit<HashInfos, \"appUrl\"> & {\n env: SecrecyEnv;\n session?: boolean | undefined;\n};\n\nexport type Value<T extends UseSecrecyParams> = T extends { redirect: true }\n ? SecrecyClient | null\n : SecrecyClient;\n\nexport function getSecrecyClient(\n env: SecrecyEnv,\n session?: boolean | undefined\n): SecrecyClient | null {\n const storage = getStorage(session);\n const uaSession = storage.userAppSession.load();\n const uaKeys = storage.userAppKeys.load();\n const uaJwt = storage.jwt.load();\n if (!uaSession || !uaKeys || !uaJwt) {\n const infos = parseInfos();\n if (infos) {\n storage.userAppKeys.save(infos.keys);\n storage.userAppSession.save(infos.uaSession);\n storage.jwt.save(infos.jwt);\n return new SecrecyClient(infos.uaSession, infos.keys, infos.jwt, env);\n }\n return null;\n }\n\n return new SecrecyClient(uaSession, uaKeys, uaJwt, env);\n}\n\nexport function login<T extends UseSecrecyParams>(\n { appCode, path, redirect, scopes, backPath, env, session }: T = {} as T\n): Promise<Value<T>> {\n return new Promise((resolve, reject) => {\n const appUrl = window.location.origin;\n if (appCode && !appUrl.includes(\"localhost\")) {\n return reject(\"Can't use appCode if not in localhost\");\n }\n const client = getSecrecyClient(env);\n\n if (!client) {\n const infos: HashInfos = {\n appUrl,\n appCode,\n redirect,\n path,\n scopes,\n backPath\n };\n const data = btoa(JSON.stringify(infos)).replaceAll(\"=\", \"\");\n\n const url = getUrl({\n env,\n hash: data,\n path: \"login\"\n });\n\n const validate = (infos: SecrecyUserApp): void => {\n const storage = getStorage(session);\n storage.userAppSession.save(infos.uaSession);\n storage.userAppKeys.save(infos.keys);\n storage.jwt.save(infos.jwt);\n return resolve(\n new SecrecyClient(\n infos.uaSession,\n infos.keys,\n infos.jwt,\n env\n ) as Value<T>\n );\n };\n\n if (redirect) {\n const infos = parseInfos();\n if (infos) {\n return validate(infos);\n } else {\n window.location.href = url;\n return resolve(null as Value<T>);\n }\n } else {\n popup(\n url,\n \"Secrecy Login\",\n {\n width: 500,\n height: 750,\n resizable: \"no\",\n menubar: \"no\",\n location: \"no\",\n centered: true,\n scrollbars: \"no\"\n },\n (err, data) => {\n if (err) {\n return reject(err);\n } else {\n const infos = data as SecrecyUserApp;\n if (infos) {\n return validate(infos);\n }\n }\n }\n );\n }\n } else {\n return resolve(client as Value<T>);\n }\n });\n}\n"]}
|
package/dist/client/helpers.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { H as HashInfos, f as SecrecyEnv, h as UseSecrecyParams, V as Value, i as getSecrecyClient, g as getUrl, l as login, p as parseInfos } from '../BaseClient-2af8a400.js';
|
|
2
|
-
import './types/index.js';
|
|
3
|
-
import 'ky';
|
|
4
|
-
import '../zeus/index.js';
|
|
5
|
-
import '../zeus/const.js';
|
|
6
|
-
import '../error.js';
|
|
7
|
-
import '../crypto/file.js';
|
|
8
|
-
import '../crypto/index.js';
|
|
9
|
-
import './types/File.js';
|
|
10
|
-
import './types/selectors.js';
|
|
11
|
-
import './types/UserAppSettings.js';
|
|
12
|
-
import './types/UserAppNotifications.js';
|
|
13
|
-
import 'jsonwebtoken';
|
|
14
|
-
import 'bson';
|
|
15
|
-
import 'ethers';
|
|
16
|
-
import './types/Inputs.js';
|
package/dist/client/helpers.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{SecrecyClient as u}from"./index.js";import{popup as U}from"../PopupTools.js";import{getStorage as w}from"./storage.js";function g(){if(!window.location.hash)return null;const s=window.location.hash.substr(1);try{const o=JSON.parse(atob(s));return window.location.hash="",o}catch{return null}}const x=({env:s,hash:o,path:e})=>{let a="";s==="dev"&&(a="dev.");const t=document.documentElement.lang;return process.env.NEXT_PUBLIC_SECRECY_API_URL?`http://localhost:3002${t?`/${t}`:""}${e.startsWith("/")?e:`/${e}`}#${o}`:`https://auth.${a}secrecy.me${t?`/${t}`:""}${e.startsWith("/")?e:`/${e}`}#${o}`};function A(s,o){const e=w(o),a=e.userAppSession.load(),t=e.userAppKeys.load(),i=e.jwt.load();if(!a||!t||!i){const r=g();return r?(e.userAppKeys.save(r.keys),e.userAppSession.save(r.uaSession),e.jwt.save(r.jwt),new u(r.uaSession,r.keys,r.jwt,s)):null}return new u(a,t,i,s)}function T({appCode:s,path:o,redirect:e,scopes:a,backPath:t,env:i,session:r}={}){return new Promise((l,p)=>{const d=window.location.origin;if(s&&!d.includes("localhost"))return p("Can't use appCode if not in localhost");const y=A(i);if(y)return l(y);{const m={appUrl:d,appCode:s,redirect:e,path:o,scopes:a,backPath:t},v=btoa(JSON.stringify(m)).replaceAll("=",""),S=x({env:i,hash:v,path:"login"}),f=n=>{const c=w(r);return c.userAppSession.save(n.uaSession),c.userAppKeys.save(n.keys),c.jwt.save(n.jwt),l(new u(n.uaSession,n.keys,n.jwt,i))};if(e){const n=g();return n?f(n):(window.location.href=S,l(null))}else U(S,"Secrecy Login",{width:500,height:750,resizable:"no",menubar:"no",location:"no",centered:!0,scrollbars:"no"},(n,c)=>{if(n)return p(n);{const h=c;if(h)return f(h)}})}})}export{A as getSecrecyClient,x as getUrl,T as login,g as parseInfos};
|
|
2
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/helpers.ts"],"sourcesContent":["import { SecrecyClient } from \"./index.js\";\nimport { popup } from \"../PopupTools.js\";\nimport type { SecrecyUserApp } from \"./types/index.js\";\nimport { getStorage } from \"./storage.js\";\n\nexport function parseInfos(): SecrecyUserApp | null {\n if (!window.location.hash) {\n return null;\n }\n const hash = window.location.hash.substr(1);\n try {\n const res = JSON.parse(atob(hash));\n window.location.hash = \"\";\n // TODO Add object content validation\n return res;\n } catch {\n return null;\n }\n}\n\nexport const getUrl = ({\n env,\n hash,\n path\n}: {\n env: string;\n hash: string;\n path: string;\n}): string => {\n let envStr = \"\";\n if (env === \"dev\") {\n envStr = \"dev.\";\n }\n const lang = document.documentElement.lang;\n return process.env.NEXT_PUBLIC_SECRECY_API_URL\n ? `http://localhost:3002${lang ? `/${lang}` : \"\"}${\n path.startsWith(\"/\") ? path : `/${path}`\n }#${hash}`\n : `https://auth.${envStr}secrecy.me${lang ? `/${lang}` : \"\"}${\n path.startsWith(\"/\") ? path : `/${path}`\n }#${hash}`;\n};\n\nexport type HashInfos = {\n appUrl: string;\n backPath?: string;\n appCode?: string | null | undefined;\n path?: string | null | undefined;\n redirect?: boolean;\n scopes?: {\n email: boolean;\n };\n};\nexport type SecrecyEnv = \"dev\" | \"prod\";\nexport type UseSecrecyParams = Omit<HashInfos, \"appUrl\"> & {\n env: SecrecyEnv;\n session?: boolean | undefined;\n};\n\nexport type Value<T extends UseSecrecyParams> = T extends { redirect: true }\n ? SecrecyClient | null\n : SecrecyClient;\n\nexport function getSecrecyClient(\n env: SecrecyEnv,\n session?: boolean | undefined\n): SecrecyClient | null {\n const storage = getStorage(session);\n const uaSession = storage.userAppSession.load();\n const uaKeys = storage.userAppKeys.load();\n const uaJwt = storage.jwt.load();\n if (!uaSession || !uaKeys || !uaJwt) {\n const infos = parseInfos();\n if (infos) {\n storage.userAppKeys.save(infos.keys);\n storage.userAppSession.save(infos.uaSession);\n storage.jwt.save(infos.jwt);\n return new SecrecyClient(infos.uaSession, infos.keys, infos.jwt, env);\n }\n return null;\n }\n\n return new SecrecyClient(uaSession, uaKeys, uaJwt, env);\n}\n\nexport function login<T extends UseSecrecyParams>(\n { appCode, path, redirect, scopes, backPath, env, session }: T = {} as T\n): Promise<Value<T>> {\n return new Promise((resolve, reject) => {\n const appUrl = window.location.origin;\n if (appCode && !appUrl.includes(\"localhost\")) {\n return reject(\"Can't use appCode if not in localhost\");\n }\n const client = getSecrecyClient(env);\n\n if (!client) {\n const infos: HashInfos = {\n appUrl,\n appCode,\n redirect,\n path,\n scopes,\n backPath\n };\n const data = btoa(JSON.stringify(infos)).replaceAll(\"=\", \"\");\n\n const url = getUrl({\n env,\n hash: data,\n path: \"login\"\n });\n\n const validate = (infos: SecrecyUserApp): void => {\n const storage = getStorage(session);\n storage.userAppSession.save(infos.uaSession);\n storage.userAppKeys.save(infos.keys);\n storage.jwt.save(infos.jwt);\n return resolve(\n new SecrecyClient(\n infos.uaSession,\n infos.keys,\n infos.jwt,\n env\n ) as Value<T>\n );\n };\n\n if (redirect) {\n const infos = parseInfos();\n if (infos) {\n return validate(infos);\n } else {\n window.location.href = url;\n return resolve(null as Value<T>);\n }\n } else {\n popup(\n url,\n \"Secrecy Login\",\n {\n width: 500,\n height: 750,\n resizable: \"no\",\n menubar: \"no\",\n location: \"no\",\n centered: true,\n scrollbars: \"no\"\n },\n (err, data) => {\n if (err) {\n return reject(err);\n } else {\n const infos = data as SecrecyUserApp;\n if (infos) {\n return validate(infos);\n }\n }\n }\n );\n }\n } else {\n return resolve(client as Value<T>);\n }\n });\n}\n"],"mappings":"AAAA,OAAS,iBAAAA,MAAqB,aAC9B,OAAS,SAAAC,MAAa,mBAEtB,OAAS,cAAAC,MAAkB,eAEpB,SAASC,GAAoC,CAClD,GAAI,CAAC,OAAO,SAAS,KACnB,OAAO,KAET,MAAMC,EAAO,OAAO,SAAS,KAAK,OAAO,CAAC,EAC1C,GAAI,CACF,MAAMC,EAAM,KAAK,MAAM,KAAKD,CAAI,CAAC,EACjC,cAAO,SAAS,KAAO,GAEhBC,CACT,MAAE,CACA,OAAO,IACT,CACF,CAEO,MAAMC,EAAS,CAAC,CACrB,IAAAC,EACA,KAAAH,EACA,KAAAI,CACF,IAIc,CACZ,IAAIC,EAAS,GACTF,IAAQ,QACVE,EAAS,QAEX,MAAMC,EAAO,SAAS,gBAAgB,KACtC,OAAO,QAAQ,IAAI,4BACf,wBAAwBA,EAAO,IAAIA,IAAS,KAC1CF,EAAK,WAAW,GAAG,EAAIA,EAAO,IAAIA,OAChCJ,IACJ,gBAAgBK,cAAmBC,EAAO,IAAIA,IAAS,KACrDF,EAAK,WAAW,GAAG,EAAIA,EAAO,IAAIA,OAChCJ,GACV,EAsBO,SAASO,EACdJ,EACAK,EACsB,CACtB,MAAMC,EAAUX,EAAWU,CAAO,EAC5BE,EAAYD,EAAQ,eAAe,KAAK,EACxCE,EAASF,EAAQ,YAAY,KAAK,EAClCG,EAAQH,EAAQ,IAAI,KAAK,EAC/B,GAAI,CAACC,GAAa,CAACC,GAAU,CAACC,EAAO,CACnC,MAAMC,EAAQd,EAAW,EACzB,OAAIc,GACFJ,EAAQ,YAAY,KAAKI,EAAM,IAAI,EACnCJ,EAAQ,eA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ACA,CACE,MAAO,IACP,OAAQ,IACR,UAAW,KACX,QAAS,KACT,SAAU,KACV,SAAU,GACV,WAAY,IACd,EACA,CAACE,EAAKH,IAAS,CACb,GAAIG,EACF,OAAON,EAAOM,CAAG,EACZ,CACL,MAAMb,EAAQU,EACd,GAAIV,EACF,OAAOY,EAASZ,CAAK,CAEzB,CACF,CACF,CAEJ,CAGF,CAAC,CACH","names":["SecrecyClient","popup","getStorage","parseInfos","hash","res","getUrl","env","path","envStr","lang","getSecrecyClient","session","storage","uaSession","uaKeys","uaJwt","infos","login","appCode","redirect","scopes","backPath","resolve","reject","appUrl","client","data","url","validate","err"]}
|
package/dist/client/index.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _BaseClientjs = require('../BaseClient.js');var _filejs = require('../crypto/file.js');var _sodiumjs = require('../sodium.js');var _SecrecyCloudClientjs = require('./SecrecyCloudClient.js');var _SecrecyMailClientjs = require('./SecrecyMailClient.js');var _SecrecyAppClientjs = require('./SecrecyAppClient.js');var _cachejs = require('../cache.js');var _SecrecyDbClientjs = require('./SecrecyDbClient.js');var _SecrecyWalletClientjs = require('./SecrecyWalletClient.js');var _SecrecyPayClientjs = require('./SecrecyPayClient.js');const v=async(i,e)=>{const{data:t}=await _filejs.encryptSecretstream.call(void 0, _sodiumjs.sodium.from_hex(e),_sodiumjs.sodium.from_string(i));return _sodiumjs.sodium.to_hex(t)};class E extends _BaseClientjs.BaseClient{#e;constructor(e,t,s,n){super(e,n),this.#e=t,this.cloud=new (0, _SecrecyCloudClientjs.SecrecyCloudClient)(this,this.#e,this.thunder),this.mail=new (0, _SecrecyMailClientjs.SecrecyMailClient)(this,this.#e,this.thunder),this.app=new (0, _SecrecyAppClientjs.SecrecyAppClient)(s,this,this.#e,this.thunder),this.db=new (0, _SecrecyDbClientjs.SecrecyDbClient)(this,this.#e,this.thunder),this.wallet=new (0, _SecrecyWalletClientjs.SecrecyWalletClient)(this),this.pay=new (0, _SecrecyPayClientjs.SecrecyPayClient)(this,this.#e,this.thunder)}get publicKey(){return this.#e.publicKey}async logout(e){_cachejs.nodesCache.clear(),_cachejs.filesCache.clear(),await super.logout(e)}}exports.SecrecyClient = E; exports.encryptName = v;
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/index.ts"],"names":["BaseClient","encryptSecretstream","sodium","SecrecyCloudClient","SecrecyMailClient","SecrecyAppClient","nodesCache","filesCache","SecrecyDbClient","SecrecyWalletClient","SecrecyPayClient","encryptName","name","nameKey","data","SecrecyClient","#keys","uaSession","uaKeys","uaJwt","env","sessionId"],"mappings":"AACA,OAAS,cAAAA,MAAkB,mBAE3B,OAAS,uBAAAC,MAA2B,oBACpC,OAAS,UAAAC,MAAc,eAGvB,OAAS,sBAAAC,MAA0B,0BACnC,OAAS,qBAAAC,MAAyB,yBAClC,OAAS,oBAAAC,MAAwB,wBACjC,OAAS,cAAAC,EAAY,cAAAC,MAAkB,cACvC,OAAS,mBAAAC,MAAuB,uBAChC,OAAS,uBAAAC,MAA2B,2BACpC,OAAS,oBAAAC,MAAwB,wBAW1B,MAAMC,EAAc,MACzBC,EACAC,IACoB,CACpB,KAAM,CAAE,KAAAC,CAAK,EAAI,MAAMb,EACrBC,EAAO,SAASW,CAAO,EACvBX,EAAO,YAAYU,CAAI,CACzB,EAEA,OADsBV,EAAO,OAAOY,CAAI,CAE1C,EAEO,MAAMC,UAAsBf,CAAW,CAC5CgB,GAEA,MAEA,KAEA,IAEA,GAEA,OAEA,IAEA,YACEC,EACAC,EACAC,EACAC,EACA,CACA,MAAMH,EAAWG,CAAG,EACpB,KAAKJ,GAAQE,EACb,KAAK,MAAQ,IAAIf,EAAmB,KAAM,KAAKa,GAAO,KAAK,OAAO,EAClE,KAAK,KAAO,IAAIZ,EAAkB,KAAM,KAAKY,GAAO,KAAK,OAAO,EAChE,KAAK,IAAM,IAAIX,EAAiBc,EAAO,KAAM,KAAKH,GAAO,KAAK,OAAO,EACrE,KAAK,GAAK,IAAIR,EAAgB,KAAM,KAAKQ,GAAO,KAAK,OAAO,EAC5D,KAAK,OAAS,IAAIP,EAAoB,IAAI,EAC1C,KAAK,IAAM,IAAIC,EAAiB,KAAM,KAAKM,GAAO,KAAK,OAAO,CAChE,CAEA,IAAI,WAAoB,CACtB,OAAO,KAAKA,GAAM,SACpB,CAEA,MAAM,OAAOK,EAAsD,CACjEf,EAAW,MAAM,EACjBC,EAAW,MAAM,EACjB,MAAM,MAAM,OAAOc,CAAS,CAC9B,CACF","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { BaseClient } from \"../BaseClient.js\";\nimport type { Progress } from \"../crypto/file.js\";\nimport { encryptSecretstream } from \"../crypto/file.js\";\nimport { sodium } from \"../sodium.js\";\nimport type { KeyPair } from \"../crypto/index.js\";\nimport type { SecrecyEnv } from \"./helpers.js\";\nimport { SecrecyCloudClient } from \"./SecrecyCloudClient.js\";\nimport { SecrecyMailClient } from \"./SecrecyMailClient.js\";\nimport { SecrecyAppClient } from \"./SecrecyAppClient.js\";\nimport { nodesCache, filesCache } from \"../cache.js\";\nimport { SecrecyDbClient } from \"./SecrecyDbClient.js\";\nimport { SecrecyWalletClient } from \"./SecrecyWalletClient.js\";\nimport { SecrecyPayClient } from \"./SecrecyPayClient.js\";\n\nexport type NewMail = {\n body: string;\n subject: string;\n files: { id: string; name: string }[];\n recipientsIds: string[];\n replyTo?: string | null | undefined;\n};\nexport type ProgressCallback = (progress: Progress) => Promise<void>;\n\nexport const encryptName = async (\n name: string,\n nameKey: string\n): Promise<string> => {\n const { data } = await encryptSecretstream(\n sodium.from_hex(nameKey),\n sodium.from_string(name)\n );\n const nameEncrypted = sodium.to_hex(data);\n return nameEncrypted;\n};\n\nexport class SecrecyClient extends BaseClient {\n #keys: KeyPair;\n\n cloud: SecrecyCloudClient;\n\n mail: SecrecyMailClient;\n\n app: SecrecyAppClient;\n\n db: SecrecyDbClient;\n\n wallet: SecrecyWalletClient;\n\n pay: SecrecyPayClient;\n\n constructor(\n uaSession: string,\n uaKeys: KeyPair,\n uaJwt: string,\n env: SecrecyEnv\n ) {\n super(uaSession, env);\n this.#keys = uaKeys;\n this.cloud = new SecrecyCloudClient(this, this.#keys, this.thunder);\n this.mail = new SecrecyMailClient(this, this.#keys, this.thunder);\n this.app = new SecrecyAppClient(uaJwt, this, this.#keys, this.thunder);\n this.db = new SecrecyDbClient(this, this.#keys, this.thunder);\n this.wallet = new SecrecyWalletClient(this);\n this.pay = new SecrecyPayClient(this, this.#keys, this.thunder);\n }\n\n get publicKey(): string {\n return this.#keys.publicKey;\n }\n\n async logout(sessionId?: string | null | undefined): Promise<void> {\n nodesCache.clear();\n filesCache.clear();\n await super.logout(sessionId);\n }\n}\n"]}
|
package/dist/client/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { N as NewMail, P as ProgressCallback, d as SecrecyClient, e as encryptName } from '../BaseClient-2af8a400.js';
|
|
2
|
-
import '../crypto/file.js';
|
|
3
|
-
import '../crypto/index.js';
|
|
4
|
-
import 'ky';
|
|
5
|
-
import '../zeus/index.js';
|
|
6
|
-
import '../zeus/const.js';
|
|
7
|
-
import '../error.js';
|
|
8
|
-
import './types/File.js';
|
|
9
|
-
import './types/selectors.js';
|
|
10
|
-
import './types/index.js';
|
|
11
|
-
import './types/UserAppSettings.js';
|
|
12
|
-
import './types/UserAppNotifications.js';
|
|
13
|
-
import './types/Inputs.js';
|
|
14
|
-
import 'jsonwebtoken';
|
|
15
|
-
import 'bson';
|
|
16
|
-
import 'ethers';
|
package/dist/client/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{BaseClient as o}from"../BaseClient.js";import{encryptSecretstream as c}from"../crypto/file.js";import{sodium as r}from"../sodium.js";import{SecrecyCloudClient as l}from"./SecrecyCloudClient.js";import{SecrecyMailClient as p}from"./SecrecyMailClient.js";import{SecrecyAppClient as y}from"./SecrecyAppClient.js";import{nodesCache as a,filesCache as m}from"../cache.js";import{SecrecyDbClient as h}from"./SecrecyDbClient.js";import{SecrecyWalletClient as d}from"./SecrecyWalletClient.js";import{SecrecyPayClient as u}from"./SecrecyPayClient.js";const v=async(i,e)=>{const{data:t}=await c(r.from_hex(e),r.from_string(i));return r.to_hex(t)};class E extends o{#e;cloud;mail;app;db;wallet;pay;constructor(e,t,s,n){super(e,n),this.#e=t,this.cloud=new l(this,this.#e,this.thunder),this.mail=new p(this,this.#e,this.thunder),this.app=new y(s,this,this.#e,this.thunder),this.db=new h(this,this.#e,this.thunder),this.wallet=new d(this),this.pay=new u(this,this.#e,this.thunder)}get publicKey(){return this.#e.publicKey}async logout(e){a.clear(),m.clear(),await super.logout(e)}}export{E as SecrecyClient,v as encryptName};
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { BaseClient } from \"../BaseClient.js\";\nimport type { Progress } from \"../crypto/file.js\";\nimport { encryptSecretstream } from \"../crypto/file.js\";\nimport { sodium } from \"../sodium.js\";\nimport type { KeyPair } from \"../crypto/index.js\";\nimport type { SecrecyEnv } from \"./helpers.js\";\nimport { SecrecyCloudClient } from \"./SecrecyCloudClient.js\";\nimport { SecrecyMailClient } from \"./SecrecyMailClient.js\";\nimport { SecrecyAppClient } from \"./SecrecyAppClient.js\";\nimport { nodesCache, filesCache } from \"../cache.js\";\nimport { SecrecyDbClient } from \"./SecrecyDbClient.js\";\nimport { SecrecyWalletClient } from \"./SecrecyWalletClient.js\";\nimport { SecrecyPayClient } from \"./SecrecyPayClient.js\";\n\nexport type NewMail = {\n body: string;\n subject: string;\n files: { id: string; name: string }[];\n recipientsIds: string[];\n replyTo?: string | null | undefined;\n};\nexport type ProgressCallback = (progress: Progress) => Promise<void>;\n\nexport const encryptName = async (\n name: string,\n nameKey: string\n): Promise<string> => {\n const { data } = await encryptSecretstream(\n sodium.from_hex(nameKey),\n sodium.from_string(name)\n );\n const nameEncrypted = sodium.to_hex(data);\n return nameEncrypted;\n};\n\nexport class SecrecyClient extends BaseClient {\n #keys: KeyPair;\n\n cloud: SecrecyCloudClient;\n\n mail: SecrecyMailClient;\n\n app: SecrecyAppClient;\n\n db: SecrecyDbClient;\n\n wallet: SecrecyWalletClient;\n\n pay: SecrecyPayClient;\n\n constructor(\n uaSession: string,\n uaKeys: KeyPair,\n uaJwt: string,\n env: SecrecyEnv\n ) {\n super(uaSession, env);\n this.#keys = uaKeys;\n this.cloud = new SecrecyCloudClient(this, this.#keys, this.thunder);\n this.mail = new SecrecyMailClient(this, this.#keys, this.thunder);\n this.app = new SecrecyAppClient(uaJwt, this, this.#keys, this.thunder);\n this.db = new SecrecyDbClient(this, this.#keys, this.thunder);\n this.wallet = new SecrecyWalletClient(this);\n this.pay = new SecrecyPayClient(this, this.#keys, this.thunder);\n }\n\n get publicKey(): string {\n return this.#keys.publicKey;\n }\n\n async logout(sessionId?: string | null | undefined): Promise<void> {\n nodesCache.clear();\n filesCache.clear();\n await super.logout(sessionId);\n }\n}\n"],"mappings":"AACA,OAAS,cAAAA,MAAkB,mBAE3B,OAAS,uBAAAC,MAA2B,oBACpC,OAAS,UAAAC,MAAc,eAGvB,OAAS,sBAAAC,MAA0B,0BACnC,OAAS,qBAAAC,MAAyB,yBAClC,OAAS,oBAAAC,MAAwB,wBACjC,OAAS,cAAAC,EAAY,cAAAC,MAAkB,cACvC,OAAS,mBAAAC,MAAuB,uBAChC,OAAS,uBAAAC,MAA2B,2BACpC,OAAS,oBAAAC,MAAwB,wBAW1B,MAAMC,EAAc,MACzBC,EACAC,IACoB,CACpB,KAAM,CAAE,KAAAC,CAAK,EAAI,MAAMb,EACrBC,EAAO,SAASW,CAAO,EACvBX,EAAO,YAAYU,CAAI,CACzB,EAEA,OADsBV,EAAO,OAAOY,CAAI,CAE1C,EAEO,MAAMC,UAAsBf,CAAW,CAC5CgB,GAEA,MAEA,KAEA,IAEA,GAEA,OAEA,IAEA,YACEC,EACAC,EACAC,EACAC,EACA,CACA,MAAMH,EAAWG,CAAG,EACpB,KAAKJ,GAAQE,EACb,KAAK,MAAQ,IAAIf,EAAmB,KAAM,KAAKa,GAAO,KAAK,OAAO,EAClE,KAAK,KAAO,IAAIZ,EAAkB,KAAM,KAAKY,GAAO,KAAK,OAAO,EAChE,KAAK,IAAM,IAAIX,EAAiBc,EAAO,KAAM,KAAKH,GAAO,KAAK,OAAO,EACrE,KAAK,GAAK,IAAIR,EAAgB,KAAM,KAAKQ,GAAO,KAAK,OAAO,EAC5D,KAAK,OAAS,IAAIP,EAAoB,IAAI,EAC1C,KAAK,IAAM,IAAIC,EAAiB,KAAM,KAAKM,GAAO,KAAK,OAAO,CAChE,CAEA,IAAI,WAAoB,CACtB,OAAO,KAAKA,GAAM,SACpB,CAEA,MAAM,OAAOK,EAAsD,CACjEf,EAAW,MAAM,EACjBC,EAAW,MAAM,EACjB,MAAM,MAAM,OAAOc,CAAS,CAC9B,CACF","names":["BaseClient","encryptSecretstream","sodium","SecrecyCloudClient","SecrecyMailClient","SecrecyAppClient","nodesCache","filesCache","SecrecyDbClient","SecrecyWalletClient","SecrecyPayClient","encryptName","name","nameKey","data","SecrecyClient","#keys","uaSession","uaKeys","uaJwt","env","sessionId"]}
|
package/dist/client/storage.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _storebuddyjs = require('../utils/store-buddy.js');function i(e){const t=_storebuddyjs.storeBuddy.call(void 0, "secrecy.user_app_session",e).init(null),n=_storebuddyjs.storeBuddy.call(void 0, "secrecy.user_app_keys",e).init(null),s=_storebuddyjs.storeBuddy.call(void 0, "secrecy.jwt",e).init(null);return{userAppKeys:n,userAppSession:t,jwt:s}}exports.getStorage = i;
|
|
2
|
-
//# sourceMappingURL=storage.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/storage.ts"],"names":["storeBuddy","getStorage","session","userAppSession","userAppKeys","jwt"],"mappings":"AAEA,OAAS,cAAAA,MAAkB,0BAEpB,SAASC,EAAWC,EAIzB,CACA,MAAMC,EAAiBH,EACrB,2BACAE,CACF,EAAE,KAAK,IAAI,EACLE,EAAcJ,EAClB,wBACAE,CACF,EAAE,KAAK,IAAI,EACLG,EAAML,EAA0B,cAAeE,CAAO,EAAE,KAAK,IAAI,EACvE,MAAO,CAAE,YAAAE,EAAa,eAAAD,EAAgB,IAAAE,CAAI,CAC5C","sourcesContent":["import type { KeyPair } from \"../index.js\";\nimport type { StoreBuddy } from \"../utils/store-buddy.js\";\nimport { storeBuddy } from \"../utils/store-buddy.js\";\n\nexport function getStorage(session?: boolean | undefined): {\n userAppKeys: StoreBuddy<KeyPair | null>;\n userAppSession: StoreBuddy<string | null>;\n jwt: StoreBuddy<string | null>;\n} {\n const userAppSession = storeBuddy<string | null>(\n `secrecy.user_app_session`,\n session\n ).init(null);\n const userAppKeys = storeBuddy<KeyPair | null>(\n `secrecy.user_app_keys`,\n session\n ).init(null);\n const jwt = storeBuddy<string | null>(`secrecy.jwt`, session).init(null);\n return { userAppKeys, userAppSession, jwt };\n}\n"]}
|
package/dist/client/storage.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { KeyPair } from '../crypto/index.js';
|
|
2
|
-
import { StoreBuddy } from '../utils/store-buddy.js';
|
|
3
|
-
|
|
4
|
-
declare function getStorage(session?: boolean | undefined): {
|
|
5
|
-
userAppKeys: StoreBuddy<KeyPair | null>;
|
|
6
|
-
userAppSession: StoreBuddy<string | null>;
|
|
7
|
-
jwt: StoreBuddy<string | null>;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { getStorage };
|
package/dist/client/storage.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{storeBuddy as r}from"../utils/store-buddy.js";function i(e){const t=r("secrecy.user_app_session",e).init(null),n=r("secrecy.user_app_keys",e).init(null),s=r("secrecy.jwt",e).init(null);return{userAppKeys:n,userAppSession:t,jwt:s}}export{i as getStorage};
|
|
2
|
-
//# sourceMappingURL=storage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/storage.ts"],"sourcesContent":["import type { KeyPair } from \"../index.js\";\nimport type { StoreBuddy } from \"../utils/store-buddy.js\";\nimport { storeBuddy } from \"../utils/store-buddy.js\";\n\nexport function getStorage(session?: boolean | undefined): {\n userAppKeys: StoreBuddy<KeyPair | null>;\n userAppSession: StoreBuddy<string | null>;\n jwt: StoreBuddy<string | null>;\n} {\n const userAppSession = storeBuddy<string | null>(\n `secrecy.user_app_session`,\n session\n ).init(null);\n const userAppKeys = storeBuddy<KeyPair | null>(\n `secrecy.user_app_keys`,\n session\n ).init(null);\n const jwt = storeBuddy<string | null>(`secrecy.jwt`, session).init(null);\n return { userAppKeys, userAppSession, jwt };\n}\n"],"mappings":"AAEA,OAAS,cAAAA,MAAkB,0BAEpB,SAASC,EAAWC,EAIzB,CACA,MAAMC,EAAiBH,EACrB,2BACAE,CACF,EAAE,KAAK,IAAI,EACLE,EAAcJ,EAClB,wBACAE,CACF,EAAE,KAAK,IAAI,EACLG,EAAML,EAA0B,cAAeE,CAAO,EAAE,KAAK,IAAI,EACvE,MAAO,CAAE,YAAAE,EAAa,eAAAD,EAAgB,IAAAE,CAAI,CAC5C","names":["storeBuddy","getStorage","session","userAppSession","userAppKeys","jwt"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";//# sourceMappingURL=File.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { InputType, GraphQLTypes } from '../../zeus/index.js';
|
|
2
|
-
import { fileSelector } from './selectors.js';
|
|
3
|
-
import '../../zeus/const.js';
|
|
4
|
-
|
|
5
|
-
type FileMetadata = {
|
|
6
|
-
id: string;
|
|
7
|
-
size: bigint;
|
|
8
|
-
sizeBefore: bigint;
|
|
9
|
-
md5: string;
|
|
10
|
-
md5Encrypted: string;
|
|
11
|
-
createdAt: Date;
|
|
12
|
-
};
|
|
13
|
-
type InternalFile = FileMetadata & {
|
|
14
|
-
key: string;
|
|
15
|
-
};
|
|
16
|
-
type GQLFile = InputType<GraphQLTypes["File"], typeof fileSelector>;
|
|
17
|
-
|
|
18
|
-
export { FileMetadata, GQLFile, InternalFile };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=File.js.map
|