@sebastienrousseau/crypto-vue 0.0.8 → 0.0.24
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/composables/useEncrypt.d.ts.map +1 -1
- package/dist/composables/useEncrypt.js +29 -33
- package/dist/composables/usePqStream.d.ts +24 -0
- package/dist/composables/usePqStream.d.ts.map +1 -0
- package/dist/composables/usePqStream.js +84 -0
- package/dist/composables/useSignature.d.ts.map +1 -1
- package/dist/composables/useSignature.js +20 -24
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/package.json +17 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEncrypt.d.ts","sourceRoot":"","sources":["../../src/composables/useEncrypt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,KAAK,GAAG,EAAE,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAczE,MAAM,WAAW,gBAAgB;IAE/B,UAAU,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAE7C,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAE5C,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzC,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IAEvC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAErE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAE5D,SAAS,EAAE,MAAM,MAAM,CAAC;IAExB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"useEncrypt.d.ts","sourceRoot":"","sources":["../../src/composables/useEncrypt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,KAAK,GAAG,EAAE,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAczE,MAAM,WAAW,gBAAgB;IAE/B,UAAU,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAE7C,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAE5C,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzC,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IAEvC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAErE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAE5D,SAAS,EAAE,MAAM,MAAM,CAAC;IAExB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAkDD,wBAAgB,UAAU,IAAI,gBAAgB,CAkD7C"}
|
|
@@ -4,52 +4,48 @@ exports.useEncrypt = useEncrypt;
|
|
|
4
4
|
const vue_1 = require("vue");
|
|
5
5
|
const crypto_lib_1 = require("@sebastienrousseau/crypto-lib");
|
|
6
6
|
const plugin_1 = require("../plugin");
|
|
7
|
+
async function runWithState(isProcessing, error, fn) {
|
|
8
|
+
isProcessing.value = true;
|
|
9
|
+
error.value = null;
|
|
10
|
+
try {
|
|
11
|
+
return fn();
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
error.value = err instanceof Error ? err : new Error(String(err));
|
|
15
|
+
throw error.value;
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
isProcessing.value = false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function resolveKey(key, defaultKey) {
|
|
22
|
+
const resolved = key ?? defaultKey;
|
|
23
|
+
if (!resolved) {
|
|
24
|
+
throw new Error("No encryption key provided and no defaultKey configured in CryptoPlugin.");
|
|
25
|
+
}
|
|
26
|
+
return resolved;
|
|
27
|
+
}
|
|
7
28
|
function useEncrypt() {
|
|
8
29
|
const opts = (0, vue_1.inject)(plugin_1.CryptoSymbol, {});
|
|
9
30
|
const ciphertext = (0, vue_1.ref)(null);
|
|
10
31
|
const plaintext = (0, vue_1.ref)(null);
|
|
11
32
|
const isProcessing = (0, vue_1.ref)(false);
|
|
12
33
|
const error = (0, vue_1.ref)(null);
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
throw new Error("No encryption key provided and no defaultKey configured in CryptoPlugin.");
|
|
17
|
-
}
|
|
18
|
-
return resolved;
|
|
19
|
-
}
|
|
20
|
-
async function encrypt(key, data) {
|
|
21
|
-
isProcessing.value = true;
|
|
22
|
-
error.value = null;
|
|
23
|
-
try {
|
|
24
|
-
const k = resolveKey(key);
|
|
34
|
+
function encrypt(key, data) {
|
|
35
|
+
return runWithState(isProcessing, error, () => {
|
|
36
|
+
const k = resolveKey(key, opts.defaultKey);
|
|
25
37
|
const ct = crypto_lib_1.crypto.encrypt(k, data);
|
|
26
38
|
ciphertext.value = ct;
|
|
27
39
|
return ct;
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
error.value = err instanceof Error ? err : new Error(String(err));
|
|
31
|
-
throw error.value;
|
|
32
|
-
}
|
|
33
|
-
finally {
|
|
34
|
-
isProcessing.value = false;
|
|
35
|
-
}
|
|
40
|
+
});
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
isProcessing
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
const k = resolveKey(key);
|
|
42
|
+
function decrypt(key, data) {
|
|
43
|
+
return runWithState(isProcessing, error, () => {
|
|
44
|
+
const k = resolveKey(key, opts.defaultKey);
|
|
42
45
|
const pt = crypto_lib_1.crypto.decrypt(k, data);
|
|
43
46
|
plaintext.value = new TextDecoder().decode(pt);
|
|
44
47
|
return pt;
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
error.value = err instanceof Error ? err : new Error(String(err));
|
|
48
|
-
throw error.value;
|
|
49
|
-
}
|
|
50
|
-
finally {
|
|
51
|
-
isProcessing.value = false;
|
|
52
|
-
}
|
|
48
|
+
});
|
|
53
49
|
}
|
|
54
50
|
function randomKey() {
|
|
55
51
|
return crypto_lib_1.crypto.randomKey();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Ref, type DeepReadonly } from "vue";
|
|
2
|
+
import { type CryptoTransformStream } from "@sebastienrousseau/crypto-lib/streaming";
|
|
3
|
+
export interface PqRecipientPublicKeys {
|
|
4
|
+
x25519PublicKey: string | Uint8Array;
|
|
5
|
+
mlKemPublicKey: string | Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
export interface PqRecipientSecretKeys {
|
|
8
|
+
x25519SecretKey: string | Uint8Array;
|
|
9
|
+
mlKemSecretKey: string | Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
export interface UsePqStreamReturn {
|
|
12
|
+
ciphertext: DeepReadonly<Ref<Uint8Array | null>>;
|
|
13
|
+
plaintext: DeepReadonly<Ref<Uint8Array | null>>;
|
|
14
|
+
chunkCount: DeepReadonly<Ref<number | null>>;
|
|
15
|
+
isProcessing: DeepReadonly<Ref<boolean>>;
|
|
16
|
+
error: DeepReadonly<Ref<Error | null>>;
|
|
17
|
+
encrypt: (data: string | Uint8Array, keys: PqRecipientPublicKeys, chunkSize?: number) => Promise<Uint8Array>;
|
|
18
|
+
decrypt: (ciphertext: Uint8Array, keys: PqRecipientSecretKeys, chunkSize?: number) => Promise<Uint8Array>;
|
|
19
|
+
createEncryptStream: (keys: PqRecipientPublicKeys, chunkSize?: number) => CryptoTransformStream<Uint8Array, Uint8Array>;
|
|
20
|
+
createDecryptStream: (keys: PqRecipientSecretKeys, chunkSize?: number) => CryptoTransformStream<Uint8Array, Uint8Array>;
|
|
21
|
+
clear: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function usePqStream(): UsePqStreamReturn;
|
|
24
|
+
//# sourceMappingURL=usePqStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePqStream.d.ts","sourceRoot":"","sources":["../../src/composables/usePqStream.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,GAAG,EAAE,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AACjE,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,yCAAyC,CAAC;AAGjD,MAAM,WAAW,qBAAqB;IAEpC,eAAe,EAAE,MAAM,GAAG,UAAU,CAAC;IAErC,cAAc,EAAE,MAAM,GAAG,UAAU,CAAC;CACrC;AAGD,MAAM,WAAW,qBAAqB;IAEpC,eAAe,EAAE,MAAM,GAAG,UAAU,CAAC;IAErC,cAAc,EAAE,MAAM,GAAG,UAAU,CAAC;CACrC;AAKD,MAAM,WAAW,iBAAiB;IAEhC,UAAU,EAAE,YAAY,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;IAEjD,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;IAEhD,UAAU,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAE7C,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzC,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IAEvC,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,GAAG,UAAU,EACzB,IAAI,EAAE,qBAAqB,EAC3B,SAAS,CAAC,EAAE,MAAM,KACf,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzB,OAAO,EAAE,CACP,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,qBAAqB,EAC3B,SAAS,CAAC,EAAE,MAAM,KACf,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzB,mBAAmB,EAAE,CACnB,IAAI,EAAE,qBAAqB,EAC3B,SAAS,CAAC,EAAE,MAAM,KACf,qBAAqB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAEnD,mBAAmB,EAAE,CACnB,IAAI,EAAE,qBAAqB,EAC3B,SAAS,CAAC,EAAE,MAAM,KACf,qBAAqB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAEnD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AA0DD,wBAAgB,WAAW,IAAI,iBAAiB,CA6C/C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePqStream = usePqStream;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
const streaming_1 = require("@sebastienrousseau/crypto-lib/streaming");
|
|
6
|
+
function toUint8Array(input) {
|
|
7
|
+
return typeof input === "string" ? new TextEncoder().encode(input) : input;
|
|
8
|
+
}
|
|
9
|
+
function executePqEncrypt(data, keys, chunkSize) {
|
|
10
|
+
const rawPt = toUint8Array(data);
|
|
11
|
+
const res = (0, streaming_1.streamPqEncrypt)({
|
|
12
|
+
recipientX25519Public: keys.x25519PublicKey,
|
|
13
|
+
recipientMlKemPublic: keys.mlKemPublicKey,
|
|
14
|
+
plaintext: rawPt,
|
|
15
|
+
chunkSize,
|
|
16
|
+
});
|
|
17
|
+
const sz = chunkSize ?? 65536;
|
|
18
|
+
const chunkCount = Math.max(1, Math.ceil(rawPt.length / sz));
|
|
19
|
+
return { ciphertext: res.ciphertext, chunkCount };
|
|
20
|
+
}
|
|
21
|
+
function executePqDecrypt(ct, keys, chunkSize) {
|
|
22
|
+
return (0, streaming_1.streamPqDecrypt)({
|
|
23
|
+
recipientX25519Secret: keys.x25519SecretKey,
|
|
24
|
+
recipientMlKemSecret: keys.mlKemSecretKey,
|
|
25
|
+
ciphertext: ct,
|
|
26
|
+
chunkSize,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async function runOp(isProcessing, error, fn) {
|
|
30
|
+
isProcessing.value = true;
|
|
31
|
+
error.value = null;
|
|
32
|
+
try {
|
|
33
|
+
return fn();
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
error.value = err instanceof Error ? err : new Error(String(err));
|
|
37
|
+
throw error.value;
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
isProcessing.value = false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function usePqStream() {
|
|
44
|
+
const ciphertext = (0, vue_1.ref)(null);
|
|
45
|
+
const plaintext = (0, vue_1.ref)(null);
|
|
46
|
+
const chunkCount = (0, vue_1.ref)(null);
|
|
47
|
+
const isProcessing = (0, vue_1.ref)(false);
|
|
48
|
+
const error = (0, vue_1.ref)(null);
|
|
49
|
+
return {
|
|
50
|
+
ciphertext: (0, vue_1.readonly)(ciphertext),
|
|
51
|
+
plaintext: (0, vue_1.readonly)(plaintext),
|
|
52
|
+
chunkCount: (0, vue_1.readonly)(chunkCount),
|
|
53
|
+
isProcessing: (0, vue_1.readonly)(isProcessing),
|
|
54
|
+
error: (0, vue_1.readonly)(error),
|
|
55
|
+
encrypt: (data, keys, sz) => runOp(isProcessing, error, () => {
|
|
56
|
+
const res = executePqEncrypt(data, keys, sz);
|
|
57
|
+
ciphertext.value = res.ciphertext;
|
|
58
|
+
chunkCount.value = res.chunkCount;
|
|
59
|
+
return res.ciphertext;
|
|
60
|
+
}),
|
|
61
|
+
decrypt: (ct, keys, sz) => runOp(isProcessing, error, () => {
|
|
62
|
+
const res = executePqDecrypt(ct, keys, sz);
|
|
63
|
+
plaintext.value = res;
|
|
64
|
+
return res;
|
|
65
|
+
}),
|
|
66
|
+
createEncryptStream: (keys, sz) => (0, streaming_1.createPqEncryptStream)({
|
|
67
|
+
recipientX25519Public: keys.x25519PublicKey,
|
|
68
|
+
recipientMlKemPublic: keys.mlKemPublicKey,
|
|
69
|
+
chunkSize: sz,
|
|
70
|
+
}),
|
|
71
|
+
createDecryptStream: (keys, sz) => (0, streaming_1.createPqDecryptStream)({
|
|
72
|
+
recipientX25519Secret: keys.x25519SecretKey,
|
|
73
|
+
recipientMlKemSecret: keys.mlKemSecretKey,
|
|
74
|
+
chunkSize: sz,
|
|
75
|
+
}),
|
|
76
|
+
clear: () => {
|
|
77
|
+
ciphertext.value = null;
|
|
78
|
+
plaintext.value = null;
|
|
79
|
+
chunkCount.value = null;
|
|
80
|
+
error.value = null;
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=usePqStream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignature.d.ts","sourceRoot":"","sources":["../../src/composables/useSignature.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,GAAG,EAAE,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AACjE,OAAO,EAEL,KAAK,aAAa,IAAI,cAAc,EACrC,MAAM,+BAA+B,CAAC;AAWvC,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAY3C,MAAM,WAAW,kBAAkB;IAEjC,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAE5C,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC;IAE3C,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC;IAEnD,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzC,KAAK,EAAE,YAAY,CAAC,GAAG,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,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAsCD,wBAAgB,YAAY,IAAI,kBAAkB,CAsDjD"}
|
|
@@ -3,45 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useSignature = useSignature;
|
|
4
4
|
const vue_1 = require("vue");
|
|
5
5
|
const crypto_lib_1 = require("@sebastienrousseau/crypto-lib");
|
|
6
|
+
async function runWithState(isProcessing, error, fn) {
|
|
7
|
+
isProcessing.value = true;
|
|
8
|
+
error.value = null;
|
|
9
|
+
try {
|
|
10
|
+
return fn();
|
|
11
|
+
}
|
|
12
|
+
catch (err) {
|
|
13
|
+
error.value = err instanceof Error ? err : new Error(String(err));
|
|
14
|
+
throw error.value;
|
|
15
|
+
}
|
|
16
|
+
finally {
|
|
17
|
+
isProcessing.value = false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
6
20
|
function useSignature() {
|
|
7
21
|
const signature = (0, vue_1.ref)(null);
|
|
8
22
|
const isValid = (0, vue_1.ref)(null);
|
|
9
23
|
const algorithm = (0, vue_1.ref)(null);
|
|
10
24
|
const isProcessing = (0, vue_1.ref)(false);
|
|
11
25
|
const error = (0, vue_1.ref)(null);
|
|
12
|
-
|
|
13
|
-
isProcessing
|
|
14
|
-
error.value = null;
|
|
15
|
-
try {
|
|
26
|
+
function sign(algo, privateKeyHex, message) {
|
|
27
|
+
return runWithState(isProcessing, error, () => {
|
|
16
28
|
const sig = crypto_lib_1.crypto.sign(algo, privateKeyHex, message);
|
|
17
29
|
signature.value = sig;
|
|
18
30
|
algorithm.value = algo;
|
|
19
31
|
return sig;
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
error.value = err instanceof Error ? err : new Error(String(err));
|
|
23
|
-
throw error.value;
|
|
24
|
-
}
|
|
25
|
-
finally {
|
|
26
|
-
isProcessing.value = false;
|
|
27
|
-
}
|
|
32
|
+
});
|
|
28
33
|
}
|
|
29
|
-
|
|
30
|
-
isProcessing
|
|
31
|
-
error.value = null;
|
|
32
|
-
try {
|
|
34
|
+
function verify(algo, publicKeyHex, message, signatureHex) {
|
|
35
|
+
return runWithState(isProcessing, error, () => {
|
|
33
36
|
const valid = crypto_lib_1.crypto.verify(algo, publicKeyHex, message, signatureHex);
|
|
34
37
|
isValid.value = valid;
|
|
35
38
|
algorithm.value = algo;
|
|
36
39
|
return valid;
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
error.value = err instanceof Error ? err : new Error(String(err));
|
|
40
|
-
throw error.value;
|
|
41
|
-
}
|
|
42
|
-
finally {
|
|
43
|
-
isProcessing.value = false;
|
|
44
|
-
}
|
|
40
|
+
});
|
|
45
41
|
}
|
|
46
42
|
function clear() {
|
|
47
43
|
signature.value = null;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,6 @@ export { useHash } from "./composables/useHash";
|
|
|
8
8
|
export type { UseHashReturn, HashAlgorithm } from "./composables/useHash";
|
|
9
9
|
export { useSignature } from "./composables/useSignature";
|
|
10
10
|
export type { UseSignatureReturn, SignAlgorithm, } from "./composables/useSignature";
|
|
11
|
+
export { usePqStream } from "./composables/usePqStream";
|
|
12
|
+
export type { UsePqStreamReturn, PqRecipientPublicKeys, PqRecipientSecretKeys, } from "./composables/usePqStream";
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,OAAO,EAAE,UAAU,E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1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSignature = exports.useHash = exports.useEncrypt = exports.useKeypair = exports.CryptoSymbol = exports.CryptoPlugin = void 0;
|
|
3
|
+
exports.usePqStream = exports.useSignature = exports.useHash = exports.useEncrypt = exports.useKeypair = exports.CryptoSymbol = exports.CryptoPlugin = void 0;
|
|
4
4
|
var plugin_1 = require("./plugin");
|
|
5
5
|
Object.defineProperty(exports, "CryptoPlugin", { enumerable: true, get: function () { return plugin_1.CryptoPlugin; } });
|
|
6
6
|
Object.defineProperty(exports, "CryptoSymbol", { enumerable: true, get: function () { return plugin_1.CryptoSymbol; } });
|
|
@@ -12,4 +12,6 @@ var useHash_1 = require("./composables/useHash");
|
|
|
12
12
|
Object.defineProperty(exports, "useHash", { enumerable: true, get: function () { return useHash_1.useHash; } });
|
|
13
13
|
var useSignature_1 = require("./composables/useSignature");
|
|
14
14
|
Object.defineProperty(exports, "useSignature", { enumerable: true, get: function () { return useSignature_1.useSignature; } });
|
|
15
|
+
var usePqStream_1 = require("./composables/usePqStream");
|
|
16
|
+
Object.defineProperty(exports, "usePqStream", { enumerable: true, get: function () { return usePqStream_1.usePqStream; } });
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebastienrousseau/crypto-vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Vue 3 composables for client-side cryptography — key generation, encryption, signing, and hashing with reactive state.",
|
|
5
5
|
"author": "Sebastien Rousseau <sebastienrousseau@users.noreply.github.com>",
|
|
6
6
|
"license": "MIT OR Apache-2.0",
|
|
@@ -16,42 +16,44 @@
|
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=22.0.0"
|
|
18
18
|
},
|
|
19
|
+
"type": "commonjs",
|
|
19
20
|
"main": "./dist/index.js",
|
|
20
21
|
"types": "./dist/index.d.ts",
|
|
21
|
-
"sideEffects": false,
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
25
|
"require": "./dist/index.js",
|
|
26
|
-
"
|
|
27
|
-
}
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
28
29
|
},
|
|
30
|
+
"sideEffects": false,
|
|
29
31
|
"files": [
|
|
30
32
|
"dist/**/*.js",
|
|
31
33
|
"dist/**/*.d.ts",
|
|
32
34
|
"dist/**/*.d.ts.map"
|
|
33
35
|
],
|
|
34
36
|
"dependencies": {
|
|
35
|
-
"@sebastienrousseau/crypto-lib": "0.0.
|
|
37
|
+
"@sebastienrousseau/crypto-lib": "0.0.24"
|
|
36
38
|
},
|
|
37
39
|
"peerDependencies": {
|
|
38
|
-
"vue": "^3.
|
|
40
|
+
"vue": "^3.5.43"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@sebastienrousseau/mocha-config": "^0.0.
|
|
42
|
-
"@types/chai": "^
|
|
43
|
+
"@sebastienrousseau/mocha-config": "^0.0.7",
|
|
44
|
+
"@types/chai": "^5.2.3",
|
|
43
45
|
"@types/chai-as-promised": "^8.0.2",
|
|
44
|
-
"@types/mocha": "^10.0.
|
|
46
|
+
"@types/mocha": "^10.0.10",
|
|
45
47
|
"@types/node": "^26.6.3",
|
|
46
48
|
"c8": "^12.0.0",
|
|
47
|
-
"chai": "^
|
|
48
|
-
"chai-as-promised": "^
|
|
49
|
-
"mocha": "^
|
|
49
|
+
"chai": "^6.3.0",
|
|
50
|
+
"chai-as-promised": "^8.0.2",
|
|
51
|
+
"mocha": "^12.0.3",
|
|
50
52
|
"rimraf": "^6.1.3",
|
|
51
53
|
"ts-node": "^10.9.2",
|
|
52
54
|
"typedoc": "^0.28.20",
|
|
53
55
|
"typescript": "~5.9.3",
|
|
54
|
-
"vue": "^3.
|
|
56
|
+
"vue": "^3.5.43"
|
|
55
57
|
},
|
|
56
58
|
"keywords": [
|
|
57
59
|
"vue",
|
|
@@ -72,8 +74,8 @@
|
|
|
72
74
|
"clean": "rimraf ./coverage ./dist ./docs",
|
|
73
75
|
"test": "c8 --check-coverage --lines 100 --branches 100 --functions 100 --reporter=lcov --reporter=text mocha --config=.mocharc.cjs",
|
|
74
76
|
"docs": "typedoc",
|
|
75
|
-
"lint": "eslint
|
|
76
|
-
"lint:fix": "eslint --cache --fix
|
|
77
|
+
"lint": "eslint src __tests__",
|
|
78
|
+
"lint:fix": "eslint --cache --fix src __tests__",
|
|
77
79
|
"format": "prettier --write src/**/*.ts",
|
|
78
80
|
"format:check": "prettier --check \"src/**/*.ts\""
|
|
79
81
|
}
|