Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
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 : #include "mozilla/dom/WebAuthenticationBinding.h"
8 : #include "mozilla/dom/AuthenticatorAssertionResponse.h"
9 :
10 : namespace mozilla {
11 : namespace dom {
12 :
13 0 : NS_IMPL_ADDREF_INHERITED(AuthenticatorAssertionResponse, AuthenticatorResponse)
14 0 : NS_IMPL_RELEASE_INHERITED(AuthenticatorAssertionResponse, AuthenticatorResponse)
15 :
16 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(AuthenticatorAssertionResponse)
17 0 : NS_INTERFACE_MAP_END_INHERITING(AuthenticatorResponse)
18 :
19 0 : AuthenticatorAssertionResponse::AuthenticatorAssertionResponse(nsPIDOMWindowInner* aParent)
20 0 : : AuthenticatorResponse(aParent)
21 0 : {}
22 :
23 0 : AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse()
24 0 : {}
25 :
26 : JSObject*
27 0 : AuthenticatorAssertionResponse::WrapObject(JSContext* aCx,
28 : JS::Handle<JSObject*> aGivenProto)
29 : {
30 0 : return AuthenticatorAssertionResponseBinding::Wrap(aCx, this, aGivenProto);
31 : }
32 :
33 : void
34 0 : AuthenticatorAssertionResponse::GetAuthenticatorData(JSContext* aCx,
35 : JS::MutableHandle<JSObject*> aRetVal) const
36 : {
37 0 : aRetVal.set(mAuthenticatorData.ToUint8Array(aCx));
38 0 : }
39 :
40 : nsresult
41 0 : AuthenticatorAssertionResponse::SetAuthenticatorData(CryptoBuffer& aBuffer)
42 : {
43 0 : if (NS_WARN_IF(!mAuthenticatorData.Assign(aBuffer))) {
44 0 : return NS_ERROR_OUT_OF_MEMORY;
45 : }
46 0 : return NS_OK;
47 : }
48 :
49 : void
50 0 : AuthenticatorAssertionResponse::GetSignature(JSContext* aCx,
51 : JS::MutableHandle<JSObject*> aRetVal) const
52 : {
53 0 : aRetVal.set(mSignature.ToUint8Array(aCx));
54 0 : }
55 :
56 : nsresult
57 0 : AuthenticatorAssertionResponse::SetSignature(CryptoBuffer& aBuffer)
58 : {
59 0 : if (NS_WARN_IF(!mSignature.Assign(aBuffer))) {
60 0 : return NS_ERROR_OUT_OF_MEMORY;
61 : }
62 0 : return NS_OK;
63 : }
64 :
65 : } // namespace dom
66 : } // namespace mozilla
|