upload build

This commit is contained in:
koplenov 2025-08-17 19:12:30 +03:00
parent 57cbb1f62a
commit 414fbdd9ae
11 changed files with 164 additions and 82 deletions

View file

@ -18810,6 +18810,26 @@ var $;
$.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public; $.$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"; "use strict";
@ -18868,13 +18888,13 @@ var $;
if (!serial) if (!serial)
return null; return null;
try { try {
const pack = $mol_base64_decode(serial); const password = this.password();
const closed = pack.slice(0, this.key_size()); const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
const salt = $mol_crypto_hash(pack.slice(this.key_size())).slice(0, 16); const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
const pass = this.password(); const data = $mol_base64_decode(serial);
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt); const salt = $mol_crypto_hash(app).slice(0, 16);
const opened = $mol_wire_sync(secret).decrypt(closed, salt); const closed = $mol_wire_sync(secret).decrypt(data, salt);
return $mol_charset_decode(opened); return $mol_charset_decode(closed);
} }
catch (error) { catch (error) {
$mol_fail_log(error); $mol_fail_log(error);
@ -18882,16 +18902,13 @@ var $;
} }
} }
key_export() { key_export() {
const pass = this.password(); const password = this.password();
const recall = $mol_crypto_salt(); const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
const salt = $mol_crypto_hash(recall).slice(0, 16); const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt); const data = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString());
const open = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString()); const salt = $mol_crypto_hash(app).slice(0, 16);
const closed = new Uint8Array($mol_wire_sync(secret).encrypt(open, salt)); const closed = $mol_wire_sync(secret).encrypt(data, salt);
const pack = new Uint8Array(this.key_size() + recall.byteLength); return $mol_base64_encode(closed);
pack.set(closed, 0);
pack.set(recall, this.key_size());
return this.$.$mol_base64_encode(pack);
} }
} }
__decorate([ __decorate([

File diff suppressed because one or more lines are too long

View file

@ -18801,6 +18801,26 @@ var $;
$.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public; $.$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"; "use strict";
@ -18859,13 +18879,13 @@ var $;
if (!serial) if (!serial)
return null; return null;
try { try {
const pack = $mol_base64_decode(serial); const password = this.password();
const closed = pack.slice(0, this.key_size()); const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
const salt = $mol_crypto_hash(pack.slice(this.key_size())).slice(0, 16); const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
const pass = this.password(); const data = $mol_base64_decode(serial);
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt); const salt = $mol_crypto_hash(app).slice(0, 16);
const opened = $mol_wire_sync(secret).decrypt(closed, salt); const closed = $mol_wire_sync(secret).decrypt(data, salt);
return $mol_charset_decode(opened); return $mol_charset_decode(closed);
} }
catch (error) { catch (error) {
$mol_fail_log(error); $mol_fail_log(error);
@ -18873,16 +18893,13 @@ var $;
} }
} }
key_export() { key_export() {
const pass = this.password(); const password = this.password();
const recall = $mol_crypto_salt(); const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
const salt = $mol_crypto_hash(recall).slice(0, 16); const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt); const data = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString());
const open = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString()); const salt = $mol_crypto_hash(app).slice(0, 16);
const closed = new Uint8Array($mol_wire_sync(secret).encrypt(open, salt)); const closed = $mol_wire_sync(secret).encrypt(data, salt);
const pack = new Uint8Array(this.key_size() + recall.byteLength); return $mol_base64_encode(closed);
pack.set(closed, 0);
pack.set(recall, this.key_size());
return this.$.$mol_base64_encode(pack);
} }
} }
__decorate([ __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 //# sourceMappingURL=node.test.js.map

File diff suppressed because one or more lines are too long

View file

@ -17607,6 +17607,26 @@ var $;
$.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public; $.$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"; "use strict";
@ -17665,13 +17685,13 @@ var $;
if (!serial) if (!serial)
return null; return null;
try { try {
const pack = $mol_base64_decode(serial); const password = this.password();
const closed = pack.slice(0, this.key_size()); const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
const salt = $mol_crypto_hash(pack.slice(this.key_size())).slice(0, 16); const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
const pass = this.password(); const data = $mol_base64_decode(serial);
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt); const salt = $mol_crypto_hash(app).slice(0, 16);
const opened = $mol_wire_sync(secret).decrypt(closed, salt); const closed = $mol_wire_sync(secret).decrypt(data, salt);
return $mol_charset_decode(opened); return $mol_charset_decode(closed);
} }
catch (error) { catch (error) {
$mol_fail_log(error); $mol_fail_log(error);
@ -17679,16 +17699,13 @@ var $;
} }
} }
key_export() { key_export() {
const pass = this.password(); const password = this.password();
const recall = $mol_charset_encode(""); const app = $mol_crypto_hash($mol_charset_encode("hd_canary"));
const salt = $mol_crypto_hash(recall).slice(0, 16); const secret = $mol_wire_sync($mol_crypto_sacred_pass)(password, app);
const secret = $mol_wire_sync(this.$.$mol_crypto_secret).pass(pass, salt); const data = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString());
const open = this.$.$mol_charset_encode(this.$.$hyoo_crus_auth.current().toString()); const salt = $mol_crypto_hash(app).slice(0, 16);
const closed = new Uint8Array($mol_wire_sync(secret).encrypt(open, salt)); const closed = $mol_wire_sync(secret).encrypt(data, salt);
const pack = new Uint8Array(this.key_size() + recall.byteLength); return $mol_base64_encode(closed);
pack.set(closed, 0);
pack.set(recall, this.key_size());
return this.$.$mol_base64_encode(pack);
} }
} }
__decorate([ __decorate([

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{ {
"$hd_canary_app_profile_Export_link_title": "Эта ссылка содержит зашифрованный профиль. Сохраните её в безопасном месте. Используя эту ссылку вы сможете восстановить ваши ваш, если введёте тот же пароль.", "$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_Iport_descr_text": "Чтобы войти в профиль, введите пароль.\n**Если текущий профиль нигде не сохранен, то он будет потерян навсегда.**",
"$hd_canary_app_profile_Password_field_name": "Пароль", "$hd_canary_app_profile_Password_field_name": "Пароль",
"$hd_canary_app_profile_bid_pass_long": "> 7 знаков", "$hd_canary_app_profile_bid_pass_long": "> 7 знаков",

View file

@ -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 //# sourceMappingURL=web.test.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{ {
"$hd_canary_app_profile_title": "Профиль", "$hd_canary_app_profile_title": "Профиль",
"$hd_canary_app_profile_bid_pass_long": "> 7 знаков", "$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_Password_field_name": "Пароль",
"$hd_canary_app_profile_Recall_field_name": "Подсказка к паролю", "$hd_canary_app_profile_Recall_field_name": "Подсказка к паролю",
"$hd_canary_app_profile_Export_link_title": "Эта ссылка содержит зашифрованный профиль. Сохраните её в безопасном месте. Используя эту ссылку вы сможете восстановить ваши ваш, если введёте тот же пароль.", "$hd_canary_app_profile_Export_link_title": "Эта ссылка содержит зашифрованный профиль. Сохраните её в безопасном месте. Используя эту ссылку вы сможете восстановить ваши ваш, если введёте тот же пароль.",

View file

@ -29,7 +29,6 @@ namespace $.$$ {
@ $mol_action @ $mol_action
import_switch() { 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_new()!))
// this.$.$hyoo_crus_auth.current($hyoo_crus_auth.from(this.key_import()!))
this.password( '' ) this.password( '' )
this.key_import( null ) this.key_import( null )
} }
@ -64,15 +63,16 @@ namespace $.$$ {
if( !serial ) return null if( !serial ) return null
try { try {
const pack = $mol_base64_decode( serial ) const password = this.password()
const closed = pack.slice( 0, this.key_size() ) const app = $mol_crypto_hash( $mol_charset_encode( "hd_canary" ) ) // 20 B
const salt = $mol_crypto_hash( pack.slice( this.key_size() ) ).slice( 0, 16 ) const secret = $mol_wire_sync( $mol_crypto_sacred_pass )( password, app ) // 16 B
const pass = this.password() const data = $mol_base64_decode( serial )
const secret = $mol_wire_sync( this.$.$mol_crypto_secret ).pass( pass, salt ) const salt = $mol_crypto_hash( app ).slice( 0, 16 )
const opened = $mol_wire_sync( secret ).decrypt( closed, salt )
const closed = $mol_wire_sync( secret ).decrypt( data, salt ) // 16x B
return $mol_charset_decode( opened )
return $mol_charset_decode( closed )
} catch( error ) { } catch( error ) {
$mol_fail_log( error ) $mol_fail_log( error )
@ -85,21 +85,16 @@ namespace $.$$ {
@$mol_action @$mol_action
@ $mol_mem @ $mol_mem
key_export() { key_export() {
const pass = this.password() const password = this.password()
// const recall = $mol_charset_encode( this.recall() ) const app = $mol_crypto_hash( $mol_charset_encode( "hd_canary" ) ) // 20 B
const recall = $mol_crypto_salt() const secret = $mol_wire_sync( $mol_crypto_sacred_pass )( password, app ) // 16 B
const salt = $mol_crypto_hash( recall ).slice( 0, 16 ) const data = this.$.$mol_charset_encode( this.$.$hyoo_crus_auth.current().toString() )
const secret = $mol_wire_sync( this.$.$mol_crypto_secret ).pass( pass, salt ) const salt = $mol_crypto_hash( app ).slice( 0, 16 )
const open = this.$.$mol_charset_encode( this.$.$hyoo_crus_auth.current().toString() ) const closed = $mol_wire_sync( secret ).encrypt( data, salt ) // 16x B
const closed = new Uint8Array( $mol_wire_sync( secret ).encrypt( open, salt ) )
return $mol_base64_encode( closed )
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 )
} }