Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22392963
password.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
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
application/javascript
Expires
Fri, Nov 27, 15:54 (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1217794
Default Alt Text
password.ts (719 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline