-
Notifications
You must be signed in to change notification settings - Fork 147
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: impl stampler, tek manager, etc #1408
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
How to use the Graphite Merge QueueAdd the label graphite-merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
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 yea this looks good to me mostly. Only feedback is around making sure we can handle the case where someone might want to:
- use our code to generate a KeysetHandle for a TEK that they then would store externally
- use externally stored TEK to get an instance of the stamper / signer later
account-kit/java/signer-sdk/src/main/java/com/alchemy/aa/Stampler.java
Outdated
Show resolved
Hide resolved
* Creates a new TEK via HpkeTEKManager or returns the existing one | ||
* @return TEK public key | ||
*/ | ||
public String initTek(){ |
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 should probably be static
. One possible flow is creating a TEK and storing it somewhere, so it could be that this stamper is initialized with a TEK that's externally managed
account-kit/java/signer-sdk/src/main/java/com/alchemy/aa/Stampler.java
Outdated
Show resolved
Hide resolved
this.bundlePrivateKey = Utilities.bytesToHex(privateKeyBytes).toLowerCase(Locale.ROOT).toCharArray(); | ||
this.bundlePublicKey = Utilities.bytesToHex(publicKeyBytes).toLowerCase(Locale.ROOT).toCharArray(); |
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.
is it more convenient / efficient to just skip this conversion and store the keys as byte[]
in this class?
account-kit/java/signer-sdk/src/main/java/com/alchemy/aa/Stampler.java
Outdated
Show resolved
Hide resolved
|
||
|
||
|
||
byte[] privateKeyBytes = Utilities.HexToBytes(signingKeyHex); |
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.
ah yea here is what I was thinking we could skip if the stamper just stores the keys as bytes
account-kit/java/signer-sdk/src/main/java/com/alchemy/aa/core/TEKManager.java
Outdated
Show resolved
Hide resolved
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.
LGTM with a few comments. will let @mokok123 comment as well
public Stamper() { | ||
this(/* tekManager= */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.
is this a construction flow we want to enable? you kinda always need a TEK manager to make this work.
I think we should have the following in addition to the one above:
public Stamper(targetPrivateKeyHex: String) {}
public Stamper(targetPrivateKey: byte[]) {}
public Stamper(targetKeySet: KeysetHandle) {}
// maybe these too?
public Stamper(targetPrivateKeyHex: String, bundle: String) {}
public Stamper(targetPrivateKey: byte[], bundle: String) {}
public Stamper(targetKeySet: KeysetHandle, bundle: String) {}
public String initTek() throws GeneralSecurityException, InvalidProtocolBufferException { | ||
byte[] tekPublicKeyBytes = this.tekManager.createTEK().getPublicKeyBytes().toByteArray(); | ||
return Hex.encode(tekPublicKeyBytes); | ||
|
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.
nit:
Pull Request Checklist
yarn test
)site
folder, and guidelines for updating/adding docs can be found in the contribution guide)feat!: breaking change
)yarn lint:check
) and fix any issues? (yarn lint:write
)PR-Codex overview
This PR introduces a new
Signer Java SDK
for handling cryptographic operations, including signing and verification of payloads. It adds essential classes for exception handling, key management, and testing, while updating the project configuration and dependencies.Detailed summary
NoTEKException
,NoInjectedBundleException
, andStamperNotInitializedException
classes for error handling.TEKManager
class for managing encryption keys.Stamper
class for signing payloads.StamperTests
for unit testing functionality.pom.xml
with new dependencies and project metadata.README.md
.