-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: default to uncompressed keys #2165
base: main
Are you sure you want to change the base?
feat: default to uncompressed keys #2165
Conversation
🦋 Changeset detectedLatest commit: 30ff14a The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
3a5b77f
to
7075bbc
Compare
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.
Nice! Changes look good overall. Left multiple comments regarding changesets. Can you also add one for the general change of this pr?
tests/InMemoryWallet.ts
Outdated
@@ -13,6 +13,7 @@ import BigNumber from 'bn.js' | |||
|
|||
import { convertToAskarKeyBackend } from '../packages/askar/src/utils/askarKeyBackend' | |||
import { didcommV1Pack, didcommV1Unpack } from '../packages/askar/src/wallet/didcommV1' | |||
import { expandIfPossible } from '../packages/core/src/crypto/jose/jwk/ecCompression' |
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.
Should this method be available as export? Or on a key instance or something?
E.g. a getter with compressedPubliKey that optionally returns null?
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.
The key instance public get publicKey
returns the uncompressed public key
import { isEncryptionSupportedForKeyType, isSigningSupportedForKeyType } from './keyUtils' | ||
import { getKeyTypeByMultiCodecPrefix, getMultiCodecPrefixByKeyType } from './multiCodecKey' | ||
|
||
export class Key { | ||
public readonly publicKey: Buffer | ||
public readonly publicKey: Uint8Array |
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 quite a big breaking change. Can you add the needed changeset entry?
@@ -52,7 +52,7 @@ describeSkipNode18('BBS Signing Provider', () => { | |||
key, | |||
}) | |||
).rejects.toThrow( | |||
'Error signing data with verkey AeAihfn5UFf7y9oesemKE1oLmTwKMRv7fafTepespr3qceF4RUMggAbogkoC8n6rXgtJytq4oGy59DsVHxmNj9WGWwkiRnP3Sz2r924RLVbc2NdP4T7yEPsSFZPsWmLjgnP1vXHpj4bVXNcTmkUmF6mSXinF3HehnQVip14vRFuMzYVxMUh28ofTJzbtUqxMWZQRu. Unsupported keyType: bls12381g1g2' | |||
'Error signing data with key associated with AeAihfn5UFf7y9oesemKE1oLmTwKMRv7fafTepespr3qceF4RUMggAbogkoC8n6rXgtJytq4oGy59DsVHxmNj9WGWwkiRnP3Sz2r924RLVbc2NdP4T7yEPsSFZPsWmLjgnP1vXHpj4bVXNcTmkUmF6mSXinF3HehnQVip14vRFuMzYVxMUh28ofTJzbtUqxMWZQRu. Unsupported keyType: bls12381g1g2' |
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.
'Error signing data with key associated with AeAihfn5UFf7y9oesemKE1oLmTwKMRv7fafTepespr3qceF4RUMggAbogkoC8n6rXgtJytq4oGy59DsVHxmNj9WGWwkiRnP3Sz2r924RLVbc2NdP4T7yEPsSFZPsWmLjgnP1vXHpj4bVXNcTmkUmF6mSXinF3HehnQVip14vRFuMzYVxMUh28ofTJzbtUqxMWZQRu. Unsupported keyType: bls12381g1g2' | |
'Error signing data with key associated with publicKeyBase58 AeAihfn5UFf7y9oesemKE1oLmTwKMRv7fafTepespr3qceF4RUMggAbogkoC8n6rXgtJytq4oGy59DsVHxmNj9WGWwkiRnP3Sz2r924RLVbc2NdP4T7yEPsSFZPsWmLjgnP1vXHpj4bVXNcTmkUmF6mSXinF3HehnQVip14vRFuMzYVxMUh28ofTJzbtUqxMWZQRu. Unsupported keyType: bls12381g1g2' |
@@ -349,7 +352,9 @@ export abstract class AskarBaseWallet implements Wallet { | |||
if (!isError(error)) { | |||
throw new CredoError('Attempted to throw error, but it was not of type Error', { cause: error }) | |||
} | |||
throw new WalletError(`Error signing data with verkey ${key.publicKeyBase58}. ${error.message}`, { cause: error }) | |||
throw new WalletError(`Error signing data with key associated with ${key.publicKeyBase58}. ${error.message}`, { |
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.
throw new WalletError(`Error signing data with key associated with ${key.publicKeyBase58}. ${error.message}`, { | |
throw new WalletError(`Error signing data with key associated with publicKeyBase58 ${key.publicKeyBase58}. ${error.message}`, { |
@@ -28,6 +28,7 @@ import { | |||
KeyBackend, | |||
KeyType, | |||
utils, | |||
expandIfPossible, |
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.
If we export i think we should have a more unique name. expandPublicKeyIfPossible maybe?
Signed-off-by: Berend Sliedrecht <berend@animo.id>
Signed-off-by: Berend Sliedrecht <berend@animo.id>
Signed-off-by: Berend Sliedrecht <berend@animo.id>
Signed-off-by: Berend Sliedrecht <berend@animo.id>
Signed-off-by: Berend Sliedrecht <berend@animo.id>
Signed-off-by: Berend Sliedrecht <berend@animo.id>
Signed-off-by: Berend Sliedrecht <berend@animo.id>
Signed-off-by: Berend Sliedrecht <berend@animo.id>
267c22c
to
4758e8b
Compare
…ative implementations - By default rely on uncompressed keys instead of compressed (for P256, P384, P521 and K256) - Utilze Uint8Array more instead of Buffer (i.e. for internally representing a key) Signed-off-by: Berend Sliedrecht <berend@animo.id>
- By default rely on uncompressed keys instead of compressed (for P256, P384, P521 and K256) | ||
- Utilze Uint8Array more instead of Buffer (i.e. for internally representing a key) |
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.
These two should be marked as minor (due to breaking changes)
Default to uncompressed keys where possible.
Later TODO's: