@d4l/collect-lib 1.43.0 → 1.44.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/dist/index.d.mts CHANGED
@@ -467,7 +467,7 @@ type ResponseContext = {
467
467
  };
468
468
  type QuestionInputType = 'decimal' | 'date' | 'year' | 'single-select' | 'multi-select' | 'scale-ordinal' | 'scale-numeric' | 'scale-likert' | 'string' | 'text' | 'geo-location' | 'list' | 'country' | 'postal-code' | 'group' | 'display' | 'matrix' | 'matrix-item';
469
469
 
470
- type DEVICE_ANNOTATION_DATA_TYPE = 'header' | 'flag' | 'any' | 'timestamp' | 'heartRate' | 'eulerAngles' | 'acceleration' | 'freeAcceleration' | 'angularSpeed' | 'angularVelocity' | 'magneticField' | 'distance' | 'remoteDistance' | 'rssi' | 'beaconId' | 'caloriesTotal' | 'distanceTotal' | 'speed' | 'motionCadence' | 'floorsTotal' | 'absoluteElevation' | 'positiveElevationTotal' | 'negativeElevationTotal' | 'minSpeed' | 'maxSpeed' | 'averageSpeed' | 'minMotionCadence' | 'maxMotionCadence' | 'averageMotionCadence' | 'vo2max' | 'stepsTotal' | 'runningStepsTotal' | 'dailySteps' | 'dailyDistance' | 'dailyCalories' | 'dailyFloors' | 'dailyElevationGain' | 'activityDetection' | 'egvs' | 'ecg' | 'spo2' | 'samsungSdkHeartRate' | 'interbeatInterval' | 'ppgGreen' | 'ppgRed' | 'ppgInfrared' | 'samsungSdkAcceleration' | 'skinTemperature' | 'sleepLevel' | 'duration' | 'respiratoryRate' | 'hrv' | 'calories' | 'steps' | 'stepCount' | 'walkingAndRunningDistance' | 'activeEnergy' | 'sleepState' | 'restingHeartRate' | 'stress' | 'workout' | 'tag' | 'cardiovascularAge' | 'activityLevel' | 'batteryLevel' | 'skinTemperatureDeviation' | 'sleepStage' | 'dataSource' | 'normalWalkingEnergyExpenditure' | 'normalWalkingEnergyExpenditurePerHour' | 'intensityEnergyExpenditure' | 'intensityEnergyExpenditurePerHour' | 'totalEnergyExpenditurePerHour' | 'fatBurned' | 'fatBurnedPerHour' | 'metabolicEquivalent' | 'minimumMetabolicEquivalent' | 'maximumMetabolicEquivalent' | 'averageMetabolicEquivalent' | 'durationOfNormalWalkingEpisodes' | 'durationOfIntensityWalkingEpisodes';
470
+ type DEVICE_ANNOTATION_DATA_TYPE = 'header' | 'flag' | 'any' | 'timestamp' | 'heartRate' | 'eulerAngles' | 'acceleration' | 'freeAcceleration' | 'angularSpeed' | 'angularVelocity' | 'magneticField' | 'distance' | 'remoteDistance' | 'rssi' | 'beaconId' | 'caloriesTotal' | 'distanceTotal' | 'speed' | 'motionCadence' | 'floorsTotal' | 'absoluteElevation' | 'positiveElevationTotal' | 'negativeElevationTotal' | 'minSpeed' | 'maxSpeed' | 'averageSpeed' | 'minMotionCadence' | 'maxMotionCadence' | 'averageMotionCadence' | 'vo2max' | 'stepsTotal' | 'runningStepsTotal' | 'dailySteps' | 'dailyDistance' | 'dailyCalories' | 'dailyFloors' | 'dailyElevationGain' | 'activityDetection' | 'egvs' | 'ecg' | 'spo2' | 'samsungSdkHeartRate' | 'interbeatInterval' | 'ppgGreen' | 'ppgRed' | 'ppgInfrared' | 'samsungSdkAcceleration' | 'skinTemperature' | 'sleepLevel' | 'duration' | 'respiratoryRate' | 'hrv' | 'calories' | 'steps' | 'stepCount' | 'walkingAndRunningDistance' | 'activeEnergy' | 'sleepState' | 'restingHeartRate' | 'stress' | 'workout' | 'tag' | 'cardiovascularAge' | 'activityLevel' | 'batteryLevel' | 'skinTemperatureDeviation' | 'menstrualCycle' | 'menstrualFlow' | 'sleepStage' | 'dataSource' | 'normalWalkingEnergyExpenditure' | 'normalWalkingEnergyExpenditurePerHour' | 'intensityEnergyExpenditure' | 'intensityEnergyExpenditurePerHour' | 'totalEnergyExpenditurePerHour' | 'fatBurned' | 'fatBurnedPerHour' | 'metabolicEquivalent' | 'minimumMetabolicEquivalent' | 'maximumMetabolicEquivalent' | 'averageMetabolicEquivalent' | 'durationOfNormalWalkingEpisodes' | 'durationOfIntensityWalkingEpisodes';
471
471
  type DEVICE_ANNOTATION_DATA_FORMAT = 'bitmask' | 'boolean' | 'unsignedInt' | 'signedInt' | 'signedBigInt' | 'float32' | 'float64' | 'byte';
472
472
  type DEVICE_ANNOTATION = DEVICE_ANNOTATION_ITEM[];
473
473
  interface DEVICE_ANNOTATION_ITEM {
@@ -541,12 +541,12 @@ interface BleDeviceMetaLabel {
541
541
  }
542
542
  type DEVICE_KEY = DEVICE_KEY_BLE | DEVICE_KEY_API | DEVICE_KEY_SDK | DEVICE_KEY_INTERNAL;
543
543
  type DEVICE_KEY_BLE = 'DOT' | 'OH1' | 'H10' | 'EstimoteUWB' | 'TicWatchE2' | 'PixelWatch1' | 'GalaxyWatch6';
544
- type DEVICE_KEY_API = 'FITBIT' | 'GOOGLE_HEALTH' | 'OURA' | 'DEXCOM' | 'dexcom_g4' | 'dexcom_g5' | 'dexcom_g6' | 'dexcom_g6+' | 'dexcom_g7';
544
+ type DEVICE_KEY_API = 'FITBIT' | 'GOOGLE_HEALTH' | 'OURA' | 'GARMIN' | 'DEXCOM' | 'dexcom_g4' | 'dexcom_g5' | 'dexcom_g6' | 'dexcom_g6+' | 'dexcom_g7';
545
545
  type DEVICE_KEY_SDK = 'AppleHealth' | 'HealthConnect';
546
546
  type DEVICE_KEY_INTERNAL = 'INTERNAL' | 'internal_accelerometer' | 'internal_gyroscope' | 'internal_magnetometer' | 'internal_beacon_sensing';
547
547
  type DEVICE_MOVELLA_PAYLOAD_MODES = 'completeEuler' | 'customMode1' | 'rateQuantities';
548
548
  type DEVICE_SIGNAL_TYPE_APPLE = 'stepCount' | 'sleepAnalysis' | 'walkingAndRunningDistance' | 'activeEnergy' | 'heartRate' | 'restingHeartRate' | 'hrv' | 'respiratoryRate' | 'spo2' | 'skinTemperature';
549
- type DEVICE_SIGNAL_TYPE = 'heartRate' | 'imu' | 'beacon' | 'beaconUWB' | 'beaconRemoteUWB' | 'rssiScan' | 'physicalActivityMonitoring' | 'customPassiveMonitoring' | 'activeSamsungSDKMonitoring' | 'passiveSamsungSDKMonitoring' | 'accelerometer' | 'gyroscope' | 'magnetometer' | 'egvs' | 'hrv' | 'respiratoryRate' | 'steps' | 'calories' | 'sleep' | 'skinTemperature' | 'spo2' | DEVICE_SIGNAL_TYPE_APPLE | 'stress' | 'workout' | 'tag' | 'cardiovascularAge' | 'activity' | 'batteryLevel';
549
+ type DEVICE_SIGNAL_TYPE = 'heartRate' | 'imu' | 'beacon' | 'beaconUWB' | 'beaconRemoteUWB' | 'rssiScan' | 'physicalActivityMonitoring' | 'customPassiveMonitoring' | 'activeSamsungSDKMonitoring' | 'passiveSamsungSDKMonitoring' | 'accelerometer' | 'gyroscope' | 'magnetometer' | 'egvs' | 'hrv' | 'respiratoryRate' | 'steps' | 'calories' | 'sleep' | 'skinTemperature' | 'spo2' | 'menstrualCycle' | DEVICE_SIGNAL_TYPE_APPLE | 'stress' | 'workout' | 'tag' | 'cardiovascularAge' | 'activity' | 'batteryLevel';
550
550
  type DeviceName = {
551
551
  shortName: string;
552
552
  fullName: string;
@@ -647,8 +647,8 @@ type ProgramDevice = {
647
647
  clientID?: string;
648
648
  clientTarget?: ProgramClientTarget;
649
649
  };
650
- type ProgramDeviceType = 'EstimoteUWB' | 'DEXCOM' | 'DOT' | 'H10' | 'OH1' | 'INTERNAL' | 'FITBIT' | 'GOOGLE_HEALTH' | 'OURA' | 'GalaxyWatch6' | 'PixelWatch1' | 'AppleHealth' | 'HealthConnect';
651
- type ProgramDevicesDataType = 'distance' | 'rssi' | 'eulerAngles' | 'freeAcceleration' | 'angularVelocity' | 'heartRate' | 'restingHeartRate' | 'hrv' | 'internal_gyroscope' | 'internal_accelerometer' | 'internal_magnetometer' | 'internal_beacon_sensing' | 'acceleration' | 'angularSpeed' | 'magneticField' | 'stepsTotal' | 'caloriesTotal' | 'distanceTotal' | 'floorsTotal' | 'absoluteElevation' | 'positiveElevationTotal' | 'negativeElevationTotal' | 'minSpeed' | 'maxSpeed' | 'averageSpeed' | 'speed' | 'vo2max' | 'motionCadence' | 'minMotionCadence' | 'maxMotionCadence' | 'averageMotionCadence' | 'dailySteps' | 'dailyDistance' | 'dailyCalories' | 'dailyFloors' | 'activityDetection' | 'egvs' | 'samsungSdkHeartRate' | 'interbeatInterval' | 'skinTemperature' | 'ppgGreen' | 'ppgRed' | 'ppgInfrared' | 'samsungSdkAcceleration' | 'ecg' | 'spo2' | 'steps' | 'calories' | 'sleep' | 'respiratoryRate' | 'stepCount' | 'walkingAndRunningDistance' | 'activeEnergy' | 'sleepAnalysis' | 'stress' | 'workout' | 'tag' | 'cardiovascularAge' | 'activity' | 'batteryLevel';
650
+ type ProgramDeviceType = 'EstimoteUWB' | 'DEXCOM' | 'DOT' | 'H10' | 'OH1' | 'INTERNAL' | 'FITBIT' | 'GOOGLE_HEALTH' | 'OURA' | 'GARMIN' | 'GalaxyWatch6' | 'PixelWatch1' | 'AppleHealth' | 'HealthConnect';
651
+ type ProgramDevicesDataType = 'distance' | 'rssi' | 'eulerAngles' | 'freeAcceleration' | 'angularVelocity' | 'heartRate' | 'restingHeartRate' | 'hrv' | 'internal_gyroscope' | 'internal_accelerometer' | 'internal_magnetometer' | 'internal_beacon_sensing' | 'acceleration' | 'angularSpeed' | 'magneticField' | 'stepsTotal' | 'caloriesTotal' | 'distanceTotal' | 'floorsTotal' | 'absoluteElevation' | 'positiveElevationTotal' | 'negativeElevationTotal' | 'minSpeed' | 'maxSpeed' | 'averageSpeed' | 'speed' | 'vo2max' | 'motionCadence' | 'minMotionCadence' | 'maxMotionCadence' | 'averageMotionCadence' | 'dailySteps' | 'dailyDistance' | 'dailyCalories' | 'dailyFloors' | 'activityDetection' | 'egvs' | 'samsungSdkHeartRate' | 'interbeatInterval' | 'skinTemperature' | 'ppgGreen' | 'ppgRed' | 'ppgInfrared' | 'samsungSdkAcceleration' | 'ecg' | 'spo2' | 'steps' | 'calories' | 'sleep' | 'respiratoryRate' | 'stepCount' | 'walkingAndRunningDistance' | 'activeEnergy' | 'sleepAnalysis' | 'stress' | 'workout' | 'tag' | 'cardiovascularAge' | 'activity' | 'menstrualCycle' | 'batteryLevel';
652
652
  type ProgramDevicesLabel = {
653
653
  name: string;
654
654
  } & TranslatedString;
@@ -767,6 +767,34 @@ declare const OURA_SIGNAL_TYPE_ANNOTATIONS: {
767
767
  [key in DEVICE_SIGNAL_TYPE]?: DEVICE_ANNOTATION;
768
768
  };
769
769
 
770
+ declare const GARMIN_SIGNAL_TYPE_ANNOTATIONS: {
771
+ [key in DEVICE_SIGNAL_TYPE]?: DEVICE_ANNOTATION;
772
+ };
773
+
774
+ /** Canonical cycle phase. Garmin `currentPhaseType` / Oura phases map onto this. */
775
+ declare const MENSTRUAL_CYCLE_PHASE: {
776
+ readonly unknown: -1;
777
+ readonly menstrual: 1;
778
+ readonly follicular: 2;
779
+ readonly ovulation: 3;
780
+ readonly luteal: 4;
781
+ readonly pregnancy: 5;
782
+ };
783
+ /** Canonical flow strength. Apple/Health Connect flow values map onto this. */
784
+ declare const MENSTRUAL_FLOW: {
785
+ readonly unknown: -1;
786
+ readonly none: 0;
787
+ readonly unspecified: 1;
788
+ readonly spotting: 2;
789
+ readonly light: 3;
790
+ readonly medium: 4;
791
+ readonly heavy: 5;
792
+ };
793
+ declare const MENSTRUAL_CYCLE_ANNOTATION_ITEM: DEVICE_ANNOTATION_ITEM;
794
+ declare const MENSTRUAL_CYCLE_ANNOTATION: DEVICE_ANNOTATION;
795
+ declare const MENSTRUAL_FLOW_ANNOTATION_ITEM: DEVICE_ANNOTATION_ITEM;
796
+ declare const MENSTRUAL_FLOW_ANNOTATION: DEVICE_ANNOTATION;
797
+
770
798
  declare const InternalSensorAnnotationTypes: {
771
799
  [key in DEVICE_KEY_INTERNAL]?: DEVICE_ANNOTATION_DATA_TYPE;
772
800
  };
@@ -1160,6 +1188,19 @@ declare class KeyHandler {
1160
1188
  private: string;
1161
1189
  recovery: string;
1162
1190
  }>;
1191
+ /**
1192
+ * Derive the dedicated encryption keypair (secp256k1) as a hierarchical child of the
1193
+ * donor identity, reusing the same one-way KDF as the program key. The public key is
1194
+ * shared with the data-collector (SPKI), which ECIES-encrypts buffered payloads to it;
1195
+ * the private key feeds HybridEncrypter.decryptV4. Deterministic, so it survives reinstall.
1196
+ * @param programPrivateKey The donor identity's base64-encoded program private key (keys.priv)
1197
+ * @returns publicKey (SPKI, base64) and privateKey (secp256k1 scalar, base64 — the same
1198
+ * encoding as the program private key)
1199
+ */
1200
+ deriveEncryptionKeypair(programPrivateKey: string): Promise<{
1201
+ publicKey: string;
1202
+ privateKey: string;
1203
+ }>;
1163
1204
  extendPublicKey: (publicKey: Uint8Array) => string;
1164
1205
  /**
1165
1206
  * Hash a message with SHA-256
@@ -1182,6 +1223,14 @@ declare class KeyHandler {
1182
1223
  * @returns True, if the signature is valid. Otherwise, false.
1183
1224
  */
1184
1225
  verify: (message: string, signature: Uint8Array, pub: string) => Promise<boolean>;
1226
+ /**
1227
+ * Reduce a donor public key to the raw uncompressed point noble expects — the inverse
1228
+ * of extendPublicKey. The SPKI wrapper ends with the 0x04 point prefix, so the raw key
1229
+ * is simply its last 65 bytes. Already-raw keys are passed through.
1230
+ * @param publicKey SPKI-wrapped (as produced by extendPublicKey) or raw uncompressed key
1231
+ * @returns The 65-byte uncompressed point (0x04 || X || Y)
1232
+ */
1233
+ private rawPublicKey;
1185
1234
  }
1186
1235
 
1187
1236
  type DonorIdentity = {
@@ -1318,6 +1367,291 @@ declare enum ERROR_CODES {
1318
1367
  UPLOAD_FAILED = "upload_failed"
1319
1368
  }
1320
1369
 
1370
+ type CollectorConnectParams = {
1371
+ /**
1372
+ * OAuth authorization code captured by the app at the HTTPS redirect
1373
+ * (Universal/App Links). The collector exchanges it server-side — the client
1374
+ * secret and the resulting Garmin token never reach the phone.
1375
+ */
1376
+ code: string;
1377
+ /** PKCE code verifier matching the authorize request. */
1378
+ codeVerifier: string;
1379
+ /** The phone's derived encryption public key (SPKI, base64) — see KeyHandler.deriveEncryptionKeypair. */
1380
+ encPublicKey: string;
1381
+ /** Consent date (RFC3339); anchors backfill and is the lower bound for stored data. */
1382
+ consentDate: string;
1383
+ };
1384
+ /** One opaque, phone-decryptable item from the collector buffer (blob is a base64 v4 ciphertext). */
1385
+ type CollectorSyncItem = {
1386
+ seq: number;
1387
+ dataType: string;
1388
+ blob: string;
1389
+ };
1390
+ type CollectorSyncResponse = {
1391
+ items: CollectorSyncItem[];
1392
+ cursor: number;
1393
+ /**
1394
+ * The server can no longer collect Garmin data for this donor: the connection is
1395
+ * gone or its authorization/token is unusable, and only a fresh authorization by
1396
+ * the participant restores it. Buffered items are still delivered alongside this
1397
+ * flag, so drain them first, then drop the local Garmin connection so the app
1398
+ * offers the "connect Garmin" task again.
1399
+ */
1400
+ reconnectRequired?: boolean;
1401
+ /** Short human-readable cause, for logs and support. */
1402
+ reconnectReason?: string;
1403
+ };
1404
+ /**
1405
+ * Build the self-signed donor bearer token used to authenticate with the collector
1406
+ * (identical scheme to the data-dispatcher / DonationSDK): sign `message + secret` with
1407
+ * the program private key, where `message` embeds the collector-issued token + the donorID.
1408
+ */
1409
+ declare const buildSelfSignedAuthToken: (keyHandler: KeyHandler, converter: Converter, pub: string, priv: string, token: string, selfSignSecret: string) => Promise<string>;
1410
+ /**
1411
+ * Client for the data-collector service. Turns Garmin's webhook-delivered data into a
1412
+ * pull feed: the phone connects (handing over its Garmin token + encryption public key),
1413
+ * then periodically syncs ECIES-encrypted items it alone can decrypt, and acks them.
1414
+ */
1415
+ declare class CollectorClient {
1416
+ private selfSignSecret;
1417
+ private api;
1418
+ private keyHandler;
1419
+ private converter;
1420
+ /**
1421
+ * @param selfSignSecret SELF_SIGN_SECRET shared with the collector (and the dispatcher)
1422
+ * @param collectorURL Base URL including the API prefix, e.g. https://collect.dev.d4l-dev.de/api/collector/v1
1423
+ */
1424
+ constructor(selfSignSecret: string, collectorURL: string, converter: Converter, crypto: CryptoModule);
1425
+ private authenticatedApi;
1426
+ /**
1427
+ * The collector's donor endpoints are study-scoped in the URL (mirroring the
1428
+ * data-dispatcher); the study id is the identity's scope (the program name).
1429
+ */
1430
+ private studySegment;
1431
+ /** Register the donor's Garmin connection and start ingestion. */
1432
+ connect(donorIdentity: DonorIdentity, params: CollectorConnectParams): Promise<{
1433
+ status: string;
1434
+ garminUserID: string;
1435
+ }>;
1436
+ /** Pull buffered (encrypted) items with sequence number greater than `since`. */
1437
+ sync(donorIdentity: DonorIdentity, since?: number): Promise<CollectorSyncResponse>;
1438
+ /** Acknowledge items up to (and including) `cursor`; the collector prunes them. */
1439
+ ack(donorIdentity: DonorIdentity, cursor: number): Promise<void>;
1440
+ /** Revoke the Garmin authorization and purge the donor's token + buffer. */
1441
+ disconnect(donorIdentity: DonorIdentity): Promise<void>;
1442
+ }
1443
+
1444
+ /**
1445
+ * node-forge does not have documentation on the types, look up the
1446
+ * source code to find documentation https://github.com/digitalbazaar/forge/tree/main/lib
1447
+ * Important: strings coming out of node-forge are binary-encoded!
1448
+ */
1449
+ declare const AES_BLOCKSIZE = 16;
1450
+ declare const TAG_LENGTH = 16;
1451
+ declare const KEY_LENGTH = 32;
1452
+ declare const HYBRID_ENCRYPTION_VERSION_RECOVERY = 3;
1453
+ declare const HYBRID_ENCRYPTION_VERSION_V4 = 4;
1454
+ declare const V4_DECRYPTER_MOBILE_APP = 0;
1455
+ declare const V4_DECRYPTER_DATA_RECEIVER = 1;
1456
+ /**
1457
+ * V4SlotSpec describes one recipient of a v4 record: the (opaque) decrypter id, the wrap
1458
+ * algorithm, and the public/symmetric key material. Build it with v4AesSlot, v4RsaSlot or
1459
+ * v4EcSlot — the same three algorithms go-crypto's ECSlot/RSASlot/AESSlot produce.
1460
+ */
1461
+ interface V4SlotSpec {
1462
+ decrypterId: number;
1463
+ keyAlg: number;
1464
+ key: string;
1465
+ }
1466
+ /** v4AesSlot wraps the data key under a symmetric key (e.g. the recovery key) with AES-256-GCM. */
1467
+ declare const v4AesSlot: (decrypterId: number, symmetricKeyBase64: string) => V4SlotSpec;
1468
+ /** v4RsaSlot wraps the data key to an RSA public key (PEM) with RSA-OAEP/SHA-256. */
1469
+ declare const v4RsaSlot: (decrypterId: number, publicKeyPem: string) => V4SlotSpec;
1470
+ /**
1471
+ * v4EcSlot wraps the data key to a secp256k1 public key via ECIES — the counterpart of
1472
+ * what the data-collector emits for the phone.
1473
+ * @param decrypterId The recipient this slot is addressed to
1474
+ * @param publicKeyBase64 SPKI public key, as returned by KeyHandler.deriveEncryptionKeypair
1475
+ */
1476
+ declare const v4EcSlot: (decrypterId: number, publicKeyBase64: string) => V4SlotSpec;
1477
+ /**
1478
+ * V4KeySpec is one entry of a decryption keychain: the recipient identity and algorithm of
1479
+ * the slots it can open, plus the private/symmetric key material. Build it with v4AesKey,
1480
+ * v4RsaKey or v4EcKey. Mirrors go-crypto's AESKey/RSAKey/ECKey.
1481
+ */
1482
+ interface V4KeySpec {
1483
+ decrypterId: number;
1484
+ keyAlg: number;
1485
+ key: string;
1486
+ }
1487
+ /** v4AesKey opens AES-symmetric slots (e.g. the donor's recovery key). */
1488
+ declare const v4AesKey: (decrypterId: number, symmetricKeyBase64: string) => V4KeySpec;
1489
+ /** v4RsaKey opens RSA-OAEP slots with a PEM private key. */
1490
+ declare const v4RsaKey: (decrypterId: number, privateKeyPem: string) => V4KeySpec;
1491
+ /** v4EcKey opens EC (ECIES secp256k1) slots with a base64 scalar. */
1492
+ declare const v4EcKey: (decrypterId: number, privateKeyBase64: string) => V4KeySpec;
1493
+ declare class HybridEncrypter {
1494
+ converter: Converter;
1495
+ constructor(converter: Converter);
1496
+ /**
1497
+ * Encrypt a donation
1498
+ * @param rec The base64 encoded symmetric recovery key
1499
+ * @param plaintext The data which should be encrypted
1500
+ * @param publicKey The public key of the donation target (in PEM format)
1501
+ * @returns The base64 encoded ArrayBuffer and encrypted donation and information for recovery
1502
+ */
1503
+ encrypt: (rec: string, plaintext: string, publicKey: string) => string;
1504
+ /**
1505
+ * Decrypt a donation
1506
+ * @param rec The base64 encoded symmetric recovery key
1507
+ * @param cipherText The encrypted donation
1508
+ * @returns An string containing the decrypted donation
1509
+ */
1510
+ decrypt: (rec: string, cipherText: string) => string;
1511
+ /**
1512
+ * Decrypt a v4 hybrid ciphertext addressed to the mobile app. The normal path is the EC
1513
+ * slot (ECIES over secp256k1) the data-collector encrypts to the phone's derived key.
1514
+ *
1515
+ * The AES-256 recovery key is a durable fallback across formats, so it is consulted for
1516
+ * two kinds of input:
1517
+ * - a v3 ciphertext, delegated to the legacy recovery-key path (`decrypt`); and
1518
+ * - a v4 ciphertext that carries an AES recovery slot (decrypterId = mobile app,
1519
+ * keyAlg = AES symmetric) but no usable EC slot — the same recovery key that could
1520
+ * recover v3 records then recovers v4 records too.
1521
+ * The EC slot is always preferred when present; the recovery key is only needed to fall
1522
+ * back to the AES slot (or a v3 blob).
1523
+ *
1524
+ * Note the legacy branch is v3-only, matching `decrypt`: v1 (AES-CBC) and v2 (AES-GCM)
1525
+ * are single-recipient formats this library never produced — donations have always been
1526
+ * written with a recovery branch — so a v1/v2 blob is rejected rather than decrypted.
1527
+ * @param privateKey The phone's encryption private key (secp256k1 scalar, base64 — as
1528
+ * returned by KeyHandler.deriveEncryptionKeypair)
1529
+ * @param cipherText The base64-encoded ciphertext (v4, or v3 for the legacy fallback)
1530
+ * @param recoveryKey Base64 recovery key; needed only for the AES-recovery or v3 paths
1531
+ * @returns The decrypted UTF-8 string
1532
+ */
1533
+ decryptV4: (privateKey: string, cipherText: string, recoveryKey?: string) => string;
1534
+ /**
1535
+ * Decrypt a v4 record with an explicit keychain — the generic entry point, mirroring
1536
+ * go-crypto's `NewDecrypterFromKeys`. A slot is opened only by a key whose
1537
+ * (decrypterId, keyAlg) match, and every matching key is tried, so a record carrying
1538
+ * several slots for the same recipient (e.g. a rotated recovery key) still opens.
1539
+ * @param cipherText The base64-encoded v4 ciphertext
1540
+ * @param keys Keychain entries, built with v4EcKey / v4AesKey / v4RsaKey
1541
+ * @returns The decrypted UTF-8 string
1542
+ */
1543
+ decryptV4WithKeys: (cipherText: string, keys: V4KeySpec[]) => string;
1544
+ /** Unwrap the data key with the first matching key, then open the payload. */
1545
+ private openV4Record;
1546
+ /**
1547
+ * Parse a v4 record into its slots and payload. Every length comes from the record
1548
+ * itself, so each read is bounds-checked first: a truncated or malformed blob fails as a
1549
+ * clear format error instead of a raw RangeError or a silently short slice.
1550
+ * @param cipherText The base64-encoded v4 ciphertext
1551
+ * @returns The decoded slots, payload IV and payload
1552
+ */
1553
+ private decodeV4;
1554
+ /**
1555
+ * Encrypt plaintext once under a random data key and wrap that key into one slot per
1556
+ * recipient (decryptV4 is the inverse). Slot decrypterIds are opaque to this class; callers
1557
+ * assign their meaning. Mirrors go-crypto's EncryptHybridV4.
1558
+ * @param plaintext The data to encrypt
1559
+ * @param slots One slot per party that must recover the data (see v4AesSlot / v4RsaSlot)
1560
+ * @returns The base64-encoded v4 ciphertext
1561
+ */
1562
+ encryptV4: (plaintext: string, slots: V4SlotSpec[]) => string;
1563
+ /** wrapV4Slot wraps dataKey for one recipient, dispatching on the slot's key algorithm. */
1564
+ private wrapV4Slot;
1565
+ /**
1566
+ * Wrap the data key to a secp256k1 public key via ECIES — the inverse of
1567
+ * unwrapV4EcDataKey, and byte-compatible with go-crypto's EC slot:
1568
+ * ephemeral ECDH -> HKDF-SHA256 -> AES-256-GCM.
1569
+ * Slot layout: ephPub(65, uncompressed) | nonce(12) | wrappedDataKey||tag(48).
1570
+ * @param publicKeyBase64 The recipient's SPKI (or raw uncompressed) secp256k1 public key
1571
+ * @param dataKey The payload data key to wrap
1572
+ */
1573
+ private wrapV4EcDataKey;
1574
+ /**
1575
+ * Wrap the data key under a symmetric key with AES-256-GCM — the inverse of
1576
+ * unwrapV4RecoveryDataKey. Layout: nonce(12) | wrappedDataKey||tag.
1577
+ *
1578
+ * This is deliberately the *same* donor recovery key that v3 uses with AES-CBC: one
1579
+ * key the donor can keep, usable across formats. Reusing it under two modes is safe
1580
+ * here — the modes are never mixed within a record, the key is only ever used to wrap
1581
+ * 32-byte data keys, and GCM is an upgrade over v3's unauthenticated CBC. GCM's
1582
+ * requirement is nonce uniqueness, which a fresh 96-bit random nonce per wrap gives
1583
+ * with an enormous margin at donation volumes (birthday bound ≈ 2^32 wraps per key).
1584
+ */
1585
+ private wrapV4RecoveryDataKey;
1586
+ /** encodeV4 assembles the v4 record: header | slots | payloadIv | payloadLen | payload. */
1587
+ private encodeV4;
1588
+ /** Encrypt with AES-256-GCM (ciphertext||tag) — the inverse of decryptAESGCM. */
1589
+ private encryptAESGCM;
1590
+ /**
1591
+ * Recover the payload data key: walk the record's slots and, for each, try every key
1592
+ * whose (decrypterId, keyAlg) match. Same semantics as go-crypto — a slot addressed to
1593
+ * another recipient is ignored, and several slots for the same recipient (rotated keys)
1594
+ * are all attempted, so an unusable one never masks a usable one.
1595
+ * @param slots The record's decoded slots
1596
+ * @param keys The caller's keychain
1597
+ * @returns The unwrapped 32-byte data key
1598
+ */
1599
+ private unwrapV4DataKey;
1600
+ /** Unwrap one slot with one matching key, dispatching on the key algorithm. */
1601
+ private unwrapV4Slot;
1602
+ /**
1603
+ * Unwrap the data key from an RSA-OAEP slot with a PEM private key — the counterpart of
1604
+ * v4RsaSlot, for a receiver-side (non-phone) decrypter.
1605
+ */
1606
+ private unwrapV4RsaDataKey;
1607
+ /**
1608
+ * Unwrap the data key from an EC slot via ECIES.
1609
+ * Slot layout: ephPub(65, uncompressed) | nonce(12) | wrappedDataKey||tag(48).
1610
+ */
1611
+ private unwrapV4EcDataKey;
1612
+ /**
1613
+ * Unwrap the data key from an AES recovery slot: the data key wrapped directly under the
1614
+ * base64 AES-256 recovery key (the same key the pre-v4 recovery branch uses).
1615
+ * Slot layout: nonce(12) | wrappedDataKey||tag(48).
1616
+ */
1617
+ private unwrapV4RecoveryDataKey;
1618
+ /**
1619
+ * Decrypt an AES-256-GCM ciphertext (ciphertext||tag) with a 12-byte nonce.
1620
+ */
1621
+ private decryptAESGCM;
1622
+ private getDataKey;
1623
+ /**
1624
+ * Encrypt the data key with a base64 encoded recovery key
1625
+ * @param rec The base64 encoded symmetric recovery phrase
1626
+ * @param dataKey The random data key
1627
+ * @returns The encrypted data key, the used initialization vector
1628
+ */
1629
+ private encryptWithRecoveryKey;
1630
+ /**
1631
+ * Decrypt the data key using the base64 encoded symmetric recovery key and a given initialization vector
1632
+ * @param rec The base64 encoded symmetric recovery key
1633
+ * @param encryptedDataKey The encrypted data key
1634
+ * @param iv The used initialization vector
1635
+ * @returns The decrypted data key
1636
+ */
1637
+ private decryptWithRecoveryKey;
1638
+ /**
1639
+ * Encrypt data key with the public key of the donation target using RSA OAEP
1640
+ * @param targetKey The public key of the donation target
1641
+ * @param dataKey The random data key
1642
+ * @returns The encrypted data key
1643
+ */
1644
+ private encryptWithTargetKey;
1645
+ /**
1646
+ * Encrypt the stringified donation using the data key
1647
+ * @param donation The stringified version of what should be donated
1648
+ * @param dataKey The key to encrypt the donation with
1649
+ * @returns The encrypted donation, the used initialization vector and the length of the encrypted donation
1650
+ */
1651
+ private encryptDonation;
1652
+ private decryptDonation;
1653
+ }
1654
+
1321
1655
  declare class DonationSDK implements SDKInterface {
1322
1656
  /**
1323
1657
  * Flag indicating if the SDK has been initialized
@@ -1611,7 +1945,7 @@ declare const wordlists: {
1611
1945
  declare const OTHER_ANSWER_CODE = "#other";
1612
1946
  declare const getFollowUpQuestionLinkId: (linkId: string) => string;
1613
1947
 
1614
- type API = 'DEXCOM' | 'FITBIT' | 'GOOGLE_HEALTH' | 'OURA';
1948
+ type API = 'DEXCOM' | 'FITBIT' | 'GOOGLE_HEALTH' | 'OURA' | 'GARMIN';
1615
1949
  type APIConfig = {
1616
1950
  loginEndpoint: string;
1617
1951
  tokenEndpoint: string;
@@ -1623,4 +1957,4 @@ declare const API_TARGET_MAP: {
1623
1957
  };
1624
1958
  };
1625
1959
 
1626
- export { ANDROID_SENSORS_CONSTANT_NAMES, type API, type APIConfig, type APIDeviceConfig, API_TARGET_MAP, APPLE_HEALTH_ANNOTATION_ACTIVE_ENERGY, APPLE_HEALTH_ANNOTATION_HEART_RATE, APPLE_HEALTH_ANNOTATION_HRV, APPLE_HEALTH_ANNOTATION_ITEM_ACTIVE_ENERGY, APPLE_HEALTH_ANNOTATION_ITEM_HEART_RATE, APPLE_HEALTH_ANNOTATION_ITEM_HRV, APPLE_HEALTH_ANNOTATION_ITEM_RESPIRATORY_RATE, APPLE_HEALTH_ANNOTATION_ITEM_RESTING_HEART_RATE, APPLE_HEALTH_ANNOTATION_ITEM_SKIN_TEMPERATURE, APPLE_HEALTH_ANNOTATION_ITEM_SLEEP_DURATION, APPLE_HEALTH_ANNOTATION_ITEM_SLEEP_STATE, APPLE_HEALTH_ANNOTATION_ITEM_SPO2, APPLE_HEALTH_ANNOTATION_ITEM_STEP_COUNT, APPLE_HEALTH_ANNOTATION_ITEM_WALKING_RUNNING_DISTANCE, APPLE_HEALTH_ANNOTATION_RESPIRATORY_RATE, APPLE_HEALTH_ANNOTATION_RESTING_HEART_RATE, APPLE_HEALTH_ANNOTATION_SKIN_TEMPERATURE, APPLE_HEALTH_ANNOTATION_SLEEP_ANALYSIS, APPLE_HEALTH_ANNOTATION_SPO2, APPLE_HEALTH_ANNOTATION_STEP_COUNT, APPLE_HEALTH_ANNOTATION_WALKING_RUNNING_DISTANCE, APPLE_HEALTH_DATA_SOURCES, APPLE_HEALTH_SIGNAL_TYPE_ANNOTATIONS, APPLE_HEALTH_SLEEP_STATE_MAP, ASMSECGMeasurementAnnotation, ASMSSpO2MeasurementAnnotation, type AndCondition, type Answer, AnswerCodeGuard, AnswerDateGuard, type AnswerItem, type Answers, AppIDNamingSystem, type AppleHealthDataSource, type AppleHealthSleepStates, type ArrayAnswer, type ArrayAnswerItem, type BLEDeviceConfig, BLE_ASMS_ANNOTATION_ITEM_ECG, BLE_ASMS_ANNOTATION_ITEM_SPO2, BLE_CPMS_ANNOTATION_ITEM_ACTIVITY_TYPE, BLE_CPMS_ANNOTATION_ITEM_DAILY_CALORIES, BLE_CPMS_ANNOTATION_ITEM_DAILY_DISTANCE, BLE_CPMS_ANNOTATION_ITEM_DAILY_ELEVATION_GAIN, BLE_CPMS_ANNOTATION_ITEM_DAILY_FLOORS, BLE_CPMS_ANNOTATION_ITEM_DAILY_STEPS, BLE_PAMS_ANNOTATION_ITEM_ABSOLUTE_ELEVATION, BLE_PAMS_ANNOTATION_ITEM_AVERAGE_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_AVERAGE_SPEED, BLE_PAMS_ANNOTATION_ITEM_BYTE, BLE_PAMS_ANNOTATION_ITEM_CALORIES_TOTAL, BLE_PAMS_ANNOTATION_ITEM_DISTANCE_TOTAL, BLE_PAMS_ANNOTATION_ITEM_FLAGS_16, BLE_PAMS_ANNOTATION_ITEM_FLAGS_24, BLE_PAMS_ANNOTATION_ITEM_FLAGS_32, BLE_PAMS_ANNOTATION_ITEM_FLAGS_8, BLE_PAMS_ANNOTATION_ITEM_FLOORS_TOTAL, BLE_PAMS_ANNOTATION_ITEM_FOUR_BYTES, BLE_PAMS_ANNOTATION_ITEM_HEADER, BLE_PAMS_ANNOTATION_ITEM_HEART_RATE, BLE_PAMS_ANNOTATION_ITEM_MAXIMUM_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_MAXIMUM_SPEED, BLE_PAMS_ANNOTATION_ITEM_MINIMUM_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_MINIMUM_SPEED, BLE_PAMS_ANNOTATION_ITEM_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_NEGATIVE_ELEVATION_GAIN, BLE_PAMS_ANNOTATION_ITEM_POSITIVE_ELEVATION_GAIN, BLE_PAMS_ANNOTATION_ITEM_RUNNING_STEPS_TOTAL, BLE_PAMS_ANNOTATION_ITEM_SPEED, BLE_PAMS_ANNOTATION_ITEM_STEPS_TOTAL, BLE_PAMS_ANNOTATION_ITEM_THREE_BYTES, BLE_PAMS_ANNOTATION_ITEM_TWO_BYTES, BLE_PAMS_ANNOTATION_ITEM_VO2_MAX, BLE_PSMS_ANNOTATION_ITEM_ACCELERATION, BLE_PSMS_ANNOTATION_ITEM_HEART_RATE, BLE_PSMS_ANNOTATION_ITEM_IBI, BLE_PSMS_ANNOTATION_ITEM_PPG_GREEN, BLE_PSMS_ANNOTATION_ITEM_PPG_IR, BLE_PSMS_ANNOTATION_ITEM_PPG_RED, BLE_PSMS_ANNOTATION_ITEM_SKIN_TEMPERATURE, type BaseDeviceConfig, type BleDeviceMetaLabel, BoolGuard, CPMSHealthServicesActivityDetectionAnnotation, CPMSHealthServicesPassiveDataAnnotation, type CodeQuestionCondition, CommunicationTypeSystem, type ComparisonOperator, type ConditionOperatorType, type ConditionQuestionType, type ConditionSorting, type ConditionType, Conjunction, type Consent, type ConsentCondition, ConsentGuard, ConsentNameSystem, type ConsentPath, type ConsentTimes, ConsentVersionSystem, type ContentBlock, type Converter, type CopyrightLabel, CountryValueSet, type CryptoModule, CustomExtensionContextValue, CustomExtensionDate, CustomExtensionStudyName, CustomQuestionSystem, type DEVICE_ANNOTATION, type DEVICE_ANNOTATION_DATA_FORMAT, type DEVICE_ANNOTATION_DATA_TYPE, DEVICE_ANNOTATION_HEARTRATE, DEVICE_ANNOTATION_HRV_RMSSD, type DEVICE_ANNOTATION_ITEM, DEVICE_ANNOTATION_ITEM_ACCELERATION, DEVICE_ANNOTATION_ITEM_ANGULAR_SPEED, DEVICE_ANNOTATION_ITEM_BEACON_ID, DEVICE_ANNOTATION_ITEM_DATA_SOURCE, DEVICE_ANNOTATION_ITEM_DISTANCE, DEVICE_ANNOTATION_ITEM_EGVS, DEVICE_ANNOTATION_ITEM_HEARTRATE, DEVICE_ANNOTATION_ITEM_HRV_RMSSD, DEVICE_ANNOTATION_ITEM_MAGNETIC_FIELD, DEVICE_ANNOTATION_ITEM_REMOTE_DISTANCE, DEVICE_ANNOTATION_ITEM_RSSI, DEVICE_ANNOTATION_ITEM_SKIN_TEMPERATURE_DEVIATION, DEVICE_ANNOTATION_ITEM_UNIX_TIMESTAMP, DEVICE_ANNOTATION_SKIN_TEMPERATURE_DEVIATION, DEVICE_ANNOTATION_TIMESTAMP_NOTE, DEVICE_ANNOTATION_TIMESTAMP_SIZE, DEVICE_ANNOTATION_TIMESTAMP_UNIT, DEVICE_D4L_COMPANION_ANNOTATION_ITEM_DATA_TYPES_FLAG, DEVICE_D4L_COMPANION_ANNOTATION_ITEM_TIMESTAMP, DEVICE_DISPLAY_LABEL_CODING, type DEVICE_KEY, type DEVICE_KEY_API, type DEVICE_KEY_BLE, type DEVICE_KEY_INTERNAL, type DEVICE_KEY_SDK, DEVICE_KEY_TO_NAME, DEVICE_LABEL_CODING, type DEVICE_MOVELLA_PAYLOAD_MODES, DEVICE_OUTPUT_RATE_CODING, DEVICE_SENSOR_DELAY_CODING, type DEVICE_SIGNAL_TYPE, type DEVICE_SIGNAL_TYPE_APPLE, type DateBlurringFunction, type DateCondition, DateGuard, type DateQuestionCondition, DecimalGuard, type DeviceConfig, type DeviceName, Disjunction, type Display, type DisplayContent, type DisplayContentPath, type DisplayPath, type DisplayType, type DonationRecord, DonationSDK, type DonorIdentity, ERROR_CODES, ExistsGuard, type ExtendedProgramDevicesDataType, FITBIT_ANNOTATION_ITEM_BREATHING_RATE, FITBIT_ANNOTATION_ITEM_CALORIES, FITBIT_ANNOTATION_ITEM_HEART_RATE, FITBIT_ANNOTATION_ITEM_HEART_RATE_VARIABILITY, FITBIT_ANNOTATION_ITEM_SKIN_TEMPERATURE, FITBIT_ANNOTATION_ITEM_SLEEP_LEVEL, FITBIT_ANNOTATION_ITEM_SLEEP_LEVEL_DURATION, FITBIT_ANNOTATION_ITEM_SPO2, FITBIT_ANNOTATION_ITEM_STEPS, FITBIT_BREATHING_RATE_ANNOTATION, FITBIT_CALORIES_ANNOTATION, FITBIT_HEART_RATE_ANNOTATION, FITBIT_HEART_RATE_VARIABILITY_ANNOTATION, FITBIT_SIGNAL_TYPE_ANNOTATIONS, FITBIT_SKIN_TEMPERATURE_ANNOTATION, FITBIT_SLEEP_ANNOTATION, FITBIT_SLEEP_LEVEL_MAP, FITBIT_SPO2_ANNOTATION, FITBIT_STEPS_ANNOTATION, type FitbitSleepLevelTypes, type FlatAnswer, type FrequencySubset, type FrequencyType, GOOGLE_HEALTH_SIGNAL_TYPE_ANNOTATIONS, type GeoLocationAnswer, type Guard, type GuardContext, type GuardParameters, HEALTH_CONNECT_ANNOTATION_ITEM_SLEEP_DURATION, HEALTH_CONNECT_ANNOTATION_ITEM_SLEEP_STAGE, HEALTH_CONNECT_ANNOTATION_ITEM_STEPS, HEALTH_CONNECT_DATA_SOURCES, HEALTH_CONNECT_SIGNAL_TYPE_ANNOTATIONS, HEALTH_CONNECT_SLEEP_ANNOTATION, HEALTH_CONNECT_SLEEP_STAGE_MAP, HEALTH_CONNECT_STEPS_ANNOTATION, type HealthConnectDataSource, type HealthConnectSleepStages, IMUAnnotation, ImageExtension, type InternalDeviceConfig, InternalSensorAnnotationTypes, Iso3166CodeSystem, KeyHandler, type MatrixAnswer, type MatrixAnswerItem, MaxValueExtension, MeasurementTypeSystem, type Message, type MessagePath, type MessageRecipient, MinLengthExtension, MinValueExtension, type MultiAnswers, type Notification, type NotificationRecipient, OTHER_ANSWER_CODE, OURA_ACTIVITY_ANNOTATION, OURA_ANNOTATION_ITEM_ACTIVITY_LEVEL, OURA_ANNOTATION_ITEM_BATTERY_LEVEL, OURA_ANNOTATION_ITEM_CARDIOVASCULAR_AGE, OURA_ANNOTATION_ITEM_STRESS, OURA_ANNOTATION_ITEM_TAG, OURA_ANNOTATION_ITEM_WORKOUT, OURA_BATTERY_LEVEL_ANNOTATION, OURA_CARDIOVASCULAR_AGE_ANNOTATION, OURA_SIGNAL_TYPE_ANNOTATIONS, OURA_STRESS_ANNOTATION, OURA_TAG_ANNOTATION, OURA_WORKOUT_ANNOTATION, ObservationTypeSystem, Offset, type OffsetCondition, type OrCondition, PAMSCardioVascularActivityAnnotation, PAMSGeneralActivityInstantaneousAnnotation, PAMSGeneralActivitySummaryAnnotation, PAMSStepCounterActivitySummaryAnnotation, PSMSAccelerationAnnotation, PSMSHeartRateAnnotation, PSMSPPGGreenAnnotation, PSMSPPGIRAnnotation, PSMSPPGRedAnnotation, PSMSSkinTemperatureAnnotation, PostalCodeCountrySourceExtension, PostalCodeFixedCountryUrl, PostalCodeFromItemUrl, PrepopulateExtension, type PreviewTimeSeriesItem, type Program, type ProgramAnonymization, type ProgramClientTarget, type ProgramConsentStep, type ProgramContact, type ProgramContent, type ProgramContentPath, type ProgramDevice, type ProgramDeviceType, type ProgramDevicesDataType, type ProgramDevicesLabel, type ProgramDisplayStep, type ProgramDonation, type ProgramEligibilityStep, type ProgramFeatured, type ProgramRoutineStep, type ProgramSensorStep, type ProgramStep, type ProgramStepBase, type ProgramStepType, type ProgramSurveyStep, type ProgramTag, type ProgramTokenStep, type ProgramType, QItemControlDefinition, type QuestionInputType, type QuestionnaireResponse, type QuestionnaireScore, RECORDING_MODEL_CURRENT_VERSION, RECORDING_SIGNAL_MODEL_CURRENT_VERSION, type RecordState, type Recording, type RecordingSignal, type RecordingSignalItem, type RecordingSignalPreview, type RecordingSignalWithId, type RecordingTag, type RecursiveKeyOf, RelativeMaxValueExtension, RelativeMinValueExtension, type ResearchSubject, type ResearchSubjectProgress, type ResearchSubjectProgressState, type ResponseCondition, type ResponseContext, ResponseGuard, type ResponseMinimal, type ResponseTimes, type ResponseValue, type RestorationSize, type Routine, type RoutineCondition, type RoutineContent, type RoutineContentPath, type RoutineContentStep, RoutineGuard, RoutineIsPassiveExtension, type RoutineTimes, type SDKDeviceConfig, type SDKInterface, SIGNAL_DURATION_CODING, type ScalarAnswer, type ScalarAnswerItem, type ScoreThreshold, type SeenDisplay, type SeenMessage, SensorIdentifierSystem, SensorSettingsSystem, SensorTypeSystem, SignalIDSystem, type SkippedStep, SliderInputLabel, SliderMaxLabelExtension, SliderMinLabelExtension, SliderOrientationExtension, SliderStepSizeExtension, type StepCondition, type StepConditionBase, type StringTemplater, StudyNameSystem, type Survey, type SurveyCondition, type SurveyContent, type SurveyContentPath, SurveyGuard, type SurveyMultiplex, type SurveyScoring, type Tag, type TagEffectiveType, type TaskFrequency, type Threshold, TimeFuncs, type TimeWindow, TokenNamingSystem, type TranslatedString, ULID_REGEX, ULIDtoUUID, UUID_REGEX, UUIDtoULID, WORDLIST_LANGUAGES, WearOS3AnnotationMap, WebConverter, type WordListLanguage, YearGuard, binaryStringToUint8Array, calculateQuestionnaireScoreRange, calculateScoreRangeForItem, capitalizeFirstLetter, dayFormat, encodeDataSource, extractWordsFromRecoveryPhrase, generateFHIRConsent, generateFHIRQuestionnaireScore, generateFHIRRecordingBundle, generateFHIRResearchSubject, generateFHIRResponse, generateFHIRSeenDisplay, generateFHIRSeenMessage, generateFHIRTag, generateQuestionGuard, generateStepGuard, generateUrn, get, getFollowUpQuestionLinkId, getLanguageOfPassPhrase, getMovellaAnnotation, getText, getTimeFuncs, indexArrayBy, isArrayAnswer, isBeforeStartDate, isFlatAnswer, isGeoLocationAnswer, isMatrixAnswer, isNotAfterEndDate, isNotBeforeStartDate, isScalarAnswer, isScoreEligible, isYearString, newStepDateGuard, overwriteTime, stringToDate, stringToYear, timezonelessDate, toDeviceConfig, toQuestionnaireResponseItem, uint8ArrayToBinaryString, utf8ToUint8Array, wordlists };
1960
+ export { AES_BLOCKSIZE, ANDROID_SENSORS_CONSTANT_NAMES, type API, type APIConfig, type APIDeviceConfig, API_TARGET_MAP, APPLE_HEALTH_ANNOTATION_ACTIVE_ENERGY, APPLE_HEALTH_ANNOTATION_HEART_RATE, APPLE_HEALTH_ANNOTATION_HRV, APPLE_HEALTH_ANNOTATION_ITEM_ACTIVE_ENERGY, APPLE_HEALTH_ANNOTATION_ITEM_HEART_RATE, APPLE_HEALTH_ANNOTATION_ITEM_HRV, APPLE_HEALTH_ANNOTATION_ITEM_RESPIRATORY_RATE, APPLE_HEALTH_ANNOTATION_ITEM_RESTING_HEART_RATE, APPLE_HEALTH_ANNOTATION_ITEM_SKIN_TEMPERATURE, APPLE_HEALTH_ANNOTATION_ITEM_SLEEP_DURATION, APPLE_HEALTH_ANNOTATION_ITEM_SLEEP_STATE, APPLE_HEALTH_ANNOTATION_ITEM_SPO2, APPLE_HEALTH_ANNOTATION_ITEM_STEP_COUNT, APPLE_HEALTH_ANNOTATION_ITEM_WALKING_RUNNING_DISTANCE, APPLE_HEALTH_ANNOTATION_RESPIRATORY_RATE, APPLE_HEALTH_ANNOTATION_RESTING_HEART_RATE, APPLE_HEALTH_ANNOTATION_SKIN_TEMPERATURE, APPLE_HEALTH_ANNOTATION_SLEEP_ANALYSIS, APPLE_HEALTH_ANNOTATION_SPO2, APPLE_HEALTH_ANNOTATION_STEP_COUNT, APPLE_HEALTH_ANNOTATION_WALKING_RUNNING_DISTANCE, APPLE_HEALTH_DATA_SOURCES, APPLE_HEALTH_SIGNAL_TYPE_ANNOTATIONS, APPLE_HEALTH_SLEEP_STATE_MAP, ASMSECGMeasurementAnnotation, ASMSSpO2MeasurementAnnotation, type AndCondition, type Answer, AnswerCodeGuard, AnswerDateGuard, type AnswerItem, type Answers, AppIDNamingSystem, type AppleHealthDataSource, type AppleHealthSleepStates, type ArrayAnswer, type ArrayAnswerItem, type BLEDeviceConfig, BLE_ASMS_ANNOTATION_ITEM_ECG, BLE_ASMS_ANNOTATION_ITEM_SPO2, BLE_CPMS_ANNOTATION_ITEM_ACTIVITY_TYPE, BLE_CPMS_ANNOTATION_ITEM_DAILY_CALORIES, BLE_CPMS_ANNOTATION_ITEM_DAILY_DISTANCE, BLE_CPMS_ANNOTATION_ITEM_DAILY_ELEVATION_GAIN, BLE_CPMS_ANNOTATION_ITEM_DAILY_FLOORS, BLE_CPMS_ANNOTATION_ITEM_DAILY_STEPS, BLE_PAMS_ANNOTATION_ITEM_ABSOLUTE_ELEVATION, BLE_PAMS_ANNOTATION_ITEM_AVERAGE_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_AVERAGE_SPEED, BLE_PAMS_ANNOTATION_ITEM_BYTE, BLE_PAMS_ANNOTATION_ITEM_CALORIES_TOTAL, BLE_PAMS_ANNOTATION_ITEM_DISTANCE_TOTAL, BLE_PAMS_ANNOTATION_ITEM_FLAGS_16, BLE_PAMS_ANNOTATION_ITEM_FLAGS_24, BLE_PAMS_ANNOTATION_ITEM_FLAGS_32, BLE_PAMS_ANNOTATION_ITEM_FLAGS_8, BLE_PAMS_ANNOTATION_ITEM_FLOORS_TOTAL, BLE_PAMS_ANNOTATION_ITEM_FOUR_BYTES, BLE_PAMS_ANNOTATION_ITEM_HEADER, BLE_PAMS_ANNOTATION_ITEM_HEART_RATE, BLE_PAMS_ANNOTATION_ITEM_MAXIMUM_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_MAXIMUM_SPEED, BLE_PAMS_ANNOTATION_ITEM_MINIMUM_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_MINIMUM_SPEED, BLE_PAMS_ANNOTATION_ITEM_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_NEGATIVE_ELEVATION_GAIN, BLE_PAMS_ANNOTATION_ITEM_POSITIVE_ELEVATION_GAIN, BLE_PAMS_ANNOTATION_ITEM_RUNNING_STEPS_TOTAL, BLE_PAMS_ANNOTATION_ITEM_SPEED, BLE_PAMS_ANNOTATION_ITEM_STEPS_TOTAL, BLE_PAMS_ANNOTATION_ITEM_THREE_BYTES, BLE_PAMS_ANNOTATION_ITEM_TWO_BYTES, BLE_PAMS_ANNOTATION_ITEM_VO2_MAX, BLE_PSMS_ANNOTATION_ITEM_ACCELERATION, BLE_PSMS_ANNOTATION_ITEM_HEART_RATE, BLE_PSMS_ANNOTATION_ITEM_IBI, BLE_PSMS_ANNOTATION_ITEM_PPG_GREEN, BLE_PSMS_ANNOTATION_ITEM_PPG_IR, BLE_PSMS_ANNOTATION_ITEM_PPG_RED, BLE_PSMS_ANNOTATION_ITEM_SKIN_TEMPERATURE, type BaseDeviceConfig, type BleDeviceMetaLabel, BoolGuard, CPMSHealthServicesActivityDetectionAnnotation, CPMSHealthServicesPassiveDataAnnotation, type CodeQuestionCondition, CollectorClient, type CollectorConnectParams, type CollectorSyncItem, type CollectorSyncResponse, CommunicationTypeSystem, type ComparisonOperator, type ConditionOperatorType, type ConditionQuestionType, type ConditionSorting, type ConditionType, Conjunction, type Consent, type ConsentCondition, ConsentGuard, ConsentNameSystem, type ConsentPath, type ConsentTimes, ConsentVersionSystem, type ContentBlock, type Converter, type CopyrightLabel, CountryValueSet, type CryptoModule, CustomExtensionContextValue, CustomExtensionDate, CustomExtensionStudyName, CustomQuestionSystem, type DEVICE_ANNOTATION, type DEVICE_ANNOTATION_DATA_FORMAT, type DEVICE_ANNOTATION_DATA_TYPE, DEVICE_ANNOTATION_HEARTRATE, DEVICE_ANNOTATION_HRV_RMSSD, type DEVICE_ANNOTATION_ITEM, DEVICE_ANNOTATION_ITEM_ACCELERATION, DEVICE_ANNOTATION_ITEM_ANGULAR_SPEED, DEVICE_ANNOTATION_ITEM_BEACON_ID, DEVICE_ANNOTATION_ITEM_DATA_SOURCE, DEVICE_ANNOTATION_ITEM_DISTANCE, DEVICE_ANNOTATION_ITEM_EGVS, DEVICE_ANNOTATION_ITEM_HEARTRATE, DEVICE_ANNOTATION_ITEM_HRV_RMSSD, DEVICE_ANNOTATION_ITEM_MAGNETIC_FIELD, DEVICE_ANNOTATION_ITEM_REMOTE_DISTANCE, DEVICE_ANNOTATION_ITEM_RSSI, DEVICE_ANNOTATION_ITEM_SKIN_TEMPERATURE_DEVIATION, DEVICE_ANNOTATION_ITEM_UNIX_TIMESTAMP, DEVICE_ANNOTATION_SKIN_TEMPERATURE_DEVIATION, DEVICE_ANNOTATION_TIMESTAMP_NOTE, DEVICE_ANNOTATION_TIMESTAMP_SIZE, DEVICE_ANNOTATION_TIMESTAMP_UNIT, DEVICE_D4L_COMPANION_ANNOTATION_ITEM_DATA_TYPES_FLAG, DEVICE_D4L_COMPANION_ANNOTATION_ITEM_TIMESTAMP, DEVICE_DISPLAY_LABEL_CODING, type DEVICE_KEY, type DEVICE_KEY_API, type DEVICE_KEY_BLE, type DEVICE_KEY_INTERNAL, type DEVICE_KEY_SDK, DEVICE_KEY_TO_NAME, DEVICE_LABEL_CODING, type DEVICE_MOVELLA_PAYLOAD_MODES, DEVICE_OUTPUT_RATE_CODING, DEVICE_SENSOR_DELAY_CODING, type DEVICE_SIGNAL_TYPE, type DEVICE_SIGNAL_TYPE_APPLE, type DateBlurringFunction, type DateCondition, DateGuard, type DateQuestionCondition, DecimalGuard, type DeviceConfig, type DeviceName, Disjunction, type Display, type DisplayContent, type DisplayContentPath, type DisplayPath, type DisplayType, type DonationRecord, DonationSDK, type DonorIdentity, ERROR_CODES, ExistsGuard, type ExtendedProgramDevicesDataType, FITBIT_ANNOTATION_ITEM_BREATHING_RATE, FITBIT_ANNOTATION_ITEM_CALORIES, FITBIT_ANNOTATION_ITEM_HEART_RATE, FITBIT_ANNOTATION_ITEM_HEART_RATE_VARIABILITY, FITBIT_ANNOTATION_ITEM_SKIN_TEMPERATURE, FITBIT_ANNOTATION_ITEM_SLEEP_LEVEL, FITBIT_ANNOTATION_ITEM_SLEEP_LEVEL_DURATION, FITBIT_ANNOTATION_ITEM_SPO2, FITBIT_ANNOTATION_ITEM_STEPS, FITBIT_BREATHING_RATE_ANNOTATION, FITBIT_CALORIES_ANNOTATION, FITBIT_HEART_RATE_ANNOTATION, FITBIT_HEART_RATE_VARIABILITY_ANNOTATION, FITBIT_SIGNAL_TYPE_ANNOTATIONS, FITBIT_SKIN_TEMPERATURE_ANNOTATION, FITBIT_SLEEP_ANNOTATION, FITBIT_SLEEP_LEVEL_MAP, FITBIT_SPO2_ANNOTATION, FITBIT_STEPS_ANNOTATION, type FitbitSleepLevelTypes, type FlatAnswer, type FrequencySubset, type FrequencyType, GARMIN_SIGNAL_TYPE_ANNOTATIONS, GOOGLE_HEALTH_SIGNAL_TYPE_ANNOTATIONS, type GeoLocationAnswer, type Guard, type GuardContext, type GuardParameters, HEALTH_CONNECT_ANNOTATION_ITEM_SLEEP_DURATION, HEALTH_CONNECT_ANNOTATION_ITEM_SLEEP_STAGE, HEALTH_CONNECT_ANNOTATION_ITEM_STEPS, HEALTH_CONNECT_DATA_SOURCES, HEALTH_CONNECT_SIGNAL_TYPE_ANNOTATIONS, HEALTH_CONNECT_SLEEP_ANNOTATION, HEALTH_CONNECT_SLEEP_STAGE_MAP, HEALTH_CONNECT_STEPS_ANNOTATION, HYBRID_ENCRYPTION_VERSION_RECOVERY, HYBRID_ENCRYPTION_VERSION_V4, type HealthConnectDataSource, type HealthConnectSleepStages, HybridEncrypter, IMUAnnotation, ImageExtension, type InternalDeviceConfig, InternalSensorAnnotationTypes, Iso3166CodeSystem, KEY_LENGTH, KeyHandler, MENSTRUAL_CYCLE_ANNOTATION, MENSTRUAL_CYCLE_ANNOTATION_ITEM, MENSTRUAL_CYCLE_PHASE, MENSTRUAL_FLOW, MENSTRUAL_FLOW_ANNOTATION, MENSTRUAL_FLOW_ANNOTATION_ITEM, type MatrixAnswer, type MatrixAnswerItem, MaxValueExtension, MeasurementTypeSystem, type Message, type MessagePath, type MessageRecipient, MinLengthExtension, MinValueExtension, type MultiAnswers, type Notification, type NotificationRecipient, OTHER_ANSWER_CODE, OURA_ACTIVITY_ANNOTATION, OURA_ANNOTATION_ITEM_ACTIVITY_LEVEL, OURA_ANNOTATION_ITEM_BATTERY_LEVEL, OURA_ANNOTATION_ITEM_CARDIOVASCULAR_AGE, OURA_ANNOTATION_ITEM_STRESS, OURA_ANNOTATION_ITEM_TAG, OURA_ANNOTATION_ITEM_WORKOUT, OURA_BATTERY_LEVEL_ANNOTATION, OURA_CARDIOVASCULAR_AGE_ANNOTATION, OURA_SIGNAL_TYPE_ANNOTATIONS, OURA_STRESS_ANNOTATION, OURA_TAG_ANNOTATION, OURA_WORKOUT_ANNOTATION, ObservationTypeSystem, Offset, type OffsetCondition, type OrCondition, PAMSCardioVascularActivityAnnotation, PAMSGeneralActivityInstantaneousAnnotation, PAMSGeneralActivitySummaryAnnotation, PAMSStepCounterActivitySummaryAnnotation, PSMSAccelerationAnnotation, PSMSHeartRateAnnotation, PSMSPPGGreenAnnotation, PSMSPPGIRAnnotation, PSMSPPGRedAnnotation, PSMSSkinTemperatureAnnotation, PostalCodeCountrySourceExtension, PostalCodeFixedCountryUrl, PostalCodeFromItemUrl, PrepopulateExtension, type PreviewTimeSeriesItem, type Program, type ProgramAnonymization, type ProgramClientTarget, type ProgramConsentStep, type ProgramContact, type ProgramContent, type ProgramContentPath, type ProgramDevice, type ProgramDeviceType, type ProgramDevicesDataType, type ProgramDevicesLabel, type ProgramDisplayStep, type ProgramDonation, type ProgramEligibilityStep, type ProgramFeatured, type ProgramRoutineStep, type ProgramSensorStep, type ProgramStep, type ProgramStepBase, type ProgramStepType, type ProgramSurveyStep, type ProgramTag, type ProgramTokenStep, type ProgramType, QItemControlDefinition, type QuestionInputType, type QuestionnaireResponse, type QuestionnaireScore, RECORDING_MODEL_CURRENT_VERSION, RECORDING_SIGNAL_MODEL_CURRENT_VERSION, type RecordState, type Recording, type RecordingSignal, type RecordingSignalItem, type RecordingSignalPreview, type RecordingSignalWithId, type RecordingTag, type RecursiveKeyOf, RelativeMaxValueExtension, RelativeMinValueExtension, type ResearchSubject, type ResearchSubjectProgress, type ResearchSubjectProgressState, type ResponseCondition, type ResponseContext, ResponseGuard, type ResponseMinimal, type ResponseTimes, type ResponseValue, type RestorationSize, type Routine, type RoutineCondition, type RoutineContent, type RoutineContentPath, type RoutineContentStep, RoutineGuard, RoutineIsPassiveExtension, type RoutineTimes, type SDKDeviceConfig, type SDKInterface, SIGNAL_DURATION_CODING, type ScalarAnswer, type ScalarAnswerItem, type ScoreThreshold, type SeenDisplay, type SeenMessage, SensorIdentifierSystem, SensorSettingsSystem, SensorTypeSystem, SignalIDSystem, type SkippedStep, SliderInputLabel, SliderMaxLabelExtension, SliderMinLabelExtension, SliderOrientationExtension, SliderStepSizeExtension, type StepCondition, type StepConditionBase, type StringTemplater, StudyNameSystem, type Survey, type SurveyCondition, type SurveyContent, type SurveyContentPath, SurveyGuard, type SurveyMultiplex, type SurveyScoring, TAG_LENGTH, type Tag, type TagEffectiveType, type TaskFrequency, type Threshold, TimeFuncs, type TimeWindow, TokenNamingSystem, type TranslatedString, ULID_REGEX, ULIDtoUUID, UUID_REGEX, UUIDtoULID, type V4KeySpec, type V4SlotSpec, V4_DECRYPTER_DATA_RECEIVER, V4_DECRYPTER_MOBILE_APP, WORDLIST_LANGUAGES, WearOS3AnnotationMap, WebConverter, type WordListLanguage, YearGuard, binaryStringToUint8Array, buildSelfSignedAuthToken, calculateQuestionnaireScoreRange, calculateScoreRangeForItem, capitalizeFirstLetter, dayFormat, encodeDataSource, extractWordsFromRecoveryPhrase, generateFHIRConsent, generateFHIRQuestionnaireScore, generateFHIRRecordingBundle, generateFHIRResearchSubject, generateFHIRResponse, generateFHIRSeenDisplay, generateFHIRSeenMessage, generateFHIRTag, generateQuestionGuard, generateStepGuard, generateUrn, get, getFollowUpQuestionLinkId, getLanguageOfPassPhrase, getMovellaAnnotation, getText, getTimeFuncs, indexArrayBy, isArrayAnswer, isBeforeStartDate, isFlatAnswer, isGeoLocationAnswer, isMatrixAnswer, isNotAfterEndDate, isNotBeforeStartDate, isScalarAnswer, isScoreEligible, isYearString, newStepDateGuard, overwriteTime, stringToDate, stringToYear, timezonelessDate, toDeviceConfig, toQuestionnaireResponseItem, uint8ArrayToBinaryString, utf8ToUint8Array, v4AesKey, v4AesSlot, v4EcKey, v4EcSlot, v4RsaKey, v4RsaSlot, wordlists };