Tearleads

PUT/auth/device-state

Commit the next user device state

Operation auth.deviceState.commit

Description

Appends one signed state to the signed-in user's device chain: genesis, which the root identity signs, or a successor that pairs a device, removes one, or rotates the user encryption key. The server verifies the state against the registered root identity and the stored chain, and that the key envelopes and sealed keyring are the ones the state signs. A state that does not extend the current head returns 409; sending the stored head again succeeds without change. One a signer may not make returns 403, and any other invalid state 400.

Authentication

Requires a signed-in session: the client sends its session token as a bearer token in the Authorization header.

Request body

application/jsonCommitUserDeviceStateRequest

The next state of the caller's device chain with the artifacts it signs.

3 fields
  • keyEnvelopeslist of objectrequired
    • at most 33 items

    The key epoch wrapped to exactly the state's active devices and the recovery key.

    A key epoch's secret wrapped to one active device or to the root recovery key.

    5 fields
    • deviceIdstringrequirednullable
      • lowercase UUID v4

      The recipient device; null for the recovery envelope.

    • kemCipherTextstringrequired
      • exactly 2,092 characters
      • base64, pattern ^(?:[A-Za-z0-9+/]{4}){522}[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=$

      Base64 ML-KEM-1024 ciphertext.

    • recipientKeyFingerprintstringrequired
      • exactly 64 characters
      • lowercase hexadecimal

      SHA-256 fingerprint of the recipient's encapsulation key.

    • recipientKindstringrequired
      • one of device, recovery

      device or recovery.

    • wrappedKeystringrequired
      • exactly 64 characters
      • base64, pattern ^(?:[A-Za-z0-9+/]{4}){16}$

      Base64 AES-256-GCM wrap of the 32-byte key epoch secret.

    Other fields are allowed.

  • linkobjectrequired

    The signed state and the public keys it introduces.

    3 fields
    • addedDeviceKeyslist of objectrequired
      • at most 32 items

      Base64 public keys of the devices this state adds. Keys of devices an earlier state added are not repeated.

      3 fields
      • deviceIdstringrequired
        • lowercase UUID v4
      • encapsulationPublicKeystringrequired
        • exactly 2,092 characters
        • base64, pattern ^(?:[A-Za-z0-9+/]{4}){522}[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=$
      • signingPublicKeystringrequired
        • exactly 3,456 characters
        • base64, pattern ^(?:[A-Za-z0-9+/]{4}){864}$

      Other fields are allowed.

    • stateobjectrequired

      One signed state of a user's device chain: which per-device keys act for the user's root identity, and the user encryption key that wraps target.

      16 fields
      • deviceslist of objectrequired
        • at most 32 items

        Every active device, ordered by device id, each with its two key fingerprints, the signing time of the state that added it, and an optional sealed label.

        5 fields
        • addedAtstringrequired
          • at most 24 characters
        • deviceIdstringrequired
          • lowercase UUID v4
        • encapsulationKeyFingerprintstringrequired
          • exactly 64 characters
          • lowercase hexadecimal
        • encryptedLabelstringrequirednullable
          • at most 208 characters
        • signingKeyFingerprintstringrequired
          • exactly 64 characters
          • lowercase hexadecimal

        Other fields are allowed.

      • keyEnvelopesHashstringrequired
        • exactly 64 characters
        • lowercase hexadecimal

        Hash of the key envelopes that wrap this state's key epoch.

      • keyEpochintegerrequired
        • 1 to 4,096

        The user encryption key's epoch. It starts at 1 and advances by one when a device is removed or the key is rotated.

      • prevStateHashstringrequirednullable
        • exactly 64 characters
        • lowercase hexadecimal

        Hash of the previous state; null only at version 1.

      • rootRecoveryKeyFingerprintstringrequired
        • exactly 64 characters
        • lowercase hexadecimal

        SHA-256 fingerprint of the root identity's ML-KEM-1024 recovery key.

      • rootSigningKeyFingerprintstringrequired
        • exactly 64 characters
        • lowercase hexadecimal

        SHA-256 fingerprint of the root identity's ML-DSA-87 signing key.

      • sealedUserKeyringHashstringrequirednullable
        • exactly 64 characters
        • lowercase hexadecimal

        Hash of the sealed keyring of earlier key epochs; null only at key epoch 1.

      • signaturestringrequired
        • exactly 6,172 characters
        • base64, pattern ^(?:[A-Za-z0-9+/]{4}){1542}[A-Za-z0-9+/][AQgw]==$

        Base64 ML-DSA-87 signature over every other field, by the key signerKeyFingerprint names.

      • signedAtstringrequired
        • at most 24 characters

        Canonical ISO-8601 UTC signing time.

      • signerDeviceIdstringrequirednullable
        • lowercase UUID v4

        The signing device; null when the root identity signed.

      • signerKeyFingerprintstringrequired
        • exactly 64 characters
        • lowercase hexadecimal

        SHA-256 fingerprint of the signing key.

      • signerKindstringrequired
        • one of device, root

        root for the root identity, which signs genesis and may sign any successor; device for a device the previous state holds active.

      • suitestringrequired
        • always tearleads.user-device-state.ml-dsa87-ml-kem1024.v1

        The state format and its algorithms.

      • userEncryptionKeyFingerprintstringrequired
        • exactly 64 characters
        • lowercase hexadecimal

        SHA-256 fingerprint of this key epoch's ML-KEM-1024 user encryption key.

      • userIdstringrequired
        • lowercase UUID v4
      • versionintegerrequired
        • 1 to 8,192

        Position in the chain, starting at 1.

      Other fields are allowed.

    • userEncryptionPublicKeystringrequirednullable
      • exactly 2,092 characters
      • base64, pattern ^(?:[A-Za-z0-9+/]{4}){522}[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=$

      Base64 ML-KEM-1024 user encryption key when this state opens a key epoch; null when it keeps the previous one.

    Other fields are allowed.

  • sealedUserKeyringobjectrequirednullable

    The sealed keyring the state signs; null at key epoch 1.

    Every earlier key epoch's secret, sealed under the current key epoch so a newly paired device reads retained history.

    7 fields
    • ivstringrequired
      • exactly 16 characters
      • base64, pattern ^(?:[A-Za-z0-9+/]{4}){4}$

      Base64 AES-GCM IV.

    • keyEpochintegerrequired
      • 2 to 4,096

      The key epoch that seals the keyring; at least 2.

    • sealedstringrequired
      • at most 349,472 characters

      Base64 ciphertext whose length is fixed by keyEpoch: an 8-byte header and 64 bytes per earlier epoch, plus the tag.

    • sealingSuitestringrequired
      • always tearleads.user-keyring.aes-256-gcm.v1

      The sealing algorithm.

    • userEncryptionKeyFingerprintstringrequired
      • exactly 64 characters
      • lowercase hexadecimal

      SHA-256 fingerprint of the sealing epoch's user encryption key.

    • userIdstringrequired
      • lowercase UUID v4
    • versionnumberrequired
      • always 1

      Keyring format version, 1.

    Other fields are allowed.

Other fields are allowed.

Responses

200 OK

application/jsonCommitUserDeviceStateResponse

The chain's head after the commit.

1 field
  • headobjectrequired

    The newest state of a user's device chain.

    3 fields
    • stateHashstringrequired
      • exactly 64 characters
      • lowercase hexadecimal

      Hash of the head state.

    • userIdstringrequired
      • lowercase UUID v4
    • versionintegerrequired
      • 1 to 8,192

      Version of the head state.

    Other fields are allowed.

Other fields are allowed.

Other responses

StatusMeaningBody
400Bad Request

application/jsonUserDeviceStateErrorResponse

401Unauthorized

application/jsonSessionFailureResponse

403Forbidden

application/jsonUserDeviceStateErrorResponse

404Not Found

application/jsonErrorResponse

409Conflict

application/jsonUserDeviceStateErrorResponse

500Internal Server Error

application/jsonErrorResponse

503Service Unavailable

application/jsonErrorResponse