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

Authentication support #51

Merged
merged 1 commit into from Jul 6, 2017

Conversation

Projects
None yet
2 participants
@metsma
Copy link
Contributor

commented Jun 26, 2017

Signed-off-by: Raul Metsma raul@metsma.ee

metsma added a commit to hwcrypto/hwcrypto.js that referenced this pull request Jun 27, 2017

JWT auth example with open-eid/chrome-token-signing#51
Signed-off-by: Raul Metsma <raul@metsma.ee>

Telgat added a commit to hwcrypto/hwcrypto.js that referenced this pull request Jun 27, 2017

@metsma

This comment has been minimized.

Copy link
Contributor Author

commented Jun 27, 2017

Using auth functionality with hwcrypto.js is similar to sign functionality

getCertificate using filter parameter with value "AUTH"

The signed input should be JWT. You can find more for creating and validating JSON Web Tokens and example page

Example:

window.hwcrypto.getCertificate({lang: 'en', filter: 'AUTH'}).then(function(certificate) {
   // Do something with the certificate, like prepare the hash to be signed
   var hash = calculateSHA256SignatureHashAsHexForCertificate(certificate.hex);
   // Now sign the hash
   window.hwcrypto.sign(certificate, {type: 'SHA-256', hex: hash}, {lang: 'en'}).then(function(signature) {
      // Do something with the signature
      storeSignature(signature.hex);
   }, function(error) {
      // Handle the error. `error.message` is one of the described error mnemonics
      console.log("Signing failed: " + error.message);
   });
});

@metsma metsma force-pushed the metsma:auth branch from 03390a7 to c47b4f2 Jul 5, 2017

Authentication support
Signed-off-by: Raul Metsma <raul@metsma.ee>

@metsma metsma force-pushed the metsma:auth branch from c47b4f2 to 4ecdadd Jul 5, 2017

@Telgat Telgat merged commit f108f1f into open-eid:master Jul 6, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@metsma metsma deleted the metsma:auth branch Jul 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.