-
Notifications
You must be signed in to change notification settings - Fork 463
Conversation
a2761a0
to
1f7b023
Compare
Add tests
1f7b023
to
72f984a
Compare
|
||
public getType(): KeyType { | ||
return this.key.type; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also an API change; I'd run this past Todd, but this is a change that 1) is an addition and 2) is not implementation specific. So I think I'm fine with it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the initial PR description to note the API changes.
@@ -11,8 +11,7 @@ export class PrivateKey { | |||
constructor(private key: Key) {} | |||
|
|||
/** Instantiate private key from an `elliptic`-format private key */ | |||
public static fromElliptic(privKey: ec.KeyPair, keyType = KeyType.k1): PrivateKey { | |||
const privArray = privKey.getPrivate().toArray(); | |||
public static fromElliptic(privKey: ec.KeyPair, keyType: KeyType): PrivateKey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that removing the default from this argument makes this PR a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file isn't in v20
Change Description
Adjusting the existing PrivateKey, PublicKey, Signature, and JsSignatureProvider to use p256 r1 format keys if optional arguments are provided, such as the r1 KeyType from numeric and elliptic constructed with p256. K1 format and secp256k1 are default if no ecurve/keyType are provided.
API Changes
PrivateKey.getType() => returns private variable this.key.type
PublicKey.getType() => returns private variable this.key.type
Signature.getType() => returns private variable this.signature.type
Documentation Additions