@tinfoilsh/passkey-kit 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -81
- package/dist/crypto.d.ts +11 -54
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +146 -97
- package/dist/crypto.js.map +1 -1
- package/dist/errors.d.ts +11 -21
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -27
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -7
- package/dist/index.js.map +1 -1
- package/dist/kit.d.ts +2 -62
- package/dist/kit.d.ts.map +1 -1
- package/dist/kit.js +331 -155
- package/dist/kit.js.map +1 -1
- package/dist/storage.d.ts +15 -29
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +113 -62
- package/dist/storage.js.map +1 -1
- package/dist/support.d.ts +2 -14
- package/dist/support.d.ts.map +1 -1
- package/dist/support.js +32 -47
- package/dist/support.js.map +1 -1
- package/dist/types.d.ts +85 -89
- package/dist/types.d.ts.map +1 -1
- package/dist/webauthn.d.ts +10 -33
- package/dist/webauthn.d.ts.map +1 -1
- package/dist/webauthn.js +89 -177
- package/dist/webauthn.js.map +1 -1
- package/dist/wrapped-key-record-codec.d.ts +4 -0
- package/dist/wrapped-key-record-codec.d.ts.map +1 -0
- package/dist/wrapped-key-record-codec.js +89 -0
- package/dist/wrapped-key-record-codec.js.map +1 -0
- package/package.json +4 -2
- package/src/crypto.ts +171 -137
- package/src/errors.ts +29 -33
- package/src/index.ts +26 -41
- package/src/kit.ts +431 -260
- package/src/storage.ts +126 -60
- package/src/support.ts +36 -50
- package/src/types.ts +99 -99
- package/src/webauthn.ts +121 -237
- package/src/wrapped-key-record-codec.ts +93 -0
- package/dist/protocol.d.ts +0 -13
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js +0 -13
- package/dist/protocol.js.map +0 -1
- package/src/protocol.ts +0 -15
package/dist/crypto.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG7E,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS;IACT,gBAAgB;IAChB,SAAS;IACT,UAAU;CACF,CAAC;AAEX,SAAS,WAAW,CAAC,KAAc,EAAE,IAAY,EAAE,UAAU,GAAG,KAAK;IACnE,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;QAC1E,MAAM,YAAY,CAAC,GAAG,IAAI,YAAY,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,aAAa,aAAa,CAAC,CAAC;IACvF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAA0B;IAC/D,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,MAAM,YAAY,CAAC,qBAAqB,CAAC,CAAC;IACvF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IACzC,MAAM,QAAQ,GAAG,CAAC,GAAG,YAAY,CAAC,CA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,CAAC,SAAS,CAAC,CAAC;QACtC,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC5B,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,eAAe;YAAE,MAAM,KAAK,CAAC;QAClD,MAAM,eAAe,CAAC,uBAAuB,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACnE,CAAC;AACH,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* The authenticator created a credential but does not support the WebAuthn
|
|
11
|
-
* PRF extension, so no key material can be derived from it.
|
|
12
|
-
*/
|
|
13
|
-
export declare class PrfNotSupportedError extends PasskeyKitError {
|
|
14
|
-
constructor(message?: string);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* The passkey provider never resolved the WebAuthn promise within the
|
|
18
|
-
* SDK's hard timeout (some password-manager browser extensions hang).
|
|
19
|
-
*/
|
|
20
|
-
export declare class PasskeyTimeoutError extends PasskeyKitError {
|
|
21
|
-
constructor(message?: string);
|
|
1
|
+
export type PasskeyKeyErrorCategory = "unsupported" | "cancelled" | "timeout" | "operation_in_progress" | "invalid_input" | "operation_failed";
|
|
2
|
+
export declare class PasskeyKeyError extends Error {
|
|
3
|
+
readonly category: PasskeyKeyErrorCategory;
|
|
4
|
+
readonly operation?: string;
|
|
5
|
+
readonly cause?: unknown;
|
|
6
|
+
constructor(category: PasskeyKeyErrorCategory, message: string, options?: {
|
|
7
|
+
cause?: unknown;
|
|
8
|
+
operation?: string;
|
|
9
|
+
});
|
|
22
10
|
}
|
|
11
|
+
export declare function invalidInput(message: string, operation?: string): PasskeyKeyError;
|
|
12
|
+
export declare function operationFailed(message: string, cause: unknown, operation?: string): PasskeyKeyError;
|
|
23
13
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAC/B,aAAa,GACb,WAAW,GACX,SAAS,GACT,uBAAuB,GACvB,eAAe,GACf,kBAAkB,CAAC;AAEvB,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBAGvB,QAAQ,EAAE,uBAAuB,EACjC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO;CAQxD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAEjF;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,eAAe,CAEjB"}
|
package/dist/errors.js
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* (never on message strings) to drive recovery flows.
|
|
4
|
-
*/
|
|
5
|
-
/** Base class for every error the SDK throws on its own behalf. */
|
|
6
|
-
export class PasskeyKitError extends Error {
|
|
7
|
-
constructor(message) {
|
|
1
|
+
export class PasskeyKeyError extends Error {
|
|
2
|
+
constructor(category, message, options = {}) {
|
|
8
3
|
super(message);
|
|
9
|
-
this.name =
|
|
4
|
+
this.name = "PasskeyKeyError";
|
|
5
|
+
this.category = category;
|
|
6
|
+
this.operation = options.operation;
|
|
7
|
+
this.cause = options.cause;
|
|
10
8
|
}
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* The authenticator created a credential but does not support the WebAuthn
|
|
15
|
-
* PRF extension, so no key material can be derived from it.
|
|
16
|
-
*/
|
|
17
|
-
export class PrfNotSupportedError extends PasskeyKitError {
|
|
18
|
-
constructor(message = `Your passkey provider doesn't support the security features required by this app. ${PROVIDER_SUGGESTION}`) {
|
|
19
|
-
super(message);
|
|
20
|
-
this.name = 'PrfNotSupportedError';
|
|
21
|
-
}
|
|
10
|
+
export function invalidInput(message, operation) {
|
|
11
|
+
return new PasskeyKeyError("invalid_input", message, { operation });
|
|
22
12
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* SDK's hard timeout (some password-manager browser extensions hang).
|
|
26
|
-
*/
|
|
27
|
-
export class PasskeyTimeoutError extends PasskeyKitError {
|
|
28
|
-
constructor(message = `Your passkey provider took too long to respond. This can happen with some browser extension password managers. ${PROVIDER_SUGGESTION}`) {
|
|
29
|
-
super(message);
|
|
30
|
-
this.name = 'PasskeyTimeoutError';
|
|
31
|
-
}
|
|
13
|
+
export function operationFailed(message, cause, operation) {
|
|
14
|
+
return new PasskeyKeyError("operation_failed", message, { cause, operation });
|
|
32
15
|
}
|
|
33
16
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAKxC,YACE,QAAiC,EACjC,OAAe,EACf,UAAmD,EAAE;QAErD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,SAAkB;IAC9D,OAAO,IAAI,eAAe,CAAC,eAAe,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,KAAc,EACd,SAAkB;IAElB,OAAO,IAAI,eAAe,CAAC,kBAAkB,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAChF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export type { StorageAdapter } from "./storage.js";
|
|
9
|
-
export { detectPrfSupport } from "./support.js";
|
|
10
|
-
export type { EnrollResult, PasskeyKitConfig, PasskeyKitErrorMessages, PasskeyKitLogger, PasskeyKitStorageKeys, PasskeyUser, PrfPasskeyResult, UnlockResult, WrappedCek, } from "./types.js";
|
|
1
|
+
export { PasskeyKeyError } from "./errors.js";
|
|
2
|
+
export type { PasskeyKeyErrorCategory } from "./errors.js";
|
|
3
|
+
export { createPasskeyKeyManager } from "./kit.js";
|
|
4
|
+
export { decodeWrappedKeyRecord, encodeWrappedKeyRecord, } from "./wrapped-key-record-codec.js";
|
|
5
|
+
export { createInsecureBrowserLocalStoragePasskeyKeyStorage, createMemoryPasskeyKeyStorage, } from "./storage.js";
|
|
6
|
+
export type { CachedPRFResult, PasskeyKeyStorage } from "./storage.js";
|
|
7
|
+
export type { CreateAndWrapKeyInput, CreatedWrappedKey, EvaluatedCredential, EvaluateCredentialInput, PasskeyCapability, PasskeyInteraction, PasskeyKeyManager, PasskeyKeyManagerConfig, PasskeyKeyProfile, PasskeyUser, PRFResult, RecoveredKey, RecoverKeyInput, RewrapKeyInput, UnwrapKeyWithPRFResultInput, WrapKeyWithPRFResultInput, WrappedKey, WrappedKeyRecord, } from "./types.js";
|
|
11
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kDAAkD,EAClD,6BAA6B,GAC9B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,eAAe,EACf,cAAc,EACd,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export { TINFOIL_HKDF_INFO_V1, TINFOIL_KEY_ID_INFO_V1, TINFOIL_PRF_SALT_INPUT_V1, } from "./protocol.js";
|
|
6
|
-
export { browserLocalStorageAdapter, createMemoryStorageAdapter, } from "./storage.js";
|
|
7
|
-
export { detectPrfSupport } from "./support.js";
|
|
1
|
+
export { PasskeyKeyError } from "./errors.js";
|
|
2
|
+
export { createPasskeyKeyManager } from "./kit.js";
|
|
3
|
+
export { decodeWrappedKeyRecord, encodeWrappedKeyRecord, } from "./wrapped-key-record-codec.js";
|
|
4
|
+
export { createInsecureBrowserLocalStoragePasskeyKeyStorage, createMemoryPasskeyKeyStorage, } from "./storage.js";
|
|
8
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kDAAkD,EAClD,6BAA6B,GAC9B,MAAM,cAAc,CAAC"}
|
package/dist/kit.d.ts
CHANGED
|
@@ -1,63 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* configuration, protocol constants, and local persistence into a single
|
|
4
|
-
* object exposing both high-level flows (enroll / unlock / rewrap) and the
|
|
5
|
-
* lower-level ceremony + crypto building blocks.
|
|
6
|
-
*/
|
|
7
|
-
import type { EnrollResult, PasskeyKitConfig, PasskeyUser, PrfPasskeyResult, UnlockResult, WrappedCek } from "./types.js";
|
|
8
|
-
export interface PasskeyKit {
|
|
9
|
-
/** Optimistic device/browser PRF support check (cached per kit). */
|
|
10
|
-
isPrfSupported(): Promise<boolean>;
|
|
11
|
-
resetPrfSupportCache(): void;
|
|
12
|
-
/**
|
|
13
|
-
* Create a new PRF-capable passkey. Returns null when the user cancels;
|
|
14
|
-
* throws PrfNotSupportedError / PasskeyTimeoutError otherwise on failure.
|
|
15
|
-
*/
|
|
16
|
-
createPasskey(user: PasskeyUser): Promise<PrfPasskeyResult | null>;
|
|
17
|
-
/**
|
|
18
|
-
* Prompt for an assertion against any of the given credential ids and
|
|
19
|
-
* return the matched credential's PRF output. Null on cancel/failure.
|
|
20
|
-
*/
|
|
21
|
-
authenticate(credentialIds: string[], options?: {
|
|
22
|
-
throwOnCancel?: boolean;
|
|
23
|
-
}): Promise<PrfPasskeyResult | null>;
|
|
24
|
-
/** Derive the AES-256-GCM KEK from a PRF output (HKDF-SHA-256). */
|
|
25
|
-
deriveKek(prfOutput: ArrayBuffer | Uint8Array): Promise<CryptoKey>;
|
|
26
|
-
/** Create a passkey and wrap the given CEK under it in one flow. */
|
|
27
|
-
enroll(opts: {
|
|
28
|
-
user: PasskeyUser;
|
|
29
|
-
cek: Uint8Array;
|
|
30
|
-
}): Promise<EnrollResult | null>;
|
|
31
|
-
/** Authenticate against the given wrapped CEKs and unwrap the matching one. */
|
|
32
|
-
unlock(wrappedCeks: WrappedCek[]): Promise<UnlockResult | null>;
|
|
33
|
-
/**
|
|
34
|
-
* Unwrap the wrapped CEK matching the cached PRF output without a
|
|
35
|
-
* biometric prompt. Returns null when nothing is cached, no wrapped CEK
|
|
36
|
-
* matches the cached credential, or the cached output fails to unwrap;
|
|
37
|
-
* fall back to `unlock()` in that case.
|
|
38
|
-
*/
|
|
39
|
-
unlockWithCachedPrf(wrappedCeks: WrappedCek[]): Promise<UnlockResult | null>;
|
|
40
|
-
/**
|
|
41
|
-
* Re-wrap a CEK using the cached PRF output (no biometric prompt).
|
|
42
|
-
* Returns null when nothing is cached.
|
|
43
|
-
*/
|
|
44
|
-
rewrapWithCachedPrf(cek: Uint8Array): Promise<WrappedCek | null>;
|
|
45
|
-
/** Wrap a CEK under the KEK of an explicit PRF result. */
|
|
46
|
-
wrapWithPrfResult(prfResult: PrfPasskeyResult, cek: Uint8Array): Promise<WrappedCek>;
|
|
47
|
-
/** Unwrap a CEK with the KEK of an explicit PRF result. */
|
|
48
|
-
unwrapWithPrfResult(prfResult: PrfPasskeyResult, wrapped: Pick<WrappedCek, "kekIvHex" | "wrappedKeyHex">): Promise<Uint8Array>;
|
|
49
|
-
/**
|
|
50
|
-
* Cached PRF result from local storage, if any. The PRF output is
|
|
51
|
-
* deterministic for a given passkey, so it can be reused to avoid
|
|
52
|
-
* re-prompting biometrics on key updates.
|
|
53
|
-
*/
|
|
54
|
-
getCachedPrfResult(): PrfPasskeyResult | null;
|
|
55
|
-
clearCachedPrfResult(): void;
|
|
56
|
-
/** Credential id owned by this device (platform attachment), if known. */
|
|
57
|
-
getLocalCredentialId(): string | null;
|
|
58
|
-
setLocalCredentialId(credentialId: string): void;
|
|
59
|
-
/** Clear all device-local state (e.g. on sign-out). */
|
|
60
|
-
clearLocalState(): void;
|
|
61
|
-
}
|
|
62
|
-
export declare function createPasskeyKit(config: PasskeyKitConfig): PasskeyKit;
|
|
1
|
+
import type { PasskeyKeyManager, PasskeyKeyManagerConfig } from "./types.js";
|
|
2
|
+
export declare function createPasskeyKeyManager(config: PasskeyKeyManagerConfig): PasskeyKeyManager;
|
|
63
3
|
//# sourceMappingURL=kit.d.ts.map
|
package/dist/kit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAGV,iBAAiB,EACjB,uBAAuB,EAMxB,MAAM,YAAY,CAAC;AAoFpB,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,uBAAuB,GAC9B,iBAAiB,CA2YnB"}
|