Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Site
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
24
Issues
24
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Indienet
Site
Commits
78c3341b
Verified
Commit
78c3341b
authored
Mar 17, 2018
by
Aral Balkan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix owner registration, find, get
parent
f45c1956
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
server/globals.js
server/globals.js
+3
-1
server/services/owner/owner.class.js
server/services/owner/owner.class.js
+18
-8
No files found.
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