@talismn/keyring 0.0.0-pr1866-20250409123927 → 0.1.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.
|
@@ -47,17 +47,13 @@ const getAccountPlatform = account => {
|
|
|
47
47
|
// Derive a key generated with PBKDF2 that will be used for AES-GCM encryption
|
|
48
48
|
const deriveKey = async (password, salt) => {
|
|
49
49
|
// Deriving 32-byte key using PBKDF2 with 100000 iterations and SHA-256
|
|
50
|
-
const keyMaterial = await crypto.subtle.importKey("raw", new TextEncoder().encode(password), "PBKDF2", false, ["
|
|
51
|
-
|
|
52
|
-
// NOTE: react-native-quick-crypto (our `global.crypto` polyfill on Talisman mobile) doesn't support `crypto.subtle.deriveKey`.
|
|
53
|
-
// But, we can work around this by using `crypto.subtle.deriveBits` and `crypto.subtle.importKey`, which when used together
|
|
54
|
-
// can provide the same functionality as `crypto.subtle.deriveKey`.
|
|
55
|
-
return crypto.subtle.importKey("raw", await crypto.subtle.deriveBits({
|
|
50
|
+
const keyMaterial = await crypto.subtle.importKey("raw", new TextEncoder().encode(password), "PBKDF2", false, ["deriveKey"]);
|
|
51
|
+
return crypto.subtle.deriveKey({
|
|
56
52
|
name: "PBKDF2",
|
|
57
53
|
salt,
|
|
58
|
-
iterations:
|
|
54
|
+
iterations: 100000,
|
|
59
55
|
hash: "SHA-256"
|
|
60
|
-
}, keyMaterial,
|
|
56
|
+
}, keyMaterial, {
|
|
61
57
|
name: "AES-GCM",
|
|
62
58
|
length: 256
|
|
63
59
|
}, false, ["encrypt", "decrypt"]);
|
|
@@ -47,17 +47,13 @@ const getAccountPlatform = account => {
|
|
|
47
47
|
// Derive a key generated with PBKDF2 that will be used for AES-GCM encryption
|
|
48
48
|
const deriveKey = async (password, salt) => {
|
|
49
49
|
// Deriving 32-byte key using PBKDF2 with 100000 iterations and SHA-256
|
|
50
|
-
const keyMaterial = await crypto.subtle.importKey("raw", new TextEncoder().encode(password), "PBKDF2", false, ["
|
|
51
|
-
|
|
52
|
-
// NOTE: react-native-quick-crypto (our `global.crypto` polyfill on Talisman mobile) doesn't support `crypto.subtle.deriveKey`.
|
|
53
|
-
// But, we can work around this by using `crypto.subtle.deriveBits` and `crypto.subtle.importKey`, which when used together
|
|
54
|
-
// can provide the same functionality as `crypto.subtle.deriveKey`.
|
|
55
|
-
return crypto.subtle.importKey("raw", await crypto.subtle.deriveBits({
|
|
50
|
+
const keyMaterial = await crypto.subtle.importKey("raw", new TextEncoder().encode(password), "PBKDF2", false, ["deriveKey"]);
|
|
51
|
+
return crypto.subtle.deriveKey({
|
|
56
52
|
name: "PBKDF2",
|
|
57
53
|
salt,
|
|
58
|
-
iterations:
|
|
54
|
+
iterations: 100000,
|
|
59
55
|
hash: "SHA-256"
|
|
60
|
-
}, keyMaterial,
|
|
56
|
+
}, keyMaterial, {
|
|
61
57
|
name: "AES-GCM",
|
|
62
58
|
length: 256
|
|
63
59
|
}, false, ["encrypt", "decrypt"]);
|
|
@@ -45,17 +45,13 @@ const getAccountPlatform = account => {
|
|
|
45
45
|
// Derive a key generated with PBKDF2 that will be used for AES-GCM encryption
|
|
46
46
|
const deriveKey = async (password, salt) => {
|
|
47
47
|
// Deriving 32-byte key using PBKDF2 with 100000 iterations and SHA-256
|
|
48
|
-
const keyMaterial = await crypto.subtle.importKey("raw", new TextEncoder().encode(password), "PBKDF2", false, ["
|
|
49
|
-
|
|
50
|
-
// NOTE: react-native-quick-crypto (our `global.crypto` polyfill on Talisman mobile) doesn't support `crypto.subtle.deriveKey`.
|
|
51
|
-
// But, we can work around this by using `crypto.subtle.deriveBits` and `crypto.subtle.importKey`, which when used together
|
|
52
|
-
// can provide the same functionality as `crypto.subtle.deriveKey`.
|
|
53
|
-
return crypto.subtle.importKey("raw", await crypto.subtle.deriveBits({
|
|
48
|
+
const keyMaterial = await crypto.subtle.importKey("raw", new TextEncoder().encode(password), "PBKDF2", false, ["deriveKey"]);
|
|
49
|
+
return crypto.subtle.deriveKey({
|
|
54
50
|
name: "PBKDF2",
|
|
55
51
|
salt,
|
|
56
|
-
iterations:
|
|
52
|
+
iterations: 100000,
|
|
57
53
|
hash: "SHA-256"
|
|
58
|
-
}, keyMaterial,
|
|
54
|
+
}, keyMaterial, {
|
|
59
55
|
name: "AES-GCM",
|
|
60
56
|
length: 256
|
|
61
57
|
}, false, ["encrypt", "decrypt"]);
|