internxt-crypto 1.6.0 → 1.6.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/asymmetric-crypto.d.mts.map +1 -1
- package/dist/asymmetric-crypto.d.ts.map +1 -1
- package/dist/asymmetric-crypto.js +12 -2
- package/dist/asymmetric-crypto.js.map +1 -1
- package/dist/asymmetric-crypto.mjs +12 -2
- package/dist/asymmetric-crypto.mjs.map +1 -1
- package/dist/{email-crypto-v_-nFOl2.mjs → email-crypto-CoRbTphp.mjs} +54 -43
- package/dist/email-crypto-CoRbTphp.mjs.map +1 -0
- package/dist/{email-crypto-CLlLUgA6.js → email-crypto-DJb-I1wm.js} +71 -42
- package/dist/email-crypto-DJb-I1wm.js.map +1 -0
- package/dist/email-crypto.d.mts +17 -1
- package/dist/email-crypto.d.mts.map +1 -1
- package/dist/email-crypto.d.ts +17 -1
- package/dist/email-crypto.d.ts.map +1 -1
- package/dist/email-crypto.js +4 -1
- package/dist/email-crypto.mjs +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/dist/index.mjs +2 -2
- package/dist/react-native/asymmetric-crypto.d.mts +21 -0
- package/dist/react-native/asymmetric-crypto.d.mts.map +1 -0
- package/dist/react-native/asymmetric-crypto.d.ts +21 -0
- package/dist/react-native/asymmetric-crypto.d.ts.map +1 -0
- package/dist/react-native/asymmetric-crypto.js +31 -0
- package/dist/react-native/asymmetric-crypto.js.map +1 -0
- package/dist/react-native/asymmetric-crypto.mjs +28 -0
- package/dist/react-native/asymmetric-crypto.mjs.map +1 -0
- package/dist/react-native/chunk-CfYAbeIz.mjs +13 -0
- package/dist/react-native/chunk-DskHE4z1.js +43 -0
- package/dist/react-native/constants.d.mts +27 -0
- package/dist/react-native/constants.d.mts.map +1 -0
- package/dist/react-native/constants.d.ts +27 -0
- package/dist/react-native/constants.d.ts.map +1 -0
- package/dist/react-native/constants.js +51 -0
- package/dist/react-native/constants.js.map +1 -0
- package/dist/react-native/constants.mjs +28 -0
- package/dist/react-native/constants.mjs.map +1 -0
- package/dist/react-native/derive-key.d.mts +32 -0
- package/dist/react-native/derive-key.d.mts.map +1 -0
- package/dist/react-native/derive-key.d.ts +32 -0
- package/dist/react-native/derive-key.d.ts.map +1 -0
- package/dist/react-native/derive-key.js +51 -0
- package/dist/react-native/derive-key.js.map +1 -0
- package/dist/react-native/derive-key.mjs +47 -0
- package/dist/react-native/derive-key.mjs.map +1 -0
- package/dist/react-native/derive-password-Bb3R3nyh.mjs +68 -0
- package/dist/react-native/derive-password-Bb3R3nyh.mjs.map +1 -0
- package/dist/react-native/derive-password-DIPrE8Mz.js +86 -0
- package/dist/react-native/derive-password-DIPrE8Mz.js.map +1 -0
- package/dist/react-native/derive-password.d.mts +28 -0
- package/dist/react-native/derive-password.d.mts.map +1 -0
- package/dist/react-native/derive-password.d.ts +28 -0
- package/dist/react-native/derive-password.d.ts.map +1 -0
- package/dist/react-native/derive-password.js +5 -0
- package/dist/react-native/derive-password.mjs +2 -0
- package/dist/react-native/email-crypto-C3ka3aAj.js +700 -0
- package/dist/react-native/email-crypto-C3ka3aAj.js.map +1 -0
- package/dist/react-native/email-crypto-CDM4iPK8.mjs +490 -0
- package/dist/react-native/email-crypto-CDM4iPK8.mjs.map +1 -0
- package/dist/react-native/email-crypto.d.mts +253 -0
- package/dist/react-native/email-crypto.d.mts.map +1 -0
- package/dist/react-native/email-crypto.d.ts +253 -0
- package/dist/react-native/email-crypto.d.ts.map +1 -0
- package/dist/react-native/email-crypto.js +35 -0
- package/dist/react-native/email-crypto.mjs +2 -0
- package/dist/react-native/hash.d.mts +50 -0
- package/dist/react-native/hash.d.mts.map +1 -0
- package/dist/react-native/hash.d.ts +50 -0
- package/dist/react-native/hash.d.ts.map +1 -0
- package/dist/react-native/hash.js +89 -0
- package/dist/react-native/hash.js.map +1 -0
- package/dist/react-native/hash.mjs +82 -0
- package/dist/react-native/hash.mjs.map +1 -0
- package/dist/react-native/index.d.mts +32 -0
- package/dist/react-native/index.d.mts.map +1 -0
- package/dist/react-native/index.d.ts +32 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +106 -0
- package/dist/react-native/index.mjs +12 -0
- package/dist/react-native/keystore-crypto-BXPEVvzq.js +238 -0
- package/dist/react-native/keystore-crypto-BXPEVvzq.js.map +1 -0
- package/dist/react-native/keystore-crypto-C6F-NQdX.mjs +185 -0
- package/dist/react-native/keystore-crypto-C6F-NQdX.mjs.map +1 -0
- package/dist/react-native/keystore-crypto.d.mts +71 -0
- package/dist/react-native/keystore-crypto.d.mts.map +1 -0
- package/dist/react-native/keystore-crypto.d.ts +71 -0
- package/dist/react-native/keystore-crypto.d.ts.map +1 -0
- package/dist/react-native/keystore-crypto.js +11 -0
- package/dist/react-native/keystore-crypto.mjs +2 -0
- package/dist/react-native/post-quantum-crypto.d.mts +32 -0
- package/dist/react-native/post-quantum-crypto.d.mts.map +1 -0
- package/dist/react-native/post-quantum-crypto.d.ts +32 -0
- package/dist/react-native/post-quantum-crypto.d.ts.map +1 -0
- package/dist/react-native/post-quantum-crypto.js +50 -0
- package/dist/react-native/post-quantum-crypto.js.map +1 -0
- package/dist/react-native/post-quantum-crypto.mjs +46 -0
- package/dist/react-native/post-quantum-crypto.mjs.map +1 -0
- package/dist/react-native/storage-service.d.mts +47 -0
- package/dist/react-native/storage-service.d.mts.map +1 -0
- package/dist/react-native/storage-service.d.ts +47 -0
- package/dist/react-native/storage-service.d.ts.map +1 -0
- package/dist/react-native/storage-service.js +66 -0
- package/dist/react-native/storage-service.js.map +1 -0
- package/dist/react-native/storage-service.mjs +54 -0
- package/dist/react-native/storage-service.mjs.map +1 -0
- package/dist/react-native/symmetric-crypto.d.mts +28 -0
- package/dist/react-native/symmetric-crypto.d.mts.map +1 -0
- package/dist/react-native/symmetric-crypto.d.ts +28 -0
- package/dist/react-native/symmetric-crypto.d.ts.map +1 -0
- package/dist/react-native/symmetric-crypto.js +52 -0
- package/dist/react-native/symmetric-crypto.js.map +1 -0
- package/dist/react-native/symmetric-crypto.mjs +48 -0
- package/dist/react-native/symmetric-crypto.mjs.map +1 -0
- package/dist/react-native/types-D1R4_m5r.d.mts +55 -0
- package/dist/react-native/types-D1R4_m5r.d.mts.map +1 -0
- package/dist/react-native/types-Y0wL7HUH.d.ts +55 -0
- package/dist/react-native/types-Y0wL7HUH.d.ts.map +1 -0
- package/dist/react-native/types.d.mts +2 -0
- package/dist/react-native/types.d.ts +2 -0
- package/dist/react-native/types.js +11 -0
- package/dist/react-native/types.js.map +1 -0
- package/dist/react-native/types.mjs +10 -0
- package/dist/react-native/types.mjs.map +1 -0
- package/dist/react-native/utils.d.mts +78 -0
- package/dist/react-native/utils.d.mts.map +1 -0
- package/dist/react-native/utils.d.ts +78 -0
- package/dist/react-native/utils.d.ts.map +1 -0
- package/dist/react-native/utils.js +123 -0
- package/dist/react-native/utils.js.map +1 -0
- package/dist/react-native/utils.mjs +109 -0
- package/dist/react-native/utils.mjs.map +1 -0
- package/dist/react-native/xwing-B34h5e3Z.mjs +15 -0
- package/dist/react-native/xwing-B34h5e3Z.mjs.map +1 -0
- package/dist/react-native/xwing-CSdiyHAt.js +33 -0
- package/dist/react-native/xwing-CSdiyHAt.js.map +1 -0
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +3 -8
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +3 -8
- package/dist/utils.mjs.map +1 -1
- package/package.json +4 -1
- package/dist/email-crypto-CLlLUgA6.js.map +0 -1
- package/dist/email-crypto-v_-nFOl2.mjs.map +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type EncryptedKeystore = {
|
|
3
|
+
userEmail: string;
|
|
4
|
+
type: KeystoreType;
|
|
5
|
+
publicKey: string;
|
|
6
|
+
privateKeyEncrypted: string;
|
|
7
|
+
};
|
|
8
|
+
type RecipientWithPublicKey = {
|
|
9
|
+
email: string;
|
|
10
|
+
publicHybridKey: Uint8Array;
|
|
11
|
+
};
|
|
12
|
+
type HybridKeyPair = {
|
|
13
|
+
publicKey: Uint8Array;
|
|
14
|
+
secretKey: Uint8Array;
|
|
15
|
+
};
|
|
16
|
+
type PwdProtectedEmail = {
|
|
17
|
+
encryptedKey: PwdProtectedKey;
|
|
18
|
+
encEmail: EmailEncrypted;
|
|
19
|
+
};
|
|
20
|
+
type PwdProtectedEmailAndSubject = {
|
|
21
|
+
encryptedKey: PwdProtectedKey;
|
|
22
|
+
encEmail: EmailAndSubjectEncrypted;
|
|
23
|
+
};
|
|
24
|
+
type HybridEncKey = {
|
|
25
|
+
hybridCiphertext: string;
|
|
26
|
+
encryptedKey: string;
|
|
27
|
+
encryptedForEmail: string;
|
|
28
|
+
};
|
|
29
|
+
type PwdProtectedKey = {
|
|
30
|
+
encryptedKey: string;
|
|
31
|
+
salt: string;
|
|
32
|
+
};
|
|
33
|
+
type EmailEncrypted = {
|
|
34
|
+
encText: string;
|
|
35
|
+
encPreview: string;
|
|
36
|
+
encAttachmentsSessionKey: string;
|
|
37
|
+
};
|
|
38
|
+
type EmailAndSubjectEncrypted = EmailEncrypted & {
|
|
39
|
+
encSubject: string;
|
|
40
|
+
};
|
|
41
|
+
type Email = {
|
|
42
|
+
text: string;
|
|
43
|
+
preview: string;
|
|
44
|
+
attachmentsSessionKey: Uint8Array;
|
|
45
|
+
};
|
|
46
|
+
type EmailAndSubject = Email & {
|
|
47
|
+
subject: string;
|
|
48
|
+
};
|
|
49
|
+
declare enum KeystoreType {
|
|
50
|
+
ENCRYPTION = "Encryption",
|
|
51
|
+
RECOVERY = "Recovery"
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { EncryptedKeystore as a, KeystoreType as c, PwdProtectedKey as d, RecipientWithPublicKey as f, EmailEncrypted as i, PwdProtectedEmail as l, EmailAndSubject as n, HybridEncKey as o, EmailAndSubjectEncrypted as r, HybridKeyPair as s, Email as t, PwdProtectedEmailAndSubject as u };
|
|
55
|
+
//# sourceMappingURL=types-D1R4_m5r.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-D1R4_m5r.d.mts","names":[],"sources":["../../src/types.ts"],"mappings":";KAAY,iBAAA;EACV,SAAA;EACA,IAAA,EAAM,YAAA;EACN,SAAA;EACA,mBAAA;AAAA;AAAA,KAGU,sBAAA;EACV,KAAA;EACA,eAAA,EAAiB,UAAA;AAAA;AAAA,KAGP,aAAA;EACV,SAAA,EAAW,UAAA;EACX,SAAA,EAAW,UAAA;AAAA;AAAA,KAGD,iBAAA;EACV,YAAA,EAAc,eAAA;EACd,QAAA,EAAU,cAAA;AAAA;AAAA,KAGA,2BAAA;EACV,YAAA,EAAc,eAAA;EACd,QAAA,EAAU,wBAAA;AAAA;AAAA,KAGA,YAAA;EACV,gBAAA;EACA,YAAA;EACA,iBAAA;AAAA;AAAA,KAGU,eAAA;EACV,YAAA;EACA,IAAA;AAAA;AAAA,KAGU,cAAA;EACV,OAAA;EACA,UAAA;EACA,wBAAA;AAAA;AAAA,KAGU,wBAAA,GAA2B,cAAA;EACrC,UAAA;AAAA;AAAA,KAGU,KAAA;EACV,IAAA;EACA,OAAA;EACA,qBAAA,EAAuB,UAAA;AAAA;AAAA,KAGb,eAAA,GAAkB,KAAA;EAC5B,OAAA;AAAA;AAAA,aAGU,YAAA;EACV,UAAA;EACA,QAAA;AAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type EncryptedKeystore = {
|
|
3
|
+
userEmail: string;
|
|
4
|
+
type: KeystoreType;
|
|
5
|
+
publicKey: string;
|
|
6
|
+
privateKeyEncrypted: string;
|
|
7
|
+
};
|
|
8
|
+
type RecipientWithPublicKey = {
|
|
9
|
+
email: string;
|
|
10
|
+
publicHybridKey: Uint8Array;
|
|
11
|
+
};
|
|
12
|
+
type HybridKeyPair = {
|
|
13
|
+
publicKey: Uint8Array;
|
|
14
|
+
secretKey: Uint8Array;
|
|
15
|
+
};
|
|
16
|
+
type PwdProtectedEmail = {
|
|
17
|
+
encryptedKey: PwdProtectedKey;
|
|
18
|
+
encEmail: EmailEncrypted;
|
|
19
|
+
};
|
|
20
|
+
type PwdProtectedEmailAndSubject = {
|
|
21
|
+
encryptedKey: PwdProtectedKey;
|
|
22
|
+
encEmail: EmailAndSubjectEncrypted;
|
|
23
|
+
};
|
|
24
|
+
type HybridEncKey = {
|
|
25
|
+
hybridCiphertext: string;
|
|
26
|
+
encryptedKey: string;
|
|
27
|
+
encryptedForEmail: string;
|
|
28
|
+
};
|
|
29
|
+
type PwdProtectedKey = {
|
|
30
|
+
encryptedKey: string;
|
|
31
|
+
salt: string;
|
|
32
|
+
};
|
|
33
|
+
type EmailEncrypted = {
|
|
34
|
+
encText: string;
|
|
35
|
+
encPreview: string;
|
|
36
|
+
encAttachmentsSessionKey: string;
|
|
37
|
+
};
|
|
38
|
+
type EmailAndSubjectEncrypted = EmailEncrypted & {
|
|
39
|
+
encSubject: string;
|
|
40
|
+
};
|
|
41
|
+
type Email = {
|
|
42
|
+
text: string;
|
|
43
|
+
preview: string;
|
|
44
|
+
attachmentsSessionKey: Uint8Array;
|
|
45
|
+
};
|
|
46
|
+
type EmailAndSubject = Email & {
|
|
47
|
+
subject: string;
|
|
48
|
+
};
|
|
49
|
+
declare enum KeystoreType {
|
|
50
|
+
ENCRYPTION = "Encryption",
|
|
51
|
+
RECOVERY = "Recovery"
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { EncryptedKeystore as a, KeystoreType as c, PwdProtectedKey as d, RecipientWithPublicKey as f, EmailEncrypted as i, PwdProtectedEmail as l, EmailAndSubject as n, HybridEncKey as o, EmailAndSubjectEncrypted as r, HybridKeyPair as s, Email as t, PwdProtectedEmailAndSubject as u };
|
|
55
|
+
//# sourceMappingURL=types-Y0wL7HUH.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-Y0wL7HUH.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";KAAY,iBAAA;EACV,SAAA;EACA,IAAA,EAAM,YAAA;EACN,SAAA;EACA,mBAAA;AAAA;AAAA,KAGU,sBAAA;EACV,KAAA;EACA,eAAA,EAAiB,UAAA;AAAA;AAAA,KAGP,aAAA;EACV,SAAA,EAAW,UAAA;EACX,SAAA,EAAW,UAAA;AAAA;AAAA,KAGD,iBAAA;EACV,YAAA,EAAc,eAAA;EACd,QAAA,EAAU,cAAA;AAAA;AAAA,KAGA,2BAAA;EACV,YAAA,EAAc,eAAA;EACd,QAAA,EAAU,wBAAA;AAAA;AAAA,KAGA,YAAA;EACV,gBAAA;EACA,YAAA;EACA,iBAAA;AAAA;AAAA,KAGU,eAAA;EACV,YAAA;EACA,IAAA;AAAA;AAAA,KAGU,cAAA;EACV,OAAA;EACA,UAAA;EACA,wBAAA;AAAA;AAAA,KAGU,wBAAA,GAA2B,cAAA;EACrC,UAAA;AAAA;AAAA,KAGU,KAAA;EACV,IAAA;EACA,OAAA;EACA,qBAAA,EAAuB,UAAA;AAAA;AAAA,KAGb,eAAA,GAAkB,KAAA;EAC5B,OAAA;AAAA;AAAA,aAGU,YAAA;EACV,UAAA;EACA,QAAA;AAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as EncryptedKeystore, c as KeystoreType, d as PwdProtectedKey, f as RecipientWithPublicKey, i as EmailEncrypted, l as PwdProtectedEmail, n as EmailAndSubject, o as HybridEncKey, r as EmailAndSubjectEncrypted, s as HybridKeyPair, t as Email, u as PwdProtectedEmailAndSubject } from "./types-D1R4_m5r.mjs";
|
|
2
|
+
export { Email, EmailAndSubject, EmailAndSubjectEncrypted, EmailEncrypted, EncryptedKeystore, HybridEncKey, HybridKeyPair, KeystoreType, PwdProtectedEmail, PwdProtectedEmailAndSubject, PwdProtectedKey, RecipientWithPublicKey };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as EncryptedKeystore, c as KeystoreType, d as PwdProtectedKey, f as RecipientWithPublicKey, i as EmailEncrypted, l as PwdProtectedEmail, n as EmailAndSubject, o as HybridEncKey, r as EmailAndSubjectEncrypted, s as HybridKeyPair, t as Email, u as PwdProtectedEmailAndSubject } from "./types-Y0wL7HUH.js";
|
|
2
|
+
export { Email, EmailAndSubject, EmailAndSubjectEncrypted, EmailEncrypted, EncryptedKeystore, HybridEncKey, HybridKeyPair, KeystoreType, PwdProtectedEmail, PwdProtectedEmailAndSubject, PwdProtectedKey, RecipientWithPublicKey };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/types.ts
|
|
3
|
+
let KeystoreType = /* @__PURE__ */ function(KeystoreType) {
|
|
4
|
+
KeystoreType["ENCRYPTION"] = "Encryption";
|
|
5
|
+
KeystoreType["RECOVERY"] = "Recovery";
|
|
6
|
+
return KeystoreType;
|
|
7
|
+
}({});
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.KeystoreType = KeystoreType;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["export type EncryptedKeystore = {\n userEmail: string;\n type: KeystoreType;\n publicKey: string;\n privateKeyEncrypted: string;\n};\n\nexport type RecipientWithPublicKey = {\n email: string;\n publicHybridKey: Uint8Array;\n};\n\nexport type HybridKeyPair = {\n publicKey: Uint8Array;\n secretKey: Uint8Array;\n};\n\nexport type PwdProtectedEmail = {\n encryptedKey: PwdProtectedKey;\n encEmail: EmailEncrypted;\n};\n\nexport type PwdProtectedEmailAndSubject = {\n encryptedKey: PwdProtectedKey;\n encEmail: EmailAndSubjectEncrypted;\n};\n\nexport type HybridEncKey = {\n hybridCiphertext: string;\n encryptedKey: string;\n encryptedForEmail: string;\n};\n\nexport type PwdProtectedKey = {\n encryptedKey: string;\n salt: string;\n};\n\nexport type EmailEncrypted = {\n encText: string;\n encPreview: string;\n encAttachmentsSessionKey: string;\n};\n\nexport type EmailAndSubjectEncrypted = EmailEncrypted & {\n encSubject: string;\n};\n\nexport type Email = {\n text: string;\n preview: string;\n attachmentsSessionKey: Uint8Array;\n};\n\nexport type EmailAndSubject = Email & {\n subject: string;\n};\n\nexport enum KeystoreType {\n ENCRYPTION = 'Encryption',\n RECOVERY = 'Recovery',\n}\n"],"mappings":";;AA0DA,IAAY,eAAL,yBAAA,cAAA;AACL,cAAA,gBAAA;AACA,cAAA,cAAA;;KACD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/types.ts
|
|
2
|
+
let KeystoreType = /* @__PURE__ */ function(KeystoreType) {
|
|
3
|
+
KeystoreType["ENCRYPTION"] = "Encryption";
|
|
4
|
+
KeystoreType["RECOVERY"] = "Recovery";
|
|
5
|
+
return KeystoreType;
|
|
6
|
+
}({});
|
|
7
|
+
//#endregion
|
|
8
|
+
export { KeystoreType };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../src/types.ts"],"sourcesContent":["export type EncryptedKeystore = {\n userEmail: string;\n type: KeystoreType;\n publicKey: string;\n privateKeyEncrypted: string;\n};\n\nexport type RecipientWithPublicKey = {\n email: string;\n publicHybridKey: Uint8Array;\n};\n\nexport type HybridKeyPair = {\n publicKey: Uint8Array;\n secretKey: Uint8Array;\n};\n\nexport type PwdProtectedEmail = {\n encryptedKey: PwdProtectedKey;\n encEmail: EmailEncrypted;\n};\n\nexport type PwdProtectedEmailAndSubject = {\n encryptedKey: PwdProtectedKey;\n encEmail: EmailAndSubjectEncrypted;\n};\n\nexport type HybridEncKey = {\n hybridCiphertext: string;\n encryptedKey: string;\n encryptedForEmail: string;\n};\n\nexport type PwdProtectedKey = {\n encryptedKey: string;\n salt: string;\n};\n\nexport type EmailEncrypted = {\n encText: string;\n encPreview: string;\n encAttachmentsSessionKey: string;\n};\n\nexport type EmailAndSubjectEncrypted = EmailEncrypted & {\n encSubject: string;\n};\n\nexport type Email = {\n text: string;\n preview: string;\n attachmentsSessionKey: Uint8Array;\n};\n\nexport type EmailAndSubject = Email & {\n subject: string;\n};\n\nexport enum KeystoreType {\n ENCRYPTION = 'Encryption',\n RECOVERY = 'Recovery',\n}\n"],"mappings":";AA0DA,IAAY,eAAL,yBAAA,cAAA;AACL,cAAA,gBAAA;AACA,cAAA,cAAA;;KACD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/utils/converters.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a Uint8Array into a hexadecimal string.
|
|
4
|
+
*
|
|
5
|
+
* @param array - The Uint8Array to convert.
|
|
6
|
+
* @returns The hexadecimal string representation of the array.
|
|
7
|
+
*/
|
|
8
|
+
declare function uint8ArrayToHex(array: Uint8Array): string;
|
|
9
|
+
/**
|
|
10
|
+
* Converts a UTF-8 string into a Uint8Array.
|
|
11
|
+
*
|
|
12
|
+
* @param str - The UTF-8 string to convert.
|
|
13
|
+
* @returns A Uint8Array created from the UTF-8 string.
|
|
14
|
+
*/
|
|
15
|
+
declare function UTF8ToUint8(str: string): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Converts an Uint8Array into a UTF-8 string.
|
|
18
|
+
*
|
|
19
|
+
* @param array - The Uint8Array to convert.
|
|
20
|
+
* @returns The UTF-8 string representation of the array.
|
|
21
|
+
*/
|
|
22
|
+
declare function uint8ToUTF8(array: Uint8Array): string;
|
|
23
|
+
/**
|
|
24
|
+
* Converts a hexadecimal string into a Uint8Array.
|
|
25
|
+
*
|
|
26
|
+
* @param hex - The hexadecimal string to convert.
|
|
27
|
+
* @returns A Uint8Array created from the hex string.
|
|
28
|
+
*/
|
|
29
|
+
declare function hexToUint8Array(hex: string): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Converts a Uint8Array into a base64 string.
|
|
32
|
+
*
|
|
33
|
+
* @param array - The Uint8Array to convert.
|
|
34
|
+
* @returns The base64 string representation of the array.
|
|
35
|
+
*/
|
|
36
|
+
declare function uint8ArrayToBase64(buffer: Uint8Array): string;
|
|
37
|
+
/**
|
|
38
|
+
* Converts a base64 string into a Uint8Array.
|
|
39
|
+
*
|
|
40
|
+
* @param str - The base64 string to convert.
|
|
41
|
+
* @returns A Uint8Array created from the base64 string.
|
|
42
|
+
*/
|
|
43
|
+
declare function base64ToUint8Array(str: string): Uint8Array;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/utils/genMnemonic.d.ts
|
|
46
|
+
/**
|
|
47
|
+
* Generates a mnemonic
|
|
48
|
+
*
|
|
49
|
+
* @returns The generated mnemonic.
|
|
50
|
+
*/
|
|
51
|
+
declare function genMnemonic(): string;
|
|
52
|
+
/**
|
|
53
|
+
* Converts a mnemonic to Uint8Array
|
|
54
|
+
*
|
|
55
|
+
* @param mnemonic - The mnemonic to convert
|
|
56
|
+
* @returns The mnemonic as Uint8Array
|
|
57
|
+
*/
|
|
58
|
+
declare function mnemonicToBytes(mnemonic: string): Uint8Array;
|
|
59
|
+
/**
|
|
60
|
+
* Converts a Uint8Array to a mnemonic
|
|
61
|
+
*
|
|
62
|
+
* @param bytes - The bytes to convert
|
|
63
|
+
* @returns The mnemonic string
|
|
64
|
+
*/
|
|
65
|
+
declare function bytesToMnemonic(bytes: Uint8Array): string;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/utils/genID.d.ts
|
|
68
|
+
/**
|
|
69
|
+
* Creates a random identifier.
|
|
70
|
+
*
|
|
71
|
+
* @returns The resulting auxilary string
|
|
72
|
+
*/
|
|
73
|
+
declare function generateUuid(): string;
|
|
74
|
+
declare function uuidToBytes(uuid: string): Uint8Array;
|
|
75
|
+
declare function bytesToUuid(bytes: Uint8Array): string;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { UTF8ToUint8, base64ToUint8Array, bytesToMnemonic, bytesToUuid, genMnemonic, generateUuid, hexToUint8Array, mnemonicToBytes, uint8ArrayToBase64, uint8ArrayToHex, uint8ToUTF8, uuidToBytes };
|
|
78
|
+
//# sourceMappingURL=utils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/utils/converters.ts","../../src/utils/genMnemonic.ts","../../src/utils/genID.ts"],"mappings":";;AASA;;;;;iBAAgB,eAAA,CAAgB,KAAA,EAAO,UAAA;;;;;AAoBvC;;iBAVgB,WAAA,CAAY,GAAA,WAAc,UAAA;;;AAoB1C;;;;iBAVgB,WAAA,CAAY,KAAA,EAAO,UAAA;AAoBnC;;;;;AAUA;AAVA,iBAVgB,eAAA,CAAgB,GAAA,WAAc,UAAA;;;;;;;iBAU9B,kBAAA,CAAmB,MAAA,EAAQ,UAAA;;;;;AC/B3C;;iBDyCgB,kBAAA,CAAmB,GAAA,WAAc,UAAA;;;;AAlDjD;;;;iBCDgB,WAAA,CAAA;ADWhB;;;;;AAUA;AAVA,iBCDgB,eAAA,CAAgB,QAAA,WAAmB,UAAA;;;;ADqBnD;;;iBCXgB,eAAA,CAAgB,KAAA,EAAO,UAAA;;;;ADnBvC;;;;iBEHgB,YAAA,CAAA;AAAA,iBAIA,WAAA,CAAY,IAAA,WAAe,UAAA;AAAA,iBAI3B,WAAA,CAAY,KAAA,EAAO,UAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/utils/converters.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a Uint8Array into a hexadecimal string.
|
|
4
|
+
*
|
|
5
|
+
* @param array - The Uint8Array to convert.
|
|
6
|
+
* @returns The hexadecimal string representation of the array.
|
|
7
|
+
*/
|
|
8
|
+
declare function uint8ArrayToHex(array: Uint8Array): string;
|
|
9
|
+
/**
|
|
10
|
+
* Converts a UTF-8 string into a Uint8Array.
|
|
11
|
+
*
|
|
12
|
+
* @param str - The UTF-8 string to convert.
|
|
13
|
+
* @returns A Uint8Array created from the UTF-8 string.
|
|
14
|
+
*/
|
|
15
|
+
declare function UTF8ToUint8(str: string): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Converts an Uint8Array into a UTF-8 string.
|
|
18
|
+
*
|
|
19
|
+
* @param array - The Uint8Array to convert.
|
|
20
|
+
* @returns The UTF-8 string representation of the array.
|
|
21
|
+
*/
|
|
22
|
+
declare function uint8ToUTF8(array: Uint8Array): string;
|
|
23
|
+
/**
|
|
24
|
+
* Converts a hexadecimal string into a Uint8Array.
|
|
25
|
+
*
|
|
26
|
+
* @param hex - The hexadecimal string to convert.
|
|
27
|
+
* @returns A Uint8Array created from the hex string.
|
|
28
|
+
*/
|
|
29
|
+
declare function hexToUint8Array(hex: string): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Converts a Uint8Array into a base64 string.
|
|
32
|
+
*
|
|
33
|
+
* @param array - The Uint8Array to convert.
|
|
34
|
+
* @returns The base64 string representation of the array.
|
|
35
|
+
*/
|
|
36
|
+
declare function uint8ArrayToBase64(buffer: Uint8Array): string;
|
|
37
|
+
/**
|
|
38
|
+
* Converts a base64 string into a Uint8Array.
|
|
39
|
+
*
|
|
40
|
+
* @param str - The base64 string to convert.
|
|
41
|
+
* @returns A Uint8Array created from the base64 string.
|
|
42
|
+
*/
|
|
43
|
+
declare function base64ToUint8Array(str: string): Uint8Array;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/utils/genMnemonic.d.ts
|
|
46
|
+
/**
|
|
47
|
+
* Generates a mnemonic
|
|
48
|
+
*
|
|
49
|
+
* @returns The generated mnemonic.
|
|
50
|
+
*/
|
|
51
|
+
declare function genMnemonic(): string;
|
|
52
|
+
/**
|
|
53
|
+
* Converts a mnemonic to Uint8Array
|
|
54
|
+
*
|
|
55
|
+
* @param mnemonic - The mnemonic to convert
|
|
56
|
+
* @returns The mnemonic as Uint8Array
|
|
57
|
+
*/
|
|
58
|
+
declare function mnemonicToBytes(mnemonic: string): Uint8Array;
|
|
59
|
+
/**
|
|
60
|
+
* Converts a Uint8Array to a mnemonic
|
|
61
|
+
*
|
|
62
|
+
* @param bytes - The bytes to convert
|
|
63
|
+
* @returns The mnemonic string
|
|
64
|
+
*/
|
|
65
|
+
declare function bytesToMnemonic(bytes: Uint8Array): string;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/utils/genID.d.ts
|
|
68
|
+
/**
|
|
69
|
+
* Creates a random identifier.
|
|
70
|
+
*
|
|
71
|
+
* @returns The resulting auxilary string
|
|
72
|
+
*/
|
|
73
|
+
declare function generateUuid(): string;
|
|
74
|
+
declare function uuidToBytes(uuid: string): Uint8Array;
|
|
75
|
+
declare function bytesToUuid(bytes: Uint8Array): string;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { UTF8ToUint8, base64ToUint8Array, bytesToMnemonic, bytesToUuid, genMnemonic, generateUuid, hexToUint8Array, mnemonicToBytes, uint8ArrayToBase64, uint8ArrayToHex, uint8ToUTF8, uuidToBytes };
|
|
78
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/utils/converters.ts","../../src/utils/genMnemonic.ts","../../src/utils/genID.ts"],"mappings":";;AASA;;;;;iBAAgB,eAAA,CAAgB,KAAA,EAAO,UAAA;;;;;AAoBvC;;iBAVgB,WAAA,CAAY,GAAA,WAAc,UAAA;;;AAoB1C;;;;iBAVgB,WAAA,CAAY,KAAA,EAAO,UAAA;AAoBnC;;;;;AAUA;AAVA,iBAVgB,eAAA,CAAgB,GAAA,WAAc,UAAA;;;;;;;iBAU9B,kBAAA,CAAmB,MAAA,EAAQ,UAAA;;;;;AC/B3C;;iBDyCgB,kBAAA,CAAmB,GAAA,WAAc,UAAA;;;;AAlDjD;;;;iBCDgB,WAAA,CAAA;ADWhB;;;;;AAUA;AAVA,iBCDgB,eAAA,CAAgB,QAAA,WAAmB,UAAA;;;;ADqBnD;;;iBCXgB,eAAA,CAAgB,KAAA,EAAO,UAAA;;;;ADnBvC;;;;iBEHgB,YAAA,CAAA;AAAA,iBAIA,WAAA,CAAY,IAAA,WAAe,UAAA;AAAA,iBAI3B,WAAA,CAAY,KAAA,EAAO,UAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk-DskHE4z1.js");
|
|
3
|
+
require("./constants.js");
|
|
4
|
+
let _noble_hashes_utils_js = require("@noble/hashes/utils.js");
|
|
5
|
+
let base64_js = require("base64-js");
|
|
6
|
+
let _scure_bip39 = require("@scure/bip39");
|
|
7
|
+
_scure_bip39 = require_chunk.__toESM(_scure_bip39);
|
|
8
|
+
let _scure_bip39_wordlists_english_js = require("@scure/bip39/wordlists/english.js");
|
|
9
|
+
let uuid = require("uuid");
|
|
10
|
+
//#region src/utils/converters.ts
|
|
11
|
+
/**
|
|
12
|
+
* Converts a Uint8Array into a hexadecimal string.
|
|
13
|
+
*
|
|
14
|
+
* @param array - The Uint8Array to convert.
|
|
15
|
+
* @returns The hexadecimal string representation of the array.
|
|
16
|
+
*/
|
|
17
|
+
function uint8ArrayToHex(array) {
|
|
18
|
+
return (0, _noble_hashes_utils_js.bytesToHex)(array);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Converts a UTF-8 string into a Uint8Array.
|
|
22
|
+
*
|
|
23
|
+
* @param str - The UTF-8 string to convert.
|
|
24
|
+
* @returns A Uint8Array created from the UTF-8 string.
|
|
25
|
+
*/
|
|
26
|
+
function UTF8ToUint8(str) {
|
|
27
|
+
return new TextEncoder().encode(str);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Converts an Uint8Array into a UTF-8 string.
|
|
31
|
+
*
|
|
32
|
+
* @param array - The Uint8Array to convert.
|
|
33
|
+
* @returns The UTF-8 string representation of the array.
|
|
34
|
+
*/
|
|
35
|
+
function uint8ToUTF8(array) {
|
|
36
|
+
return new TextDecoder().decode(array);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Converts a hexadecimal string into a Uint8Array.
|
|
40
|
+
*
|
|
41
|
+
* @param hex - The hexadecimal string to convert.
|
|
42
|
+
* @returns A Uint8Array created from the hex string.
|
|
43
|
+
*/
|
|
44
|
+
function hexToUint8Array(hex) {
|
|
45
|
+
return (0, _noble_hashes_utils_js.hexToBytes)(hex);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Converts a Uint8Array into a base64 string.
|
|
49
|
+
*
|
|
50
|
+
* @param array - The Uint8Array to convert.
|
|
51
|
+
* @returns The base64 string representation of the array.
|
|
52
|
+
*/
|
|
53
|
+
function uint8ArrayToBase64(buffer) {
|
|
54
|
+
return (0, base64_js.fromByteArray)(buffer);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Converts a base64 string into a Uint8Array.
|
|
58
|
+
*
|
|
59
|
+
* @param str - The base64 string to convert.
|
|
60
|
+
* @returns A Uint8Array created from the base64 string.
|
|
61
|
+
*/
|
|
62
|
+
function base64ToUint8Array(str) {
|
|
63
|
+
return (0, base64_js.toByteArray)(str);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/utils/genMnemonic.ts
|
|
67
|
+
/**
|
|
68
|
+
* Generates a mnemonic
|
|
69
|
+
*
|
|
70
|
+
* @returns The generated mnemonic.
|
|
71
|
+
*/
|
|
72
|
+
function genMnemonic() {
|
|
73
|
+
return _scure_bip39.generateMnemonic(_scure_bip39_wordlists_english_js.wordlist, 256);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Converts a mnemonic to Uint8Array
|
|
77
|
+
*
|
|
78
|
+
* @param mnemonic - The mnemonic to convert
|
|
79
|
+
* @returns The mnemonic as Uint8Array
|
|
80
|
+
*/
|
|
81
|
+
function mnemonicToBytes(mnemonic) {
|
|
82
|
+
return _scure_bip39.mnemonicToEntropy(mnemonic, _scure_bip39_wordlists_english_js.wordlist);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Converts a Uint8Array to a mnemonic
|
|
86
|
+
*
|
|
87
|
+
* @param bytes - The bytes to convert
|
|
88
|
+
* @returns The mnemonic string
|
|
89
|
+
*/
|
|
90
|
+
function bytesToMnemonic(bytes) {
|
|
91
|
+
return _scure_bip39.entropyToMnemonic(bytes, _scure_bip39_wordlists_english_js.wordlist);
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/utils/genID.ts
|
|
95
|
+
/**
|
|
96
|
+
* Creates a random identifier.
|
|
97
|
+
*
|
|
98
|
+
* @returns The resulting auxilary string
|
|
99
|
+
*/
|
|
100
|
+
function generateUuid() {
|
|
101
|
+
return (0, uuid.v4)();
|
|
102
|
+
}
|
|
103
|
+
function uuidToBytes(uuid$1) {
|
|
104
|
+
return (0, uuid.parse)(uuid$1);
|
|
105
|
+
}
|
|
106
|
+
function bytesToUuid(bytes) {
|
|
107
|
+
return (0, uuid.stringify)(bytes);
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
exports.UTF8ToUint8 = UTF8ToUint8;
|
|
111
|
+
exports.base64ToUint8Array = base64ToUint8Array;
|
|
112
|
+
exports.bytesToMnemonic = bytesToMnemonic;
|
|
113
|
+
exports.bytesToUuid = bytesToUuid;
|
|
114
|
+
exports.genMnemonic = genMnemonic;
|
|
115
|
+
exports.generateUuid = generateUuid;
|
|
116
|
+
exports.hexToUint8Array = hexToUint8Array;
|
|
117
|
+
exports.mnemonicToBytes = mnemonicToBytes;
|
|
118
|
+
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
119
|
+
exports.uint8ArrayToHex = uint8ArrayToHex;
|
|
120
|
+
exports.uint8ToUTF8 = uint8ToUTF8;
|
|
121
|
+
exports.uuidToBytes = uuidToBytes;
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["bip39","wordlist","uuid"],"sources":["../../src/utils/converters.ts","../../src/utils/genMnemonic.ts","../../src/utils/genID.ts"],"sourcesContent":["import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js';\nimport { fromByteArray, toByteArray } from 'base64-js';\n\n/**\n * Converts a Uint8Array into a hexadecimal string.\n *\n * @param array - The Uint8Array to convert.\n * @returns The hexadecimal string representation of the array.\n */\nexport function uint8ArrayToHex(array: Uint8Array): string {\n return bytesToHex(array);\n}\n\n/**\n * Converts a UTF-8 string into a Uint8Array.\n *\n * @param str - The UTF-8 string to convert.\n * @returns A Uint8Array created from the UTF-8 string.\n */\nexport function UTF8ToUint8(str: string): Uint8Array {\n return new TextEncoder().encode(str);\n}\n\n/**\n * Converts an Uint8Array into a UTF-8 string.\n *\n * @param array - The Uint8Array to convert.\n * @returns The UTF-8 string representation of the array.\n */\nexport function uint8ToUTF8(array: Uint8Array): string {\n return new TextDecoder().decode(array);\n}\n\n/**\n * Converts a hexadecimal string into a Uint8Array.\n *\n * @param hex - The hexadecimal string to convert.\n * @returns A Uint8Array created from the hex string.\n */\nexport function hexToUint8Array(hex: string): Uint8Array {\n return hexToBytes(hex);\n}\n\n/**\n * Converts a Uint8Array into a base64 string.\n *\n * @param array - The Uint8Array to convert.\n * @returns The base64 string representation of the array.\n */\nexport function uint8ArrayToBase64(buffer: Uint8Array): string {\n return fromByteArray(buffer);\n}\n\n/**\n * Converts a base64 string into a Uint8Array.\n *\n * @param str - The base64 string to convert.\n * @returns A Uint8Array created from the base64 string.\n */\nexport function base64ToUint8Array(str: string): Uint8Array {\n return toByteArray(str);\n}\n","import * as bip39 from '@scure/bip39';\nimport { wordlist } from '@scure/bip39/wordlists/english.js';\nimport { AES_KEY_BYTE_LENGTH } from '../constants';\n/**\n * Generates a mnemonic\n *\n * @returns The generated mnemonic.\n */\nexport function genMnemonic(): string {\n return bip39.generateMnemonic(wordlist, AES_KEY_BYTE_LENGTH * 8);\n}\n\n/**\n * Converts a mnemonic to Uint8Array\n *\n * @param mnemonic - The mnemonic to convert\n * @returns The mnemonic as Uint8Array\n */\nexport function mnemonicToBytes(mnemonic: string): Uint8Array {\n return bip39.mnemonicToEntropy(mnemonic, wordlist);\n}\n\n/**\n * Converts a Uint8Array to a mnemonic\n *\n * @param bytes - The bytes to convert\n * @returns The mnemonic string\n */\nexport function bytesToMnemonic(bytes: Uint8Array): string {\n return bip39.entropyToMnemonic(bytes, wordlist);\n}\n","import { v4 as uuidv4, parse, stringify } from 'uuid';\n/**\n * Creates a random identifier.\n *\n * @returns The resulting auxilary string\n */\nexport function generateUuid(): string {\n return uuidv4();\n}\n\nexport function uuidToBytes(uuid: string): Uint8Array {\n return parse(uuid);\n}\n\nexport function bytesToUuid(bytes: Uint8Array): string {\n return stringify(bytes);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AASA,SAAgB,gBAAgB,OAA2B;AACzD,SAAA,GAAA,uBAAA,YAAkB,MAAM;;;;;;;;AAS1B,SAAgB,YAAY,KAAyB;AACnD,QAAO,IAAI,aAAa,CAAC,OAAO,IAAI;;;;;;;;AAStC,SAAgB,YAAY,OAA2B;AACrD,QAAO,IAAI,aAAa,CAAC,OAAO,MAAM;;;;;;;;AASxC,SAAgB,gBAAgB,KAAyB;AACvD,SAAA,GAAA,uBAAA,YAAkB,IAAI;;;;;;;;AASxB,SAAgB,mBAAmB,QAA4B;AAC7D,SAAA,GAAA,UAAA,eAAqB,OAAO;;;;;;;;AAS9B,SAAgB,mBAAmB,KAAyB;AAC1D,SAAA,GAAA,UAAA,aAAmB,IAAI;;;;;;;;;ACpDzB,SAAgB,cAAsB;AACpC,QAAOA,aAAM,iBAAiBC,kCAAAA,UAAAA,IAAkC;;;;;;;;AASlE,SAAgB,gBAAgB,UAA8B;AAC5D,QAAOD,aAAM,kBAAkB,UAAUC,kCAAAA,SAAS;;;;;;;;AASpD,SAAgB,gBAAgB,OAA2B;AACzD,QAAOD,aAAM,kBAAkB,OAAOC,kCAAAA,SAAS;;;;;;;;;ACvBjD,SAAgB,eAAuB;AACrC,SAAA,GAAA,KAAA,KAAe;;AAGjB,SAAgB,YAAY,QAA0B;AACpD,SAAA,GAAA,KAAA,OAAaC,OAAK;;AAGpB,SAAgB,YAAY,OAA2B;AACrD,SAAA,GAAA,KAAA,WAAiB,MAAM"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import "./constants.mjs";
|
|
2
|
+
import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
|
|
3
|
+
import { fromByteArray, toByteArray } from "base64-js";
|
|
4
|
+
import * as bip39 from "@scure/bip39";
|
|
5
|
+
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
6
|
+
import { parse, stringify, v4 } from "uuid";
|
|
7
|
+
//#region src/utils/converters.ts
|
|
8
|
+
/**
|
|
9
|
+
* Converts a Uint8Array into a hexadecimal string.
|
|
10
|
+
*
|
|
11
|
+
* @param array - The Uint8Array to convert.
|
|
12
|
+
* @returns The hexadecimal string representation of the array.
|
|
13
|
+
*/
|
|
14
|
+
function uint8ArrayToHex(array) {
|
|
15
|
+
return bytesToHex(array);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Converts a UTF-8 string into a Uint8Array.
|
|
19
|
+
*
|
|
20
|
+
* @param str - The UTF-8 string to convert.
|
|
21
|
+
* @returns A Uint8Array created from the UTF-8 string.
|
|
22
|
+
*/
|
|
23
|
+
function UTF8ToUint8(str) {
|
|
24
|
+
return new TextEncoder().encode(str);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Converts an Uint8Array into a UTF-8 string.
|
|
28
|
+
*
|
|
29
|
+
* @param array - The Uint8Array to convert.
|
|
30
|
+
* @returns The UTF-8 string representation of the array.
|
|
31
|
+
*/
|
|
32
|
+
function uint8ToUTF8(array) {
|
|
33
|
+
return new TextDecoder().decode(array);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Converts a hexadecimal string into a Uint8Array.
|
|
37
|
+
*
|
|
38
|
+
* @param hex - The hexadecimal string to convert.
|
|
39
|
+
* @returns A Uint8Array created from the hex string.
|
|
40
|
+
*/
|
|
41
|
+
function hexToUint8Array(hex) {
|
|
42
|
+
return hexToBytes(hex);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Converts a Uint8Array into a base64 string.
|
|
46
|
+
*
|
|
47
|
+
* @param array - The Uint8Array to convert.
|
|
48
|
+
* @returns The base64 string representation of the array.
|
|
49
|
+
*/
|
|
50
|
+
function uint8ArrayToBase64(buffer) {
|
|
51
|
+
return fromByteArray(buffer);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Converts a base64 string into a Uint8Array.
|
|
55
|
+
*
|
|
56
|
+
* @param str - The base64 string to convert.
|
|
57
|
+
* @returns A Uint8Array created from the base64 string.
|
|
58
|
+
*/
|
|
59
|
+
function base64ToUint8Array(str) {
|
|
60
|
+
return toByteArray(str);
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/utils/genMnemonic.ts
|
|
64
|
+
/**
|
|
65
|
+
* Generates a mnemonic
|
|
66
|
+
*
|
|
67
|
+
* @returns The generated mnemonic.
|
|
68
|
+
*/
|
|
69
|
+
function genMnemonic() {
|
|
70
|
+
return bip39.generateMnemonic(wordlist, 256);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Converts a mnemonic to Uint8Array
|
|
74
|
+
*
|
|
75
|
+
* @param mnemonic - The mnemonic to convert
|
|
76
|
+
* @returns The mnemonic as Uint8Array
|
|
77
|
+
*/
|
|
78
|
+
function mnemonicToBytes(mnemonic) {
|
|
79
|
+
return bip39.mnemonicToEntropy(mnemonic, wordlist);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Converts a Uint8Array to a mnemonic
|
|
83
|
+
*
|
|
84
|
+
* @param bytes - The bytes to convert
|
|
85
|
+
* @returns The mnemonic string
|
|
86
|
+
*/
|
|
87
|
+
function bytesToMnemonic(bytes) {
|
|
88
|
+
return bip39.entropyToMnemonic(bytes, wordlist);
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/utils/genID.ts
|
|
92
|
+
/**
|
|
93
|
+
* Creates a random identifier.
|
|
94
|
+
*
|
|
95
|
+
* @returns The resulting auxilary string
|
|
96
|
+
*/
|
|
97
|
+
function generateUuid() {
|
|
98
|
+
return v4();
|
|
99
|
+
}
|
|
100
|
+
function uuidToBytes(uuid) {
|
|
101
|
+
return parse(uuid);
|
|
102
|
+
}
|
|
103
|
+
function bytesToUuid(bytes) {
|
|
104
|
+
return stringify(bytes);
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
export { UTF8ToUint8, base64ToUint8Array, bytesToMnemonic, bytesToUuid, genMnemonic, generateUuid, hexToUint8Array, mnemonicToBytes, uint8ArrayToBase64, uint8ArrayToHex, uint8ToUTF8, uuidToBytes };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":["uuidv4"],"sources":["../../src/utils/converters.ts","../../src/utils/genMnemonic.ts","../../src/utils/genID.ts"],"sourcesContent":["import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js';\nimport { fromByteArray, toByteArray } from 'base64-js';\n\n/**\n * Converts a Uint8Array into a hexadecimal string.\n *\n * @param array - The Uint8Array to convert.\n * @returns The hexadecimal string representation of the array.\n */\nexport function uint8ArrayToHex(array: Uint8Array): string {\n return bytesToHex(array);\n}\n\n/**\n * Converts a UTF-8 string into a Uint8Array.\n *\n * @param str - The UTF-8 string to convert.\n * @returns A Uint8Array created from the UTF-8 string.\n */\nexport function UTF8ToUint8(str: string): Uint8Array {\n return new TextEncoder().encode(str);\n}\n\n/**\n * Converts an Uint8Array into a UTF-8 string.\n *\n * @param array - The Uint8Array to convert.\n * @returns The UTF-8 string representation of the array.\n */\nexport function uint8ToUTF8(array: Uint8Array): string {\n return new TextDecoder().decode(array);\n}\n\n/**\n * Converts a hexadecimal string into a Uint8Array.\n *\n * @param hex - The hexadecimal string to convert.\n * @returns A Uint8Array created from the hex string.\n */\nexport function hexToUint8Array(hex: string): Uint8Array {\n return hexToBytes(hex);\n}\n\n/**\n * Converts a Uint8Array into a base64 string.\n *\n * @param array - The Uint8Array to convert.\n * @returns The base64 string representation of the array.\n */\nexport function uint8ArrayToBase64(buffer: Uint8Array): string {\n return fromByteArray(buffer);\n}\n\n/**\n * Converts a base64 string into a Uint8Array.\n *\n * @param str - The base64 string to convert.\n * @returns A Uint8Array created from the base64 string.\n */\nexport function base64ToUint8Array(str: string): Uint8Array {\n return toByteArray(str);\n}\n","import * as bip39 from '@scure/bip39';\nimport { wordlist } from '@scure/bip39/wordlists/english.js';\nimport { AES_KEY_BYTE_LENGTH } from '../constants';\n/**\n * Generates a mnemonic\n *\n * @returns The generated mnemonic.\n */\nexport function genMnemonic(): string {\n return bip39.generateMnemonic(wordlist, AES_KEY_BYTE_LENGTH * 8);\n}\n\n/**\n * Converts a mnemonic to Uint8Array\n *\n * @param mnemonic - The mnemonic to convert\n * @returns The mnemonic as Uint8Array\n */\nexport function mnemonicToBytes(mnemonic: string): Uint8Array {\n return bip39.mnemonicToEntropy(mnemonic, wordlist);\n}\n\n/**\n * Converts a Uint8Array to a mnemonic\n *\n * @param bytes - The bytes to convert\n * @returns The mnemonic string\n */\nexport function bytesToMnemonic(bytes: Uint8Array): string {\n return bip39.entropyToMnemonic(bytes, wordlist);\n}\n","import { v4 as uuidv4, parse, stringify } from 'uuid';\n/**\n * Creates a random identifier.\n *\n * @returns The resulting auxilary string\n */\nexport function generateUuid(): string {\n return uuidv4();\n}\n\nexport function uuidToBytes(uuid: string): Uint8Array {\n return parse(uuid);\n}\n\nexport function bytesToUuid(bytes: Uint8Array): string {\n return stringify(bytes);\n}\n"],"mappings":";;;;;;;;;;;;;AASA,SAAgB,gBAAgB,OAA2B;AACzD,QAAO,WAAW,MAAM;;;;;;;;AAS1B,SAAgB,YAAY,KAAyB;AACnD,QAAO,IAAI,aAAa,CAAC,OAAO,IAAI;;;;;;;;AAStC,SAAgB,YAAY,OAA2B;AACrD,QAAO,IAAI,aAAa,CAAC,OAAO,MAAM;;;;;;;;AASxC,SAAgB,gBAAgB,KAAyB;AACvD,QAAO,WAAW,IAAI;;;;;;;;AASxB,SAAgB,mBAAmB,QAA4B;AAC7D,QAAO,cAAc,OAAO;;;;;;;;AAS9B,SAAgB,mBAAmB,KAAyB;AAC1D,QAAO,YAAY,IAAI;;;;;;;;;ACpDzB,SAAgB,cAAsB;AACpC,QAAO,MAAM,iBAAiB,UAAA,IAAkC;;;;;;;;AASlE,SAAgB,gBAAgB,UAA8B;AAC5D,QAAO,MAAM,kBAAkB,UAAU,SAAS;;;;;;;;AASpD,SAAgB,gBAAgB,OAA2B;AACzD,QAAO,MAAM,kBAAkB,OAAO,SAAS;;;;;;;;;ACvBjD,SAAgB,eAAuB;AACrC,QAAOA,IAAQ;;AAGjB,SAAgB,YAAY,MAA0B;AACpD,QAAO,MAAM,KAAK;;AAGpB,SAAgB,YAAY,OAA2B;AACrD,QAAO,UAAU,MAAM"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ml_kem768_x25519 } from "@noble/post-quantum/hybrid.js";
|
|
2
|
+
//#region src/hybrid-crypto/xwing.ts
|
|
3
|
+
function genHybridKeys(seed) {
|
|
4
|
+
return ml_kem768_x25519.keygen(seed);
|
|
5
|
+
}
|
|
6
|
+
function encapsulateHybrid(publicKey) {
|
|
7
|
+
return ml_kem768_x25519.encapsulate(publicKey);
|
|
8
|
+
}
|
|
9
|
+
function decapsulateHybrid(cipherText, secretKey) {
|
|
10
|
+
return ml_kem768_x25519.decapsulate(cipherText, secretKey);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { encapsulateHybrid as n, genHybridKeys as r, decapsulateHybrid as t };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=xwing-B34h5e3Z.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xwing-B34h5e3Z.mjs","names":["hybridCipher"],"sources":["../../src/hybrid-crypto/xwing.ts"],"sourcesContent":["import { ml_kem768_x25519 as hybridCipher } from '@noble/post-quantum/hybrid.js';\nimport { HybridKeyPair } from '../types';\n\nexport function genHybridKeys(seed?: Uint8Array): HybridKeyPair {\n return hybridCipher.keygen(seed);\n}\n\nexport function encapsulateHybrid(publicKey: Uint8Array): { cipherText: Uint8Array; sharedSecret: Uint8Array } {\n return hybridCipher.encapsulate(publicKey);\n}\n\nexport function decapsulateHybrid(cipherText: Uint8Array, secretKey: Uint8Array): Uint8Array {\n return hybridCipher.decapsulate(cipherText, secretKey);\n}\n"],"mappings":";;AAGA,SAAgB,cAAc,MAAkC;AAC9D,QAAOA,iBAAa,OAAO,KAAK;;AAGlC,SAAgB,kBAAkB,WAA6E;AAC7G,QAAOA,iBAAa,YAAY,UAAU;;AAG5C,SAAgB,kBAAkB,YAAwB,WAAmC;AAC3F,QAAOA,iBAAa,YAAY,YAAY,UAAU"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require("./chunk-DskHE4z1.js");
|
|
2
|
+
let _noble_post_quantum_hybrid_js = require("@noble/post-quantum/hybrid.js");
|
|
3
|
+
//#region src/hybrid-crypto/xwing.ts
|
|
4
|
+
function genHybridKeys(seed) {
|
|
5
|
+
return _noble_post_quantum_hybrid_js.ml_kem768_x25519.keygen(seed);
|
|
6
|
+
}
|
|
7
|
+
function encapsulateHybrid(publicKey) {
|
|
8
|
+
return _noble_post_quantum_hybrid_js.ml_kem768_x25519.encapsulate(publicKey);
|
|
9
|
+
}
|
|
10
|
+
function decapsulateHybrid(cipherText, secretKey) {
|
|
11
|
+
return _noble_post_quantum_hybrid_js.ml_kem768_x25519.decapsulate(cipherText, secretKey);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
Object.defineProperty(exports, "decapsulateHybrid", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function() {
|
|
17
|
+
return decapsulateHybrid;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "encapsulateHybrid", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return encapsulateHybrid;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "genHybridKeys", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function() {
|
|
29
|
+
return genHybridKeys;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=xwing-CSdiyHAt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xwing-CSdiyHAt.js","names":["hybridCipher"],"sources":["../../src/hybrid-crypto/xwing.ts"],"sourcesContent":["import { ml_kem768_x25519 as hybridCipher } from '@noble/post-quantum/hybrid.js';\nimport { HybridKeyPair } from '../types';\n\nexport function genHybridKeys(seed?: Uint8Array): HybridKeyPair {\n return hybridCipher.keygen(seed);\n}\n\nexport function encapsulateHybrid(publicKey: Uint8Array): { cipherText: Uint8Array; sharedSecret: Uint8Array } {\n return hybridCipher.encapsulate(publicKey);\n}\n\nexport function decapsulateHybrid(cipherText: Uint8Array, secretKey: Uint8Array): Uint8Array {\n return hybridCipher.decapsulate(cipherText, secretKey);\n}\n"],"mappings":";;;AAGA,SAAgB,cAAc,MAAkC;AAC9D,QAAOA,8BAAAA,iBAAa,OAAO,KAAK;;AAGlC,SAAgB,kBAAkB,WAA6E;AAC7G,QAAOA,8BAAAA,iBAAa,YAAY,UAAU;;AAG5C,SAAgB,kBAAkB,YAAwB,WAAmC;AAC3F,QAAOA,8BAAAA,iBAAa,YAAY,YAAY,UAAU"}
|
package/dist/utils.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils/converters.ts","../src/utils/genMnemonic.ts","../src/utils/genID.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils/converters.ts","../src/utils/genMnemonic.ts","../src/utils/genID.ts"],"mappings":";;AASA;;;;;iBAAgB,eAAA,CAAgB,KAAA,EAAO,UAAA;;;;;AAoBvC;;iBAVgB,WAAA,CAAY,GAAA,WAAc,UAAA;;;AAoB1C;;;;iBAVgB,WAAA,CAAY,KAAA,EAAO,UAAA;AAoBnC;;;;;AAUA;AAVA,iBAVgB,eAAA,CAAgB,GAAA,WAAc,UAAA;;;;;;;iBAU9B,kBAAA,CAAmB,MAAA,EAAQ,UAAA;;;;;AC/B3C;;iBDyCgB,kBAAA,CAAmB,GAAA,WAAc,UAAA;;;;AAlDjD;;;;iBCDgB,WAAA,CAAA;ADWhB;;;;;AAUA;AAVA,iBCDgB,eAAA,CAAgB,QAAA,WAAmB,UAAA;;;;ADqBnD;;;iBCXgB,eAAA,CAAgB,KAAA,EAAO,UAAA;;;;ADnBvC;;;;iBEHgB,YAAA,CAAA;AAAA,iBAIA,WAAA,CAAY,IAAA,WAAe,UAAA;AAAA,iBAI3B,WAAA,CAAY,KAAA,EAAO,UAAA"}
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../src/utils/converters.ts","../src/utils/genMnemonic.ts","../src/utils/genID.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../src/utils/converters.ts","../src/utils/genMnemonic.ts","../src/utils/genID.ts"],"mappings":";;AASA;;;;;iBAAgB,eAAA,CAAgB,KAAA,EAAO,UAAA;;;;;AAoBvC;;iBAVgB,WAAA,CAAY,GAAA,WAAc,UAAA;;;AAoB1C;;;;iBAVgB,WAAA,CAAY,KAAA,EAAO,UAAA;AAoBnC;;;;;AAUA;AAVA,iBAVgB,eAAA,CAAgB,GAAA,WAAc,UAAA;;;;;;;iBAU9B,kBAAA,CAAmB,MAAA,EAAQ,UAAA;;;;;AC/B3C;;iBDyCgB,kBAAA,CAAmB,GAAA,WAAc,UAAA;;;;AAlDjD;;;;iBCDgB,WAAA,CAAA;ADWhB;;;;;AAUA;AAVA,iBCDgB,eAAA,CAAgB,QAAA,WAAmB,UAAA;;;;ADqBnD;;;iBCXgB,eAAA,CAAgB,KAAA,EAAO,UAAA;;;;ADnBvC;;;;iBEHgB,YAAA,CAAA;AAAA,iBAIA,WAAA,CAAY,IAAA,WAAe,UAAA;AAAA,iBAI3B,WAAA,CAAY,KAAA,EAAO,UAAA"}
|