Leon4gr45 commited on
Commit
c355749
·
verified ·
1 Parent(s): eee446b

Upload folder using huggingface_hub (part 23)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +3 -0
  2. node_modules/@simplewebauthn/server/script/helpers/decodeCredentialPublicKey.js +15 -0
  3. node_modules/@simplewebauthn/server/script/helpers/fetch.d.ts +13 -0
  4. node_modules/@simplewebauthn/server/script/helpers/fetch.d.ts.map +1 -0
  5. node_modules/@simplewebauthn/server/script/helpers/fetch.js +18 -0
  6. node_modules/@simplewebauthn/server/script/helpers/generateChallenge.d.ts +13 -0
  7. node_modules/@simplewebauthn/server/script/helpers/generateChallenge.d.ts.map +1 -0
  8. node_modules/@simplewebauthn/server/script/helpers/generateChallenge.js +28 -0
  9. node_modules/@simplewebauthn/server/script/helpers/generateUserID.d.ts +13 -0
  10. node_modules/@simplewebauthn/server/script/helpers/generateUserID.d.ts.map +1 -0
  11. node_modules/@simplewebauthn/server/script/helpers/generateUserID.js +24 -0
  12. node_modules/@simplewebauthn/server/script/helpers/getCertificateInfo.d.ts +33 -0
  13. node_modules/@simplewebauthn/server/script/helpers/getCertificateInfo.d.ts.map +1 -0
  14. node_modules/@simplewebauthn/server/script/helpers/getCertificateInfo.js +80 -0
  15. node_modules/@simplewebauthn/server/script/helpers/index.d.ts +18 -0
  16. node_modules/@simplewebauthn/server/script/helpers/index.d.ts.map +1 -0
  17. node_modules/@simplewebauthn/server/script/helpers/index.js +46 -0
  18. node_modules/@simplewebauthn/server/script/helpers/isCertRevoked.d.ts +9 -0
  19. node_modules/@simplewebauthn/server/script/helpers/isCertRevoked.d.ts.map +1 -0
  20. node_modules/@simplewebauthn/server/script/helpers/isCertRevoked.js +99 -0
  21. node_modules/@simplewebauthn/server/script/helpers/iso/index.d.ts +12 -0
  22. node_modules/@simplewebauthn/server/script/helpers/iso/index.d.ts.map +1 -0
  23. node_modules/@simplewebauthn/server/script/helpers/iso/index.js +37 -0
  24. node_modules/@simplewebauthn/server/script/helpers/iso/isoBase64URL.d.ts +43 -0
  25. node_modules/@simplewebauthn/server/script/helpers/iso/isoBase64URL.d.ts.map +1 -0
  26. node_modules/@simplewebauthn/server/script/helpers/iso/isoBase64URL.js +85 -0
  27. node_modules/@simplewebauthn/server/script/helpers/iso/isoCBOR.d.ts +29 -0
  28. node_modules/@simplewebauthn/server/script/helpers/iso/isoCBOR.d.ts.map +1 -0
  29. node_modules/@simplewebauthn/server/script/helpers/iso/isoCBOR.js +62 -0
  30. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/digest.d.ts +10 -0
  31. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/digest.d.ts.map +1 -0
  32. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/digest.js +17 -0
  33. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getRandomValues.d.ts +8 -0
  34. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getRandomValues.d.ts.map +1 -0
  35. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getRandomValues.js +14 -0
  36. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getWebCrypto.d.ts +14 -0
  37. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -0
  38. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getWebCrypto.js +54 -0
  39. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/importKey.d.ts +5 -0
  40. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/importKey.d.ts.map +1 -0
  41. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/importKey.js +11 -0
  42. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/index.d.ts +8 -0
  43. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/index.d.ts.map +1 -0
  44. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/index.js +13 -0
  45. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +7 -0
  46. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +1 -0
  47. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js +23 -0
  48. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +7 -0
  49. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -0
  50. node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +22 -0
.gitattributes CHANGED
@@ -58,3 +58,6 @@ node_modules/@rolldown/binding-linux-x64-gnu/rolldown-binding.linux-x64-gnu.node
58
  node_modules/@rolldown/binding-linux-x64-musl/rolldown-binding.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
59
  node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
60
  node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
 
 
 
 
58
  node_modules/@rolldown/binding-linux-x64-musl/rolldown-binding.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
59
  node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
60
  node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
61
+ node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
62
+ node_modules/@swc/core-linux-x64-musl/swc.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
63
+ node_modules/@trivago/prettier-plugin-sort-imports/.yarn/install-state.gz filter=lfs diff=lfs merge=lfs -text
node_modules/@simplewebauthn/server/script/helpers/decodeCredentialPublicKey.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._decodeCredentialPublicKeyInternals = void 0;
4
+ exports.decodeCredentialPublicKey = decodeCredentialPublicKey;
5
+ const index_js_1 = require("./iso/index.js");
6
+ function decodeCredentialPublicKey(publicKey) {
7
+ return exports._decodeCredentialPublicKeyInternals.stubThis(index_js_1.isoCBOR.decodeFirst(publicKey));
8
+ }
9
+ /**
10
+ * Make it possible to stub the return value during testing
11
+ * @ignore Don't include this in docs output
12
+ */
13
+ exports._decodeCredentialPublicKeyInternals = {
14
+ stubThis: (value) => value,
15
+ };
node_modules/@simplewebauthn/server/script/helpers/fetch.d.ts ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * A simple method for requesting data via standard `fetch`. Should work
3
+ * across multiple runtimes.
4
+ */
5
+ export declare function fetch(url: string): Promise<Response>;
6
+ /**
7
+ * Make it possible to stub the return value during testing
8
+ * @ignore Don't include this in docs output
9
+ */
10
+ export declare const _fetchInternals: {
11
+ stubThis: (url: string) => Promise<Response>;
12
+ };
13
+ //# sourceMappingURL=fetch.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/fetch.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/helpers/fetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEpD;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;oBACV,MAAM;CACvB,CAAC"}
node_modules/@simplewebauthn/server/script/helpers/fetch.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._fetchInternals = void 0;
4
+ exports.fetch = fetch;
5
+ /**
6
+ * A simple method for requesting data via standard `fetch`. Should work
7
+ * across multiple runtimes.
8
+ */
9
+ function fetch(url) {
10
+ return exports._fetchInternals.stubThis(url);
11
+ }
12
+ /**
13
+ * Make it possible to stub the return value during testing
14
+ * @ignore Don't include this in docs output
15
+ */
16
+ exports._fetchInternals = {
17
+ stubThis: (url) => globalThis.fetch(url),
18
+ };
node_modules/@simplewebauthn/server/script/helpers/generateChallenge.d.ts ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Uint8Array_ } from '../types/index.js';
2
+ /**
3
+ * Generate a suitably random value to be used as an attestation or assertion challenge
4
+ */
5
+ export declare function generateChallenge(): Promise<Uint8Array_>;
6
+ /**
7
+ * Make it possible to stub the return value during testing
8
+ * @ignore Don't include this in docs output
9
+ */
10
+ export declare const _generateChallengeInternals: {
11
+ stubThis: (value: Uint8Array_) => Uint8Array;
12
+ };
13
+ //# sourceMappingURL=generateChallenge.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/generateChallenge.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"generateChallenge.d.ts","sourceRoot":"","sources":["../../src/helpers/generateChallenge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,WAAW,CAAC,CAc9D;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B;sBACpB,WAAW;CAC9B,CAAC"}
node_modules/@simplewebauthn/server/script/helpers/generateChallenge.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._generateChallengeInternals = void 0;
4
+ exports.generateChallenge = generateChallenge;
5
+ const index_js_1 = require("./iso/index.js");
6
+ /**
7
+ * Generate a suitably random value to be used as an attestation or assertion challenge
8
+ */
9
+ async function generateChallenge() {
10
+ /**
11
+ * WebAuthn spec says that 16 bytes is a good minimum:
12
+ *
13
+ * "In order to prevent replay attacks, the challenges MUST contain enough entropy to make
14
+ * guessing them infeasible. Challenges SHOULD therefore be at least 16 bytes long."
15
+ *
16
+ * Just in case, let's double it
17
+ */
18
+ const challenge = new Uint8Array(32);
19
+ await index_js_1.isoCrypto.getRandomValues(challenge);
20
+ return exports._generateChallengeInternals.stubThis(challenge);
21
+ }
22
+ /**
23
+ * Make it possible to stub the return value during testing
24
+ * @ignore Don't include this in docs output
25
+ */
26
+ exports._generateChallengeInternals = {
27
+ stubThis: (value) => value,
28
+ };
node_modules/@simplewebauthn/server/script/helpers/generateUserID.d.ts ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Uint8Array_ } from '../types/index.js';
2
+ /**
3
+ * Generate a suitably random value to be used as user ID
4
+ */
5
+ export declare function generateUserID(): Promise<Uint8Array_>;
6
+ /**
7
+ * Make it possible to stub the return value during testing
8
+ * @ignore Don't include this in docs output
9
+ */
10
+ export declare const _generateUserIDInternals: {
11
+ stubThis: (value: Uint8Array_) => Uint8Array;
12
+ };
13
+ //# sourceMappingURL=generateUserID.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/generateUserID.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"generateUserID.d.ts","sourceRoot":"","sources":["../../src/helpers/generateUserID.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAU3D;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB;sBACjB,WAAW;CAC9B,CAAC"}
node_modules/@simplewebauthn/server/script/helpers/generateUserID.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._generateUserIDInternals = void 0;
4
+ exports.generateUserID = generateUserID;
5
+ const index_js_1 = require("./iso/index.js");
6
+ /**
7
+ * Generate a suitably random value to be used as user ID
8
+ */
9
+ async function generateUserID() {
10
+ /**
11
+ * WebAuthn spec says user.id has a max length of 64 bytes. I prefer how 32 random bytes look
12
+ * after they're base64url-encoded so I'm choosing to go with that here.
13
+ */
14
+ const newUserID = new Uint8Array(32);
15
+ await index_js_1.isoCrypto.getRandomValues(newUserID);
16
+ return exports._generateUserIDInternals.stubThis(newUserID);
17
+ }
18
+ /**
19
+ * Make it possible to stub the return value during testing
20
+ * @ignore Don't include this in docs output
21
+ */
22
+ exports._generateUserIDInternals = {
23
+ stubThis: (value) => value,
24
+ };
node_modules/@simplewebauthn/server/script/helpers/getCertificateInfo.d.ts ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Certificate } from '@peculiar/asn1-x509';
2
+ import type { Uint8Array_ } from '../types/index.js';
3
+ export type CertificateInfo = {
4
+ issuer: Issuer;
5
+ subject: Subject;
6
+ version: number;
7
+ basicConstraintsCA: boolean;
8
+ notBefore: Date;
9
+ notAfter: Date;
10
+ parsedCertificate: Certificate;
11
+ };
12
+ type Issuer = {
13
+ C?: string;
14
+ O?: string;
15
+ OU?: string;
16
+ CN?: string;
17
+ combined: string;
18
+ };
19
+ type Subject = {
20
+ C?: string;
21
+ O?: string;
22
+ OU?: string;
23
+ CN?: string;
24
+ combined: string;
25
+ };
26
+ /**
27
+ * Extract PEM certificate info
28
+ *
29
+ * @param pemCertificate Result from call to `convertASN1toPEM(x5c[0])`
30
+ */
31
+ export declare function getCertificateInfo(leafCertBuffer: Uint8Array_): CertificateInfo;
32
+ export {};
33
+ //# sourceMappingURL=getCertificateInfo.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/getCertificateInfo.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"getCertificateInfo.d.ts","sourceRoot":"","sources":["../../src/helpers/getCertificateInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,WAAW,EAA0B,MAAM,qBAAqB,CAAC;AAE5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,IAAI,CAAC;IACf,iBAAiB,EAAE,WAAW,CAAC;CAChC,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AASF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,WAAW,GAC1B,eAAe,CA+CjB"}
node_modules/@simplewebauthn/server/script/helpers/getCertificateInfo.js ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCertificateInfo = getCertificateInfo;
4
+ const asn1_schema_1 = require("@peculiar/asn1-schema");
5
+ const asn1_x509_1 = require("@peculiar/asn1-x509");
6
+ const issuerSubjectIDKey = {
7
+ '2.5.4.6': 'C',
8
+ '2.5.4.10': 'O',
9
+ '2.5.4.11': 'OU',
10
+ '2.5.4.3': 'CN',
11
+ };
12
+ /**
13
+ * Extract PEM certificate info
14
+ *
15
+ * @param pemCertificate Result from call to `convertASN1toPEM(x5c[0])`
16
+ */
17
+ function getCertificateInfo(leafCertBuffer) {
18
+ const x509 = asn1_schema_1.AsnParser.parse(leafCertBuffer, asn1_x509_1.Certificate);
19
+ const parsedCert = x509.tbsCertificate;
20
+ // Issuer
21
+ const issuer = { combined: '' };
22
+ parsedCert.issuer.forEach(([iss]) => {
23
+ const key = issuerSubjectIDKey[iss.type];
24
+ if (key) {
25
+ issuer[key] = iss.value.toString();
26
+ }
27
+ });
28
+ issuer.combined = issuerSubjectToString(issuer);
29
+ // Subject
30
+ const subject = { combined: '' };
31
+ parsedCert.subject.forEach(([iss]) => {
32
+ const key = issuerSubjectIDKey[iss.type];
33
+ if (key) {
34
+ subject[key] = iss.value.toString();
35
+ }
36
+ });
37
+ subject.combined = issuerSubjectToString(subject);
38
+ let basicConstraintsCA = false;
39
+ if (parsedCert.extensions) {
40
+ // console.log(parsedCert.extensions);
41
+ for (const ext of parsedCert.extensions) {
42
+ if (ext.extnID === asn1_x509_1.id_ce_basicConstraints) {
43
+ const basicConstraints = asn1_schema_1.AsnParser.parse(ext.extnValue, asn1_x509_1.BasicConstraints);
44
+ basicConstraintsCA = basicConstraints.cA;
45
+ }
46
+ }
47
+ }
48
+ return {
49
+ issuer,
50
+ subject,
51
+ version: parsedCert.version,
52
+ basicConstraintsCA,
53
+ notBefore: parsedCert.validity.notBefore.getTime(),
54
+ notAfter: parsedCert.validity.notAfter.getTime(),
55
+ parsedCertificate: x509,
56
+ };
57
+ }
58
+ /**
59
+ * Stringify the parts of Issuer or Subject info for easier comparison of subject issuers with
60
+ * issuer subjects.
61
+ *
62
+ * The order might seem arbitrary, because it is. It should be enough that the two are stringified
63
+ * in the same order.
64
+ */
65
+ function issuerSubjectToString(input) {
66
+ const parts = [];
67
+ if (input.C) {
68
+ parts.push(input.C);
69
+ }
70
+ if (input.O) {
71
+ parts.push(input.O);
72
+ }
73
+ if (input.OU) {
74
+ parts.push(input.OU);
75
+ }
76
+ if (input.CN) {
77
+ parts.push(input.CN);
78
+ }
79
+ return parts.join(' : ');
80
+ }
node_modules/@simplewebauthn/server/script/helpers/index.d.ts ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export * from './convertAAGUIDToString.js';
2
+ export * from './convertCertBufferToPEM.js';
3
+ export * from './convertCOSEtoPKCS.js';
4
+ export * from './decodeAttestationObject.js';
5
+ export * from './decodeClientDataJSON.js';
6
+ export * from './decodeCredentialPublicKey.js';
7
+ export * from './generateChallenge.js';
8
+ export * from './generateUserID.js';
9
+ export * from './getCertificateInfo.js';
10
+ export * from './isCertRevoked.js';
11
+ export * from './parseAuthenticatorData.js';
12
+ export * from './toHash.js';
13
+ export * from './validateCertificatePath.js';
14
+ export * from './verifySignature.js';
15
+ export * from './iso/index.js';
16
+ export * from '../metadata/verifyMDSBlob.js';
17
+ export * as cose from './cose.js';
18
+ //# sourceMappingURL=index.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC"}
node_modules/@simplewebauthn/server/script/helpers/index.js ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.cose = void 0;
30
+ __exportStar(require("./convertAAGUIDToString.js"), exports);
31
+ __exportStar(require("./convertCertBufferToPEM.js"), exports);
32
+ __exportStar(require("./convertCOSEtoPKCS.js"), exports);
33
+ __exportStar(require("./decodeAttestationObject.js"), exports);
34
+ __exportStar(require("./decodeClientDataJSON.js"), exports);
35
+ __exportStar(require("./decodeCredentialPublicKey.js"), exports);
36
+ __exportStar(require("./generateChallenge.js"), exports);
37
+ __exportStar(require("./generateUserID.js"), exports);
38
+ __exportStar(require("./getCertificateInfo.js"), exports);
39
+ __exportStar(require("./isCertRevoked.js"), exports);
40
+ __exportStar(require("./parseAuthenticatorData.js"), exports);
41
+ __exportStar(require("./toHash.js"), exports);
42
+ __exportStar(require("./validateCertificatePath.js"), exports);
43
+ __exportStar(require("./verifySignature.js"), exports);
44
+ __exportStar(require("./iso/index.js"), exports);
45
+ __exportStar(require("../metadata/verifyMDSBlob.js"), exports);
46
+ exports.cose = __importStar(require("./cose.js"));
node_modules/@simplewebauthn/server/script/helpers/isCertRevoked.d.ts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import { type X509Certificate } from '@peculiar/x509';
2
+ /**
3
+ * A method to pull a CRL from a certificate and compare its serial number to the list of revoked
4
+ * certificate serial numbers within the CRL.
5
+ *
6
+ * CRL certificate structure referenced from https://tools.ietf.org/html/rfc5280#page-117
7
+ */
8
+ export declare function isCertRevoked(cert: X509Certificate): Promise<boolean>;
9
+ //# sourceMappingURL=isCertRevoked.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/isCertRevoked.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"isCertRevoked.d.ts","sourceRoot":"","sources":["../../src/helpers/isCertRevoked.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AAexB;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAkG3E"}
node_modules/@simplewebauthn/server/script/helpers/isCertRevoked.js ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCertRevoked = isCertRevoked;
4
+ const x509_1 = require("@peculiar/x509");
5
+ const fetch_js_1 = require("./fetch.js");
6
+ const cacheRevokedCerts = {};
7
+ /**
8
+ * A method to pull a CRL from a certificate and compare its serial number to the list of revoked
9
+ * certificate serial numbers within the CRL.
10
+ *
11
+ * CRL certificate structure referenced from https://tools.ietf.org/html/rfc5280#page-117
12
+ */
13
+ async function isCertRevoked(cert) {
14
+ const { extensions } = cert;
15
+ if (!extensions) {
16
+ return false;
17
+ }
18
+ let extAuthorityKeyID;
19
+ let extSubjectKeyID;
20
+ let extCRLDistributionPoints;
21
+ extensions.forEach((ext) => {
22
+ if (ext instanceof x509_1.AuthorityKeyIdentifierExtension) {
23
+ extAuthorityKeyID = ext;
24
+ }
25
+ else if (ext instanceof x509_1.SubjectKeyIdentifierExtension) {
26
+ extSubjectKeyID = ext;
27
+ }
28
+ else if (ext instanceof x509_1.CRLDistributionPointsExtension) {
29
+ extCRLDistributionPoints = ext;
30
+ }
31
+ });
32
+ // Check to see if we've got cached info for the cert's CA
33
+ let keyIdentifier = undefined;
34
+ if (extAuthorityKeyID && extAuthorityKeyID.keyId) {
35
+ keyIdentifier = extAuthorityKeyID.keyId;
36
+ }
37
+ else if (extSubjectKeyID) {
38
+ /**
39
+ * We might be dealing with a self-signed root certificate. Check the
40
+ * Subject key Identifier extension next.
41
+ */
42
+ keyIdentifier = extSubjectKeyID.keyId;
43
+ }
44
+ if (keyIdentifier) {
45
+ const cached = cacheRevokedCerts[keyIdentifier];
46
+ if (cached) {
47
+ const now = new Date();
48
+ // If there's a nextUpdate then make sure we're before it
49
+ if (!cached.nextUpdate || cached.nextUpdate > now) {
50
+ return cached.revokedCerts.indexOf(cert.serialNumber) >= 0;
51
+ }
52
+ }
53
+ }
54
+ const crlURL = extCRLDistributionPoints?.distributionPoints?.[0].distributionPoint?.fullName?.[0]
55
+ .uniformResourceIdentifier;
56
+ // If no URL is provided then we have nothing to check
57
+ if (!crlURL) {
58
+ return false;
59
+ }
60
+ // Download and read the CRL
61
+ let certListBytes;
62
+ try {
63
+ const respCRL = await (0, fetch_js_1.fetch)(crlURL);
64
+ certListBytes = await respCRL.arrayBuffer();
65
+ }
66
+ catch (_err) {
67
+ return false;
68
+ }
69
+ let data;
70
+ try {
71
+ data = new x509_1.X509Crl(certListBytes);
72
+ }
73
+ catch (_err) {
74
+ // Something was malformed with the CRL, so pass
75
+ return false;
76
+ }
77
+ const newCached = {
78
+ revokedCerts: [],
79
+ nextUpdate: undefined,
80
+ };
81
+ // nextUpdate
82
+ if (data.nextUpdate) {
83
+ newCached.nextUpdate = data.nextUpdate;
84
+ }
85
+ // revokedCertificates
86
+ const revokedCerts = data.entries;
87
+ if (revokedCerts) {
88
+ for (const cert of revokedCerts) {
89
+ const revokedHex = cert.serialNumber;
90
+ newCached.revokedCerts.push(revokedHex);
91
+ }
92
+ // Cache the results
93
+ if (keyIdentifier) {
94
+ cacheRevokedCerts[keyIdentifier] = newCached;
95
+ }
96
+ return newCached.revokedCerts.indexOf(cert.serialNumber) >= 0;
97
+ }
98
+ return false;
99
+ }
node_modules/@simplewebauthn/server/script/helpers/iso/index.d.ts ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * A collection of methods for isomorphic manipulation of trickier data types
3
+ *
4
+ * The goal with these is to make it easier to replace dependencies later that might not play well
5
+ * with specific server-like runtimes that expose global Web APIs (CloudFlare Workers, Deno, Bun,
6
+ * etc...), while also supporting execution in Node.
7
+ */
8
+ export * as isoBase64URL from './isoBase64URL.js';
9
+ export * as isoCBOR from './isoCBOR.js';
10
+ export * as isoCrypto from './isoCrypto/index.js';
11
+ export * as isoUint8Array from './isoUint8Array.js';
12
+ //# sourceMappingURL=index.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC"}
node_modules/@simplewebauthn/server/script/helpers/iso/index.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.isoUint8Array = exports.isoCrypto = exports.isoCBOR = exports.isoBase64URL = void 0;
27
+ /**
28
+ * A collection of methods for isomorphic manipulation of trickier data types
29
+ *
30
+ * The goal with these is to make it easier to replace dependencies later that might not play well
31
+ * with specific server-like runtimes that expose global Web APIs (CloudFlare Workers, Deno, Bun,
32
+ * etc...), while also supporting execution in Node.
33
+ */
34
+ exports.isoBase64URL = __importStar(require("./isoBase64URL.js"));
35
+ exports.isoCBOR = __importStar(require("./isoCBOR.js"));
36
+ exports.isoCrypto = __importStar(require("./isoCrypto/index.js"));
37
+ exports.isoUint8Array = __importStar(require("./isoUint8Array.js"));
node_modules/@simplewebauthn/server/script/helpers/iso/isoBase64URL.d.ts ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Base64URLString, Uint8Array_ } from '../../types/index.js';
2
+ /**
3
+ * Decode from a Base64URL-encoded string to an ArrayBuffer. Best used when converting a
4
+ * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
5
+ * excludeCredentials.
6
+ *
7
+ * @param buffer Value to decode from base64
8
+ * @param to (optional) The decoding to use, in case it's desirable to decode from base64 instead
9
+ */
10
+ export declare function toBuffer(base64urlString: string, from?: 'base64' | 'base64url'): Uint8Array_;
11
+ /**
12
+ * Encode the given array buffer into a Base64URL-encoded string. Ideal for converting various
13
+ * credential response ArrayBuffers to string for sending back to the server as JSON.
14
+ *
15
+ * @param buffer Value to encode to base64
16
+ * @param to (optional) The encoding to use, in case it's desirable to encode to base64 instead
17
+ */
18
+ export declare function fromBuffer(buffer: Uint8Array_, to?: 'base64' | 'base64url'): string;
19
+ /**
20
+ * Convert a base64url string into base64
21
+ */
22
+ export declare function toBase64(base64urlString: string): string;
23
+ /**
24
+ * Encode a UTF-8 string to base64url
25
+ */
26
+ export declare function fromUTF8String(utf8String: string): string;
27
+ /**
28
+ * Decode a base64url string into its original UTF-8 string
29
+ */
30
+ export declare function toUTF8String(base64urlString: string): string;
31
+ /**
32
+ * Confirm that the string is encoded into base64
33
+ */
34
+ export declare function isBase64(input: string): boolean;
35
+ /**
36
+ * Confirm that the string is encoded into base64url, with support for optional padding
37
+ */
38
+ export declare function isBase64URL(input: string): boolean;
39
+ /**
40
+ * Remove optional padding from a base64url-encoded string
41
+ */
42
+ export declare function trimPadding(input: Base64URLString): Base64URLString;
43
+ //# sourceMappingURL=isoBase64URL.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/isoBase64URL.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"isoBase64URL.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoBase64URL.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,eAAe,EAAE,MAAM,EACvB,IAAI,GAAE,QAAQ,GAAG,WAAyB,GACzC,WAAW,CAGb;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,WAAW,EACnB,EAAE,GAAE,QAAQ,GAAG,WAAyB,GACvC,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIlD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,eAAe,CAEnE"}
node_modules/@simplewebauthn/server/script/helpers/iso/isoBase64URL.js ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.toBuffer = toBuffer;
7
+ exports.fromBuffer = fromBuffer;
8
+ exports.toBase64 = toBase64;
9
+ exports.fromUTF8String = fromUTF8String;
10
+ exports.toUTF8String = toUTF8String;
11
+ exports.isBase64 = isBase64;
12
+ exports.isBase64URL = isBase64URL;
13
+ exports.trimPadding = trimPadding;
14
+ /**
15
+ * A runtime-agnostic collection of methods for working with Base64URL encoding
16
+ * @module
17
+ */
18
+ const base64_1 = __importDefault(require("@hexagon/base64"));
19
+ /**
20
+ * Decode from a Base64URL-encoded string to an ArrayBuffer. Best used when converting a
21
+ * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
22
+ * excludeCredentials.
23
+ *
24
+ * @param buffer Value to decode from base64
25
+ * @param to (optional) The decoding to use, in case it's desirable to decode from base64 instead
26
+ */
27
+ function toBuffer(base64urlString, from = 'base64url') {
28
+ const _buffer = base64_1.default.toArrayBuffer(base64urlString, from === 'base64url');
29
+ return new Uint8Array(_buffer);
30
+ }
31
+ /**
32
+ * Encode the given array buffer into a Base64URL-encoded string. Ideal for converting various
33
+ * credential response ArrayBuffers to string for sending back to the server as JSON.
34
+ *
35
+ * @param buffer Value to encode to base64
36
+ * @param to (optional) The encoding to use, in case it's desirable to encode to base64 instead
37
+ */
38
+ function fromBuffer(buffer, to = 'base64url') {
39
+ /**
40
+ * Gracefully handle Uint8Array subclass types, like Node's Buffer, that can have a large
41
+ * ArrayBuffer backing it.
42
+ */
43
+ const _normalized = new Uint8Array(buffer);
44
+ return base64_1.default.fromArrayBuffer(_normalized.buffer, to === 'base64url');
45
+ }
46
+ /**
47
+ * Convert a base64url string into base64
48
+ */
49
+ function toBase64(base64urlString) {
50
+ const fromBase64Url = base64_1.default.toArrayBuffer(base64urlString, true);
51
+ const toBase64 = base64_1.default.fromArrayBuffer(fromBase64Url);
52
+ return toBase64;
53
+ }
54
+ /**
55
+ * Encode a UTF-8 string to base64url
56
+ */
57
+ function fromUTF8String(utf8String) {
58
+ return base64_1.default.fromString(utf8String, true);
59
+ }
60
+ /**
61
+ * Decode a base64url string into its original UTF-8 string
62
+ */
63
+ function toUTF8String(base64urlString) {
64
+ return base64_1.default.toString(base64urlString, true);
65
+ }
66
+ /**
67
+ * Confirm that the string is encoded into base64
68
+ */
69
+ function isBase64(input) {
70
+ return base64_1.default.validate(input, false);
71
+ }
72
+ /**
73
+ * Confirm that the string is encoded into base64url, with support for optional padding
74
+ */
75
+ function isBase64URL(input) {
76
+ // Trim padding characters from the string if present
77
+ input = trimPadding(input);
78
+ return base64_1.default.validate(input, true);
79
+ }
80
+ /**
81
+ * Remove optional padding from a base64url-encoded string
82
+ */
83
+ function trimPadding(input) {
84
+ return input.replace(/=/g, '');
85
+ }
node_modules/@simplewebauthn/server/script/helpers/iso/isoCBOR.d.ts ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * A runtime-agnostic collection of methods for working with CBOR encoding
3
+ * @module
4
+ */
5
+ import * as tinyCbor from '@levischuck/tiny-cbor';
6
+ import type { Uint8Array_ } from '../../types/index.js';
7
+ /**
8
+ * Whatever CBOR encoder is used should keep CBOR data the same length when data is re-encoded
9
+ *
10
+ * MOST CRITICALLY, this means the following needs to be true of whatever CBOR library we use:
11
+ * - CBOR Map type values MUST decode to JavaScript Maps
12
+ * - CBOR tag 64 (uint8 Typed Array) MUST NOT be used when encoding Uint8Arrays back to CBOR
13
+ *
14
+ * So long as these requirements are maintained, then CBOR sequences can be encoded and decoded
15
+ * freely while maintaining their lengths for the most accurate pointer movement across them.
16
+ */
17
+ /**
18
+ * Decode and return the first item in a sequence of CBOR-encoded values
19
+ *
20
+ * @param input The CBOR data to decode
21
+ * @param asObject (optional) Whether to convert any CBOR Maps into JavaScript Objects. Defaults to
22
+ * `false`
23
+ */
24
+ export declare function decodeFirst<Type>(input: Uint8Array_): Type;
25
+ /**
26
+ * Encode data to CBOR
27
+ */
28
+ export declare function encode(input: tinyCbor.CBORType): Uint8Array_;
29
+ //# sourceMappingURL=isoCBOR.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/isoCBOR.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"isoCBOR.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoCBOR.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAQ1D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,GAAG,WAAW,CAE5D"}
node_modules/@simplewebauthn/server/script/helpers/iso/isoCBOR.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.decodeFirst = decodeFirst;
27
+ exports.encode = encode;
28
+ /**
29
+ * A runtime-agnostic collection of methods for working with CBOR encoding
30
+ * @module
31
+ */
32
+ const tinyCbor = __importStar(require("@levischuck/tiny-cbor"));
33
+ /**
34
+ * Whatever CBOR encoder is used should keep CBOR data the same length when data is re-encoded
35
+ *
36
+ * MOST CRITICALLY, this means the following needs to be true of whatever CBOR library we use:
37
+ * - CBOR Map type values MUST decode to JavaScript Maps
38
+ * - CBOR tag 64 (uint8 Typed Array) MUST NOT be used when encoding Uint8Arrays back to CBOR
39
+ *
40
+ * So long as these requirements are maintained, then CBOR sequences can be encoded and decoded
41
+ * freely while maintaining their lengths for the most accurate pointer movement across them.
42
+ */
43
+ /**
44
+ * Decode and return the first item in a sequence of CBOR-encoded values
45
+ *
46
+ * @param input The CBOR data to decode
47
+ * @param asObject (optional) Whether to convert any CBOR Maps into JavaScript Objects. Defaults to
48
+ * `false`
49
+ */
50
+ function decodeFirst(input) {
51
+ // Make a copy so we don't mutate the original
52
+ const _input = new Uint8Array(input);
53
+ const decoded = tinyCbor.decodePartialCBOR(_input, 0);
54
+ const [first] = decoded;
55
+ return first;
56
+ }
57
+ /**
58
+ * Encode data to CBOR
59
+ */
60
+ function encode(input) {
61
+ return tinyCbor.encodeCBOR(input);
62
+ }
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/digest.d.ts ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { COSEALG } from '../../cose.js';
2
+ import type { Uint8Array_ } from '../../../types/index.js';
3
+ /**
4
+ * Generate a digest of the provided data.
5
+ *
6
+ * @param data The data to generate a digest of
7
+ * @param algorithm A COSE algorithm ID that maps to a desired SHA algorithm
8
+ */
9
+ export declare function digest(data: Uint8Array_, algorithm: COSEALG): Promise<Uint8Array_>;
10
+ //# sourceMappingURL=digest.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/digest.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/digest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;GAKG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,WAAW,CAAC,CAQtB"}
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/digest.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.digest = digest;
4
+ const mapCoseAlgToWebCryptoAlg_js_1 = require("./mapCoseAlgToWebCryptoAlg.js");
5
+ const getWebCrypto_js_1 = require("./getWebCrypto.js");
6
+ /**
7
+ * Generate a digest of the provided data.
8
+ *
9
+ * @param data The data to generate a digest of
10
+ * @param algorithm A COSE algorithm ID that maps to a desired SHA algorithm
11
+ */
12
+ async function digest(data, algorithm) {
13
+ const WebCrypto = await (0, getWebCrypto_js_1.getWebCrypto)();
14
+ const subtleAlgorithm = (0, mapCoseAlgToWebCryptoAlg_js_1.mapCoseAlgToWebCryptoAlg)(algorithm);
15
+ const hashed = await WebCrypto.subtle.digest(subtleAlgorithm, data);
16
+ return new Uint8Array(hashed);
17
+ }
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getRandomValues.d.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import type { Uint8Array_ } from '../../../types/index.js';
2
+ /**
3
+ * Fill up the provided bytes array with random bytes equal to its length.
4
+ *
5
+ * @returns the same bytes array passed into the method
6
+ */
7
+ export declare function getRandomValues(array: Uint8Array_): Promise<Uint8Array_>;
8
+ //# sourceMappingURL=getRandomValues.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getRandomValues.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"getRandomValues.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/getRandomValues.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAM9E"}
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getRandomValues.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRandomValues = getRandomValues;
4
+ const getWebCrypto_js_1 = require("./getWebCrypto.js");
5
+ /**
6
+ * Fill up the provided bytes array with random bytes equal to its length.
7
+ *
8
+ * @returns the same bytes array passed into the method
9
+ */
10
+ async function getRandomValues(array) {
11
+ const WebCrypto = await (0, getWebCrypto_js_1.getWebCrypto)();
12
+ WebCrypto.getRandomValues(array);
13
+ return array;
14
+ }
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getWebCrypto.d.ts ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Crypto } from '../../../types/index.js';
2
+ /**
3
+ * Try to get an instance of the Crypto API from the current runtime. Should support Node,
4
+ * as well as others, like Deno, that implement Web APIs.
5
+ */
6
+ export declare function getWebCrypto(): Promise<Crypto>;
7
+ export declare class MissingWebCrypto extends Error {
8
+ constructor();
9
+ }
10
+ export declare const _getWebCryptoInternals: {
11
+ stubThisGlobalThisCrypto: () => import("crypto").webcrypto.Crypto;
12
+ setCachedCrypto: (newCrypto: Crypto | undefined) => void;
13
+ };
14
+ //# sourceMappingURL=getWebCrypto.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getWebCrypto.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"getWebCrypto.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/getWebCrypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAgC9C;AAED,qBAAa,gBAAiB,SAAQ,KAAK;;CAM1C;AAGD,eAAO,MAAM,sBAAsB;;iCAGJ,MAAM,GAAG,SAAS;CAGhD,CAAC"}
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/getWebCrypto.js ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._getWebCryptoInternals = exports.MissingWebCrypto = void 0;
4
+ exports.getWebCrypto = getWebCrypto;
5
+ let webCrypto = undefined;
6
+ /**
7
+ * Try to get an instance of the Crypto API from the current runtime. Should support Node,
8
+ * as well as others, like Deno, that implement Web APIs.
9
+ */
10
+ function getWebCrypto() {
11
+ /**
12
+ * Hello there! If you came here wondering why this method is asynchronous when use of
13
+ * `globalThis.crypto` is not, it's to minimize a bunch of refactor related to making this
14
+ * synchronous. For example, `generateRegistrationOptions()` and `generateAuthenticationOptions()`
15
+ * become synchronous if we make this synchronous (since nothing else in that method is async)
16
+ * which represents a breaking API change in this library's core API.
17
+ *
18
+ * TODO: If it's after February 2025 when you read this then consider whether it still makes sense
19
+ * to keep this method asynchronous.
20
+ */
21
+ const toResolve = new Promise((resolve, reject) => {
22
+ if (webCrypto) {
23
+ return resolve(webCrypto);
24
+ }
25
+ /**
26
+ * Naively attempt to access Crypto as a global object, which popular ESM-centric run-times
27
+ * support (and Node v20+)
28
+ */
29
+ const _globalThisCrypto = exports._getWebCryptoInternals.stubThisGlobalThisCrypto();
30
+ if (_globalThisCrypto) {
31
+ webCrypto = _globalThisCrypto;
32
+ return resolve(webCrypto);
33
+ }
34
+ // We tried to access it both in Node and globally, so bail out
35
+ return reject(new MissingWebCrypto());
36
+ });
37
+ return toResolve;
38
+ }
39
+ class MissingWebCrypto extends Error {
40
+ constructor() {
41
+ const message = 'An instance of the Crypto API could not be located';
42
+ super(message);
43
+ this.name = 'MissingWebCrypto';
44
+ }
45
+ }
46
+ exports.MissingWebCrypto = MissingWebCrypto;
47
+ // Make it possible to stub return values during testing
48
+ exports._getWebCryptoInternals = {
49
+ stubThisGlobalThisCrypto: () => globalThis.crypto,
50
+ // Make it possible to reset the `webCrypto` at the top of the file
51
+ setCachedCrypto: (newCrypto) => {
52
+ webCrypto = newCrypto;
53
+ },
54
+ };
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/importKey.d.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ export declare function importKey(opts: {
2
+ keyData: JsonWebKey;
3
+ algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams;
4
+ }): Promise<CryptoKey>;
5
+ //# sourceMappingURL=importKey.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/importKey.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"importKey.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/importKey.ts"],"names":[],"mappings":"AAEA,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,mBAAmB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;CAC5E,GAAG,OAAO,CAAC,SAAS,CAAC,CAQrB"}
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/importKey.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.importKey = importKey;
4
+ const getWebCrypto_js_1 = require("./getWebCrypto.js");
5
+ async function importKey(opts) {
6
+ const WebCrypto = await (0, getWebCrypto_js_1.getWebCrypto)();
7
+ const { keyData, algorithm } = opts;
8
+ return WebCrypto.subtle.importKey('jwk', keyData, algorithm, false, [
9
+ 'verify',
10
+ ]);
11
+ }
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/index.d.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * A runtime-agnostic collection of methods for working with the WebCrypto API
3
+ * @module
4
+ */
5
+ export { digest } from './digest.js';
6
+ export { getRandomValues } from './getRandomValues.js';
7
+ export { verify } from './verify.js';
8
+ //# sourceMappingURL=index.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/index.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verify = exports.getRandomValues = exports.digest = void 0;
4
+ /**
5
+ * A runtime-agnostic collection of methods for working with the WebCrypto API
6
+ * @module
7
+ */
8
+ var digest_js_1 = require("./digest.js");
9
+ Object.defineProperty(exports, "digest", { enumerable: true, get: function () { return digest_js_1.digest; } });
10
+ var getRandomValues_js_1 = require("./getRandomValues.js");
11
+ Object.defineProperty(exports, "getRandomValues", { enumerable: true, get: function () { return getRandomValues_js_1.getRandomValues; } });
12
+ var verify_js_1 = require("./verify.js");
13
+ Object.defineProperty(exports, "verify", { enumerable: true, get: function () { return verify_js_1.verify; } });
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import { SubtleCryptoAlg } from './structs.js';
2
+ import { COSEALG } from '../../cose.js';
3
+ /**
4
+ * Convert a COSE alg ID into a corresponding string value that WebCrypto APIs expect
5
+ */
6
+ export declare function mapCoseAlgToWebCryptoAlg(alg: COSEALG): SubtleCryptoAlg;
7
+ //# sourceMappingURL=mapCoseAlgToWebCryptoAlg.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"mapCoseAlgToWebCryptoAlg.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAetE"}
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapCoseAlgToWebCryptoAlg = mapCoseAlgToWebCryptoAlg;
4
+ const cose_js_1 = require("../../cose.js");
5
+ /**
6
+ * Convert a COSE alg ID into a corresponding string value that WebCrypto APIs expect
7
+ */
8
+ function mapCoseAlgToWebCryptoAlg(alg) {
9
+ if ([cose_js_1.COSEALG.RS1].indexOf(alg) >= 0) {
10
+ return 'SHA-1';
11
+ }
12
+ else if ([cose_js_1.COSEALG.ES256, cose_js_1.COSEALG.PS256, cose_js_1.COSEALG.RS256].indexOf(alg) >= 0) {
13
+ return 'SHA-256';
14
+ }
15
+ else if ([cose_js_1.COSEALG.ES384, cose_js_1.COSEALG.PS384, cose_js_1.COSEALG.RS384].indexOf(alg) >= 0) {
16
+ return 'SHA-384';
17
+ }
18
+ else if ([cose_js_1.COSEALG.ES512, cose_js_1.COSEALG.PS512, cose_js_1.COSEALG.RS512, cose_js_1.COSEALG.EdDSA].indexOf(alg) >=
19
+ 0) {
20
+ return 'SHA-512';
21
+ }
22
+ throw new Error(`Could not map COSE alg value of ${alg} to a WebCrypto alg`);
23
+ }
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import { COSEALG } from '../../cose.js';
2
+ import { SubtleCryptoKeyAlgName } from './structs.js';
3
+ /**
4
+ * Convert a COSE alg ID into a corresponding key algorithm string value that WebCrypto APIs expect
5
+ */
6
+ export declare function mapCoseAlgToWebCryptoKeyAlgName(alg: COSEALG): SubtleCryptoKeyAlgName;
7
+ //# sourceMappingURL=mapCoseAlgToWebCryptoKeyAlgName.d.ts.map
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"mapCoseAlgToWebCryptoKeyAlgName.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,OAAO,GACX,sBAAsB,CAoBxB"}
node_modules/@simplewebauthn/server/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapCoseAlgToWebCryptoKeyAlgName = mapCoseAlgToWebCryptoKeyAlgName;
4
+ const cose_js_1 = require("../../cose.js");
5
+ /**
6
+ * Convert a COSE alg ID into a corresponding key algorithm string value that WebCrypto APIs expect
7
+ */
8
+ function mapCoseAlgToWebCryptoKeyAlgName(alg) {
9
+ if ([cose_js_1.COSEALG.EdDSA].indexOf(alg) >= 0) {
10
+ return 'Ed25519';
11
+ }
12
+ else if ([cose_js_1.COSEALG.ES256, cose_js_1.COSEALG.ES384, cose_js_1.COSEALG.ES512, cose_js_1.COSEALG.ES256K].indexOf(alg) >= 0) {
13
+ return 'ECDSA';
14
+ }
15
+ else if ([cose_js_1.COSEALG.RS256, cose_js_1.COSEALG.RS384, cose_js_1.COSEALG.RS512, cose_js_1.COSEALG.RS1].indexOf(alg) >= 0) {
16
+ return 'RSASSA-PKCS1-v1_5';
17
+ }
18
+ else if ([cose_js_1.COSEALG.PS256, cose_js_1.COSEALG.PS384, cose_js_1.COSEALG.PS512].indexOf(alg) >= 0) {
19
+ return 'RSA-PSS';
20
+ }
21
+ throw new Error(`Could not map COSE alg value of ${alg} to a WebCrypto key alg name`);
22
+ }