_site/cover/msmp_auth_more_data.COVER.html

1 %% Copyright (c) 2023 Peter Morgan <peter.james.morgan@gmail.com>
2 %%
3 %% Licensed under the Apache License, Version 2.0 (the "License");
4 %% you may not use this file except in compliance with the License.
5 %% You may obtain a copy of the License at
6 %%
7 %% http://www.apache.org/licenses/LICENSE-2.0
8 %%
9 %% Unless required by applicable law or agreed to in writing, software
10 %% distributed under the License is distributed on an "AS IS" BASIS,
11 %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 %% See the License for the specific language governing permissions and
13 %% limitations under the License.
14
15
16 -module(msmp_auth_more_data).
17
18
19 -export([decode/0]).
20
21 -spec decode() -> scran:parser(binary(), msmp:auth_more_data()).
22
23 decode() ->
24 3 fun
25 (Input) ->
26 2 (scran_result:into_map(
27 scran_sequence:sequence(
28 [scran_result:kv(
29 action,
30 scran_combinator:value(
31 auth_more_data,
32 scran_bytes:tag(<<1>>))),
33
34 scran_branch:alt(
35 [scran_sequence:sequence(
36 [scran_result:kv(
37 status,
38 scran_combinator:value(
39 fast_auth_success,
40 scran_bytes:tag(<<3>>))),
41 scran_combinator:ignore_result(
42 scran_combinator:eof())]),
43
44 scran_sequence:sequence(
45 [scran_result:kv(
46 status,
47 scran_combinator:value(
48 perform_full_authentication,
49 scran_bytes:tag(<<4>>))),
50 scran_combinator:ignore_result(
51 scran_combinator:eof())]),
52
53 %% if not otherwise tagged the more auth data
54 %% must be a server public key transmitted in
55 %% clear text.
56 scran_result:kv(
57 public_key,
58 scran_combinator:rest())])])))(Input)
59 end.
Line Hits Source