Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Indienet
Site
Commits
78c3341b
Verified
Commit
78c3341b
authored
Mar 17, 2018
by
Aral Balkan
Browse files
Fix owner registration, find, get
parent
f45c1956
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/globals.js
View file @
78c3341b
...
...
@@ -23,7 +23,9 @@ function setOwnerKeys (app, ownerKeys = null) {
encryptedPrivateSigningKey
:
mainKeyObject
.
encryptedPrivateSigningKey
}
ownerPublicSigningKey
=
mainKeyObject
.
publicSigningKey
ownerPublicSigningKey
=
{
publicSigningKey
:
mainKeyObject
.
publicSigningKey
}
}
if
(
ownerKeys
===
null
&&
fs
.
existsSync
(
ownerKeysFilePath
))
{
...
...
server/services/owner/owner.class.js
View file @
78c3341b
...
...
@@ -17,14 +17,24 @@ class Service {
}
async
get
(
id
,
params
)
{
console
.
log
(
`ID:
${
id
}
`
)
switch
(
id
)
{
case
'
encrypted-private-signing-key
'
:
return
this
.
app
.
get
(
'
ownerEncryptedPrivateSigningKey
'
)
case
'
public-signing-key
'
:
return
this
.
app
.
get
(
'
ownerPublicSigningKey
'
)
default
:
throw
new
errors
.
MethodNotAllowed
()
const
getKey
=
keyName
=>
{
const
key
=
this
.
app
.
get
(
keyName
)
if
(
key
===
null
)
throw
new
errors
.
NotFound
(
'
Key not set.
'
)
return
key
}
try
{
switch
(
id
)
{
case
'
encrypted-private-signing-key
'
:
return
getKey
(
'
ownerEncryptedPrivateSigningKey
'
)
case
'
public-signing-key
'
:
return
getKey
(
'
ownerPublicSigningKey
'
)
default
:
throw
new
errors
.
NotFound
(
'
Key type does not exist.
'
)
}
}
catch
(
error
)
{
/* re- */
throw
error
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment