@@ -130,22 +130,22 @@ async function validateExpectations() {
130
130
if ( ! Array . isArray ( allowCredentials ) ) {
131
131
throw new Error ( "expected allowCredentials to be null or array" ) ;
132
132
} else {
133
- for ( const index in allowCredentials ) {
134
- if ( typeof allowCredentials [ index ] . id === "string" ) {
135
- allowCredentials [ index ] . id = coerceToArrayBuffer ( allowCredentials [ index ] . id , "allowCredentials[" + index + "].id" ) ;
133
+ allowCredentials . forEach ( ( allowCredential , index ) => {
134
+ if ( typeof allowCredential . id === "string" ) {
135
+ allowCredential . id = coerceToArrayBuffer ( allowCredential . id , "allowCredentials[" + index + "].id" ) ;
136
136
}
137
- if ( allowCredentials [ index ] . id == null || ! ( allowCredentials [ index ] . id instanceof ArrayBuffer ) ) {
137
+ if ( allowCredential . id == null || ! ( allowCredential . id instanceof ArrayBuffer ) ) {
138
138
throw new Error ( "expected id of allowCredentials[" + index + "] to be ArrayBuffer" ) ;
139
139
}
140
- if ( allowCredentials [ index ] . type == null || allowCredentials [ index ] . type !== "public-key" ) {
140
+ if ( allowCredential . type == null || allowCredential . type !== "public-key" ) {
141
141
throw new Error ( "expected type of allowCredentials[" + index + "] to be string with value 'public-key'" ) ;
142
142
}
143
- if ( allowCredentials [ index ] . transports != null && ! Array . isArray ( allowCredentials [ index ] . transports ) ) {
143
+ if ( allowCredential . transports != null && ! Array . isArray ( allowCredential . transports ) ) {
144
144
throw new Error ( "expected transports of allowCredentials[" + index + "] to be array or null" ) ;
145
- } else if ( allowCredentials [ index ] . transports != null && ! allowCredentials [ index ] . transports . every ( el => [ "usb" , "nfc" , "ble" , "cable" , "internal" ] . includes ( el ) ) ) {
145
+ } else if ( allowCredential . transports != null && ! allowCredential . transports . every ( el => [ "usb" , "nfc" , "ble" , "cable" , "internal" ] . includes ( el ) ) ) {
146
146
throw new Error ( "expected transports of allowCredentials[" + index + "] to be string with value 'usb', 'nfc', 'ble', 'cable', 'internal' or null" ) ;
147
147
}
148
- }
148
+ } ) ;
149
149
}
150
150
}
151
151
0 commit comments