1
1
/*!
2
- * Copyright (c) 2019-2024 Digital Bazaar, Inc. All rights reserved.
2
+ * Copyright (c) 2019-2025 Digital Bazaar, Inc. All rights reserved.
3
3
*/
4
4
import * as bbs2023Cryptosuite from '@digitalbazaar/bbs-2023-cryptosuite' ;
5
5
import * as Bls12381Multikey from '@digitalbazaar/bls12-381-multikey' ;
@@ -806,6 +806,30 @@ for(const [version, mockCredential] of versionedCredentials) {
806
806
result . verified . should . be . a ( 'boolean' ) ;
807
807
result . verified . should . be . true ;
808
808
} ) ;
809
+ it ( 'includes credentials in verification results' , async ( ) => {
810
+ const challenge = uuid ( ) ;
811
+
812
+ const { presentation, suite, documentLoader} =
813
+ await _generatePresentation ( { challenge, mockCredential, version} ) ;
814
+
815
+ const result = await vc . verify ( {
816
+ challenge,
817
+ suite,
818
+ documentLoader,
819
+ presentation,
820
+ includeCredentials : true
821
+ } ) ;
822
+
823
+ if ( result . error ) {
824
+ const firstError = [ ] . concat ( result . error ) [ 0 ] ;
825
+ throw firstError ;
826
+ }
827
+ result . verified . should . be . a ( 'boolean' ) ;
828
+ result . verified . should . be . true ;
829
+ result . credentialResults . length . should . equal ( 1 ) ;
830
+ result . credentialResults [ 0 ] . credential . should . deep . equal (
831
+ presentation . verifiableCredential [ 0 ] ) ;
832
+ } ) ;
809
833
it ( 'verifies an unsigned presentation' , async ( ) => {
810
834
const {
811
835
presentation,
@@ -831,6 +855,35 @@ for(const [version, mockCredential] of versionedCredentials) {
831
855
result . verified . should . be . a ( 'boolean' ) ;
832
856
result . verified . should . be . true ;
833
857
} ) ;
858
+ it ( 'includes credentials in unsigned presentation results' , async ( ) => {
859
+ const {
860
+ presentation,
861
+ suite : vcSuite ,
862
+ documentLoader,
863
+ } = await _generatePresentation ( {
864
+ unsigned : true ,
865
+ mockCredential,
866
+ version
867
+ } ) ;
868
+
869
+ const result = await vc . verify ( {
870
+ documentLoader,
871
+ presentation,
872
+ suite : vcSuite ,
873
+ unsignedPresentation : true ,
874
+ includeCredentials : true
875
+ } ) ;
876
+
877
+ if ( result . error ) {
878
+ const firstError = [ ] . concat ( result . error ) [ 0 ] ;
879
+ throw firstError ;
880
+ }
881
+ result . verified . should . be . a ( 'boolean' ) ;
882
+ result . verified . should . be . true ;
883
+ result . credentialResults . length . should . equal ( 1 ) ;
884
+ result . credentialResults [ 0 ] . credential . should . deep . equal (
885
+ presentation . verifiableCredential [ 0 ] ) ;
886
+ } ) ;
834
887
} ) ;
835
888
836
889
describe ( `VerifiablePresentations Version ${ version } w/ multiple VCs` ,
0 commit comments