@@ -83,6 +83,25 @@ pub trait AppCredentialsPolicyClient<'a> {
83
83
) ;
84
84
}
85
85
86
+ /// The accepted credential from the credential checker.
87
+ ///
88
+ /// This combines both the credential as stored in the TBF footer with an
89
+ /// optional opaque value provided by the checker when it accepted the
90
+ /// credential. This value can be used when assigning an AppID to the
91
+ /// application based on the how the credential was approved. For example, if
92
+ /// the credential checker has a list of valid public keys used to verify
93
+ /// signatures, it might set the optional value to the index of the public key
94
+ /// in this list.
95
+ #[ derive( Copy , Clone ) ]
96
+ pub struct AcceptedCredential {
97
+ /// The credential stored in the footer that the credential checker
98
+ /// accepted.
99
+ pub credential : TbfFooterV2Credentials ,
100
+ /// An optional opaque value set by the credential checker to store metadata
101
+ /// about the accepted credential. This is credential checker specific.
102
+ pub metadata : Option < core:: num:: NonZeroUsize > ,
103
+ }
104
+
86
105
/// Implements a Credentials Checking Policy.
87
106
pub trait AppCredentialsPolicy < ' a > {
88
107
/// Set the client which gets notified after the credential check completes.
@@ -187,10 +206,7 @@ pub trait ProcessCheckerMachineClient {
187
206
fn done (
188
207
& self ,
189
208
process_binary : ProcessBinary ,
190
- result : Result <
191
- Option < ( TbfFooterV2Credentials , Option < core:: num:: NonZeroUsize > ) > ,
192
- ProcessCheckError ,
193
- > ,
209
+ result : Result < Option < AcceptedCredential > , ProcessCheckError > ,
194
210
) ;
195
211
}
196
212
@@ -441,7 +457,13 @@ impl AppCredentialsPolicyClient<'static> for ProcessCheckerMachine {
441
457
Ok ( CheckResult :: Accept ( opaque) ) => {
442
458
self . client . map ( |client| {
443
459
if let Some ( pb) = self . process_binary . take ( ) {
444
- client. done ( pb, Ok ( Some ( ( credentials, opaque) ) ) )
460
+ client. done (
461
+ pb,
462
+ Ok ( Some ( AcceptedCredential {
463
+ credential : credentials,
464
+ metadata : opaque,
465
+ } ) ) ,
466
+ )
445
467
}
446
468
} ) ;
447
469
false
0 commit comments