Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Elliptic p256 compatibility support #634

Merged
merged 3 commits into from
Jan 3, 2020
Merged

Conversation

bradlhart
Copy link
Contributor

@bradlhart bradlhart commented Dec 20, 2019

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

  • 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

  • Documentation Additions


public getType(): KeyType {
return this.key.type;
}
Copy link
Contributor

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

Copy link
Contributor Author

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 {
Copy link
Contributor

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.

Copy link
Contributor

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

@bradlhart bradlhart merged commit b3eb443 into develop Jan 3, 2020
@bradlhart bradlhart deleted the p256-ecurve-compatibility branch January 3, 2020 17:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants