FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bitcore/SINKey.js at master · trapp/bitcore · GitHub
trapp
/
bitcore
Public
forked from
bitpay/bitcore
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
bitcore
/
SINKey.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (34 loc) · 1002 Bytes
Breadcrumbs
bitcore
/
SINKey.js
Copy path
File metadata and controls
43 lines (34 loc) · 1002 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require
(
'classtool'
)
;
function
ClassSpec
(
b
)
{
var
coinUtil
=
require
(
'./util/util'
)
;
var
timeUtil
=
require
(
'./util/time'
)
;
var
KeyModule
=
require
(
'./Key'
)
;
var
SIN
=
require
(
'./SIN'
)
.
class
(
)
;
function
SINKey
(
cfg
)
{
if
(
typeof
cfg
!=
'object'
)
cfg
=
{
}
;
this
.
created
=
cfg
.
created
;
this
.
privKey
=
cfg
.
privKey
;
}
;
SINKey
.
prototype
.
generate
=
function
(
)
{
this
.
privKey
=
KeyModule
.
Key
.
generateSync
(
)
;
this
.
created
=
timeUtil
.
curtime
(
)
;
}
;
SINKey
.
prototype
.
pubkeyHash
=
function
(
)
{
return
coinUtil
.
sha256ripe160
(
this
.
privKey
.
public
)
;
}
;
SINKey
.
prototype
.
storeObj
=
function
(
)
{
var
pubKey
=
this
.
privKey
.
public
.
toString
(
'hex'
)
;
var
pubKeyHash
=
this
.
pubkeyHash
(
)
;
var
sin
=
new
SIN
(
SIN
.
SIN_EPHEM
,
pubKeyHash
)
;
var
obj
=
{
created
:
this
.
created
,
priv
:
this
.
privKey
.
private
.
toString
(
'hex'
)
,
pub
:
pubKey
,
sin
:
sin
.
toString
(
)
,
}
;
return
obj
;
}
;
return
SINKey
;
}
;
module
.
defineClass
(
ClassSpec
)
;
Back
|
FazBrowse Home
|
New Git URL