Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
1149d4bf
Commit
1149d4bf
authored
12 years ago
by
Sean McArthur
Browse files
Options
Downloads
Patches
Plain Diff
generate_ephemeral_keys.js instead of .sh
making this script cross-platform
parent
bb6d42f9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package.json
+1
-1
1 addition, 1 deletion
package.json
scripts/generate_ephemeral_keys.js
+46
-0
46 additions, 0 deletions
scripts/generate_ephemeral_keys.js
with
47 additions
and
1 deletion
package.json
+
1
−
1
View file @
1149d4bf
...
...
@@ -41,7 +41,7 @@
"
jshint
"
:
"
0.7.1
"
},
"scripts"
:
{
"postinstall"
:
"./scripts/generate_ephemeral_keys.s
h
"
,
"postinstall"
:
"
node
./scripts/generate_ephemeral_keys.
j
s"
,
"test"
:
"./scripts/test"
,
"start"
:
"./scripts/run_locally.js"
},
...
...
This diff is collapsed.
Click to expand it.
scripts/generate_ephemeral_keys.js
0 → 100644
+
46
−
0
View file @
1149d4bf
var
fs
=
require
(
'
fs
'
);
var
path
=
require
(
'
path
'
);
var
child_process
=
require
(
'
child_process
'
);
var
existsSync
=
fs
.
existsSync
||
path
.
existsSync
;
var
VAR
=
path
.
join
(
__dirname
,
'
../var
'
);
var
CERT
=
path
.
join
(
VAR
,
'
root.cert
'
);
function
exec
(
file
,
args
,
next
)
{
child_process
.
exec
([
file
,
args
].
join
(
'
'
),
function
(
err
,
stdout
,
stderr
)
{
if
(
err
)
throw
err
;
if
(
stderr
)
console
.
error
(
stderr
);
next
&&
next
(
stdout
);
});
}
// if keys already exist, do nothing
if
(
existsSync
(
CERT
))
{
process
.
exit
(
0
);
}
var
GENERATE_KEYPAIR
=
path
.
join
(
__dirname
,
'
../node_modules/.bin/generate-keypair
'
);
var
CERTIFY
=
path
.
join
(
__dirname
,
'
../node_modules/.bin/certify
'
);
if
(
!
existsSync
(
GENERATE_KEYPAIR
))
{
console
.
error
(
'
cannot find generate-keypair from jwcrypto. try: npm install
'
);
process
.
exit
(
1
);
}
if
(
!
existsSync
(
CERTIFY
))
{
console
.
error
(
'
cannot find certify from jwcrypto. try: rm -rf node_modules && npm install
'
);
process
.
exit
(
1
);
}
console
.
log
(
'
*** Generating ephemeral keys used for testing ***
'
);
exec
(
GENERATE_KEYPAIR
,
'
-k 256 -a rsa
'
,
function
(
stdout
)
{
if
(
stdout
)
console
.
log
(
stdout
);
fs
.
mkdirSync
(
VAR
);
exec
(
CERTIFY
,
'
-s key.secretkey -p key.publickey
'
,
function
(
cert
)
{
fs
.
writeFileSync
(
CERT
,
cert
);
fs
.
unlinkSync
(
'
key.publickey
'
);
fs
.
renameSync
(
'
key.secretkey
'
,
path
.
join
(
VAR
,
'
root.secretkey
'
));
});
});
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