@secrecy/lib 1.0.0-dev.9 → 1.0.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.
Files changed (133) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/dist/BaseClient.d.ts +111 -0
  4. package/dist/BaseClient.js +506 -0
  5. package/{lib → dist}/PopupTools.d.ts +4 -4
  6. package/dist/PopupTools.js +195 -0
  7. package/{lib → dist}/ZeusThunder.d.ts +0 -0
  8. package/dist/ZeusThunder.js +65 -0
  9. package/dist/cache.d.ts +6 -0
  10. package/dist/cache.js +4 -0
  11. package/dist/client/SecrecyAppClient.d.ts +17 -0
  12. package/dist/client/SecrecyAppClient.js +226 -0
  13. package/dist/client/SecrecyCloudClient.d.ts +89 -0
  14. package/dist/client/SecrecyCloudClient.js +1405 -0
  15. package/dist/client/SecrecyDbClient.d.ts +21 -0
  16. package/dist/client/SecrecyDbClient.js +177 -0
  17. package/dist/client/SecrecyMailClient.d.ts +42 -0
  18. package/dist/client/SecrecyMailClient.js +1022 -0
  19. package/dist/client/SecrecyPayClient.d.ts +28 -0
  20. package/dist/client/SecrecyPayClient.js +68 -0
  21. package/dist/client/SecrecyWalletClient.d.ts +30 -0
  22. package/dist/client/SecrecyWalletClient.js +73 -0
  23. package/{lib → dist}/client/convert/file.d.ts +3 -3
  24. package/dist/client/convert/file.js +33 -0
  25. package/dist/client/convert/mail.d.ts +3 -0
  26. package/dist/client/convert/mail.js +42 -0
  27. package/dist/client/convert/node.d.ts +9 -0
  28. package/dist/client/convert/node.js +87 -0
  29. package/{lib → dist}/client/helpers.d.ts +9 -4
  30. package/dist/client/helpers.js +119 -0
  31. package/dist/client/index.d.ts +34 -0
  32. package/dist/client/index.js +46 -0
  33. package/{lib → dist}/client/storage.d.ts +0 -0
  34. package/dist/client/storage.js +12 -0
  35. package/dist/client/types/File.d.ts +14 -0
  36. package/dist/client/types/File.js +3 -0
  37. package/dist/client/types/Inputs.d.ts +16 -0
  38. package/dist/client/types/Inputs.js +3 -0
  39. package/dist/client/types/Node.d.ts +56 -0
  40. package/dist/client/types/Node.js +3 -0
  41. package/dist/client/types/UserAppNotifications.d.ts +6 -0
  42. package/dist/client/types/UserAppNotifications.js +3 -0
  43. package/dist/client/types/UserAppSettings.d.ts +5 -0
  44. package/dist/client/types/UserAppSettings.js +3 -0
  45. package/{lib → dist}/client/types/index.d.ts +25 -59
  46. package/dist/client/types/index.js +8 -0
  47. package/dist/client/types/selectors.d.ts +400 -0
  48. package/dist/client/types/selectors.js +135 -0
  49. package/{lib → dist}/crypto/file.d.ts +2 -2
  50. package/dist/crypto/file.js +195 -0
  51. package/{lib → dist}/crypto/index.d.ts +0 -0
  52. package/dist/crypto/index.js +45 -0
  53. package/dist/error.d.ts +33 -0
  54. package/dist/error.js +3 -0
  55. package/dist/index.d.ts +14 -0
  56. package/dist/index.js +10 -0
  57. package/{lib → dist}/minify/index.d.ts +0 -0
  58. package/dist/minify/index.js +23 -0
  59. package/{lib → dist}/minify/lz4.d.ts +0 -0
  60. package/dist/minify/lz4.js +539 -0
  61. package/{lib → dist}/sodium.d.ts +0 -0
  62. package/dist/sodium.js +6 -0
  63. package/{lib → dist}/utils/store-buddy.d.ts +1 -1
  64. package/dist/utils/store-buddy.js +58 -0
  65. package/{lib → dist}/utils/time.d.ts +0 -0
  66. package/dist/utils/time.js +12 -0
  67. package/{lib → dist/utils}/utils.d.ts +0 -0
  68. package/dist/utils/utils.js +47 -0
  69. package/{lib → dist}/worker/md5.d.ts +0 -0
  70. package/dist/worker/md5.js +24 -0
  71. package/{lib → dist}/worker/sodium.d.ts +0 -0
  72. package/dist/worker/sodium.js +118 -0
  73. package/{lib → dist}/worker/workerCodes.d.ts +0 -0
  74. package/dist/worker/workerCodes.js +255 -0
  75. package/{lib → dist}/zeus/const.d.ts +5 -0
  76. package/dist/zeus/const.js +1679 -0
  77. package/dist/zeus/index.d.ts +7941 -0
  78. package/dist/zeus/index.js +599 -0
  79. package/package.json +64 -54
  80. package/lib/BaseClient.d.ts +0 -266
  81. package/lib/BaseClient.js +0 -1332
  82. package/lib/PopupTools.js +0 -213
  83. package/lib/ZeusThunder.js +0 -115
  84. package/lib/cache.d.ts +0 -7
  85. package/lib/cache.js +0 -5
  86. package/lib/client/admin/index.d.ts +0 -10
  87. package/lib/client/admin/index.js +0 -145
  88. package/lib/client/convert/file.js +0 -39
  89. package/lib/client/convert/folder.d.ts +0 -8
  90. package/lib/client/convert/folder.js +0 -264
  91. package/lib/client/convert/mail.d.ts +0 -3
  92. package/lib/client/convert/mail.js +0 -46
  93. package/lib/client/convert/vFile.d.ts +0 -5
  94. package/lib/client/convert/vFile.js +0 -164
  95. package/lib/client/helpers.js +0 -116
  96. package/lib/client/index.d.ts +0 -169
  97. package/lib/client/index.js +0 -3803
  98. package/lib/client/storage.js +0 -12
  99. package/lib/client/types/File.d.ts +0 -21
  100. package/lib/client/types/File.js +0 -2
  101. package/lib/client/types/FilesOnUsersOnApplications.d.ts +0 -9
  102. package/lib/client/types/FilesOnUsersOnApplications.js +0 -2
  103. package/lib/client/types/Folder.d.ts +0 -68
  104. package/lib/client/types/Folder.js +0 -7
  105. package/lib/client/types/Inputs.d.ts +0 -21
  106. package/lib/client/types/Inputs.js +0 -2
  107. package/lib/client/types/UserAppNotifications.d.ts +0 -6
  108. package/lib/client/types/UserAppNotifications.js +0 -2
  109. package/lib/client/types/UserAppSettings.d.ts +0 -7
  110. package/lib/client/types/UserAppSettings.js +0 -2
  111. package/lib/client/types/VFile.d.ts +0 -62
  112. package/lib/client/types/VFile.js +0 -4
  113. package/lib/client/types/index.js +0 -9
  114. package/lib/client/types/queries.d.ts +0 -535
  115. package/lib/client/types/queries.js +0 -192
  116. package/lib/crypto/file.js +0 -291
  117. package/lib/crypto/index.js +0 -37
  118. package/lib/index.d.ts +0 -12
  119. package/lib/index.js +0 -41
  120. package/lib/minify/index.js +0 -28
  121. package/lib/minify/lz4.js +0 -633
  122. package/lib/sodium.js +0 -28
  123. package/lib/utils/store-buddy.js +0 -69
  124. package/lib/utils/time.js +0 -22
  125. package/lib/utils.js +0 -188
  126. package/lib/worker/__mock__/sodium.worker.d.ts +0 -19
  127. package/lib/worker/__mock__/sodium.worker.js +0 -57
  128. package/lib/worker/md5.js +0 -43
  129. package/lib/worker/sodium.js +0 -155
  130. package/lib/worker/workerCodes.js +0 -3
  131. package/lib/zeus/const.js +0 -1671
  132. package/lib/zeus/index.d.ts +0 -33302
  133. package/lib/zeus/index.js +0 -558
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Anonymize
3
+ Copyright (c) 2023 Anonymize
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1 +1 @@
1
- # Anonymize Secrecy Library 📚
1
+ # Anonymize Secrecy Library 📚🔐
@@ -0,0 +1,111 @@
1
+ import type { DownloadProgress as DLProgress } from "ky";
2
+ import type { SecrecyEnv } from "./client/helpers.js";
3
+ import type { GraphQLTypes, Lang, Thunder, UserRole } from "./zeus/index.js";
4
+ import { InfuraNetwork } from "./zeus/index.js";
5
+ import type { ErrorAccessDenied, ErrorLimit, ErrorNotFound, ErrorNotExist } from "./error.js";
6
+ export type SuccessResponse<T> = {
7
+ __typename: "SuccessResponse";
8
+ data: T;
9
+ };
10
+ export type DownloadProgress = DLProgress;
11
+ export type SendReport = {
12
+ id: string;
13
+ user: {
14
+ id: string;
15
+ firstname: string;
16
+ lastname: string;
17
+ email: string;
18
+ };
19
+ reportedUser: {
20
+ id: string;
21
+ firstname: string;
22
+ lastname: string;
23
+ email: string;
24
+ };
25
+ customMessage?: string | undefined;
26
+ };
27
+ export type UserData<T extends Record<string, unknown> = Record<string, unknown>> = {
28
+ isSuperuser: boolean;
29
+ isSearchable: boolean;
30
+ } & T;
31
+ export type UserBase = {
32
+ email: string;
33
+ phone: string;
34
+ lastname: string;
35
+ role: UserRole;
36
+ firstname: string;
37
+ id: string;
38
+ deletedAt?: Date;
39
+ lastLogin: Date;
40
+ lang: Lang;
41
+ };
42
+ type WithPublicKey = {
43
+ withPublicKey?: boolean;
44
+ };
45
+ export type User<T extends WithPublicKey = WithPublicKey> = T extends {
46
+ withPublicKey: true;
47
+ } ? UserBase & {
48
+ publicKey: string;
49
+ } : UserBase;
50
+ type ClassGetUserParams = WithPublicKey & {
51
+ userId?: string;
52
+ userEmail?: string;
53
+ };
54
+ type StaticGetUserParams = ClassGetUserParams & {
55
+ env: SecrecyEnv;
56
+ };
57
+ export type CloudLimits = {
58
+ count: bigint;
59
+ maxCount?: bigint | undefined;
60
+ size: bigint;
61
+ maxSize?: bigint | undefined;
62
+ };
63
+ export type MailLimitsValues = {
64
+ count: bigint;
65
+ maxCount?: bigint | undefined;
66
+ fileSize: bigint;
67
+ maxFileSize?: bigint | undefined;
68
+ fileCount: bigint;
69
+ maxFileCount?: bigint | undefined;
70
+ };
71
+ export type QueryLimits = {
72
+ cloud: CloudLimits;
73
+ mail: {
74
+ sent: MailLimitsValues;
75
+ received: MailLimitsValues;
76
+ };
77
+ };
78
+ export declare class BaseClient {
79
+ static readonly getBaseUrl: (env?: SecrecyEnv, graphcdn?: boolean) => string;
80
+ static readonly getBaseClient: (env: SecrecyEnv, session?: string | null | undefined) => ReturnType<typeof Thunder>;
81
+ protected thunder: ReturnType<typeof Thunder>;
82
+ sessionId: string;
83
+ constructor(session: string, env: SecrecyEnv);
84
+ logout(sessionId?: string | null | undefined): Promise<void>;
85
+ me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
86
+ static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
87
+ user<T extends ClassGetUserParams>(params: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
88
+ updateProfile({ firstname, lastname, lang }: {
89
+ firstname: string | null;
90
+ lastname: string | null;
91
+ lang: Lang | null;
92
+ }): Promise<SuccessResponse<User> | ErrorNotFound | ErrorAccessDenied | null>;
93
+ static isCryptoTransactionDone({ env, idOrHash, network }: {
94
+ env: SecrecyEnv;
95
+ idOrHash: string;
96
+ network?: InfuraNetwork;
97
+ }): Promise<boolean>;
98
+ limits(): Promise<SuccessResponse<QueryLimits> | ErrorAccessDenied | ErrorNotExist | ErrorLimit | ErrorNotFound | null>;
99
+ reportUser(reportedUserId: string, customMessage?: string): Promise<SuccessResponse<SendReport> | ErrorAccessDenied | ErrorNotFound | null>;
100
+ getSponsorshipLink({ backUrl }: {
101
+ backUrl: string;
102
+ }): Promise<string | null>;
103
+ static getPaymentRequest: ({ env, paymentRequestId, secrecyIdSeller, secrecyId, appCode }: {
104
+ env: SecrecyEnv;
105
+ paymentRequestId: string;
106
+ secrecyIdSeller: string;
107
+ secrecyId?: string | undefined;
108
+ appCode?: string | undefined;
109
+ }) => Promise<SuccessResponse<GraphQLTypes["GetPaymentRequestToPay"]> | ErrorAccessDenied | ErrorNotFound>;
110
+ }
111
+ export {};