Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
denser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
denser
Commits
8adf4a4f
Commit
8adf4a4f
authored
1 month ago
by
Krzysztof Kocot
Browse files
Options
Downloads
Patches
Plain Diff
Create function to decode master password toprivate keys
parent
4ec00a3d
No related branches found
Branches containing commit
No related tags found
1 merge request
!553
Fix "Reveal button in Key & Permissions is not working"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/transaction/lib/hive.ts
+27
-0
27 additions, 0 deletions
packages/transaction/lib/hive.ts
with
27 additions
and
0 deletions
packages/transaction/lib/hive.ts
+
27
−
0
View file @
8adf4a4f
...
...
@@ -890,3 +890,30 @@ export interface TransactionOptions {
export
type
LevelAuthority
=
Parameters
<
Awaited
<
ReturnType
<
(
typeof
AccountAuthorityUpdateOperation
)[
'
createFor
'
]
>>
[
'
role
'
]
>
[
0
];
const
keyTypes
=
[
'
active
'
,
'
owner
'
,
'
posting
'
,
'
memo
'
]
as const
;
export
const
getPrivateKeys
=
async
(
username
:
string
,
password
:
string
):
Promise
<
{
type
:
(
typeof
keyTypes
)[
number
];
privateKey
:
string
;
correctKey
:
boolean
;
}[]
>
=>
{
const
chain
=
await
hiveChainService
.
getHiveChain
();
const
keys
=
await
Promise
.
all
(
keyTypes
.
map
(
async
(
keyType
)
=>
{
const
key
=
await
chain
.
getPrivateKeyFromPassword
(
username
,
keyType
,
password
);
const
operation
=
(
await
AccountAuthorityUpdateOperation
.
createFor
(
chain
,
username
)).
role
(
keyType
);
const
checkKey
=
operation
.
level
===
'
memo
'
?
operation
.
value
===
key
.
associatedPublicKey
:
operation
.
has
(
key
.
associatedPublicKey
);
return
{
type
:
keyType
,
privateKey
:
key
.
wifPrivateKey
,
correctKey
:
checkKey
};
})
);
return
keys
;
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment