Skip to content

Commit 57d0ea8

Browse files
committed
HDNode: adds getPublicKeyBuffer
1 parent 9232666 commit 57d0ea8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/hdnode.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ HDNode.prototype.getFingerprint = function () {
136136
return this.getIdentifier().slice(0, 4)
137137
}
138138

139+
HDNode.prototype.getPublicKeyBuffer = function () {
140+
return this.keyPair.getPublicKeyBuffer()
141+
}
142+
139143
HDNode.prototype.neutered = function () {
140144
var neuteredKeyPair = new ECPair(null, this.keyPair.Q, {
141145
network: this.keyPair.network

test/hdnode.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ describe('HDNode', function () {
121121
}))
122122
})
123123

124+
describe('getPublicKeyBuffer', function () {
125+
it('wraps keyPair.getPublicKeyBuffer', sinon.test(function () {
126+
this.mock(keyPair).expects('getPublicKeyBuffer')
127+
.once().withArgs().returns('pubKeyBuffer')
128+
129+
assert.strictEqual(hd.getPublicKeyBuffer(), 'pubKeyBuffer')
130+
}))
131+
})
132+
124133
describe('sign', function () {
125134
it('wraps keyPair.sign', sinon.test(function () {
126135
this.mock(keyPair).expects('sign')

0 commit comments

Comments
 (0)