-
Notifications
You must be signed in to change notification settings - Fork 0
Format-preserving encryption capabilities #17
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
Merged
+715
−218
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
36a3a37
FPE.init()
alberto-crossmint c49014c
Fix UT
alberto-crossmint 3ab2989
improve
alberto-crossmint 14689bc
improveSerialization
alberto-crossmint e93bc29
testSerialization
alberto-crossmint 9551800
deleteDebugLog
alberto-crossmint c0ae581
.
alberto-crossmint 201ae47
fix
alberto-crossmint 797cc52
fix
alberto-crossmint d7dd59b
add pubkey in response
alberto-crossmint a70d331
delete debug log
alberto-crossmint 740fdec
Add public key on request
alberto-crossmint c97e8f2
fixUT
alberto-crossmint e4da13f
practions
alberto-crossmint File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { z } from 'zod'; | ||
|
||
export type EncryptionResult<T extends ArrayBuffer | string> = { | ||
ciphertext: T; | ||
encapsulatedKey: T; | ||
publicKey: T; | ||
}; | ||
export type DecryptOptions = { | ||
validateTeeSender: boolean; | ||
}; | ||
|
||
export const SerializedPublicKeySchema = z.object({ | ||
raw: z.string(), | ||
algorithm: z.any(), | ||
}); | ||
export type SerializedPublicKey = z.infer<typeof SerializedPublicKeySchema>; | ||
|
||
export const SerializedPrivateKeySchema = z.object({ | ||
raw: z.any(), | ||
usages: z.array(z.custom<KeyUsage>()), | ||
algorithm: z.any(), | ||
}); | ||
export type SerializedPrivateKey = z.infer<typeof SerializedPrivateKeySchema>; | ||
|
||
export const AES256_KEY_SPEC: AesKeyGenParams = { | ||
name: 'AES-GCM' as const, | ||
length: 256, | ||
} as const; | ||
export const ECDH_KEY_SPEC: EcKeyGenParams = { | ||
name: 'ECDH' as const, | ||
namedCurve: 'P-384' as const, | ||
} as const; | ||
|
||
export const STORAGE_KEYS = { | ||
PRIV_KEY: 'private-key', | ||
PUB_KEY: 'public-key', | ||
} as const; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We add the public key for the TEE to derive the corresponding AES256 encryption key