upload build
This commit is contained in:
parent
57cbb1f62a
commit
414fbdd9ae
11 changed files with 164 additions and 82 deletions
51
-/node.js
51
-/node.js
|
|
@ -18810,6 +18810,26 @@ var $;
|
|||
$.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public;
|
||||
})($ || ($ = {}));
|
||||
|
||||
;
|
||||
"use strict";
|
||||
var $;
|
||||
(function ($) {
|
||||
async function $mol_crypto_sacred_pass(pass, salt) {
|
||||
const raw = await $mol_crypto_native.subtle.importKey("raw", $mol_charset_encode(pass), "PBKDF2", false, ["deriveKey"]).catch($mol_crypto_restack);
|
||||
const hard = await $mol_crypto_native.subtle.deriveKey({
|
||||
name: "PBKDF2",
|
||||
salt,
|
||||
iterations: 10_000,
|
||||
hash: "SHA-256",
|
||||
}, raw, {
|
||||
name: 'AES-CBC',
|
||||
length: 128,
|
||||
}, Boolean('extractable'), ['encrypt', 'decrypt']).catch($mol_crypto_restack);
|
||||
return $mol_crypto_sacred.from_native(hard);
|
||||
}
|
||||
$.$mol_crypto_sacred_pass = $mol_crypto_sacred_pass;
|
||||
})($ || ($ = {}));
|
||||
|
||||
;
|
||||
"use strict";
|
||||
|
||||
|
|
@ -18868,13 +18888,13 @@ var $;
|
|||
if (!serial)
|
||||
return null;
|
||||
try {
|
||||
const pack = $mol_base64_decode(serial);
|
||||
const closed = pack.slice(0, this.key_size());
|
||||
const salt = $mol_crypto_hash(pack.slice(this.key_size())).slice(0, 16);
|
||||
const pass = this.password();
|
||||
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt);
|
||||
const opened = $mol_wire_sync(secret).decrypt(closed, salt);
|
||||
return $mol_charset_decode(opened);
|
||||
const password = this.password();
|
||||
const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
|
||||
const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
|
||||
const data = $mol_base64_decode(serial);
|
||||
const salt = $mol_crypto_hash(app).slice(0, 16);
|
||||
const closed = $mol_wire_sync(secret).decrypt(data, salt);
|
||||
return $mol_charset_decode(closed);
|
||||
}
|
||||
catch (error) {
|
||||
$mol_fail_log(error);
|
||||
|
|
@ -18882,16 +18902,13 @@ var $;
|
|||
}
|
||||
}
|
||||
key_export() {
|
||||
const pass = this.password();
|
||||
const recall = $mol_crypto_salt();
|
||||
const salt = $mol_crypto_hash(recall).slice(0, 16);
|
||||
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt);
|
||||
const open = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString());
|
||||
const closed = new Uint8Array($mol_wire_sync(secret).encrypt(open, salt));
|
||||
const pack = new Uint8Array(this.key_size() + recall.byteLength);
|
||||
pack.set(closed, 0);
|
||||
pack.set(recall, this.key_size());
|
||||
return this.$.$mol_base64_encode(pack);
|
||||
const password = this.password();
|
||||
const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
|
||||
const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
|
||||
const data = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString());
|
||||
const salt = $mol_crypto_hash(app).slice(0, 16);
|
||||
const closed = $mol_wire_sync(secret).encrypt(data, salt);
|
||||
return $mol_base64_encode(closed);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -18801,6 +18801,26 @@ var $;
|
|||
$.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public;
|
||||
})($ || ($ = {}));
|
||||
|
||||
;
|
||||
"use strict";
|
||||
var $;
|
||||
(function ($) {
|
||||
async function $mol_crypto_sacred_pass(pass, salt) {
|
||||
const raw = await $mol_crypto_native.subtle.importKey("raw", $mol_charset_encode(pass), "PBKDF2", false, ["deriveKey"]).catch($mol_crypto_restack);
|
||||
const hard = await $mol_crypto_native.subtle.deriveKey({
|
||||
name: "PBKDF2",
|
||||
salt,
|
||||
iterations: 10_000,
|
||||
hash: "SHA-256",
|
||||
}, raw, {
|
||||
name: 'AES-CBC',
|
||||
length: 128,
|
||||
}, Boolean('extractable'), ['encrypt', 'decrypt']).catch($mol_crypto_restack);
|
||||
return $mol_crypto_sacred.from_native(hard);
|
||||
}
|
||||
$.$mol_crypto_sacred_pass = $mol_crypto_sacred_pass;
|
||||
})($ || ($ = {}));
|
||||
|
||||
;
|
||||
"use strict";
|
||||
|
||||
|
|
@ -18859,13 +18879,13 @@ var $;
|
|||
if (!serial)
|
||||
return null;
|
||||
try {
|
||||
const pack = $mol_base64_decode(serial);
|
||||
const closed = pack.slice(0, this.key_size());
|
||||
const salt = $mol_crypto_hash(pack.slice(this.key_size())).slice(0, 16);
|
||||
const pass = this.password();
|
||||
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt);
|
||||
const opened = $mol_wire_sync(secret).decrypt(closed, salt);
|
||||
return $mol_charset_decode(opened);
|
||||
const password = this.password();
|
||||
const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
|
||||
const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
|
||||
const data = $mol_base64_decode(serial);
|
||||
const salt = $mol_crypto_hash(app).slice(0, 16);
|
||||
const closed = $mol_wire_sync(secret).decrypt(data, salt);
|
||||
return $mol_charset_decode(closed);
|
||||
}
|
||||
catch (error) {
|
||||
$mol_fail_log(error);
|
||||
|
|
@ -18873,16 +18893,13 @@ var $;
|
|||
}
|
||||
}
|
||||
key_export() {
|
||||
const pass = this.password();
|
||||
const recall = $mol_crypto_salt();
|
||||
const salt = $mol_crypto_hash(recall).slice(0, 16);
|
||||
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt);
|
||||
const open = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString());
|
||||
const closed = new Uint8Array($mol_wire_sync(secret).encrypt(open, salt));
|
||||
const pack = new Uint8Array(this.key_size() + recall.byteLength);
|
||||
pack.set(closed, 0);
|
||||
pack.set(recall, this.key_size());
|
||||
return this.$.$mol_base64_encode(pack);
|
||||
const password = this.password();
|
||||
const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
|
||||
const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
|
||||
const data = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString());
|
||||
const salt = $mol_crypto_hash(app).slice(0, 16);
|
||||
const closed = $mol_wire_sync(secret).encrypt(data, salt);
|
||||
return $mol_base64_encode(closed);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
|
|
@ -24553,5 +24570,23 @@ var $;
|
|||
});
|
||||
})($ || ($ = {}));
|
||||
|
||||
;
|
||||
"use strict";
|
||||
var $;
|
||||
(function ($) {
|
||||
$mol_test({
|
||||
async 'Derivation from password'() {
|
||||
const data = new Uint8Array([1, 2, 3]);
|
||||
const salt1 = $mol_crypto_salt();
|
||||
const secret1 = await $mol_crypto_sacred_pass('hello', salt1);
|
||||
const secret2 = await $mol_crypto_sacred_pass('hello', salt1);
|
||||
const salt2 = $mol_crypto_salt();
|
||||
const closed = await secret1.encrypt(data, salt2);
|
||||
const opened = await secret2.decrypt(closed, salt2);
|
||||
$mol_assert_equal(data, opened);
|
||||
},
|
||||
});
|
||||
})($ || ($ = {}));
|
||||
|
||||
|
||||
//# sourceMappingURL=node.test.js.map
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
51
-/web.js
51
-/web.js
|
|
@ -17607,6 +17607,26 @@ var $;
|
|||
$.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public;
|
||||
})($ || ($ = {}));
|
||||
|
||||
;
|
||||
"use strict";
|
||||
var $;
|
||||
(function ($) {
|
||||
async function $mol_crypto_sacred_pass(pass, salt) {
|
||||
const raw = await $mol_crypto_native.subtle.importKey("raw", $mol_charset_encode(pass), "PBKDF2", false, ["deriveKey"]).catch($mol_crypto_restack);
|
||||
const hard = await $mol_crypto_native.subtle.deriveKey({
|
||||
name: "PBKDF2",
|
||||
salt,
|
||||
iterations: 10_000,
|
||||
hash: "SHA-256",
|
||||
}, raw, {
|
||||
name: 'AES-CBC',
|
||||
length: 128,
|
||||
}, Boolean('extractable'), ['encrypt', 'decrypt']).catch($mol_crypto_restack);
|
||||
return $mol_crypto_sacred.from_native(hard);
|
||||
}
|
||||
$.$mol_crypto_sacred_pass = $mol_crypto_sacred_pass;
|
||||
})($ || ($ = {}));
|
||||
|
||||
;
|
||||
"use strict";
|
||||
|
||||
|
|
@ -17665,13 +17685,13 @@ var $;
|
|||
if (!serial)
|
||||
return null;
|
||||
try {
|
||||
const pack = $mol_base64_decode(serial);
|
||||
const closed = pack.slice(0, this.key_size());
|
||||
const salt = $mol_crypto_hash(pack.slice(this.key_size())).slice(0, 16);
|
||||
const pass = this.password();
|
||||
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt);
|
||||
const opened = $mol_wire_sync(secret).decrypt(closed, salt);
|
||||
return $mol_charset_decode(opened);
|
||||
const password = this.password();
|
||||
const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
|
||||
const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
|
||||
const data = $mol_base64_decode(serial);
|
||||
const salt = $mol_crypto_hash(app).slice(0, 16);
|
||||
const closed = $mol_wire_sync(secret).decrypt(data, salt);
|
||||
return $mol_charset_decode(closed);
|
||||
}
|
||||
catch (error) {
|
||||
$mol_fail_log(error);
|
||||
|
|
@ -17679,16 +17699,13 @@ var $;
|
|||
}
|
||||
}
|
||||
key_export() {
|
||||
const pass = this.password();
|
||||
const recall = $mol_charset_encode("");
|
||||
const salt = $mol_crypto_hash(recall).slice(0, 16);
|
||||
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt);
|
||||
const open = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString());
|
||||
const closed = new Uint8Array($mol_wire_sync(secret).encrypt(open, salt));
|
||||
const pack = new Uint8Array(this.key_size() + recall.byteLength);
|
||||
pack.set(closed, 0);
|
||||
pack.set(recall, this.key_size());
|
||||
return this.$.$mol_base64_encode(pack);
|
||||
const password = this.password();
|
||||
const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
|
||||
const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
|
||||
const data = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString());
|
||||
const salt = $mol_crypto_hash(app).slice(0, 16);
|
||||
const closed = $mol_wire_sync(secret).encrypt(data, salt);
|
||||
return $mol_base64_encode(closed);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$hd_canary_app_profile_Export_link_title": "Эта ссылка содержит зашифрованный профиль. Сохраните её в безопасном месте. Используя эту ссылку вы сможете восстановить ваши ваш, если введёте тот же пароль.",
|
||||
"$hd_canary_app_profile_Expot_bid_text": "Ваш профиль хранится в браузере. Чтобы его не потерять или перенести на другое устройство, рекомендуется придумать надёжный пароль для её экспорта.",
|
||||
"$hd_canary_app_profile_Expot_bid_text": "Ваш профиль хранится в браузере. Чтобы его не потерять или перенести на другое устройство, рекомендуется придумать надёжный пароль для его экспорта.",
|
||||
"$hd_canary_app_profile_Iport_descr_text": "Чтобы войти в профиль, введите пароль.\n**Если текущий профиль нигде не сохранен, то он будет потерян навсегда.**",
|
||||
"$hd_canary_app_profile_Password_field_name": "Пароль",
|
||||
"$hd_canary_app_profile_bid_pass_long": "> 7 знаков",
|
||||
|
|
|
|||
|
|
@ -5793,5 +5793,23 @@ var $;
|
|||
});
|
||||
})($ || ($ = {}));
|
||||
|
||||
;
|
||||
"use strict";
|
||||
var $;
|
||||
(function ($) {
|
||||
$mol_test({
|
||||
async 'Derivation from password'() {
|
||||
const data = new Uint8Array([1, 2, 3]);
|
||||
const salt1 = $mol_crypto_salt();
|
||||
const secret1 = await $mol_crypto_sacred_pass('hello', salt1);
|
||||
const secret2 = await $mol_crypto_sacred_pass('hello', salt1);
|
||||
const salt2 = $mol_crypto_salt();
|
||||
const closed = await secret1.encrypt(data, salt2);
|
||||
const opened = await secret2.decrypt(closed, salt2);
|
||||
$mol_assert_equal(data, opened);
|
||||
},
|
||||
});
|
||||
})($ || ($ = {}));
|
||||
|
||||
|
||||
//# sourceMappingURL=web.test.js.map
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$hd_canary_app_profile_title": "Профиль",
|
||||
"$hd_canary_app_profile_bid_pass_long": "> 7 знаков",
|
||||
"$hd_canary_app_profile_Expot_bid_text": "Ваш профиль хранится в браузере. Чтобы его не потерять или перенести на другое устройство, рекомендуется придумать надёжный пароль для её экспорта.",
|
||||
"$hd_canary_app_profile_Expot_bid_text": "Ваш профиль хранится в браузере. Чтобы его не потерять или перенести на другое устройство, рекомендуется придумать надёжный пароль для его экспорта.",
|
||||
"$hd_canary_app_profile_Password_field_name": "Пароль",
|
||||
"$hd_canary_app_profile_Recall_field_name": "Подсказка к паролю",
|
||||
"$hd_canary_app_profile_Export_link_title": "Эта ссылка содержит зашифрованный профиль. Сохраните её в безопасном месте. Используя эту ссылку вы сможете восстановить ваши ваш, если введёте тот же пароль.",
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ namespace $.$$ {
|
|||
@ $mol_action
|
||||
import_switch() {
|
||||
this.$.$hyoo_crus_auth.current($hyoo_crus_auth.from(this.key_new()!))
|
||||
// this.$.$hyoo_crus_auth.current($hyoo_crus_auth.from(this.key_import()!))
|
||||
this.password( '' )
|
||||
this.key_import( null )
|
||||
}
|
||||
|
|
@ -64,15 +63,16 @@ namespace $.$$ {
|
|||
if( !serial ) return null
|
||||
|
||||
try {
|
||||
const pack = $mol_base64_decode( serial )
|
||||
const closed = pack.slice( 0, this.key_size() )
|
||||
const salt = $mol_crypto_hash( pack.slice( this.key_size() ) ).slice( 0, 16 )
|
||||
|
||||
const pass = this.password()
|
||||
const secret = $mol_wire_sync( this.$.$mol_crypto_secret ).pass( pass, salt )
|
||||
const opened = $mol_wire_sync( secret ).decrypt( closed, salt )
|
||||
|
||||
return $mol_charset_decode( opened )
|
||||
const password = this.password()
|
||||
const app = $mol_crypto_hash( $mol_charset_encode( "hd_canary" ) ) // 20 B
|
||||
const secret = $mol_wire_sync( $mol_crypto_sacred_pass )( password, app ) // 16 B
|
||||
|
||||
const data = $mol_base64_decode( serial )
|
||||
const salt = $mol_crypto_hash( app ).slice( 0, 16 )
|
||||
|
||||
const closed = $mol_wire_sync( secret ).decrypt( data, salt ) // 16x B
|
||||
|
||||
return $mol_charset_decode( closed )
|
||||
} catch( error ) {
|
||||
|
||||
$mol_fail_log( error )
|
||||
|
|
@ -85,21 +85,16 @@ namespace $.$$ {
|
|||
@$mol_action
|
||||
@ $mol_mem
|
||||
key_export() {
|
||||
const pass = this.password()
|
||||
// const recall = $mol_charset_encode( this.recall() )
|
||||
const recall = $mol_crypto_salt()
|
||||
|
||||
const salt = $mol_crypto_hash( recall ).slice( 0, 16 )
|
||||
const secret = $mol_wire_sync( this.$.$mol_crypto_secret ).pass( pass, salt )
|
||||
|
||||
const open = this.$.$mol_charset_encode( this.$.$hyoo_crus_auth.current().toString() )
|
||||
const closed = new Uint8Array( $mol_wire_sync( secret ).encrypt( open, salt ) )
|
||||
|
||||
const pack = new Uint8Array( this.key_size() + recall.byteLength )
|
||||
pack.set( closed, 0 )
|
||||
pack.set( recall, this.key_size() )
|
||||
|
||||
return this.$.$mol_base64_encode( pack )
|
||||
const password = this.password()
|
||||
const app = $mol_crypto_hash( $mol_charset_encode( "hd_canary" ) ) // 20 B
|
||||
const secret = $mol_wire_sync( $mol_crypto_sacred_pass )( password, app ) // 16 B
|
||||
|
||||
const data = this.$.$mol_charset_encode( this.$.$hyoo_crus_auth.current().toString() )
|
||||
const salt = $mol_crypto_hash( app ).slice( 0, 16 )
|
||||
|
||||
const closed = $mol_wire_sync( secret ).encrypt( data, salt ) // 16x B
|
||||
|
||||
return $mol_base64_encode( closed )
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue