This repository was archived by the owner on Mar 8, 2024. It is now read-only.
Conversation
simplify verify call to use Embedded option
dino-rodriguez
approved these changes
Aug 3, 2020
Member
dino-rodriguez
left a comment
There was a problem hiding this comment.
This is great Neil. This will be super useful for validating JWS and in general testing out the full-fledged usage of the server implementation.
|
|
||
| import { SigningParams } from './verifiable-payid' | ||
|
|
||
| import ECKey = JWK.ECKey |
Member
There was a problem hiding this comment.
Just curious as I haven't seen this before : why are these also import statements instead of constants / variables?
| * @param signingParams - The key/alg to use to generate the signature. | ||
| * @returns A signed JWS. | ||
| */ | ||
| export function sign( |
Member
There was a problem hiding this comment.
This is super clean and simple.
| * @param signingParams - The key/alg to use to generate the signature. | ||
| * @returns A signed JWS. | ||
| */ | ||
| function signWithIdentityKey( |
Member
There was a problem hiding this comment.
Nice helper abstractions!
| } | ||
| }) | ||
|
|
||
| it('Signed PayID returns JWS', async function () { |
Member
There was a problem hiding this comment.
For tests we've usually been doing GIVEN WHEN THIS comments, not sure if you wanted to continue this pattern here, but imo it makes tests easily human readable.
| address: Address, | ||
| signingParams: Array<IdentityKeySigningParams | ServerKeySigningParams>, | ||
| ): GeneralJWS { | ||
| // There seems to be a bug with the JOSE library when dealing with multiple signatures + unencoded payloads. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
High Level Overview of Change
adds functions and types to sign a PayID address using identity or server key and generate JWS. A complete usage looks like this.
Build utils. Launch node repl:
Run the following code inside the repl:
Context of Change
new functions in new files
Type of Change
Before / After
Test Plan
Generate and sign payIDs using various combinations of key and algorithms.