Skip to content
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: Update signer-function logic to be more dynamic #103

Open
cre8 opened this issue Feb 24, 2024 · 3 comments
Open

feat: Update signer-function logic to be more dynamic #103

cre8 opened this issue Feb 24, 2024 · 3 comments

Comments

@cre8
Copy link
Contributor

cre8 commented Feb 24, 2024

Right now I can pass a signer function to request the required key on demand like this example with veramo:

    const signer: Signer = async (data: string) => context.agent.keyManagerSign({ keyRef: key.kid, data })
    const sdjwt = new SDJwtInstance({
      signer,
      hasher: this.algorithms.hasher,
      saltGenerator: this.algorithms.salltGenerator,
      signAlg: alg,
  })

The problem is, that the signAlg is a static value so I am not able to use any other sign algorithm in my signer.

Suggestion

The signer will return not just the signature, but also the used signAlgorithm. This would allow a more dynamic approach
We could think about using this approach also for the hasher, beside the specification of sd-jwt is limited to sha-256. But It would make this approach more generalised when we change it now for the signature

@lukasjhan
Copy link
Member

Input data of signer function is Base64url(header) + '.' + Base64url(payload). The value of signAlg is put into header (e.g. {alg: "EdDSA", typ: "sd-jwt"}). So I think we can't use signer's return value to set header.

@lukasjhan
Copy link
Member

My first intention was to create an sdjwtInstance and issue it after the algorithm is decided. What I think was algorithm is more reusable than claim.

However as you told, framworks provide multiple alg. I propose using optional parameters in issue, present and verify method to inject the signer and signAlg.
And instance's signer and signAlg value is a default

@cre8
Copy link
Contributor Author

cre8 commented Feb 24, 2024

So we should not pass the header + payload in the signer function, but only the payload? Like you said: the type of key could be defined in when selecting the issuer -> and then the key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants