@deltarocks/pykrete-front 0.1.0 → 0.2.0
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/client.d.ts +6 -14
- package/client.js +15 -82
- package/client.js.map +1 -1
- package/control/gen/link/Frontend/add_passkey/Request.d.ts +10 -0
- package/control/gen/link/Frontend/add_passkey/Request.js +20 -0
- package/control/gen/link/Frontend/add_passkey/Request.js.map +1 -0
- package/control/gen/link/Frontend/add_passkey/Response.d.ts +6 -0
- package/control/gen/link/Frontend/add_passkey/Response.js +13 -0
- package/control/gen/link/Frontend/add_passkey/Response.js.map +1 -0
- package/control/gen/link/Frontend/add_passkey/mod.d.ts +2 -0
- package/control/gen/link/Frontend/add_passkey/mod.js +4 -0
- package/control/gen/link/Frontend/add_passkey/mod.js.map +1 -0
- package/control/gen/link/Frontend/clear_session/Request.d.ts +5 -0
- package/control/gen/link/Frontend/clear_session/Request.js +10 -0
- package/control/gen/link/Frontend/clear_session/Request.js.map +1 -0
- package/control/gen/link/Frontend/clear_session/mod.d.ts +1 -0
- package/control/gen/link/Frontend/clear_session/mod.js +3 -0
- package/control/gen/link/Frontend/clear_session/mod.js.map +1 -0
- package/control/gen/{Challenge.d.ts → link/Frontend/create_password_with_secret_code/Request.d.ts} +4 -5
- package/control/gen/link/Frontend/create_password_with_secret_code/Request.js +25 -0
- package/control/gen/link/Frontend/create_password_with_secret_code/Request.js.map +1 -0
- package/control/gen/link/Frontend/create_password_with_secret_code/Response.d.ts +6 -0
- package/control/gen/link/Frontend/create_password_with_secret_code/Response.js +13 -0
- package/control/gen/link/Frontend/create_password_with_secret_code/Response.js.map +1 -0
- package/control/gen/link/Frontend/create_password_with_secret_code/mod.d.ts +2 -0
- package/control/gen/link/Frontend/create_password_with_secret_code/mod.js +4 -0
- package/control/gen/link/Frontend/create_password_with_secret_code/mod.js.map +1 -0
- package/control/gen/link/Frontend/device_code_input/Request.d.ts +8 -0
- package/control/gen/link/Frontend/device_code_input/Request.js +16 -0
- package/control/gen/link/Frontend/device_code_input/Request.js.map +1 -0
- package/control/gen/link/Frontend/device_code_input/Response.d.ts +5 -0
- package/control/gen/link/Frontend/device_code_input/Response.js +13 -0
- package/control/gen/link/Frontend/device_code_input/Response.js.map +1 -0
- package/control/gen/link/Frontend/device_code_input/mod.d.ts +2 -0
- package/control/gen/link/Frontend/device_code_input/mod.js +4 -0
- package/control/gen/link/Frontend/device_code_input/mod.js.map +1 -0
- package/control/gen/link/Frontend/finished_message/Request.d.ts +7 -0
- package/control/gen/link/Frontend/finished_message/Request.js +16 -0
- package/control/gen/link/Frontend/finished_message/Request.js.map +1 -0
- package/control/gen/link/Frontend/finished_message/mod.d.ts +1 -0
- package/control/gen/link/Frontend/finished_message/mod.js +3 -0
- package/control/gen/link/Frontend/finished_message/mod.js.map +1 -0
- package/control/gen/link/Frontend/finished_redirect/Request.d.ts +7 -0
- package/control/gen/link/Frontend/finished_redirect/Request.js +16 -0
- package/control/gen/link/Frontend/finished_redirect/Request.js.map +1 -0
- package/control/gen/link/Frontend/finished_redirect/mod.d.ts +1 -0
- package/control/gen/link/Frontend/finished_redirect/mod.js +3 -0
- package/control/gen/link/Frontend/finished_redirect/mod.js.map +1 -0
- package/control/gen/link/Frontend/logout_confirmation/Request.d.ts +10 -0
- package/control/gen/link/Frontend/logout_confirmation/Request.js +20 -0
- package/control/gen/link/Frontend/logout_confirmation/Request.js.map +1 -0
- package/control/gen/link/Frontend/logout_confirmation/Response.d.ts +6 -0
- package/control/gen/link/Frontend/logout_confirmation/Response.js +13 -0
- package/control/gen/link/Frontend/logout_confirmation/Response.js.map +1 -0
- package/control/gen/link/Frontend/logout_confirmation/mod.d.ts +2 -0
- package/control/gen/link/Frontend/logout_confirmation/mod.js +4 -0
- package/control/gen/link/Frontend/logout_confirmation/mod.js.map +1 -0
- package/control/gen/link/Frontend/mod.d.ts +15 -0
- package/control/gen/link/Frontend/mod.js +17 -0
- package/control/gen/link/Frontend/mod.js.map +1 -0
- package/control/gen/link/Frontend/organization_access/Request.d.ts +10 -0
- package/control/gen/link/Frontend/organization_access/Request.js +20 -0
- package/control/gen/link/Frontend/organization_access/Request.js.map +1 -0
- package/control/gen/link/Frontend/organization_access/Response.d.ts +6 -0
- package/control/gen/link/Frontend/organization_access/Response.js +13 -0
- package/control/gen/link/Frontend/organization_access/Response.js.map +1 -0
- package/control/gen/link/Frontend/organization_access/mod.d.ts +2 -0
- package/control/gen/link/Frontend/organization_access/mod.js +4 -0
- package/control/gen/link/Frontend/organization_access/mod.js.map +1 -0
- package/control/gen/link/Frontend/passkey_input/Request.d.ts +12 -0
- package/control/gen/link/Frontend/passkey_input/Request.js +25 -0
- package/control/gen/link/Frontend/passkey_input/Request.js.map +1 -0
- package/control/gen/link/Frontend/passkey_input/Response.d.ts +6 -0
- package/control/gen/link/Frontend/passkey_input/Response.js +13 -0
- package/control/gen/link/Frontend/passkey_input/Response.js.map +1 -0
- package/control/gen/link/Frontend/passkey_input/mod.d.ts +2 -0
- package/control/gen/link/Frontend/passkey_input/mod.js +4 -0
- package/control/gen/link/Frontend/passkey_input/mod.js.map +1 -0
- package/control/gen/link/Frontend/password_input/Request.d.ts +12 -0
- package/control/gen/link/Frontend/password_input/Request.js +25 -0
- package/control/gen/link/Frontend/password_input/Request.js.map +1 -0
- package/control/gen/link/Frontend/password_input/Response.d.ts +6 -0
- package/control/gen/link/Frontend/password_input/Response.js +13 -0
- package/control/gen/link/Frontend/password_input/Response.js.map +1 -0
- package/control/gen/link/Frontend/password_input/mod.d.ts +2 -0
- package/control/gen/link/Frontend/password_input/mod.js +4 -0
- package/control/gen/link/Frontend/password_input/mod.js.map +1 -0
- package/control/gen/link/Frontend/permission_confirmation/Request.d.ts +10 -0
- package/control/gen/link/Frontend/permission_confirmation/Request.js +20 -0
- package/control/gen/link/Frontend/permission_confirmation/Request.js.map +1 -0
- package/control/gen/link/Frontend/permission_confirmation/Response.d.ts +6 -0
- package/control/gen/link/Frontend/permission_confirmation/Response.js +13 -0
- package/control/gen/link/Frontend/permission_confirmation/Response.js.map +1 -0
- package/control/gen/link/Frontend/permission_confirmation/mod.d.ts +2 -0
- package/control/gen/link/Frontend/permission_confirmation/mod.js +4 -0
- package/control/gen/link/Frontend/permission_confirmation/mod.js.map +1 -0
- package/control/gen/link/Frontend/second_factor_input/Request.d.ts +10 -0
- package/control/gen/link/Frontend/second_factor_input/Request.js +20 -0
- package/control/gen/link/Frontend/second_factor_input/Request.js.map +1 -0
- package/control/gen/link/Frontend/second_factor_input/Response.d.ts +5 -0
- package/control/gen/link/Frontend/second_factor_input/Response.js +13 -0
- package/control/gen/link/Frontend/second_factor_input/Response.js.map +1 -0
- package/control/gen/link/Frontend/second_factor_input/mod.d.ts +2 -0
- package/control/gen/link/Frontend/second_factor_input/mod.js +4 -0
- package/control/gen/link/Frontend/second_factor_input/mod.js.map +1 -0
- package/control/gen/link/Frontend/service.d.ts +79 -0
- package/control/gen/link/Frontend/service.js +166 -0
- package/control/gen/link/Frontend/service.js.map +1 -0
- package/control/gen/link/Frontend/stored_credentials/Request.d.ts +5 -0
- package/control/gen/link/Frontend/stored_credentials/Request.js +10 -0
- package/control/gen/link/Frontend/stored_credentials/Request.js.map +1 -0
- package/control/gen/link/Frontend/stored_credentials/Response.d.ts +6 -0
- package/control/gen/link/Frontend/stored_credentials/Response.js +13 -0
- package/control/gen/link/Frontend/stored_credentials/Response.js.map +1 -0
- package/control/gen/link/Frontend/stored_credentials/mod.d.ts +2 -0
- package/control/gen/link/Frontend/stored_credentials/mod.js +4 -0
- package/control/gen/link/Frontend/stored_credentials/mod.js.map +1 -0
- package/control/gen/link/Frontend/username_input/Request.d.ts +12 -0
- package/control/gen/link/Frontend/username_input/Request.js +25 -0
- package/control/gen/link/Frontend/username_input/Request.js.map +1 -0
- package/control/gen/link/Frontend/username_input/Response.d.ts +6 -0
- package/control/gen/link/Frontend/username_input/Response.js +13 -0
- package/control/gen/link/Frontend/username_input/Response.js.map +1 -0
- package/control/gen/link/Frontend/username_input/mod.d.ts +2 -0
- package/control/gen/link/Frontend/username_input/mod.js +4 -0
- package/control/gen/link/Frontend/username_input/mod.js.map +1 -0
- package/control/gen/link/Vault/keybase_material/Request.d.ts +9 -0
- package/control/gen/link/Vault/keybase_material/Request.js +20 -0
- package/control/gen/link/Vault/keybase_material/Request.js.map +1 -0
- package/control/gen/link/Vault/keybase_material/mod.d.ts +1 -0
- package/control/gen/link/Vault/keybase_material/mod.js +3 -0
- package/control/gen/link/Vault/keybase_material/mod.js.map +1 -0
- package/control/gen/link/Vault/mod.d.ts +5 -0
- package/control/gen/link/Vault/mod.js +7 -0
- package/control/gen/link/Vault/mod.js.map +1 -0
- package/control/gen/link/Vault/protect_password/Request.d.ts +11 -0
- package/control/gen/link/Vault/protect_password/Request.js +25 -0
- package/control/gen/link/Vault/protect_password/Request.js.map +1 -0
- package/control/gen/link/Vault/protect_password/Response.d.ts +6 -0
- package/control/gen/link/Vault/protect_password/Response.js +13 -0
- package/control/gen/link/Vault/protect_password/Response.js.map +1 -0
- package/control/gen/link/Vault/protect_password/mod.d.ts +2 -0
- package/control/gen/link/Vault/protect_password/mod.js +4 -0
- package/control/gen/link/Vault/protect_password/mod.js.map +1 -0
- package/control/gen/link/Vault/service.d.ts +30 -0
- package/control/gen/link/Vault/service.js +57 -0
- package/control/gen/link/Vault/service.js.map +1 -0
- package/control/gen/link/Vault/start_session/Request.d.ts +7 -0
- package/control/gen/link/Vault/start_session/Request.js +16 -0
- package/control/gen/link/Vault/start_session/Request.js.map +1 -0
- package/control/gen/link/Vault/start_session/mod.d.ts +1 -0
- package/control/gen/link/Vault/start_session/mod.js +3 -0
- package/control/gen/link/Vault/start_session/mod.js.map +1 -0
- package/control/gen/link/Vault/wrap_keybase/Request.d.ts +7 -0
- package/control/gen/link/Vault/wrap_keybase/Request.js +16 -0
- package/control/gen/link/Vault/wrap_keybase/Request.js.map +1 -0
- package/control/gen/link/Vault/wrap_keybase/Response.d.ts +5 -0
- package/control/gen/link/Vault/wrap_keybase/Response.js +13 -0
- package/control/gen/link/Vault/wrap_keybase/Response.js.map +1 -0
- package/control/gen/link/Vault/wrap_keybase/mod.d.ts +2 -0
- package/control/gen/link/Vault/wrap_keybase/mod.js +4 -0
- package/control/gen/link/Vault/wrap_keybase/mod.js.map +1 -0
- package/control/gen/{PowChallenge.d.ts → link/Worker/captcha/Request.d.ts} +3 -3
- package/control/gen/link/Worker/captcha/Request.js +20 -0
- package/control/gen/link/Worker/captcha/Request.js.map +1 -0
- package/control/gen/link/Worker/captcha/Response.d.ts +7 -0
- package/control/gen/link/Worker/captcha/Response.js +19 -0
- package/control/gen/link/Worker/captcha/Response.js.map +1 -0
- package/control/gen/link/Worker/captcha/mod.d.ts +2 -0
- package/control/gen/link/Worker/captcha/mod.js +4 -0
- package/control/gen/link/Worker/captcha/mod.js.map +1 -0
- package/control/gen/{EncryptAppKeys.d.ts → link/Worker/encrypt_app_keys/Request.d.ts} +2 -2
- package/control/gen/{EncryptAppKeys.js → link/Worker/encrypt_app_keys/Request.js} +4 -4
- package/control/gen/link/Worker/encrypt_app_keys/Request.js.map +1 -0
- package/control/gen/link/Worker/encrypt_app_keys/Response.d.ts +5 -0
- package/control/gen/link/Worker/encrypt_app_keys/Response.js +13 -0
- package/control/gen/link/Worker/encrypt_app_keys/Response.js.map +1 -0
- package/control/gen/link/Worker/encrypt_app_keys/mod.d.ts +2 -0
- package/control/gen/link/Worker/encrypt_app_keys/mod.js +4 -0
- package/control/gen/link/Worker/encrypt_app_keys/mod.js.map +1 -0
- package/control/gen/link/Worker/mod.d.ts +4 -0
- package/control/gen/link/Worker/mod.js +6 -0
- package/control/gen/link/Worker/mod.js.map +1 -0
- package/control/gen/link/Worker/service.d.ts +27 -0
- package/control/gen/link/Worker/service.js +48 -0
- package/control/gen/link/Worker/service.js.map +1 -0
- package/control/gen/{UnlockKeybase.d.ts → link/Worker/unlock_keybase/Request.d.ts} +2 -2
- package/control/gen/{UnlockKeybase.js → link/Worker/unlock_keybase/Request.js} +5 -5
- package/control/gen/link/Worker/unlock_keybase/Request.js.map +1 -0
- package/control/gen/link/Worker/unlock_keybase/Response.d.ts +6 -0
- package/control/gen/link/Worker/unlock_keybase/Response.js +13 -0
- package/control/gen/link/Worker/unlock_keybase/Response.js.map +1 -0
- package/control/gen/link/Worker/unlock_keybase/mod.d.ts +2 -0
- package/control/gen/link/Worker/unlock_keybase/mod.js +4 -0
- package/control/gen/link/Worker/unlock_keybase/mod.js.map +1 -0
- package/control/gen/link/mod.d.ts +3 -0
- package/control/gen/link/mod.js +5 -0
- package/control/gen/link/mod.js.map +1 -0
- package/control/gen/mod.d.ts +1 -7
- package/control/gen/mod.js +1 -7
- package/control/gen/mod.js.map +1 -1
- package/control/mod.d.ts +9 -8
- package/control/mod.js +1 -4
- package/control/mod.js.map +1 -1
- package/control/pds.d.ts +1 -1
- package/control/pds.js +1 -1
- package/control/pds.js.map +1 -1
- package/control/pds_native.d.ts +2 -2
- package/control/pds_native.js +3 -2
- package/control/pds_native.js.map +1 -1
- package/control/schema_hash.js +1 -1
- package/control/schema_hash.js.map +1 -1
- package/lib/pykrete_front.internal.js +1 -1
- package/lib/pykrete_front.js +1 -1
- package/lib/pykrete_front.wasm +0 -0
- package/link/mod.d.ts +26 -0
- package/link/mod.js +92 -0
- package/link/mod.js.map +1 -0
- package/link/worker.d.ts +3 -0
- package/link/worker.js +148 -0
- package/link/worker.js.map +1 -0
- package/package.json +208 -23
- package/worker.d.ts +1 -30
- package/worker.js +9 -91
- package/worker.js.map +1 -1
- package/control/gen/Challenge.js +0 -25
- package/control/gen/Challenge.js.map +0 -1
- package/control/gen/ChallengeRequest.d.ts +0 -44
- package/control/gen/ChallengeRequest.js +0 -159
- package/control/gen/ChallengeRequest.js.map +0 -1
- package/control/gen/EncryptAppKeys.js.map +0 -1
- package/control/gen/PowChallenge.js +0 -20
- package/control/gen/PowChallenge.js.map +0 -1
- package/control/gen/Reply.d.ts +0 -54
- package/control/gen/Reply.js +0 -204
- package/control/gen/Reply.js.map +0 -1
- package/control/gen/Request.d.ts +0 -33
- package/control/gen/Request.js +0 -127
- package/control/gen/Request.js.map +0 -1
- package/control/gen/UnlockKeybase.js.map +0 -1
package/control/gen/mod.js
CHANGED
|
@@ -3,14 +3,11 @@ export * as ActiveOrganizationSelection from "./ActiveOrganizationSelection.js";
|
|
|
3
3
|
export * as App from "./App.js";
|
|
4
4
|
export * as AppKeyData from "./AppKeyData.js";
|
|
5
5
|
export * as AppKeys from "./AppKeys.js";
|
|
6
|
-
export * as Challenge from "./Challenge.js";
|
|
7
|
-
export * as ChallengeRequest from "./ChallengeRequest.js";
|
|
8
6
|
export * as ChallengeUpdate from "./ChallengeUpdate.js";
|
|
9
7
|
export * as ControlInit from "./ControlInit.js";
|
|
10
8
|
export * as ControlInitKind from "./ControlInitKind.js";
|
|
11
9
|
export * as CreatePasswordWithSecretCodeResponse from "./CreatePasswordWithSecretCodeResponse.js";
|
|
12
10
|
export * as DisplayPermission from "./DisplayPermission.js";
|
|
13
|
-
export * as EncryptAppKeys from "./EncryptAppKeys.js";
|
|
14
11
|
export * as FactorResponse from "./FactorResponse.js";
|
|
15
12
|
export * as IdentifyResponse from "./IdentifyResponse.js";
|
|
16
13
|
export * as KeybaseEnvelope from "./KeybaseEnvelope.js";
|
|
@@ -34,22 +31,19 @@ export * as PasswordInput from "./PasswordInput.js";
|
|
|
34
31
|
export * as PermissionConfirmation from "./PermissionConfirmation.js";
|
|
35
32
|
export * as PermissionGroup from "./PermissionGroup.js";
|
|
36
33
|
export * as PermissionIcon from "./PermissionIcon.js";
|
|
37
|
-
export * as PowChallenge from "./PowChallenge.js";
|
|
38
34
|
export * as Publisher from "./Publisher.js";
|
|
39
35
|
export * as RegisterPasskeyResponse from "./RegisterPasskeyResponse.js";
|
|
40
36
|
export * as RegisteredPasskey from "./RegisteredPasskey.js";
|
|
41
|
-
export * as Reply from "./Reply.js";
|
|
42
|
-
export * as Request from "./Request.js";
|
|
43
37
|
export * as RequestDetail from "./RequestDetail.js";
|
|
44
38
|
export * as SecondFactorInput from "./SecondFactorInput.js";
|
|
45
39
|
export * as StoredCredentialsResponse from "./StoredCredentialsResponse.js";
|
|
46
|
-
export * as UnlockKeybase from "./UnlockKeybase.js";
|
|
47
40
|
export * as UnlockKeybaseResponse from "./UnlockKeybaseResponse.js";
|
|
48
41
|
export * as array from "./array/mod.js";
|
|
49
42
|
export * as bool from "./bool.js";
|
|
50
43
|
export * as buffer from "./buffer/mod.js";
|
|
51
44
|
export * as i32 from "./i32.js";
|
|
52
45
|
export * as i64 from "./i64.js";
|
|
46
|
+
export * as link from "./link/mod.js";
|
|
53
47
|
export * as map_0 from "./map_0.js";
|
|
54
48
|
export * as option_0 from "./option_0.js";
|
|
55
49
|
export * as option_1 from "./option_1.js";
|
package/control/gen/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["mod.ts"],"sourcesContent":["// This file is automatically generated from PDS descriptor\nexport * as ActiveOrganizationSelection from \"./ActiveOrganizationSelection.ts\";\nexport * as App from \"./App.ts\";\nexport * as AppKeyData from \"./AppKeyData.ts\";\nexport * as AppKeys from \"./AppKeys.ts\";\nexport * as
|
|
1
|
+
{"version":3,"names":[],"sources":["mod.ts"],"sourcesContent":["// This file is automatically generated from PDS descriptor\nexport * as ActiveOrganizationSelection from \"./ActiveOrganizationSelection.ts\";\nexport * as App from \"./App.ts\";\nexport * as AppKeyData from \"./AppKeyData.ts\";\nexport * as AppKeys from \"./AppKeys.ts\";\nexport * as ChallengeUpdate from \"./ChallengeUpdate.ts\";\nexport * as ControlInit from \"./ControlInit.ts\";\nexport * as ControlInitKind from \"./ControlInitKind.ts\";\nexport * as CreatePasswordWithSecretCodeResponse from \"./CreatePasswordWithSecretCodeResponse.ts\";\nexport * as DisplayPermission from \"./DisplayPermission.ts\";\nexport * as FactorResponse from \"./FactorResponse.ts\";\nexport * as IdentifyResponse from \"./IdentifyResponse.ts\";\nexport * as KeybaseEnvelope from \"./KeybaseEnvelope.ts\";\nexport * as KeybaseSource from \"./KeybaseSource.ts\";\nexport * as KeybaseUnlocked from \"./KeybaseUnlocked.ts\";\nexport * as LegacyKeybase from \"./LegacyKeybase.ts\";\nexport * as LegacyKeybaseMaterial from \"./LegacyKeybaseMaterial.ts\";\nexport * as LogoutConfirmation from \"./LogoutConfirmation.ts\";\nexport * as OrganizationAccess from \"./OrganizationAccess.ts\";\nexport * as OrganizationAccessResponse from \"./OrganizationAccessResponse.ts\";\nexport * as OrganizationChoice from \"./OrganizationChoice.ts\";\nexport * as OrganizationChoiceAccess from \"./OrganizationChoiceAccess.ts\";\nexport * as PasskeyAssertion from \"./PasskeyAssertion.ts\";\nexport * as PasskeyCreationRequest from \"./PasskeyCreationRequest.ts\";\nexport * as PasskeyInput from \"./PasskeyInput.ts\";\nexport * as PasskeyRegistration from \"./PasskeyRegistration.ts\";\nexport * as PasskeyRequest from \"./PasskeyRequest.ts\";\nexport * as PasswordChallengeRequest from \"./PasswordChallengeRequest.ts\";\nexport * as PasswordChallengeResponse from \"./PasswordChallengeResponse.ts\";\nexport * as PasswordInput from \"./PasswordInput.ts\";\nexport * as PermissionConfirmation from \"./PermissionConfirmation.ts\";\nexport * as PermissionGroup from \"./PermissionGroup.ts\";\nexport * as PermissionIcon from \"./PermissionIcon.ts\";\nexport * as Publisher from \"./Publisher.ts\";\nexport * as RegisterPasskeyResponse from \"./RegisterPasskeyResponse.ts\";\nexport * as RegisteredPasskey from \"./RegisteredPasskey.ts\";\nexport * as RequestDetail from \"./RequestDetail.ts\";\nexport * as SecondFactorInput from \"./SecondFactorInput.ts\";\nexport * as StoredCredentialsResponse from \"./StoredCredentialsResponse.ts\";\nexport * as UnlockKeybaseResponse from \"./UnlockKeybaseResponse.ts\";\nexport * as array from \"./array/mod.ts\";\nexport * as bool from \"./bool.ts\";\nexport * as buffer from \"./buffer/mod.ts\";\nexport * as i32 from \"./i32.ts\";\nexport * as i64 from \"./i64.ts\";\nexport * as link from \"./link/mod.ts\";\nexport * as map_0 from \"./map_0.ts\";\nexport * as option_0 from \"./option_0.ts\";\nexport * as option_1 from \"./option_1.ts\";\nexport * as option_2 from \"./option_2.ts\";\nexport * as option_3 from \"./option_3.ts\";\nexport * as option_4 from \"./option_4.ts\";\nexport * as option_5 from \"./option_5.ts\";\nexport * as option_6 from \"./option_6.ts\";\nexport * as pstring_6 from \"./pstring_6.ts\";\nexport * as u32 from \"./u32.ts\";\nexport * as u8 from \"./u8.ts\";\nexport * as varint from \"./varint.ts\";\nexport * as void from \"./void.ts\";\n"],"mappings":"AAAA;AACA,OAAO,KAAK,2BAA2B,MAAM,kCAAkC;AAC/E,OAAO,KAAK,GAAG,MAAM,UAAU;AAC/B,OAAO,KAAK,UAAU,MAAM,iBAAiB;AAC7C,OAAO,KAAK,OAAO,MAAM,cAAc;AACvC,OAAO,KAAK,eAAe,MAAM,sBAAsB;AACvD,OAAO,KAAK,WAAW,MAAM,kBAAkB;AAC/C,OAAO,KAAK,eAAe,MAAM,sBAAsB;AACvD,OAAO,KAAK,oCAAoC,MAAM,2CAA2C;AACjG,OAAO,KAAK,iBAAiB,MAAM,wBAAwB;AAC3D,OAAO,KAAK,cAAc,MAAM,qBAAqB;AACrD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB;AACzD,OAAO,KAAK,eAAe,MAAM,sBAAsB;AACvD,OAAO,KAAK,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAK,eAAe,MAAM,sBAAsB;AACvD,OAAO,KAAK,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAK,qBAAqB,MAAM,4BAA4B;AACnE,OAAO,KAAK,kBAAkB,MAAM,yBAAyB;AAC7D,OAAO,KAAK,kBAAkB,MAAM,yBAAyB;AAC7D,OAAO,KAAK,0BAA0B,MAAM,iCAAiC;AAC7E,OAAO,KAAK,kBAAkB,MAAM,yBAAyB;AAC7D,OAAO,KAAK,wBAAwB,MAAM,+BAA+B;AACzE,OAAO,KAAK,gBAAgB,MAAM,uB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AAS,MAAM,gBAAgB;AAC3C,OAAO,KAAK,GAAG,MAAM,UAAU;AAC/B,OAAO,KAAK,EAAE,MAAM,SAAS;AAC7B,OAAO,KAAK,MAAM,MAAM,aAAa;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW","ignoreList":[]}
|
package/control/mod.d.ts
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
import * as schema from "./gen/mod.js";
|
|
2
|
+
export * as link from "./gen/link/mod.js";
|
|
2
3
|
import { PdsError } from "./pds.js";
|
|
3
4
|
export { SCHEMA_HASH } from "./schema_hash.js";
|
|
4
5
|
export { PdsError };
|
|
5
6
|
export type App = schema.App.Ty;
|
|
6
7
|
export type AppKeyData = schema.AppKeyData.Ty;
|
|
7
8
|
export type AppKeys = schema.AppKeys.Ty;
|
|
8
|
-
export type Challenge = schema.Challenge.Ty;
|
|
9
|
-
export type ChallengeRequest = schema.ChallengeRequest.Ty;
|
|
10
9
|
export type ChallengeUpdate = schema.ChallengeUpdate.Ty;
|
|
11
10
|
export type ControlInit = schema.ControlInit.Ty;
|
|
12
11
|
export type ControlInitKind = schema.ControlInitKind.Ty;
|
|
12
|
+
export type CreatePasswordWithSecretCodeResponse = schema.CreatePasswordWithSecretCodeResponse.Ty;
|
|
13
13
|
export type DisplayPermission = schema.DisplayPermission.Ty;
|
|
14
|
+
export type FactorResponse = schema.FactorResponse.Ty;
|
|
15
|
+
export type IdentifyResponse = schema.IdentifyResponse.Ty;
|
|
14
16
|
export type KeybaseEnvelope = schema.KeybaseEnvelope.Ty;
|
|
15
17
|
export type KeybaseSource = schema.KeybaseSource.Ty;
|
|
16
18
|
export type LogoutConfirmation = schema.LogoutConfirmation.Ty;
|
|
17
19
|
export type OrganizationAccess = schema.OrganizationAccess.Ty;
|
|
20
|
+
export type OrganizationAccessResponse = schema.OrganizationAccessResponse.Ty;
|
|
18
21
|
export type OrganizationChoice = schema.OrganizationChoice.Ty;
|
|
19
22
|
export type OrganizationChoiceAccess = schema.OrganizationChoiceAccess.Ty;
|
|
20
23
|
export type PasskeyAssertion = schema.PasskeyAssertion.Ty;
|
|
21
24
|
export type PasskeyCreationRequest = schema.PasskeyCreationRequest.Ty;
|
|
25
|
+
export type PasskeyInput = schema.PasskeyInput.Ty;
|
|
22
26
|
export type PasskeyRegistration = schema.PasskeyRegistration.Ty;
|
|
23
27
|
export type PasskeyRequest = schema.PasskeyRequest.Ty;
|
|
24
28
|
export type PasswordChallengeRequest = schema.PasswordChallengeRequest.Ty;
|
|
25
29
|
export type PasswordChallengeResponse = schema.PasswordChallengeResponse.Ty;
|
|
30
|
+
export type PasswordInput = schema.PasswordInput.Ty;
|
|
26
31
|
export type PermissionConfirmation = schema.PermissionConfirmation.Ty;
|
|
27
32
|
export type PermissionGroup = schema.PermissionGroup.Ty;
|
|
28
33
|
export type Publisher = schema.Publisher.Ty;
|
|
29
|
-
export type
|
|
30
|
-
export type Request = schema.Request.Ty;
|
|
34
|
+
export type RegisterPasskeyResponse = schema.RegisterPasskeyResponse.Ty;
|
|
31
35
|
export type RequestDetail = schema.RequestDetail.Ty;
|
|
32
36
|
export type SecondFactorInput = schema.SecondFactorInput.Ty;
|
|
37
|
+
export type StoredCredentialsResponse = schema.StoredCredentialsResponse.Ty;
|
|
33
38
|
export type UnlockKeybaseResponse = schema.UnlockKeybaseResponse.Ty;
|
|
34
39
|
export declare const encodeControlInit: (v: schema.ControlInit.Ty) => Uint8Array<ArrayBuffer>;
|
|
35
40
|
export declare const decodeControlInit: (bytes: Uint8Array) => schema.ControlInit.Ty;
|
|
36
|
-
export declare const encodeRequest: (v: schema.Request.Ty) => Uint8Array<ArrayBuffer>;
|
|
37
|
-
export declare const decodeRequest: (bytes: Uint8Array) => schema.Request.Ty;
|
|
38
|
-
export declare const encodeReply: (v: schema.Reply.Ty) => Uint8Array<ArrayBuffer>;
|
|
39
|
-
export declare const decodeReply: (bytes: Uint8Array) => schema.Reply.Ty;
|
|
40
41
|
export declare const encodeAppKeys: (v: schema.AppKeys.Ty) => Uint8Array<ArrayBuffer>;
|
package/control/mod.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as schema from "./gen/mod.js";
|
|
2
|
+
export * as link from "./gen/link/mod.js";
|
|
2
3
|
import { Input, Output, PdsError } from "./pds.js";
|
|
3
4
|
export { SCHEMA_HASH } from "./schema_hash.js";
|
|
4
5
|
export { PdsError };
|
|
@@ -21,9 +22,5 @@ function decoder(codec) {
|
|
|
21
22
|
}
|
|
22
23
|
export const encodeControlInit = encoder(schema.ControlInit);
|
|
23
24
|
export const decodeControlInit = decoder(schema.ControlInit);
|
|
24
|
-
export const encodeRequest = encoder(schema.Request);
|
|
25
|
-
export const decodeRequest = decoder(schema.Request);
|
|
26
|
-
export const encodeReply = encoder(schema.Reply);
|
|
27
|
-
export const decodeReply = decoder(schema.Reply);
|
|
28
25
|
export const encodeAppKeys = encoder(schema.AppKeys);
|
|
29
26
|
//# sourceMappingURL=mod.js.map
|
package/control/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["mod.ts"],"sourcesContent":["import * as schema from './gen/mod.ts';\nimport { Input, Output, PdsError } from './pds.ts';\n\nexport { SCHEMA_HASH } from './schema_hash.ts';\nexport { PdsError };\n\nexport type App = schema.App.Ty;\nexport type AppKeyData = schema.AppKeyData.Ty;\nexport type AppKeys = schema.AppKeys.Ty;\nexport type
|
|
1
|
+
{"version":3,"names":[],"sources":["mod.ts"],"sourcesContent":["import * as schema from './gen/mod.ts';\n\nexport * as link from './gen/link/mod.ts';\nimport { Input, Output, PdsError } from './pds.ts';\n\nexport { SCHEMA_HASH } from './schema_hash.ts';\nexport { PdsError };\n\nexport type App = schema.App.Ty;\nexport type AppKeyData = schema.AppKeyData.Ty;\nexport type AppKeys = schema.AppKeys.Ty;\nexport type ChallengeUpdate = schema.ChallengeUpdate.Ty;\nexport type ControlInit = schema.ControlInit.Ty;\nexport type ControlInitKind = schema.ControlInitKind.Ty;\nexport type CreatePasswordWithSecretCodeResponse =\n\tschema.CreatePasswordWithSecretCodeResponse.Ty;\nexport type DisplayPermission = schema.DisplayPermission.Ty;\nexport type FactorResponse = schema.FactorResponse.Ty;\nexport type IdentifyResponse = schema.IdentifyResponse.Ty;\nexport type KeybaseEnvelope = schema.KeybaseEnvelope.Ty;\nexport type KeybaseSource = schema.KeybaseSource.Ty;\nexport type LogoutConfirmation = schema.LogoutConfirmation.Ty;\nexport type OrganizationAccess = schema.OrganizationAccess.Ty;\nexport type OrganizationAccessResponse = schema.OrganizationAccessResponse.Ty;\nexport type OrganizationChoice = schema.OrganizationChoice.Ty;\nexport type OrganizationChoiceAccess = schema.OrganizationChoiceAccess.Ty;\nexport type PasskeyAssertion = schema.PasskeyAssertion.Ty;\nexport type PasskeyCreationRequest = schema.PasskeyCreationRequest.Ty;\nexport type PasskeyInput = schema.PasskeyInput.Ty;\nexport type PasskeyRegistration = schema.PasskeyRegistration.Ty;\nexport type PasskeyRequest = schema.PasskeyRequest.Ty;\nexport type PasswordChallengeRequest = schema.PasswordChallengeRequest.Ty;\nexport type PasswordChallengeResponse = schema.PasswordChallengeResponse.Ty;\nexport type PasswordInput = schema.PasswordInput.Ty;\nexport type PermissionConfirmation = schema.PermissionConfirmation.Ty;\nexport type PermissionGroup = schema.PermissionGroup.Ty;\nexport type Publisher = schema.Publisher.Ty;\nexport type RegisterPasskeyResponse = schema.RegisterPasskeyResponse.Ty;\nexport type RequestDetail = schema.RequestDetail.Ty;\nexport type SecondFactorInput = schema.SecondFactorInput.Ty;\nexport type StoredCredentialsResponse = schema.StoredCredentialsResponse.Ty;\nexport type UnlockKeybaseResponse = schema.UnlockKeybaseResponse.Ty;\n\ntype Codec<T> = {\n\tserialize(v: T, output: Output): void;\n\tdeserialize(input: Input): T;\n};\n\nfunction encoder<T>(codec: Codec<T>): (v: T) => Uint8Array<ArrayBuffer> {\n\treturn (v) => {\n\t\tconst out = new Output();\n\t\tcodec.serialize(v, out);\n\t\treturn out.into_inner();\n\t};\n}\n\nfunction decoder<T>(codec: Codec<T>): (bytes: Uint8Array) => T {\n\treturn (bytes) => {\n\t\tconst input = new Input(bytes);\n\t\tconst v = codec.deserialize(input);\n\t\tif (input.remaining() !== 0) {\n\t\t\tthrow new PdsError('InvalidValue', 'trailing data');\n\t\t}\n\t\treturn v;\n\t};\n}\n\nexport const encodeControlInit = encoder(schema.ControlInit);\nexport const decodeControlInit = decoder(schema.ControlInit);\nexport const encodeAppKeys = encoder(schema.AppKeys);\n"],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc;AAEtC,OAAO,KAAK,IAAI,MAAM,mBAAmB;AACzC,SAAS,KAAK,EAAE,MAAM,EAAE,QAAQ,QAAQ,UAAU;AAElD,SAAS,WAAW,QAAQ,kBAAkB;AAC9C,SAAS,QAAQ;AA0CjB,SAAS,OAAO,CAAI,KAAe,EAAqC;EACvE,OAAQ,CAAC,IAAK;IACb,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,CAAC;IACxB,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;IACvB,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC;EACxB,CAAC;AACF;AAEA,SAAS,OAAO,CAAI,KAAe,EAA4B;EAC9D,OAAQ,KAAK,IAAK;IACjB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC;IAC9B,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC;IAClC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,EAAE;MAC5B,MAAM,IAAI,QAAQ,CAAC,cAAc,EAAE,eAAe,CAAC;IACpD;IACA,OAAO,CAAC;EACT,CAAC;AACF;AAEA,OAAO,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;AAC5D,OAAO,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;AAC5D,OAAO,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC","ignoreList":[]}
|
package/control/pds.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '@deltarocks/pds
|
|
1
|
+
export * from '@deltarocks/bifrostlink/pds';
|
package/control/pds.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from '@deltarocks/pds
|
|
1
|
+
export * from '@deltarocks/bifrostlink/pds';
|
|
2
2
|
//# sourceMappingURL=pds.js.map
|
package/control/pds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["pds.ts"],"sourcesContent":["export * from '@deltarocks/pds
|
|
1
|
+
{"version":3,"names":[],"sources":["pds.ts"],"sourcesContent":["export * from '@deltarocks/bifrostlink/pds';\n"],"mappings":"AAAA,cAAc,6BAA6B","ignoreList":[]}
|
package/control/pds_native.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { pds_bool, pds_i32, pds_i64, pds_u32, pds_u8, pds_void, } from '@deltarocks/pds
|
|
2
|
-
export
|
|
1
|
+
export { pds_bool, pds_i32, pds_i64, pds_u32, pds_u8, pds_void, } from '@deltarocks/bifrostlink/pds';
|
|
2
|
+
export declare const pds_varint: import("@deltarocks/pds-bytes-runtime").Native<number>;
|
package/control/pds_native.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
import { protobuf } from '@deltarocks/bifrostlink/pds';
|
|
2
|
+
export { pds_bool, pds_i32, pds_i64, pds_u32, pds_u8, pds_void } from '@deltarocks/bifrostlink/pds';
|
|
3
|
+
export const pds_varint = protobuf.pds_int32;
|
|
3
4
|
//# sourceMappingURL=pds_native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["pds_native.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":[],"sources":["pds_native.ts"],"sourcesContent":["import { protobuf } from '@deltarocks/bifrostlink/pds';\n\nexport {\n\tpds_bool,\n\tpds_i32,\n\tpds_i64,\n\tpds_u32,\n\tpds_u8,\n\tpds_void,\n} from '@deltarocks/bifrostlink/pds';\nexport const pds_varint = protobuf.pds_int32;\n"],"mappings":"AAAA,SAAS,QAAQ,QAAQ,6BAA6B;AAEtD,SACC,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,QACF,6BAA6B;AACpC,OAAO,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS","ignoreList":[]}
|
package/control/schema_hash.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const SCHEMA_HASH = new Uint8Array([
|
|
1
|
+
export const SCHEMA_HASH = new Uint8Array([0x9b, 0x8b, 0x89, 0x53, 0xab, 0x8c, 0x55, 0xf7, 0xda, 0x4a, 0xcf, 0xfb, 0x6e, 0xa3, 0x6f, 0xf1, 0xb7, 0xa6, 0xeb, 0xb8, 0x23, 0x41, 0x77, 0x70, 0xa7, 0x4e, 0xf1, 0x0b, 0x4b, 0x36, 0x6f, 0xa4]);
|
|
2
2
|
//# sourceMappingURL=schema_hash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["schema_hash.ts"],"sourcesContent":["export const SCHEMA_HASH = new Uint8Array([
|
|
1
|
+
{"version":3,"names":[],"sources":["schema_hash.ts"],"sourcesContent":["export const SCHEMA_HASH = new Uint8Array([0x9b, 0x8b, 0x89, 0x53, 0xab, 0x8c, 0x55, 0xf7, 0xda, 0x4a, 0xcf, 0xfb, 0x6e, 0xa3, 0x6f, 0xf1, 0xb7, 0xa6, 0xeb, 0xb8, 0x23, 0x41, 0x77, 0x70, 0xa7, 0x4e, 0xf1, 0x0b, 0x4b, 0x36, 0x6f, 0xa4]);\n"],"mappings":"AAAA,OAAO,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC","ignoreList":[]}
|
|
@@ -324,7 +324,7 @@ export function protect_pw_v1(pw, user_salt) {
|
|
|
324
324
|
export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
|
|
325
325
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
326
326
|
}
|
|
327
|
-
export function
|
|
327
|
+
export function __wbg_getRandomValues_8b6f1f663e6f188d() {
|
|
328
328
|
return handleError(function (arg0, arg1) {
|
|
329
329
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
330
330
|
}, arguments);
|
package/lib/pykrete_front.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// deno-fmt-ignore-file
|
|
5
5
|
// @ts-self-types="./pykrete_front.d.ts"
|
|
6
6
|
|
|
7
|
-
// source-hash:
|
|
7
|
+
// source-hash: afa9aefa1d6465a2d3d5673f1c8336ad2268404e
|
|
8
8
|
import * as wasm from "./pykrete_front.wasm";
|
|
9
9
|
export * from "./pykrete_front.internal.js";
|
|
10
10
|
import { __wbg_set_wasm } from "./pykrete_front.internal.js";
|
package/lib/pykrete_front.wasm
CHANGED
|
Binary file
|
package/link/mod.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type AddressCodec, type Port, Rpc } from '@deltarocks/bifrostlink';
|
|
2
|
+
import { link, type PasswordChallengeRequest, type PasswordChallengeResponse } from "../control/mod.js";
|
|
3
|
+
export type Address = 'backend' | 'frontend' | 'worker';
|
|
4
|
+
export type Frontend = link.Frontend.Server<Address>;
|
|
5
|
+
export declare const address: AddressCodec<Address>;
|
|
6
|
+
export declare function callerIs(from: Address, expected: Address): void;
|
|
7
|
+
export type WorkerMessage = {
|
|
8
|
+
Link: MessagePort;
|
|
9
|
+
};
|
|
10
|
+
export declare function workerLink(worker: Worker): Port;
|
|
11
|
+
export type ControlLink = {
|
|
12
|
+
close(): void;
|
|
13
|
+
};
|
|
14
|
+
export type ControlOptions = {
|
|
15
|
+
keysJwk?: string | null;
|
|
16
|
+
};
|
|
17
|
+
export declare class Page {
|
|
18
|
+
#private;
|
|
19
|
+
readonly rpc: Rpc<Address>;
|
|
20
|
+
constructor(worker: Port);
|
|
21
|
+
attach(backend: Port, frontend: Frontend, options?: ControlOptions): ControlLink;
|
|
22
|
+
protectPassword(password: string, challenge: PasswordChallengeRequest, keybaseSort: number | null): Promise<PasswordChallengeResponse>;
|
|
23
|
+
rememberKeybaseMaterial(keybaseSort: number, material: Uint8Array): Promise<void>;
|
|
24
|
+
wrapKeybase(material: Uint8Array): Promise<Uint8Array | null>;
|
|
25
|
+
close(): void;
|
|
26
|
+
}
|
package/link/mod.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { messagePort, Rpc } from '@deltarocks/bifrostlink';
|
|
2
|
+
import { link } from "../control/mod.js";
|
|
3
|
+
import { PdsError } from "../control/pds.js";
|
|
4
|
+
const ADDRESSES = ['backend', 'frontend', 'worker'];
|
|
5
|
+
export const address = {
|
|
6
|
+
encode(address, output) {
|
|
7
|
+
output.write_byte(ADDRESSES.indexOf(address));
|
|
8
|
+
},
|
|
9
|
+
decode(input) {
|
|
10
|
+
const address = ADDRESSES[input.read()];
|
|
11
|
+
if (address === undefined) {
|
|
12
|
+
throw new PdsError('InvalidValue', 'unknown pykrete address');
|
|
13
|
+
}
|
|
14
|
+
return address;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export function callerIs(from, expected) {
|
|
18
|
+
if (from !== expected) {
|
|
19
|
+
throw new Error(`only the ${expected} asks this, not the ${from}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function workerLink(worker) {
|
|
23
|
+
return messagePort(new Promise(resolve => worker.addEventListener('message', ({
|
|
24
|
+
data
|
|
25
|
+
}) => resolve(data.Link), {
|
|
26
|
+
once: true
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
export class Page {
|
|
30
|
+
rpc;
|
|
31
|
+
#vault;
|
|
32
|
+
#frontend = null;
|
|
33
|
+
constructor(worker) {
|
|
34
|
+
this.rpc = new Rpc('frontend', address);
|
|
35
|
+
const delegate = new Proxy({}, {
|
|
36
|
+
get: (_, name) => (from, ...rest) => {
|
|
37
|
+
callerIs(from, 'backend');
|
|
38
|
+
const frontend = this.#frontend;
|
|
39
|
+
if (frontend === null) {
|
|
40
|
+
throw new Error('there is no control session');
|
|
41
|
+
}
|
|
42
|
+
const method = Reflect.get(frontend, name);
|
|
43
|
+
return Reflect.apply(method, frontend, [from, ...rest]);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
link.Frontend.register_endpoints(delegate, this.rpc);
|
|
47
|
+
this.rpc.addDirect('worker', worker);
|
|
48
|
+
this.#vault = new link.Vault.Client(this.rpc.remote('worker'));
|
|
49
|
+
}
|
|
50
|
+
attach(backend, frontend, options = {}) {
|
|
51
|
+
this.rpc.removeDirect('backend');
|
|
52
|
+
this.#frontend = frontend;
|
|
53
|
+
this.#vault.start_session({
|
|
54
|
+
keys_jwk: options.keysJwk ?? null
|
|
55
|
+
}).catch(e => {
|
|
56
|
+
if (!this.rpc.closed) {
|
|
57
|
+
console.warn('pykrete worker refused a new session', e);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
this.rpc.addDirect('backend', backend);
|
|
61
|
+
return {
|
|
62
|
+
close: () => {
|
|
63
|
+
if (this.#frontend === frontend) {
|
|
64
|
+
this.#frontend = null;
|
|
65
|
+
this.rpc.removeDirect('backend');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
protectPassword(password, challenge, keybaseSort) {
|
|
71
|
+
return this.#vault.protect_password({
|
|
72
|
+
password,
|
|
73
|
+
challenge,
|
|
74
|
+
keybase_sort: keybaseSort
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
rememberKeybaseMaterial(keybaseSort, material) {
|
|
78
|
+
return this.#vault.keybase_material({
|
|
79
|
+
keybase_sort: keybaseSort,
|
|
80
|
+
material
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
wrapKeybase(material) {
|
|
84
|
+
return this.#vault.wrap_keybase({
|
|
85
|
+
material
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
close() {
|
|
89
|
+
this.rpc.close();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=mod.js.map
|
package/link/mod.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["mod.ts"],"sourcesContent":["import {\n\ttype AddressCodec,\n\tmessagePort,\n\ttype Port,\n\tRpc,\n} from '@deltarocks/bifrostlink';\nimport {\n\tlink,\n\ttype PasswordChallengeRequest,\n\ttype PasswordChallengeResponse,\n} from '../control/mod.ts';\nimport { type Input, type Output, PdsError } from '../control/pds.ts';\n\nexport type Address = 'backend' | 'frontend' | 'worker';\n\nexport type Frontend = link.Frontend.Server<Address>;\n\nconst ADDRESSES: readonly Address[] = ['backend', 'frontend', 'worker'];\n\nexport const address: AddressCodec<Address> = {\n\tencode(address: Address, output: Output) {\n\t\toutput.write_byte(ADDRESSES.indexOf(address));\n\t},\n\tdecode(input: Input): Address {\n\t\tconst address = ADDRESSES[input.read()];\n\t\tif (address === undefined) {\n\t\t\tthrow new PdsError('InvalidValue', 'unknown pykrete address');\n\t\t}\n\t\treturn address;\n\t},\n};\n\nexport function callerIs(from: Address, expected: Address): void {\n\tif (from !== expected) {\n\t\tthrow new Error(`only the ${expected} asks this, not the ${from}`);\n\t}\n}\n\nexport type WorkerMessage = { Link: MessagePort };\n\nexport function workerLink(worker: Worker): Port {\n\treturn messagePort(\n\t\tnew Promise<MessagePort>((resolve) =>\n\t\t\tworker.addEventListener(\n\t\t\t\t'message',\n\t\t\t\t({ data }: MessageEvent<WorkerMessage>) => resolve(data.Link),\n\t\t\t\t{ once: true },\n\t\t\t)\n\t\t),\n\t);\n}\n\nexport type ControlLink = {\n\tclose(): void;\n};\n\nexport type ControlOptions = {\n\tkeysJwk?: string | null;\n};\n\nexport class Page {\n\treadonly rpc: Rpc<Address>;\n\t#vault: link.Vault.Client<Address>;\n\t#frontend: Frontend | null = null;\n\n\tconstructor(worker: Port) {\n\t\tthis.rpc = new Rpc<Address>('frontend', address);\n\t\tconst delegate = new Proxy({} as Frontend, {\n\t\t\tget: (_, name) => (from: Address, ...rest: unknown[]) => {\n\t\t\t\tcallerIs(from, 'backend');\n\t\t\t\tconst frontend = this.#frontend;\n\t\t\t\tif (frontend === null) {\n\t\t\t\t\tthrow new Error('there is no control session');\n\t\t\t\t}\n\t\t\t\tconst method = Reflect.get(frontend, name) as (\n\t\t\t\t\t...args: unknown[]\n\t\t\t\t) => unknown;\n\t\t\t\treturn Reflect.apply(method, frontend, [from, ...rest]);\n\t\t\t},\n\t\t});\n\t\tlink.Frontend.register_endpoints(delegate, this.rpc);\n\t\tthis.rpc.addDirect('worker', worker);\n\t\tthis.#vault = new link.Vault.Client(this.rpc.remote('worker'));\n\t}\n\n\tattach(\n\t\tbackend: Port,\n\t\tfrontend: Frontend,\n\t\toptions: ControlOptions = {},\n\t): ControlLink {\n\t\tthis.rpc.removeDirect('backend');\n\t\tthis.#frontend = frontend;\n\t\tthis.#vault.start_session({ keys_jwk: options.keysJwk ?? null }).catch(\n\t\t\t(e) => {\n\t\t\t\tif (!this.rpc.closed) {\n\t\t\t\t\tconsole.warn('pykrete worker refused a new session', e);\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\t\tthis.rpc.addDirect('backend', backend);\n\t\treturn {\n\t\t\tclose: () => {\n\t\t\t\tif (this.#frontend === frontend) {\n\t\t\t\t\tthis.#frontend = null;\n\t\t\t\t\tthis.rpc.removeDirect('backend');\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tprotectPassword(\n\t\tpassword: string,\n\t\tchallenge: PasswordChallengeRequest,\n\t\tkeybaseSort: number | null,\n\t): Promise<PasswordChallengeResponse> {\n\t\treturn this.#vault.protect_password({\n\t\t\tpassword,\n\t\t\tchallenge,\n\t\t\tkeybase_sort: keybaseSort,\n\t\t});\n\t}\n\n\trememberKeybaseMaterial(\n\t\tkeybaseSort: number,\n\t\tmaterial: Uint8Array,\n\t): Promise<void> {\n\t\treturn this.#vault.keybase_material({\n\t\t\tkeybase_sort: keybaseSort,\n\t\t\tmaterial,\n\t\t});\n\t}\n\n\twrapKeybase(material: Uint8Array): Promise<Uint8Array | null> {\n\t\treturn this.#vault.wrap_keybase({ material });\n\t}\n\n\tclose(): void {\n\t\tthis.rpc.close();\n\t}\n}\n"],"mappings":"AAAA,SAEC,WAAW,EAEX,GAAG,QACG,yBAAyB;AAChC,SACC,IAAI,QAGE,mBAAmB;AAC1B,SAAkC,QAAQ,QAAQ,mBAAmB;AAMrE,MAAM,SAA6B,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC;AAEvE,OAAO,MAAM,OAA8B,GAAG;EAC7C,MAAM,CAAC,OAAgB,EAAE,MAAc,EAAE;IACxC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;EAC9C,CAAC;EACD,MAAM,CAAC,KAAY,EAAW;IAC7B,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,IAAI,OAAO,KAAK,SAAS,EAAE;MAC1B,MAAM,IAAI,QAAQ,CAAC,cAAc,EAAE,y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,CAAC,KAAK,CAAC,gBAAgB,CAAC;MACnC,YAAY,EAAE,WAAW;MACzB;IACD,CAAC,CAAC;EACH;EAEA,WAAW,CAAC,QAAoB,EAA8B;IAC7D,OAAO,IAAI,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC;MAAE;IAAS,CAAC,CAAC;EAC9C;EAEA,KAAK,GAAS;IACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;EACjB;AACD","ignoreList":[]}
|
package/link/worker.d.ts
ADDED
package/link/worker.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Rpc } from '@deltarocks/bifrostlink';
|
|
2
|
+
import { Keybase, pow_captcha, protect_pw_v0, protect_pw_v1 } from '../lib/pykrete_front.js';
|
|
3
|
+
import { encodeAppKeys, link } from "../control/mod.js";
|
|
4
|
+
import { address, callerIs } from "./mod.js";
|
|
5
|
+
const ENCODER = new TextEncoder();
|
|
6
|
+
class Keys {
|
|
7
|
+
materials = new Map();
|
|
8
|
+
keysJwk = null;
|
|
9
|
+
keybase;
|
|
10
|
+
drop() {
|
|
11
|
+
this.keybase?.free();
|
|
12
|
+
this.keybase = undefined;
|
|
13
|
+
}
|
|
14
|
+
open(uid, source) {
|
|
15
|
+
switch (source.kind) {
|
|
16
|
+
case 'fresh':
|
|
17
|
+
return Keybase.fresh(uid);
|
|
18
|
+
case 'envelope':
|
|
19
|
+
{
|
|
20
|
+
const material = this.materials.get(source.value.keybase_sort);
|
|
21
|
+
return material ? Keybase.from_envelope(uid, material, source.value.envelope) : undefined;
|
|
22
|
+
}
|
|
23
|
+
case 'legacy':
|
|
24
|
+
{
|
|
25
|
+
const legacy = source.value;
|
|
26
|
+
const found = legacy.materials.map(m => this.materials.get(m.keybase_sort));
|
|
27
|
+
if (!found.every(m => m !== undefined)) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return Keybase.from_legacy(uid, new Uint32Array(legacy.materials.map(m => m.legacy_sort)), new Uint8Array(found.flatMap(m => [...m])), legacy.wrapped, legacy.material_hash);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
unlock(uid, source, wrapFor) {
|
|
35
|
+
this.drop();
|
|
36
|
+
this.keybase = this.open(uid, source);
|
|
37
|
+
const envelopes = [];
|
|
38
|
+
for (const keybase_sort of wrapFor) {
|
|
39
|
+
const material = this.materials.get(keybase_sort);
|
|
40
|
+
if (!this.keybase || !material) {
|
|
41
|
+
this.drop();
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
envelopes.push({
|
|
45
|
+
keybase_sort,
|
|
46
|
+
envelope: this.keybase.wrap(material)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return this.keybase ? {
|
|
50
|
+
kind: 'unlocked',
|
|
51
|
+
value: {
|
|
52
|
+
fingerprint: this.keybase.fingerprint,
|
|
53
|
+
envelopes
|
|
54
|
+
}
|
|
55
|
+
} : {
|
|
56
|
+
kind: 'failed'
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
protect(password, challenge, keybaseSort) {
|
|
60
|
+
const pw = ENCODER.encode(password);
|
|
61
|
+
const out = challenge.kind === 'v0' ? protect_pw_v0(pw) : protect_pw_v1(pw, challenge.value);
|
|
62
|
+
const {
|
|
63
|
+
ppw,
|
|
64
|
+
kbm
|
|
65
|
+
} = out;
|
|
66
|
+
out.free();
|
|
67
|
+
if (keybaseSort !== null) {
|
|
68
|
+
this.materials.set(keybaseSort, kbm);
|
|
69
|
+
}
|
|
70
|
+
return challenge.kind === 'v0' ? {
|
|
71
|
+
kind: 'v0',
|
|
72
|
+
value: ppw
|
|
73
|
+
} : {
|
|
74
|
+
kind: 'v1',
|
|
75
|
+
value: ppw
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function serveKeys(frontend) {
|
|
80
|
+
const rpc = new Rpc('worker', address);
|
|
81
|
+
const keys = new Keys();
|
|
82
|
+
link.Worker.register_endpoints({
|
|
83
|
+
captcha(from, {
|
|
84
|
+
challenge,
|
|
85
|
+
cost
|
|
86
|
+
}) {
|
|
87
|
+
callerIs(from, 'backend');
|
|
88
|
+
return {
|
|
89
|
+
nonce: pow_captcha(challenge, cost)
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
unlock_keybase(from, {
|
|
93
|
+
uid,
|
|
94
|
+
source,
|
|
95
|
+
wrap_for
|
|
96
|
+
}) {
|
|
97
|
+
callerIs(from, 'backend');
|
|
98
|
+
return keys.unlock(uid, source, wrap_for);
|
|
99
|
+
},
|
|
100
|
+
encrypt_app_keys(from, {
|
|
101
|
+
app_keys,
|
|
102
|
+
keys_jwk
|
|
103
|
+
}) {
|
|
104
|
+
callerIs(from, 'backend');
|
|
105
|
+
if (!keys.keybase) {
|
|
106
|
+
throw new Error('app keys are asked for before the keybase is unlocked');
|
|
107
|
+
}
|
|
108
|
+
const jwk = keys_jwk ?? keys.keysJwk;
|
|
109
|
+
if (jwk === null) {
|
|
110
|
+
throw new Error('there is no keys_jwk to encrypt app keys to');
|
|
111
|
+
}
|
|
112
|
+
return keys.keybase.encrypt_app_keys(encodeAppKeys(app_keys), jwk);
|
|
113
|
+
}
|
|
114
|
+
}, rpc);
|
|
115
|
+
link.Vault.register_endpoints({
|
|
116
|
+
start_session(from, {
|
|
117
|
+
keys_jwk
|
|
118
|
+
}) {
|
|
119
|
+
callerIs(from, 'frontend');
|
|
120
|
+
keys.materials.clear();
|
|
121
|
+
keys.keysJwk = keys_jwk;
|
|
122
|
+
},
|
|
123
|
+
protect_password(from, {
|
|
124
|
+
password,
|
|
125
|
+
challenge,
|
|
126
|
+
keybase_sort
|
|
127
|
+
}) {
|
|
128
|
+
callerIs(from, 'frontend');
|
|
129
|
+
return keys.protect(password, challenge, keybase_sort);
|
|
130
|
+
},
|
|
131
|
+
keybase_material(from, {
|
|
132
|
+
keybase_sort,
|
|
133
|
+
material
|
|
134
|
+
}) {
|
|
135
|
+
callerIs(from, 'frontend');
|
|
136
|
+
keys.materials.set(keybase_sort, material);
|
|
137
|
+
},
|
|
138
|
+
wrap_keybase(from, {
|
|
139
|
+
material
|
|
140
|
+
}) {
|
|
141
|
+
callerIs(from, 'frontend');
|
|
142
|
+
return keys.keybase ? keys.keybase.wrap(material) : null;
|
|
143
|
+
}
|
|
144
|
+
}, rpc);
|
|
145
|
+
rpc.addDirect('frontend', frontend);
|
|
146
|
+
return rpc;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["worker.ts"],"sourcesContent":["import { type Port, Rpc } from '@deltarocks/bifrostlink';\nimport {\n\tKeybase,\n\tpow_captcha,\n\tprotect_pw_v0,\n\tprotect_pw_v1,\n} from '../lib/pykrete_front.js';\nimport {\n\tencodeAppKeys,\n\ttype KeybaseEnvelope,\n\ttype KeybaseSource,\n\tlink,\n\ttype PasswordChallengeRequest,\n\ttype PasswordChallengeResponse,\n\ttype UnlockKeybaseResponse,\n} from '../control/mod.ts';\nimport { type Address, address, callerIs } from './mod.ts';\n\nconst ENCODER = new TextEncoder();\n\nclass Keys {\n\tmaterials = new Map<number, Uint8Array>();\n\tkeysJwk: string | null = null;\n\tkeybase: Keybase | undefined;\n\n\tdrop() {\n\t\tthis.keybase?.free();\n\t\tthis.keybase = undefined;\n\t}\n\n\topen(uid: string, source: KeybaseSource): Keybase | undefined {\n\t\tswitch (source.kind) {\n\t\t\tcase 'fresh':\n\t\t\t\treturn Keybase.fresh(uid);\n\t\t\tcase 'envelope': {\n\t\t\t\tconst material = this.materials.get(source.value.keybase_sort);\n\t\t\t\treturn material\n\t\t\t\t\t? Keybase.from_envelope(uid, material, source.value.envelope)\n\t\t\t\t\t: undefined;\n\t\t\t}\n\t\t\tcase 'legacy': {\n\t\t\t\tconst legacy = source.value;\n\t\t\t\tconst found = legacy.materials.map((m) =>\n\t\t\t\t\tthis.materials.get(m.keybase_sort)\n\t\t\t\t);\n\t\t\t\tif (!found.every((m): m is Uint8Array => m !== undefined)) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn Keybase.from_legacy(\n\t\t\t\t\tuid,\n\t\t\t\t\tnew Uint32Array(legacy.materials.map((m) => m.legacy_sort)),\n\t\t\t\t\tnew Uint8Array(found.flatMap((m) => [...m])),\n\t\t\t\t\tlegacy.wrapped,\n\t\t\t\t\tlegacy.material_hash,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tunlock(\n\t\tuid: string,\n\t\tsource: KeybaseSource,\n\t\twrapFor: Iterable<number>,\n\t): UnlockKeybaseResponse {\n\t\tthis.drop();\n\t\tthis.keybase = this.open(uid, source);\n\t\tconst envelopes: KeybaseEnvelope[] = [];\n\t\tfor (const keybase_sort of wrapFor) {\n\t\t\tconst material = this.materials.get(keybase_sort);\n\t\t\tif (!this.keybase || !material) {\n\t\t\t\tthis.drop();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tenvelopes.push({ keybase_sort, envelope: this.keybase.wrap(material) });\n\t\t}\n\t\treturn this.keybase\n\t\t\t? {\n\t\t\t\tkind: 'unlocked',\n\t\t\t\tvalue: { fingerprint: this.keybase.fingerprint, envelopes },\n\t\t\t}\n\t\t\t: { kind: 'failed' };\n\t}\n\n\tprotect(\n\t\tpassword: string,\n\t\tchallenge: PasswordChallengeRequest,\n\t\tkeybaseSort: number | null,\n\t): PasswordChallengeResponse {\n\t\tconst pw = ENCODER.encode(password);\n\t\tconst out = challenge.kind === 'v0'\n\t\t\t? protect_pw_v0(pw)\n\t\t\t: protect_pw_v1(pw, challenge.value);\n\t\tconst { ppw, kbm } = out;\n\t\tout.free();\n\t\tif (keybaseSort !== null) {\n\t\t\tthis.materials.set(keybaseSort, kbm);\n\t\t}\n\t\treturn challenge.kind === 'v0'\n\t\t\t? { kind: 'v0', value: ppw }\n\t\t\t: { kind: 'v1', value: ppw };\n\t}\n}\n\nexport function serveKeys(frontend: Port): Rpc<Address> {\n\tconst rpc = new Rpc<Address>('worker', address);\n\tconst keys = new Keys();\n\n\tlink.Worker.register_endpoints({\n\t\tcaptcha(from, { challenge, cost }) {\n\t\t\tcallerIs(from, 'backend');\n\t\t\treturn { nonce: pow_captcha(challenge, cost) };\n\t\t},\n\t\tunlock_keybase(from, { uid, source, wrap_for }) {\n\t\t\tcallerIs(from, 'backend');\n\t\t\treturn keys.unlock(uid, source, wrap_for);\n\t\t},\n\t\tencrypt_app_keys(from, { app_keys, keys_jwk }) {\n\t\t\tcallerIs(from, 'backend');\n\t\t\tif (!keys.keybase) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'app keys are asked for before the keybase is unlocked',\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst jwk = keys_jwk ?? keys.keysJwk;\n\t\t\tif (jwk === null) {\n\t\t\t\tthrow new Error('there is no keys_jwk to encrypt app keys to');\n\t\t\t}\n\t\t\treturn keys.keybase.encrypt_app_keys(encodeAppKeys(app_keys), jwk);\n\t\t},\n\t}, rpc);\n\n\tlink.Vault.register_endpoints({\n\t\tstart_session(from, { keys_jwk }) {\n\t\t\tcallerIs(from, 'frontend');\n\t\t\tkeys.materials.clear();\n\t\t\tkeys.keysJwk = keys_jwk;\n\t\t},\n\t\tprotect_password(from, { password, challenge, keybase_sort }) {\n\t\t\tcallerIs(from, 'frontend');\n\t\t\treturn keys.protect(password, challenge, keybase_sort);\n\t\t},\n\t\tkeybase_material(from, { keybase_sort, material }) {\n\t\t\tcallerIs(from, 'frontend');\n\t\t\tkeys.materials.set(keybase_sort, material);\n\t\t},\n\t\twrap_keybase(from, { material }) {\n\t\t\tcallerIs(from, 'frontend');\n\t\t\treturn keys.keybase ? keys.keybase.wrap(material) : null;\n\t\t},\n\t}, rpc);\n\n\trpc.addDirect('frontend', frontend);\n\treturn rpc;\n}\n"],"mappings":"AAAA,SAAoB,GAAG,QAAQ,yBAAyB;AACxD,SACC,OAAO,EACP,WAAW,EACX,aAAa,EACb,aAAa,QACP,y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