@stryke/crypto 0.4.1 → 0.5.0
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/base-64.cjs +3 -3
- package/dist/base-64.d.ts +2 -2
- package/dist/base-64.mjs +1 -1
- package/dist/encryption.cjs +23 -27
- package/dist/encryption.mjs +1 -1
- package/dist/encryption.node.cjs +34 -0
- package/dist/encryption.node.d.ts +36 -0
- package/dist/encryption.node.mjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/neutral.cjs +38 -0
- package/dist/neutral.d.ts +3 -0
- package/dist/neutral.mjs +1 -0
- package/package.json +32 -4
package/dist/base-64.cjs
CHANGED
|
@@ -7,7 +7,7 @@ exports.base64FromBase64url = base64FromBase64url;
|
|
|
7
7
|
exports.base64ToBase64url = base64ToBase64url;
|
|
8
8
|
exports.decodeBase64 = decodeBase64;
|
|
9
9
|
exports.encodeBase64 = encodeBase64;
|
|
10
|
-
var
|
|
10
|
+
var _neutral = require("@stryke/convert/neutral");
|
|
11
11
|
var _utf8ArrayToString = require("@stryke/convert/utf8-array-to-string");
|
|
12
12
|
var _isString = require("@stryke/type-checks/is-string");
|
|
13
13
|
var _isUndefined = require("@stryke/type-checks/is-undefined");
|
|
@@ -15,7 +15,7 @@ const a = new Uint8Array([65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78
|
|
|
15
15
|
h = 61,
|
|
16
16
|
s = new Uint8Array([100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 62, 100, 100, 100, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 100, 100, 100, 100, 100, 100, 100, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 100, 100, 100, 100, 100, 100, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]);
|
|
17
17
|
function encodeBase64(r) {
|
|
18
|
-
(0, _isString.isString)(r) && (r = (0,
|
|
18
|
+
(0, _isString.isString)(r) && (r = (0, _neutral.stringToUint8Array)(r));
|
|
19
19
|
const f = r.length,
|
|
20
20
|
n = new Uint8Array(Math.ceil(f / 3) * 4),
|
|
21
21
|
l = Math.floor(f / 3);
|
|
@@ -41,7 +41,7 @@ function encodeBase64(r) {
|
|
|
41
41
|
return (0, _utf8ArrayToString.utf8ArrayToString)(n);
|
|
42
42
|
}
|
|
43
43
|
function decodeBase64(r) {
|
|
44
|
-
(0, _isString.isString)(r) && (r = (0,
|
|
44
|
+
(0, _isString.isString)(r) && (r = (0, _neutral.stringToUint8Array)(r));
|
|
45
45
|
const f = r.length;
|
|
46
46
|
if (f % 4 !== 0) throw new Error("invalid length");
|
|
47
47
|
let n = 0;
|
package/dist/base-64.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Encodes a Uint8Array into a Base64 encoded Uint8Array.
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
4
|
+
* @credit https://github.com/hi-ogawa/js-utils
|
|
5
5
|
*
|
|
6
6
|
* @param input - The input Uint8Array or string to encode.
|
|
7
7
|
* @returns The Base64 encoded Uint8Array.
|
|
@@ -10,7 +10,7 @@ export declare function encodeBase64(input: Uint8Array | string): string;
|
|
|
10
10
|
/**
|
|
11
11
|
* Decodes a Base64 encoded Uint8Array into a Uint8Array.
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @credit https://github.com/hi-ogawa/js-utils
|
|
14
14
|
*
|
|
15
15
|
* @param input - The Base64 encoded Uint8Array or string to decode.
|
|
16
16
|
* @returns The decoded Uint8Array.
|
package/dist/base-64.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{stringToUint8Array as i}from"@stryke/convert/neutral";import{utf8ArrayToString as x}from"@stryke/convert/utf8-array-to-string";import{isString as b}from"@stryke/type-checks/is-string";import{isUndefined as k}from"@stryke/type-checks/is-undefined";const a=new Uint8Array([65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47]),h=61,s=new Uint8Array([100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,62,100,100,100,63,52,53,54,55,56,57,58,59,60,61,100,100,100,100,100,100,100,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,100,100,100,100,100,100,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100]);export function encodeBase64(r){b(r)&&(r=i(r));const f=r.length,n=new Uint8Array(Math.ceil(f/3)*4),l=Math.floor(f/3);for(let e=0;e<l;e++){const c=r[3*e+0]<<16|r[3*e+1]<<8|r[3*e+2];n[4*e+0]=a[c>>18&63],n[4*e+1]=a[c>>12&63],n[4*e+2]=a[c>>6&63],n[4*e+3]=a[c>>0&63]}const t=l;switch(f%3){case 1:{const e=r[3*t+0]<<16;n[4*t+0]=a[e>>18&63],n[4*t+1]=a[e>>12&63],n[4*t+2]=h,n[4*t+3]=h;break}case 2:{const e=r[3*t+0]<<16|r[3*t+1]<<8;n[4*t+0]=a[e>>18&63],n[4*t+1]=a[e>>12&63],n[4*t+2]=a[e>>6&63],n[4*t+3]=h;break}}return x(n)}export function decodeBase64(r){b(r)&&(r=i(r));const f=r.length;if(f%4!==0)throw new Error("invalid length");let n=0;for(;n<2&&n<r.length&&r[r.length-1-n]===h;)n++;for(let o=0;o<r.length-n;o++)if(k(r[o])||k(s[r[o]])||s[r[o]]>=64)throw new Error("invalid data");const l=Math.floor((f-n)/4),t=3*l+(3-n)%3,e=new Uint8Array(t);for(let o=0;o<l;o++){const g=s[r[4*o+0]]<<18|s[r[4*o+1]]<<12|s[r[4*o+2]]<<6|s[r[4*o+3]]<<0;e[3*o]=g>>16&255,e[3*o+1]=g>>8&255,e[3*o+2]=g>>0&255}const c=l;switch(t%3){case 1:{const o=s[r[4*c+0]]<<18|s[r[4*c+1]]<<12;e[3*c]=o>>16&255;break}case 2:{const o=s[r[4*c+0]]<<18|s[r[4*c+1]]<<12|s[r[4*c+2]]<<6;e[3*c]=o>>16&255,e[3*c+1]=o>>8&255;break}}return e}export function base64ToBase64url(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}export function base64FromBase64url(r){return r.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-r.length%4)%4)}
|
package/dist/encryption.cjs
CHANGED
|
@@ -10,11 +10,7 @@ exports.decryptBuffer = decryptBuffer;
|
|
|
10
10
|
exports.encodeKey = encodeKey;
|
|
11
11
|
exports.encrypt = encrypt;
|
|
12
12
|
exports.encryptBuffer = encryptBuffer;
|
|
13
|
-
var
|
|
14
|
-
var _stringToUtf8Array = require("@stryke/convert/string-to-utf8-array");
|
|
15
|
-
var _uint8ArrayToStream = require("@stryke/convert/uint8-array-to-stream");
|
|
16
|
-
var _uint8ArrayToString = require("@stryke/convert/uint8-array-to-string");
|
|
17
|
-
var _utf8ArrayToString = require("@stryke/convert/utf8-array-to-string");
|
|
13
|
+
var _neutral = require("@stryke/convert/neutral");
|
|
18
14
|
var _base = require("./base-64.cjs");
|
|
19
15
|
var _hex = require("./hex.cjs");
|
|
20
16
|
async function createKey() {
|
|
@@ -23,42 +19,42 @@ async function createKey() {
|
|
|
23
19
|
length: 256
|
|
24
20
|
}, !0, ["encrypt", "decrypt"]);
|
|
25
21
|
}
|
|
26
|
-
async function encodeKey(
|
|
27
|
-
const r = await crypto.subtle.exportKey("raw",
|
|
22
|
+
async function encodeKey(e) {
|
|
23
|
+
const r = await crypto.subtle.exportKey("raw", e);
|
|
28
24
|
return (0, _base.encodeBase64)(new Uint8Array(r)).toString();
|
|
29
25
|
}
|
|
30
|
-
async function decodeKey(
|
|
31
|
-
const r = (0, _base.decodeBase64)(
|
|
26
|
+
async function decodeKey(e) {
|
|
27
|
+
const r = (0, _base.decodeBase64)(e);
|
|
32
28
|
return crypto.subtle.importKey("raw", r.buffer, "AES-GCM", !0, ["encrypt", "decrypt"]);
|
|
33
29
|
}
|
|
34
30
|
const o = 24;
|
|
35
|
-
async function encrypt(
|
|
36
|
-
const
|
|
31
|
+
async function encrypt(e, r) {
|
|
32
|
+
const t = crypto.getRandomValues(new Uint8Array(o / 2)),
|
|
37
33
|
n = await crypto.subtle.encrypt({
|
|
38
34
|
name: "AES-GCM",
|
|
39
|
-
iv:
|
|
40
|
-
},
|
|
41
|
-
return (0, _hex.encodeHex)(
|
|
35
|
+
iv: t
|
|
36
|
+
}, e, (0, _neutral.stringToUtf8Array)(r));
|
|
37
|
+
return (0, _hex.encodeHex)(t) + (0, _base.encodeBase64)(new Uint8Array(n));
|
|
42
38
|
}
|
|
43
|
-
async function decrypt(
|
|
44
|
-
const
|
|
39
|
+
async function decrypt(e, r) {
|
|
40
|
+
const t = await crypto.subtle.decrypt({
|
|
45
41
|
name: "AES-GCM",
|
|
46
42
|
iv: (0, _hex.decodeHex)(r.slice(0, o))
|
|
47
|
-
},
|
|
48
|
-
return (0,
|
|
43
|
+
}, e, (0, _base.decodeBase64)(r.slice(o)));
|
|
44
|
+
return (0, _neutral.utf8ArrayToString)(t);
|
|
49
45
|
}
|
|
50
|
-
async function encryptBuffer(
|
|
51
|
-
const
|
|
46
|
+
async function encryptBuffer(e, r) {
|
|
47
|
+
const t = crypto.getRandomValues(new Uint8Array(16)),
|
|
52
48
|
n = await crypto.subtle.encrypt({
|
|
53
49
|
name: "AES-GCM",
|
|
54
|
-
iv:
|
|
55
|
-
},
|
|
56
|
-
return (0,
|
|
50
|
+
iv: t
|
|
51
|
+
}, e, r);
|
|
52
|
+
return (0, _neutral.uint8ArrayToString)((0, _neutral.concatUint8Array)([t, new Uint8Array(n)]));
|
|
57
53
|
}
|
|
58
|
-
async function decryptBuffer(
|
|
59
|
-
const
|
|
54
|
+
async function decryptBuffer(e, r) {
|
|
55
|
+
const t = (0, _neutral.base64StringToUint8Array)(r);
|
|
60
56
|
return crypto.subtle.decrypt({
|
|
61
57
|
name: "AES-GCM",
|
|
62
|
-
iv:
|
|
63
|
-
},
|
|
58
|
+
iv: t.slice(0, 16)
|
|
59
|
+
}, e, t.slice(16));
|
|
64
60
|
}
|
package/dist/encryption.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{base64StringToUint8Array as i
|
|
1
|
+
import{base64StringToUint8Array as i,concatUint8Array as s,stringToUtf8Array as a,uint8ArrayToString as p,utf8ArrayToString as u}from"@stryke/convert/neutral";import{decodeBase64 as y,encodeBase64 as c}from"./base-64";import{decodeHex as f,encodeHex as d}from"./hex";export async function createKey(){return crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}export async function encodeKey(e){const r=await crypto.subtle.exportKey("raw",e);return c(new Uint8Array(r)).toString()}export async function decodeKey(e){const r=y(e);return crypto.subtle.importKey("raw",r.buffer,"AES-GCM",!0,["encrypt","decrypt"])}const o=24;export async function encrypt(e,r){const t=crypto.getRandomValues(new Uint8Array(o/2)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},e,a(r));return d(t)+c(new Uint8Array(n))}export async function decrypt(e,r){const t=await crypto.subtle.decrypt({name:"AES-GCM",iv:f(r.slice(0,o))},e,y(r.slice(o)));return u(t)}export async function encryptBuffer(e,r){const t=crypto.getRandomValues(new Uint8Array(16)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},e,r);return p(s([t,new Uint8Array(n)]))}export async function decryptBuffer(e,r){const t=i(r);return crypto.subtle.decrypt({name:"AES-GCM",iv:t.slice(0,16)},e,t.slice(16))}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createKey = createKey;
|
|
7
|
+
exports.decrypt = decrypt;
|
|
8
|
+
exports.encrypt = encrypt;
|
|
9
|
+
var _nodeBuffer = require("node:buffer");
|
|
10
|
+
var _nodeCrypto = require("node:crypto");
|
|
11
|
+
const u = "chacha20-poly1305",
|
|
12
|
+
g = 32,
|
|
13
|
+
n = 16,
|
|
14
|
+
d = 16,
|
|
15
|
+
e = 64,
|
|
16
|
+
E = 1e5;
|
|
17
|
+
function createKey(t, c) {
|
|
18
|
+
return typeof t == "string" ? (0, _nodeCrypto.createSecretKey)(t, c) : (0, _nodeCrypto.createSecretKey)(t);
|
|
19
|
+
}
|
|
20
|
+
function encrypt(t, c) {
|
|
21
|
+
const r = (0, _nodeCrypto.pbkdf2Sync)(t, (0, _nodeCrypto.randomBytes)(e), E, g, "sha512"),
|
|
22
|
+
s = (0, _nodeCrypto.randomBytes)(n),
|
|
23
|
+
o = (0, _nodeCrypto.randomBytes)(e),
|
|
24
|
+
f = (0, _nodeCrypto.createCipheriv)(u, r, (0, _nodeCrypto.randomBytes)(n)),
|
|
25
|
+
h = _nodeBuffer.Buffer.concat([f.update(c, "utf8"), f.final()]),
|
|
26
|
+
T = f.getAuthTag();
|
|
27
|
+
return _nodeBuffer.Buffer.concat([o, s, T, h]).toString("hex");
|
|
28
|
+
}
|
|
29
|
+
function decrypt(t, c) {
|
|
30
|
+
const r = _nodeBuffer.Buffer.from(c, "hex"),
|
|
31
|
+
s = (0, _nodeCrypto.pbkdf2Sync)(t, r.slice(0, e), E, g, "sha512"),
|
|
32
|
+
o = (0, _nodeCrypto.createDecipheriv)(u, s, r.slice(e, e + n));
|
|
33
|
+
return o.setAuthTag(r.slice(e + n, e + n + d)), o.update(r.slice(e + n + d)) + o.final("utf8");
|
|
34
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { BinaryLike, KeyObject } from "node:crypto";
|
|
2
|
+
/**
|
|
3
|
+
* Creates and returns a new key object containing a secret key for symmetric encryption or \`Hmac\`.
|
|
4
|
+
*
|
|
5
|
+
* @param key - The key to use when creating the \`KeyObject\`.
|
|
6
|
+
* @returns The new \`KeyObject\`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createKey(key: NodeJS.ArrayBufferView): KeyObject;
|
|
9
|
+
/**
|
|
10
|
+
* Creates and returns a new key object containing a secret key for symmetric encryption or \`Hmac\`.
|
|
11
|
+
*
|
|
12
|
+
* @param key - The key to use. If \`key\` is a \`Buffer\`, \`TypedArray\`, or \`DataView\`, the \`encoding\` argument is ignored.
|
|
13
|
+
* @param encoding - The \`encoding\` of the \`key\` string. Must be one of \`'utf8'\`, \`'utf16le'\`, \`'latin1'\`, or \`'base64'\`. Default is \`'utf8'\`.
|
|
14
|
+
* @returns The new \`KeyObject\`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createKey(key: string, encoding: BufferEncoding): KeyObject;
|
|
17
|
+
/**
|
|
18
|
+
* Symmetrically encrypts data using the [ChaCha20-Poly1305](https://en.wikipedia.org/wiki/ChaCha20-Poly1305) cipher.
|
|
19
|
+
*
|
|
20
|
+
* @see https://en.wikipedia.org/wiki/ChaCha20-Poly1305
|
|
21
|
+
*
|
|
22
|
+
* @param secret - The secret key used for encryption.
|
|
23
|
+
* @param plaintext - The data to encrypt.
|
|
24
|
+
* @returns The encrypted data.
|
|
25
|
+
*/
|
|
26
|
+
export declare function encrypt(secret: BinaryLike, plaintext: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Symmetrically decrypts data using the [ChaCha20-Poly1305](https://en.wikipedia.org/wiki/ChaCha20-Poly1305) cipher.
|
|
29
|
+
*
|
|
30
|
+
* @see https://en.wikipedia.org/wiki/ChaCha20-Poly1305
|
|
31
|
+
*
|
|
32
|
+
* @param secret - The secret key used for decryption.
|
|
33
|
+
* @param encrypted - The encrypted data to decrypt.
|
|
34
|
+
* @returns The decrypted data.
|
|
35
|
+
*/
|
|
36
|
+
export declare function decrypt(secret: BinaryLike, encrypted: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Buffer as a}from"node:buffer";import{createCipheriv as _,createDecipheriv as B,createSecretKey as y,pbkdf2Sync as p,randomBytes as i}from"node:crypto";const u="chacha20-poly1305",g=32,n=16,d=16,e=64,E=1e5;export function createKey(t,c){return typeof t=="string"?y(t,c):y(t)}export function encrypt(t,c){const r=p(t,i(e),E,g,"sha512"),s=i(n),o=i(e),f=_(u,r,i(n)),h=a.concat([f.update(c,"utf8"),f.final()]),T=f.getAuthTag();return a.concat([o,s,T,h]).toString("hex")}export function decrypt(t,c){const r=a.from(c,"hex"),s=p(t,r.slice(0,e),E,g,"sha512"),o=B(u,s,r.slice(e,e+n));return o.setAuthTag(r.slice(e+n,e+n+d)),o.update(r.slice(e+n+d))+o.final("utf8")}
|
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ Object.keys(_base).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
-
var _encryption = require("./encryption.cjs");
|
|
17
|
+
var _encryption = require("./encryption.node.cjs");
|
|
18
18
|
Object.keys(_encryption).forEach(function (key) {
|
|
19
19
|
if (key === "default" || key === "__esModule") return;
|
|
20
20
|
if (key in exports && exports[key] === _encryption[key]) return;
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./base-64";export*from"./encryption";export*from"./hex";
|
|
1
|
+
export*from"./base-64";export*from"./encryption.node";export*from"./hex";
|
package/dist/neutral.cjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _base = require("./base-64.cjs");
|
|
7
|
+
Object.keys(_base).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _base[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _base[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _encryption = require("./encryption.cjs");
|
|
18
|
+
Object.keys(_encryption).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _encryption[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _encryption[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _hex = require("./hex.cjs");
|
|
29
|
+
Object.keys(_hex).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _hex[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _hex[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
package/dist/neutral.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./base-64";export*from"./encryption";export*from"./hex";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/crypto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing cryptographic utilities used by Storm Software.",
|
|
6
6
|
"repository": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
},
|
|
11
11
|
"private": false,
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@stryke/convert": "^0.
|
|
13
|
+
"@stryke/convert": "^0.6.0",
|
|
14
14
|
"@stryke/type-checks": "^0.3.9"
|
|
15
15
|
},
|
|
16
|
+
"devDependencies": { "@types/node": "^22.14.0" },
|
|
16
17
|
"publishConfig": { "access": "public" },
|
|
17
|
-
"devDependencies": {},
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"files": ["dist/**/*"],
|
|
20
20
|
"homepage": "https://stormsoftware.com",
|
|
@@ -58,6 +58,20 @@
|
|
|
58
58
|
}
|
|
59
59
|
],
|
|
60
60
|
"exports": {
|
|
61
|
+
"./neutral": {
|
|
62
|
+
"import": {
|
|
63
|
+
"types": "./dist/neutral.d.ts",
|
|
64
|
+
"default": "./dist/neutral.mjs"
|
|
65
|
+
},
|
|
66
|
+
"require": {
|
|
67
|
+
"types": "./dist/neutral.d.ts",
|
|
68
|
+
"default": "./dist/neutral.cjs"
|
|
69
|
+
},
|
|
70
|
+
"default": {
|
|
71
|
+
"types": "./dist/neutral.d.ts",
|
|
72
|
+
"default": "./dist/neutral.mjs"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
61
75
|
"./index": {
|
|
62
76
|
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
|
|
63
77
|
"require": {
|
|
@@ -85,6 +99,20 @@
|
|
|
85
99
|
"default": "./dist/encryption.mjs"
|
|
86
100
|
}
|
|
87
101
|
},
|
|
102
|
+
"./encryption.node": {
|
|
103
|
+
"import": {
|
|
104
|
+
"types": "./dist/encryption.node.d.ts",
|
|
105
|
+
"default": "./dist/encryption.node.mjs"
|
|
106
|
+
},
|
|
107
|
+
"require": {
|
|
108
|
+
"types": "./dist/encryption.node.d.ts",
|
|
109
|
+
"default": "./dist/encryption.node.cjs"
|
|
110
|
+
},
|
|
111
|
+
"default": {
|
|
112
|
+
"types": "./dist/encryption.node.d.ts",
|
|
113
|
+
"default": "./dist/encryption.node.mjs"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
88
116
|
"./base-64": {
|
|
89
117
|
"import": {
|
|
90
118
|
"types": "./dist/base-64.d.ts",
|
|
@@ -112,5 +140,5 @@
|
|
|
112
140
|
"main": "./dist/index.cjs",
|
|
113
141
|
"module": "./dist/index.mjs",
|
|
114
142
|
"types": "./dist/index.d.ts",
|
|
115
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "73e8ba817597f78f119c7924d64e609e72f158c4"
|
|
116
144
|
}
|