Skip to content

Commit ba92ebd

Browse files
authored
fix: signatureCurve property on keys (#98)
* SignatureKey should define the signatureCurve property * VerificationKey should define the signatureCurve property * tests
1 parent 62cdf4c commit ba92ebd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/material-management/src/signature_key.ts

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class SignatureKey {
4848
readOnlyProperty<SignatureKey, 'privateKey'>(this, 'privateKey', privateKey)
4949
}
5050
readOnlyBinaryProperty(this, 'compressPoint', compressPoint)
51+
readOnlyProperty(this, 'signatureCurve', namedCurve)
5152
Object.setPrototypeOf(this, SignatureKey.prototype)
5253
Object.freeze(this)
5354
}
@@ -81,6 +82,7 @@ export class VerificationKey {
8182
} else {
8283
readOnlyProperty<VerificationKey, 'publicKey'>(this, 'publicKey', publicKey)
8384
}
85+
readOnlyProperty(this, 'signatureCurve', namedCurve)
8486
Object.setPrototypeOf(this, VerificationKey.prototype)
8587
Object.freeze(this)
8688
}

modules/material-management/test/signature_key.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe('SignatureKey', () => {
4040
const sigKey = new SignatureKey(new Uint8Array(3), new Uint8Array(3), suite)
4141
expect(sigKey).to.haveOwnProperty('privateKey').to.be.a('string')
4242
expect(sigKey).to.haveOwnProperty('compressPoint').to.be.instanceOf(Uint8Array)
43+
expect(sigKey).to.haveOwnProperty('signatureCurve').and.to.equal(suite.signatureCurve)
4344
})
4445

4546
it('encodeCompressPoint', () => {
@@ -50,11 +51,12 @@ describe('SignatureKey', () => {
5051
})
5152
})
5253

53-
describe('SignatureKey', () => {
54+
describe('VerificationKey', () => {
5455
it('basic usage', () => {
5556
const suite = new NodeAlgorithmSuite(AlgorithmSuiteIdentifier.ALG_AES128_GCM_IV12_TAG16_HKDF_SHA256_ECDSA_P256)
5657
const verKey = new VerificationKey(new Uint8Array(3), suite)
5758
expect(verKey).to.haveOwnProperty('publicKey').to.be.a('string')
59+
expect(verKey).to.haveOwnProperty('signatureCurve').and.to.equal(suite.signatureCurve)
5860
})
5961

6062
it('decodeCompressPoint', () => {

0 commit comments

Comments
 (0)