-
Notifications
You must be signed in to change notification settings - Fork 2
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: support authn keys #2
base: v0.45.x-send-restrictions-authn
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent changes enhance the Cosmos SDK by supporting authentication keys, specifically through the introduction of a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AuthnService
participant CryptoCodec
participant SignatureVerifier
User->>AuthnService: Request Authentication
AuthnService->>CryptoCodec: Register PubKey
CryptoCodec-->>AuthnService: Registration Successful
AuthnService->>SignatureVerifier: Verify Signature
SignatureVerifier-->>AuthnService: Verification Result
AuthnService-->>User: Authentication Success/Failure
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
@coderabbitai review |
Actions performedReview triggered.
|
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.
Actionable comments posted: 12
Outside diff range, codebase verification and nitpick comments (1)
crypto/keys/authn/signature_test.go (1)
1-2
: Add a package comment.Consider adding a comment to describe the purpose of the
authn
package.// Package authn provides functionalities for authentication key management and signature verification. package authn
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
crypto/keys/authn/keys.pb.go
is excluded by!**/*.pb.go
Files selected for processing (9)
- Makefile (1 hunks)
- crypto/codec/amino.go (2 hunks)
- crypto/codec/proto.go (2 hunks)
- crypto/keys/authn/authn.go (1 hunks)
- crypto/keys/authn/signature.go (1 hunks)
- crypto/keys/authn/signature_test.go (1 hunks)
- docs/core/proto-docs.md (2 hunks)
- proto/cosmos/crypto/authn/keys.proto (1 hunks)
- x/auth/ante/sigverify.go (2 hunks)
Files skipped from review due to trivial changes (1)
- Makefile
Additional context used
golangci-lint
crypto/keys/authn/signature.go
80-80: appendAssign: append result not assigned to the same slice
(gocritic)
Gitleaks
crypto/keys/authn/signature_test.go
55-55: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
322-322: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
Markdownlint
docs/core/proto-docs.md
3541-3541: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3542-3542: Expected: 1; Actual: 3
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3548-3548: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3554-3554: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3555-3555: Expected: 1; Actual: 3
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3556-3556: Expected: 1; Actual: 4
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3557-3557: Expected: 1; Actual: 5
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3566-3566: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3567-3567: Expected: 1; Actual: 3
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3545-3545: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines(MD022, blanks-around-headings)
Additional comments not posted (39)
proto/cosmos/crypto/authn/keys.proto (6)
1-1
: Syntax declaration is correct.The file correctly declares the syntax as proto3.
2-2
: Package declaration is correct.The package is appropriately named
cosmos.crypto.authn
.
4-4
: Import statement is correct.The file correctly imports
gogoproto/gogo.proto
for using gogoproto options.
8-11
: Review ofgoproto_stringer
option.The
goproto_stringer
option is set to false, which disables the generation of theString()
method for thePubKey
message. This is appropriate if string representation is not needed.
12-12
: Review ofkey_id
field.The
key_id
field is defined as a string with field number 1. This is appropriate for storing an identifier for the key.
13-13
: Review ofkey
field.The
key
field is defined as bytes with field number 2. This is appropriate for storing the actual key data.crypto/codec/proto.go (3)
Line range hint
1-1
:
Package declaration is correct.The package is appropriately named
codec
.
Line range hint
3-11
:
Import statements are correct.The file correctly imports the necessary packages, including the new
authn
package.
17-17
: Registration ofauthn.PubKey
is correct.The function correctly registers the new
authn.PubKey
type as an implementation of thecosmos.crypto.PubKey
interface.crypto/codec/amino.go (3)
Line range hint
1-1
:
Package declaration is correct.The package is appropriately named
codec
.
4-7
: Import statements are correct.The file correctly imports the necessary packages, including the new
authn
package.
20-21
: Registration ofauthn.PubKey
is correct.The function correctly registers the new
authn.PubKey
type alongside existing public key types.crypto/keys/authn/authn.go (7)
40-42
: LGTM!The method is straightforward and correct.
44-46
: LGTM!The method is straightforward and correct.
48-50
: LGTM!The method is straightforward and correct.
52-54
: LGTM!The method is straightforward and correct.
56-59
: LGTM!The method is straightforward and correct.
71-76
: LGTM!The method is straightforward and correct.
79-81
: LGTM!The method is straightforward and correct.
x/auth/ante/sigverify.go (1)
390-393
: LGTM!The new case for
*authn.PubKey
is consistent with existing cases and correctly handles the new public key type.crypto/keys/authn/signature_test.go (18)
22-33
: LGTM!The
CollectedClientData
structure is well-defined and follows the WebAuthn specification.
35-37
: LGTM!The
TokenBinding
structure is well-defined and follows the WebAuthn specification.
61-74
: LGTM!The
GenerateClientData
function is well-implemented and follows the WebAuthn specification.
76-112
: LGTM!The
TestVerifySignature
function is comprehensive and covers multiple scenarios.
114-148
: LGTM!The
TestVerifySignature_ChallengeStdEncoding
function is well-implemented and covers the scenario effectively.
150-184
: LGTM!The
TestVerifySignature_ChallengeHexEncoding
function is well-implemented and covers the scenario effectively.
186-220
: LGTM!The
TestVerifySignature_ChallengeEmpty
function is well-implemented and covers the scenario effectively.
222-253
: LGTM!The
TestVerifySignature_ChallengeNil
function is well-implemented and covers the scenario effectively.
255-287
: LGTM!The
TestVerifySignature_ChallengeInteger
function is well-implemented and covers the scenario effectively.
289-314
: LGTM!The
TestVerifySignature_ClientDataJSONEmpty
function is well-implemented and covers the scenario effectively.
316-349
: LGTM!The
TestVerifySignature_UncompressedPubKey
function is well-implemented and covers the scenario effectively.Tools
Gitleaks
322-322: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
351-378
: LGTM!The
TestVerifySignature_AnotherPubKey
function is well-implemented and covers the scenario effectively.
380-406
: LGTM!The
TestVerifySignature_SignaureNotInASN1
function is well-implemented and covers the scenario effectively.
408-433
: LGTM!The
TestVerifySignature_EmptyAuthenticatorData
function is well-implemented and covers the scenario effectively.
435-461
: LGTM!The
TestVerifySignature_SignatureEncodingInBase64
function is well-implemented and covers the scenario effectively.
463-488
: LGTM!The
TestVerifySignature_ClientDataJSONEncodingInBase64
function is well-implemented and covers the scenario effectively.
490-494
: LGTM!The
TestVerifySignature_EmptySignature
function is well-implemented and covers the scenario effectively.
496-520
: LGTM!The
TestVerifySignature_AuthenticatorDataLength
function is well-implemented and covers the scenario effectively.docs/core/proto-docs.md (1)
229-231
: LGTM!The reference link to
cosmos/crypto/authn/keys.proto
andPubKey
has been correctly added.
<a name="cosmos/crypto/authn/keys.proto"></a> | ||
<p align="right"><a href="#top">Top</a></p> | ||
|
||
## cosmos/crypto/authn/keys.proto | ||
|
||
|
||
|
||
<a name="cosmos.crypto.authn.PubKey"></a> | ||
|
||
### PubKey | ||
PubKey defines a authn public key | ||
|
||
|
||
| Field | Type | Label | Description | | ||
| ----- | ---- | ----- | ----------- | | ||
| `key_id` | [string](#string) | | | | ||
| `key` | [bytes](#bytes) | | | | ||
|
||
|
||
|
||
|
||
|
||
<!-- end messages --> | ||
|
||
<!-- end enums --> | ||
|
||
<!-- end HasExtensions --> | ||
|
||
<!-- end services --> | ||
|
||
|
||
|
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.
Fix the formatting issues.
There are multiple consecutive blank lines and missing blank lines around headings. This violates markdownlint rules.
-<a name="cosmos/crypto/authn/keys.proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-
-## cosmos/crypto/authn/keys.proto
-
-
-
-<a name="cosmos.crypto.authn.PubKey"></a>
-
-### PubKey
-PubKey defines a authn public key
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| `key_id` | [string](#string) | | |
-| `key` | [bytes](#bytes) | | |
-
-
-
-
<!-- end messages -->
<!-- end enums -->
<!-- end HasExtensions -->
<!-- end services -->
-
-
-
-<a name="cosmos/crypto/ed25519/keys.proto"></a>
-<p align="right"><a href="#top">Top</a></p>
+<a name="cosmos/crypto/authn/keys.proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## cosmos/crypto/authn/keys.proto
+
+<a name="cosmos.crypto.authn.PubKey"></a>
+
+### PubKey
+PubKey defines an authn public key
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `key_id` | [string](#string) | | |
+| `key` | [bytes](#bytes) | | |
+
<!-- end messages -->
<!-- end enums -->
<!-- end HasExtensions -->
<!-- end services -->
+
+<a name="cosmos/crypto/ed25519/keys.proto"></a>
+<p align="right"><a href="#top">Top</a></p>
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<a name="cosmos/crypto/authn/keys.proto"></a> | |
<p align="right"><a href="#top">Top</a></p> | |
## cosmos/crypto/authn/keys.proto | |
<a name="cosmos.crypto.authn.PubKey"></a> | |
### PubKey | |
PubKey defines a authn public key | |
| Field | Type | Label | Description | | |
| ----- | ---- | ----- | ----------- | | |
| `key_id` | [string](#string) | | | | |
| `key` | [bytes](#bytes) | | | | |
<!-- end messages --> | |
<!-- end enums --> | |
<!-- end HasExtensions --> | |
<!-- end services --> | |
<a name="cosmos/crypto/authn/keys.proto"></a> | |
<p align="right"><a href="#top">Top</a></p> | |
## cosmos/crypto/authn/keys.proto | |
<a name="cosmos.crypto.authn.PubKey"></a> | |
### PubKey | |
PubKey defines an authn public key | |
| Field | Type | Label | Description | | |
| ----- | ---- | ----- | ----------- | | |
| `key_id` | [string](#string) | | | | |
| `key` | [bytes](#bytes) | | | | |
<!-- end messages --> | |
<!-- end enums --> | |
<!-- end HasExtensions --> | |
<!-- end services --> | |
<a name="cosmos/crypto/ed25519/keys.proto"></a> | |
<p align="right"><a href="#top">Top</a></p> |
Tools
Markdownlint
3541-3541: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3542-3542: Expected: 1; Actual: 3
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3548-3548: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3554-3554: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3555-3555: Expected: 1; Actual: 3
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3556-3556: Expected: 1; Actual: 4
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3557-3557: Expected: 1; Actual: 5
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3566-3566: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3567-3567: Expected: 1; Actual: 3
Multiple consecutive blank lines(MD012, no-multiple-blanks)
3545-3545: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines(MD022, blanks-around-headings)
} | ||
|
||
clientDataHash := sha256.Sum256(clientDataJSON) | ||
payload := append(authenticatorData, clientDataHash[:]...) |
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.
Fix the append assignment issue.
The result of append
should be assigned back to payload
to ensure the new slice is used.
- payload := append(authenticatorData, clientDataHash[:]...)
+ payload = append(authenticatorData, clientDataHash[:]...)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
payload := append(authenticatorData, clientDataHash[:]...) | |
payload = append(authenticatorData, clientDataHash[:]...) |
Tools
golangci-lint
80-80: appendAssign: append result not assigned to the same slice
(gocritic)
signatureBytes, err := hex.DecodeString(sig.Signature) | ||
if err != nil { | ||
return false | ||
} |
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.
Handle hex decoding errors gracefully.
The current error handling simply returns false. Consider logging the error for debugging purposes.
- if err != nil {
- return false
- }
+ if err != nil {
+ // Log the error for debugging purposes
+ fmt.Printf("Error decoding signatureBytes: %v\n", err)
+ return false
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
signatureBytes, err := hex.DecodeString(sig.Signature) | |
if err != nil { | |
return false | |
} | |
signatureBytes, err := hex.DecodeString(sig.Signature) | |
if err != nil { | |
// Log the error for debugging purposes | |
fmt.Printf("Error decoding signatureBytes: %v\n", err) | |
return false | |
} |
challenge, err := base64.RawURLEncoding.DecodeString(challengeBase64) | ||
if err != nil { | ||
return false | ||
} |
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.
Handle base64 decoding errors gracefully.
The current error handling simply returns false. Consider logging the error for debugging purposes.
- if err != nil {
- return false
- }
+ if err != nil {
+ // Log the error for debugging purposes
+ fmt.Printf("Error decoding challengeBase64: %v\n", err)
+ return false
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
challenge, err := base64.RawURLEncoding.DecodeString(challengeBase64) | |
if err != nil { | |
return false | |
} | |
challenge, err := base64.RawURLEncoding.DecodeString(challengeBase64) | |
if err != nil { | |
// Log the error for debugging purposes | |
fmt.Printf("Error decoding challengeBase64: %v\n", err) | |
return false | |
} |
authenticatorData, err := hex.DecodeString(sig.AuthenticatorData) | ||
if err != nil { | ||
return false | ||
} |
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.
Handle hex decoding errors gracefully.
The current error handling simply returns false. Consider logging the error for debugging purposes.
- if err != nil {
- return false
- }
+ if err != nil {
+ // Log the error for debugging purposes
+ fmt.Printf("Error decoding authenticatorData: %v\n", err)
+ return false
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
authenticatorData, err := hex.DecodeString(sig.AuthenticatorData) | |
if err != nil { | |
return false | |
} | |
authenticatorData, err := hex.DecodeString(sig.AuthenticatorData) | |
if err != nil { | |
// Log the error for debugging purposes | |
fmt.Printf("Error decoding authenticatorData: %v\n", err) | |
return false | |
} |
err := json.Unmarshal(sigStr, &sig) | ||
if err != nil { | ||
return false | ||
} |
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.
Handle JSON unmarshalling errors gracefully.
The current error handling simply returns false. Consider logging the error for debugging purposes.
- if err != nil {
- return false
- }
+ if err != nil {
+ // Log the error for debugging purposes
+ fmt.Printf("Error unmarshalling signature: %v\n", err)
+ return false
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
err := json.Unmarshal(sigStr, &sig) | |
if err != nil { | |
return false | |
} | |
err := json.Unmarshal(sigStr, &sig) | |
if err != nil { | |
// Log the error for debugging purposes | |
fmt.Printf("Error unmarshalling signature: %v\n", err) | |
return false | |
} |
func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { | ||
if len(bz) != PubKeySize { | ||
return sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "invalid pubkey size") | ||
} |
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.
Handle invalid pubkey size error gracefully.
The error message should be more descriptive to aid debugging.
- return sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "invalid pubkey size")
+ return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "invalid pubkey size: expected %d, got %d", PubKeySize, len(bz))
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { | |
if len(bz) != PubKeySize { | |
return sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "invalid pubkey size") | |
} | |
func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { | |
if len(bz) != PubKeySize { | |
return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "invalid pubkey size: expected %d, got %d", PubKeySize, len(bz)) | |
} |
func (pubKey *PubKey) Address() crypto.Address { | ||
if len(pubKey.Key) != PubKeySize { | ||
panic("length of pubkey is incorrect") | ||
} |
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.
Avoid using panic statements.
Replace the panic statement with proper error handling to ensure the application does not crash unexpectedly.
- if len(pubKey.Key) != PubKeySize {
- panic("length of pubkey is incorrect")
- }
+ if len(pubKey.Key) != PubKeySize {
+ return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "length of pubkey is incorrect")
+ }
Committable suggestion was skipped due to low confidence.
cborSig := Signature{ | ||
AuthenticatorData: hex.EncodeToString(authenticatorData), | ||
ClientDataJSON: hex.EncodeToString(clientDataJSON), | ||
Signature: hex.EncodeToString(sig), | ||
} |
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.
Define the Signature
structure.
The Signature
structure is used in multiple test functions but is not defined in the provided code.
type Signature struct {
AuthenticatorData string `json:"authenticatorData"`
ClientDataJSON string `json:"clientDataJSON"`
Signature string `json:"signature"`
}
Also applies to: 139-143, 175-179, 211-215, 244-248, 278-282, 340-344, 369-373, 397-401, 424-428, 452-456, 479-483, 511-515
func GenerateAuthnKey(t *testing.T) (*ecdsa.PrivateKey, PubKey) { | ||
curve := elliptic.P256() | ||
privateKey, err := ecdsa.GenerateKey(curve, rand.Reader) | ||
require.NoError(t, err) | ||
pkBytes := elliptic.MarshalCompressed(curve, privateKey.PublicKey.X, privateKey.PublicKey.Y) | ||
pk := PubKey{ | ||
KeyId: "a099eda0fb05e5783379f73a06acca726673b8e07e436edcd0d71645982af65c", | ||
Key: pkBytes, | ||
} | ||
return privateKey, pk | ||
} |
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.
Remove hardcoded KeyId.
The hardcoded KeyId was flagged by static analysis tools. Consider generating it dynamically.
- KeyId: "a099eda0fb05e5783379f73a06acca726673b8e07e436edcd0d71645982af65c",
+ hash := sha256.Sum256(pkBytes)
+ KeyId: hex.EncodeToString(hash[:]),
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
func GenerateAuthnKey(t *testing.T) (*ecdsa.PrivateKey, PubKey) { | |
curve := elliptic.P256() | |
privateKey, err := ecdsa.GenerateKey(curve, rand.Reader) | |
require.NoError(t, err) | |
pkBytes := elliptic.MarshalCompressed(curve, privateKey.PublicKey.X, privateKey.PublicKey.Y) | |
pk := PubKey{ | |
KeyId: "a099eda0fb05e5783379f73a06acca726673b8e07e436edcd0d71645982af65c", | |
Key: pkBytes, | |
} | |
return privateKey, pk | |
} | |
func GenerateAuthnKey(t *testing.T) (*ecdsa.PrivateKey, PubKey) { | |
curve := elliptic.P256() | |
privateKey, err := ecdsa.GenerateKey(curve, rand.Reader) | |
require.NoError(t, err) | |
pkBytes := elliptic.MarshalCompressed(curve, privateKey.PublicKey.X, privateKey.PublicKey.Y) | |
hash := sha256.Sum256(pkBytes) | |
pk := PubKey{ | |
KeyId: hex.EncodeToString(hash[:]), | |
Key: pkBytes, | |
} | |
return privateKey, pk | |
} |
Tools
Gitleaks
55-55: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
Closes #1
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
PubKey
structure and its fields.Tests