/src/mozilla-central/dom/webauthn/WebAuthnCoseIdentifiers.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_dom_WebAuthnCoseIdentifiers_h |
8 | | #define mozilla_dom_WebAuthnCoseIdentifiers_h |
9 | | |
10 | | #include "mozilla/dom/WebCryptoCommon.h" |
11 | | |
12 | | namespace mozilla { |
13 | | namespace dom { |
14 | | |
15 | | // From https://www.iana.org/assignments/cose/cose.xhtml#algorithms |
16 | | enum class CoseAlgorithmIdentifier : int32_t { |
17 | | ES256 = -7 |
18 | | }; |
19 | | |
20 | | static nsresult |
21 | | CoseAlgorithmToWebCryptoId(const int32_t& aId, /* out */ nsString& aName) |
22 | 0 | { |
23 | 0 | switch(static_cast<CoseAlgorithmIdentifier>(aId)) { |
24 | 0 | case CoseAlgorithmIdentifier::ES256: |
25 | 0 | aName.AssignLiteral(JWK_ALG_ECDSA_P_256); |
26 | 0 | break; |
27 | 0 | default: |
28 | 0 | return NS_ERROR_DOM_NOT_SUPPORTED_ERR; |
29 | 0 | } |
30 | 0 | return NS_OK; |
31 | 0 | } |
32 | | |
33 | | } // namespace dom |
34 | | } // namespace mozilla |
35 | | |
36 | | #endif // mozilla_dom_WebAuthnCoseIdentifiers_h |