@@ -1330,8 +1330,23 @@ function derToRaw(signature) {
1330
1330
...extractBigNum ( signature , sStart , signature . length , 32 ) ,
1331
1331
] ) ;
1332
1332
}
1333
+ function isAndroidFacetId ( str ) {
1334
+ return str . startsWith ( "android:apk-key-hash:" ) ;
1335
+ }
1336
+
1337
+ function isIOSFacetId ( str ) {
1338
+ return str . startsWith ( "ios:bundle-id:" ) ;
1339
+ }
1340
+
1333
1341
1334
1342
function checkOrigin ( str ) {
1343
+ if ( ! str )
1344
+ throw new Error ( "Empty Origin" ) ;
1345
+
1346
+ if ( isAndroidFacetId ( str ) || isIOSFacetId ( str ) ) {
1347
+ return str ;
1348
+ }
1349
+
1335
1350
const originUrl = new URL ( str ) ;
1336
1351
const origin = originUrl . origin ;
1337
1352
@@ -1980,22 +1995,22 @@ async function validateExpectations() {
1980
1995
if ( ! Array . isArray ( allowCredentials ) ) {
1981
1996
throw new Error ( "expected allowCredentials to be null or array" ) ;
1982
1997
} else {
1983
- for ( const index in allowCredentials ) {
1984
- if ( typeof allowCredentials [ index ] . id === "string" ) {
1985
- allowCredentials [ index ] . id = coerceToArrayBuffer$1 ( allowCredentials [ index ] . id , "allowCredentials[" + index + "].id" ) ;
1998
+ allowCredentials . forEach ( ( allowCredential , index ) => {
1999
+ if ( typeof allowCredential . id === "string" ) {
2000
+ allowCredential . id = coerceToArrayBuffer$1 ( allowCredential . id , "allowCredentials[" + index + "].id" ) ;
1986
2001
}
1987
- if ( allowCredentials [ index ] . id == null || ! ( allowCredentials [ index ] . id instanceof ArrayBuffer ) ) {
2002
+ if ( allowCredential . id == null || ! ( allowCredential . id instanceof ArrayBuffer ) ) {
1988
2003
throw new Error ( "expected id of allowCredentials[" + index + "] to be ArrayBuffer" ) ;
1989
2004
}
1990
- if ( allowCredentials [ index ] . type == null || allowCredentials [ index ] . type !== "public-key" ) {
2005
+ if ( allowCredential . type == null || allowCredential . type !== "public-key" ) {
1991
2006
throw new Error ( "expected type of allowCredentials[" + index + "] to be string with value 'public-key'" ) ;
1992
2007
}
1993
- if ( allowCredentials [ index ] . transports != null && ! Array . isArray ( allowCredentials [ index ] . transports ) ) {
2008
+ if ( allowCredential . transports != null && ! Array . isArray ( allowCredential . transports ) ) {
1994
2009
throw new Error ( "expected transports of allowCredentials[" + index + "] to be array or null" ) ;
1995
- } else if ( allowCredentials [ index ] . transports != null && ! allowCredentials [ index ] . transports . every ( el => [ "usb" , "nfc" , "ble" , "cable" , "internal" ] . includes ( el ) ) ) {
2010
+ } else if ( allowCredential . transports != null && ! allowCredential . transports . every ( el => [ "usb" , "nfc" , "ble" , "cable" , "internal" ] . includes ( el ) ) ) {
1996
2011
throw new Error ( "expected transports of allowCredentials[" + index + "] to be string with value 'usb', 'nfc', 'ble', 'cable', 'internal' or null" ) ;
1997
2012
}
1998
- }
2013
+ } ) ;
1999
2014
}
2000
2015
}
2001
2016
0 commit comments