Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7317546
password.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
713 B
Referenced Files
None
Subscribers
None
password.ts
View Options
import
SecureHasher
from
"../../../utils/secure-hasher"
;
import
{
Context
,
Field
}
from
"../../../main"
;
const
MIN_LENGTH
=
8
;
export
default
class
Password
extends
Field
{
typeName
=
"password"
;
async
isProperValue
(
context
:
Context
,
input
:
string
)
{
return
input
.
length
>=
MIN_LENGTH
?
Field
.
valid
()
:
Field
.
invalid
(
context
.
app
.
i18n
(
"invalid_password"
,
[
MIN_LENGTH
]));
}
async
encode
(
_
:
Context
,
input
:
string
)
{
if
(
input
===
null
)
{
return
null
;
}
const
hash_params
=
this
.
app
.
ConfigManager
.
get
(
"password_hash"
);
const
salt
=
SecureHasher
.
generateRandomSalt
(
hash_params
.
salt_length
);
return
SecureHasher
.
hash
(
input
,
salt
,
hash_params
);
}
async
decode
()
{
return
"secret"
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-Algol68
Expires
Sun, Jul 13, 04:49 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
783118
Default Alt Text
password.ts (713 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment