@strapi/data-transfer 5.31.1 → 5.31.3
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/utils/encryption/decrypt.js +6 -6
- package/dist/utils/encryption/decrypt.js.map +1 -1
- package/dist/utils/encryption/decrypt.mjs +6 -6
- package/dist/utils/encryption/decrypt.mjs.map +1 -1
- package/dist/utils/encryption/encrypt.js +6 -6
- package/dist/utils/encryption/encrypt.js.map +1 -1
- package/dist/utils/encryption/encrypt.mjs +6 -6
- package/dist/utils/encryption/encrypt.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -13,20 +13,20 @@ const getDecryptionStrategy = (algorithm)=>{
|
|
|
13
13
|
},
|
|
14
14
|
aes128 (key) {
|
|
15
15
|
const hashedKey = crypto.scryptSync(key, '', 32);
|
|
16
|
-
const initVector = hashedKey.
|
|
17
|
-
const securityKey = hashedKey.
|
|
16
|
+
const initVector = hashedKey.subarray(16);
|
|
17
|
+
const securityKey = hashedKey.subarray(0, 16);
|
|
18
18
|
return crypto.createDecipheriv(algorithm, securityKey, initVector);
|
|
19
19
|
},
|
|
20
20
|
aes192 (key) {
|
|
21
21
|
const hashedKey = crypto.scryptSync(key, '', 40);
|
|
22
|
-
const initVector = hashedKey.
|
|
23
|
-
const securityKey = hashedKey.
|
|
22
|
+
const initVector = hashedKey.subarray(24);
|
|
23
|
+
const securityKey = hashedKey.subarray(0, 24);
|
|
24
24
|
return crypto.createDecipheriv(algorithm, securityKey, initVector);
|
|
25
25
|
},
|
|
26
26
|
aes256 (key) {
|
|
27
27
|
const hashedKey = crypto.scryptSync(key, '', 48);
|
|
28
|
-
const initVector = hashedKey.
|
|
29
|
-
const securityKey = hashedKey.
|
|
28
|
+
const initVector = hashedKey.subarray(32);
|
|
29
|
+
const securityKey = hashedKey.subarray(0, 32);
|
|
30
30
|
return crypto.createDecipheriv(algorithm, securityKey, initVector);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decrypt.js","sources":["../../../src/utils/encryption/decrypt.ts"],"sourcesContent":["import { Decipheriv, scryptSync, CipherKey, BinaryLike, createDecipheriv } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../../types';\n\n// different key values depending on algorithm chosen\nconst getDecryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.
|
|
1
|
+
{"version":3,"file":"decrypt.js","sources":["../../../src/utils/encryption/decrypt.ts"],"sourcesContent":["import { Decipheriv, scryptSync, CipherKey, BinaryLike, createDecipheriv } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../../types';\n\n// different key values depending on algorithm chosen\nconst getDecryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.subarray(16);\n const securityKey: CipherKey = hashedKey.subarray(0, 16);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes192(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 40);\n const initVector: BinaryLike | null = hashedKey.subarray(24);\n const securityKey: CipherKey = hashedKey.subarray(0, 24);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes256(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 48);\n const initVector: BinaryLike | null = hashedKey.subarray(32);\n const securityKey: CipherKey = hashedKey.subarray(0, 32);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n };\n\n return strategies[algorithm];\n};\n\n/**\n * It creates a cipher instance used for decryption\n *\n * @param key - The decryption key\n * @param algorithm - The algorithm to use to create the Cipher\n *\n * @returns A {@link Decipheriv} instance created with the given key & algorithm\n */\nexport const createDecryptionCipher = (\n key: string,\n algorithm: Algorithm = 'aes-128-ecb'\n): Decipheriv => {\n return getDecryptionStrategy(algorithm)(key);\n};\n"],"names":["getDecryptionStrategy","algorithm","strategies","key","hashedKey","scryptSync","initVector","securityKey","createDecipheriv","aes128","subarray","aes192","aes256","createDecryptionCipher"],"mappings":";;;;AAGA;AACA,MAAMA,wBAAwB,CAACC,SAAAA,GAAAA;AAC7B,IAAA,MAAMC,UAAyB,GAAA;AAC7B,QAAA,aAAA,CAAA,CAAcC,GAAW,EAAA;YACvB,MAAMC,SAAAA,GAAYC,iBAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;AACtC,YAAA,MAAMG,UAAgC,GAAA,IAAA;AACtC,YAAA,MAAMC,WAAyBH,GAAAA,SAAAA;YAC/B,OAAOI,uBAAAA,CAAiBP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAClD,SAAA;AACAG,QAAAA,MAAAA,CAAAA,CAAON,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,uBAAAA,CAAiBP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAClD,SAAA;AACAK,QAAAA,MAAAA,CAAAA,CAAOR,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,uBAAAA,CAAiBP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAClD,SAAA;AACAM,QAAAA,MAAAA,CAAAA,CAAOT,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,uBAAAA,CAAiBP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAClD;AACF,KAAA;IAEA,OAAOJ,UAAU,CAACD,SAAU,CAAA;AAC9B,CAAA;AAEA;;;;;;;AAOC,IACYY,MAAAA,sBAAAA,GAAyB,CACpCV,GAAAA,EACAF,YAAuB,aAAa,GAAA;AAEpC,IAAA,OAAOD,sBAAsBC,SAAWE,CAAAA,CAAAA,GAAAA,CAAAA;AAC1C;;;;"}
|
|
@@ -11,20 +11,20 @@ const getDecryptionStrategy = (algorithm)=>{
|
|
|
11
11
|
},
|
|
12
12
|
aes128 (key) {
|
|
13
13
|
const hashedKey = scryptSync(key, '', 32);
|
|
14
|
-
const initVector = hashedKey.
|
|
15
|
-
const securityKey = hashedKey.
|
|
14
|
+
const initVector = hashedKey.subarray(16);
|
|
15
|
+
const securityKey = hashedKey.subarray(0, 16);
|
|
16
16
|
return createDecipheriv(algorithm, securityKey, initVector);
|
|
17
17
|
},
|
|
18
18
|
aes192 (key) {
|
|
19
19
|
const hashedKey = scryptSync(key, '', 40);
|
|
20
|
-
const initVector = hashedKey.
|
|
21
|
-
const securityKey = hashedKey.
|
|
20
|
+
const initVector = hashedKey.subarray(24);
|
|
21
|
+
const securityKey = hashedKey.subarray(0, 24);
|
|
22
22
|
return createDecipheriv(algorithm, securityKey, initVector);
|
|
23
23
|
},
|
|
24
24
|
aes256 (key) {
|
|
25
25
|
const hashedKey = scryptSync(key, '', 48);
|
|
26
|
-
const initVector = hashedKey.
|
|
27
|
-
const securityKey = hashedKey.
|
|
26
|
+
const initVector = hashedKey.subarray(32);
|
|
27
|
+
const securityKey = hashedKey.subarray(0, 32);
|
|
28
28
|
return createDecipheriv(algorithm, securityKey, initVector);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decrypt.mjs","sources":["../../../src/utils/encryption/decrypt.ts"],"sourcesContent":["import { Decipheriv, scryptSync, CipherKey, BinaryLike, createDecipheriv } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../../types';\n\n// different key values depending on algorithm chosen\nconst getDecryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.
|
|
1
|
+
{"version":3,"file":"decrypt.mjs","sources":["../../../src/utils/encryption/decrypt.ts"],"sourcesContent":["import { Decipheriv, scryptSync, CipherKey, BinaryLike, createDecipheriv } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../../types';\n\n// different key values depending on algorithm chosen\nconst getDecryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.subarray(16);\n const securityKey: CipherKey = hashedKey.subarray(0, 16);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes192(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 40);\n const initVector: BinaryLike | null = hashedKey.subarray(24);\n const securityKey: CipherKey = hashedKey.subarray(0, 24);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n aes256(key: string): Decipheriv {\n const hashedKey = scryptSync(key, '', 48);\n const initVector: BinaryLike | null = hashedKey.subarray(32);\n const securityKey: CipherKey = hashedKey.subarray(0, 32);\n return createDecipheriv(algorithm, securityKey, initVector);\n },\n };\n\n return strategies[algorithm];\n};\n\n/**\n * It creates a cipher instance used for decryption\n *\n * @param key - The decryption key\n * @param algorithm - The algorithm to use to create the Cipher\n *\n * @returns A {@link Decipheriv} instance created with the given key & algorithm\n */\nexport const createDecryptionCipher = (\n key: string,\n algorithm: Algorithm = 'aes-128-ecb'\n): Decipheriv => {\n return getDecryptionStrategy(algorithm)(key);\n};\n"],"names":["getDecryptionStrategy","algorithm","strategies","key","hashedKey","scryptSync","initVector","securityKey","createDecipheriv","aes128","subarray","aes192","aes256","createDecryptionCipher"],"mappings":";;AAGA;AACA,MAAMA,wBAAwB,CAACC,SAAAA,GAAAA;AAC7B,IAAA,MAAMC,UAAyB,GAAA;AAC7B,QAAA,aAAA,CAAA,CAAcC,GAAW,EAAA;YACvB,MAAMC,SAAAA,GAAYC,UAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;AACtC,YAAA,MAAMG,UAAgC,GAAA,IAAA;AACtC,YAAA,MAAMC,WAAyBH,GAAAA,SAAAA;YAC/B,OAAOI,gBAAAA,CAAiBP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAClD,SAAA;AACAG,QAAAA,MAAAA,CAAAA,CAAON,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,UAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,gBAAAA,CAAiBP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAClD,SAAA;AACAK,QAAAA,MAAAA,CAAAA,CAAOR,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,UAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,gBAAAA,CAAiBP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAClD,SAAA;AACAM,QAAAA,MAAAA,CAAAA,CAAOT,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,UAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,gBAAAA,CAAiBP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAClD;AACF,KAAA;IAEA,OAAOJ,UAAU,CAACD,SAAU,CAAA;AAC9B,CAAA;AAEA;;;;;;;AAOC,IACYY,MAAAA,sBAAAA,GAAyB,CACpCV,GAAAA,EACAF,YAAuB,aAAa,GAAA;AAEpC,IAAA,OAAOD,sBAAsBC,SAAWE,CAAAA,CAAAA,GAAAA,CAAAA;AAC1C;;;;"}
|
|
@@ -13,20 +13,20 @@ const getEncryptionStrategy = (algorithm)=>{
|
|
|
13
13
|
},
|
|
14
14
|
aes128 (key) {
|
|
15
15
|
const hashedKey = crypto.scryptSync(key, '', 32);
|
|
16
|
-
const initVector = hashedKey.
|
|
17
|
-
const securityKey = hashedKey.
|
|
16
|
+
const initVector = hashedKey.subarray(16);
|
|
17
|
+
const securityKey = hashedKey.subarray(0, 16);
|
|
18
18
|
return crypto.createCipheriv(algorithm, securityKey, initVector);
|
|
19
19
|
},
|
|
20
20
|
aes192 (key) {
|
|
21
21
|
const hashedKey = crypto.scryptSync(key, '', 40);
|
|
22
|
-
const initVector = hashedKey.
|
|
23
|
-
const securityKey = hashedKey.
|
|
22
|
+
const initVector = hashedKey.subarray(24);
|
|
23
|
+
const securityKey = hashedKey.subarray(0, 24);
|
|
24
24
|
return crypto.createCipheriv(algorithm, securityKey, initVector);
|
|
25
25
|
},
|
|
26
26
|
aes256 (key) {
|
|
27
27
|
const hashedKey = crypto.scryptSync(key, '', 48);
|
|
28
|
-
const initVector = hashedKey.
|
|
29
|
-
const securityKey = hashedKey.
|
|
28
|
+
const initVector = hashedKey.subarray(32);
|
|
29
|
+
const securityKey = hashedKey.subarray(0, 32);
|
|
30
30
|
return crypto.createCipheriv(algorithm, securityKey, initVector);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encrypt.js","sources":["../../../src/utils/encryption/encrypt.ts"],"sourcesContent":["import { createCipheriv, Cipheriv, scryptSync, CipherKey, BinaryLike } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../../types';\n\n// different key values depending on algorithm chosen\nconst getEncryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.
|
|
1
|
+
{"version":3,"file":"encrypt.js","sources":["../../../src/utils/encryption/encrypt.ts"],"sourcesContent":["import { createCipheriv, Cipheriv, scryptSync, CipherKey, BinaryLike } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../../types';\n\n// different key values depending on algorithm chosen\nconst getEncryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.subarray(16);\n const securityKey: CipherKey = hashedKey.subarray(0, 16);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes192(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 40);\n const initVector: BinaryLike | null = hashedKey.subarray(24);\n const securityKey: CipherKey = hashedKey.subarray(0, 24);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes256(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 48);\n const initVector: BinaryLike | null = hashedKey.subarray(32);\n const securityKey: CipherKey = hashedKey.subarray(0, 32);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n };\n\n return strategies[algorithm];\n};\n\n/**\n * It creates a cipher instance used for encryption\n *\n * @param key - The encryption key\n * @param algorithm - The algorithm to use to create the Cipher\n *\n * @returns A {@link Cipheriv} instance created with the given key & algorithm\n */\nexport const createEncryptionCipher = (\n key: string,\n algorithm: Algorithm = 'aes-128-ecb'\n): Cipheriv => {\n return getEncryptionStrategy(algorithm)(key);\n};\n"],"names":["getEncryptionStrategy","algorithm","strategies","key","hashedKey","scryptSync","initVector","securityKey","createCipheriv","aes128","subarray","aes192","aes256","createEncryptionCipher"],"mappings":";;;;AAGA;AACA,MAAMA,wBAAwB,CAACC,SAAAA,GAAAA;AAC7B,IAAA,MAAMC,UAAyB,GAAA;AAC7B,QAAA,aAAA,CAAA,CAAcC,GAAW,EAAA;YACvB,MAAMC,SAAAA,GAAYC,iBAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;AACtC,YAAA,MAAMG,UAAgC,GAAA,IAAA;AACtC,YAAA,MAAMC,WAAyBH,GAAAA,SAAAA;YAC/B,OAAOI,qBAAAA,CAAeP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAChD,SAAA;AACAG,QAAAA,MAAAA,CAAAA,CAAON,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,qBAAAA,CAAeP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAChD,SAAA;AACAK,QAAAA,MAAAA,CAAAA,CAAOR,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,qBAAAA,CAAeP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAChD,SAAA;AACAM,QAAAA,MAAAA,CAAAA,CAAOT,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,iBAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,qBAAAA,CAAeP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAChD;AACF,KAAA;IAEA,OAAOJ,UAAU,CAACD,SAAU,CAAA;AAC9B,CAAA;AAEA;;;;;;;AAOC,IACYY,MAAAA,sBAAAA,GAAyB,CACpCV,GAAAA,EACAF,YAAuB,aAAa,GAAA;AAEpC,IAAA,OAAOD,sBAAsBC,SAAWE,CAAAA,CAAAA,GAAAA,CAAAA;AAC1C;;;;"}
|
|
@@ -11,20 +11,20 @@ const getEncryptionStrategy = (algorithm)=>{
|
|
|
11
11
|
},
|
|
12
12
|
aes128 (key) {
|
|
13
13
|
const hashedKey = scryptSync(key, '', 32);
|
|
14
|
-
const initVector = hashedKey.
|
|
15
|
-
const securityKey = hashedKey.
|
|
14
|
+
const initVector = hashedKey.subarray(16);
|
|
15
|
+
const securityKey = hashedKey.subarray(0, 16);
|
|
16
16
|
return createCipheriv(algorithm, securityKey, initVector);
|
|
17
17
|
},
|
|
18
18
|
aes192 (key) {
|
|
19
19
|
const hashedKey = scryptSync(key, '', 40);
|
|
20
|
-
const initVector = hashedKey.
|
|
21
|
-
const securityKey = hashedKey.
|
|
20
|
+
const initVector = hashedKey.subarray(24);
|
|
21
|
+
const securityKey = hashedKey.subarray(0, 24);
|
|
22
22
|
return createCipheriv(algorithm, securityKey, initVector);
|
|
23
23
|
},
|
|
24
24
|
aes256 (key) {
|
|
25
25
|
const hashedKey = scryptSync(key, '', 48);
|
|
26
|
-
const initVector = hashedKey.
|
|
27
|
-
const securityKey = hashedKey.
|
|
26
|
+
const initVector = hashedKey.subarray(32);
|
|
27
|
+
const securityKey = hashedKey.subarray(0, 32);
|
|
28
28
|
return createCipheriv(algorithm, securityKey, initVector);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encrypt.mjs","sources":["../../../src/utils/encryption/encrypt.ts"],"sourcesContent":["import { createCipheriv, Cipheriv, scryptSync, CipherKey, BinaryLike } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../../types';\n\n// different key values depending on algorithm chosen\nconst getEncryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.
|
|
1
|
+
{"version":3,"file":"encrypt.mjs","sources":["../../../src/utils/encryption/encrypt.ts"],"sourcesContent":["import { createCipheriv, Cipheriv, scryptSync, CipherKey, BinaryLike } from 'crypto';\nimport { EncryptionStrategy, Strategies, Algorithm } from '../../../types';\n\n// different key values depending on algorithm chosen\nconst getEncryptionStrategy = (algorithm: Algorithm): EncryptionStrategy => {\n const strategies: Strategies = {\n 'aes-128-ecb'(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 16);\n const initVector: BinaryLike | null = null;\n const securityKey: CipherKey = hashedKey;\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes128(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 32);\n const initVector: BinaryLike | null = hashedKey.subarray(16);\n const securityKey: CipherKey = hashedKey.subarray(0, 16);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes192(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 40);\n const initVector: BinaryLike | null = hashedKey.subarray(24);\n const securityKey: CipherKey = hashedKey.subarray(0, 24);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n aes256(key: string): Cipheriv {\n const hashedKey = scryptSync(key, '', 48);\n const initVector: BinaryLike | null = hashedKey.subarray(32);\n const securityKey: CipherKey = hashedKey.subarray(0, 32);\n return createCipheriv(algorithm, securityKey, initVector);\n },\n };\n\n return strategies[algorithm];\n};\n\n/**\n * It creates a cipher instance used for encryption\n *\n * @param key - The encryption key\n * @param algorithm - The algorithm to use to create the Cipher\n *\n * @returns A {@link Cipheriv} instance created with the given key & algorithm\n */\nexport const createEncryptionCipher = (\n key: string,\n algorithm: Algorithm = 'aes-128-ecb'\n): Cipheriv => {\n return getEncryptionStrategy(algorithm)(key);\n};\n"],"names":["getEncryptionStrategy","algorithm","strategies","key","hashedKey","scryptSync","initVector","securityKey","createCipheriv","aes128","subarray","aes192","aes256","createEncryptionCipher"],"mappings":";;AAGA;AACA,MAAMA,wBAAwB,CAACC,SAAAA,GAAAA;AAC7B,IAAA,MAAMC,UAAyB,GAAA;AAC7B,QAAA,aAAA,CAAA,CAAcC,GAAW,EAAA;YACvB,MAAMC,SAAAA,GAAYC,UAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;AACtC,YAAA,MAAMG,UAAgC,GAAA,IAAA;AACtC,YAAA,MAAMC,WAAyBH,GAAAA,SAAAA;YAC/B,OAAOI,cAAAA,CAAeP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAChD,SAAA;AACAG,QAAAA,MAAAA,CAAAA,CAAON,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,UAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,cAAAA,CAAeP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAChD,SAAA;AACAK,QAAAA,MAAAA,CAAAA,CAAOR,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,UAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,cAAAA,CAAeP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAChD,SAAA;AACAM,QAAAA,MAAAA,CAAAA,CAAOT,GAAW,EAAA;YAChB,MAAMC,SAAAA,GAAYC,UAAWF,CAAAA,GAAAA,EAAK,EAAI,EAAA,EAAA,CAAA;YACtC,MAAMG,UAAAA,GAAgCF,SAAUM,CAAAA,QAAQ,CAAC,EAAA,CAAA;AACzD,YAAA,MAAMH,WAAyBH,GAAAA,SAAAA,CAAUM,QAAQ,CAAC,CAAG,EAAA,EAAA,CAAA;YACrD,OAAOF,cAAAA,CAAeP,WAAWM,WAAaD,EAAAA,UAAAA,CAAAA;AAChD;AACF,KAAA;IAEA,OAAOJ,UAAU,CAACD,SAAU,CAAA;AAC9B,CAAA;AAEA;;;;;;;AAOC,IACYY,MAAAA,sBAAAA,GAAyB,CACpCV,GAAAA,EACAF,YAAuB,aAAa,GAAA;AAEpC,IAAA,OAAOD,sBAAsBC,SAAWE,CAAAA,CAAAA,GAAAA,CAAAA;AAC1C;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/data-transfer",
|
|
3
|
-
"version": "5.31.
|
|
3
|
+
"version": "5.31.3",
|
|
4
4
|
"description": "Data transfer capabilities for Strapi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"watch": "run -T rollup -c -w"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@strapi/logger": "5.31.
|
|
46
|
-
"@strapi/types": "5.31.
|
|
47
|
-
"@strapi/utils": "5.31.
|
|
45
|
+
"@strapi/logger": "5.31.3",
|
|
46
|
+
"@strapi/types": "5.31.3",
|
|
47
|
+
"@strapi/utils": "5.31.3",
|
|
48
48
|
"chalk": "4.1.2",
|
|
49
49
|
"cli-table3": "0.6.5",
|
|
50
50
|
"commander": "8.3.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"ws": "8.17.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@strapi/database": "5.31.
|
|
64
|
+
"@strapi/database": "5.31.3",
|
|
65
65
|
"@types/fs-extra": "11.0.4",
|
|
66
66
|
"@types/jest": "29.5.2",
|
|
67
67
|
"@types/koa": "2.13.4",
|