Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7188434
password.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
719 B
Referenced Files
None
Subscribers
None
password.ts
View Options
import
SecureHasher
from
"../../../utils/secure-hasher.js"
;
import
{
Context
,
Field
}
from
"../../../main.js"
;
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
Tue, Jul 8, 08:12 (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
808664
Default Alt Text
password.ts (719 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment