Skip to content

[Feature]: Allow serializing CryptoKeys via storage state #35946

@Aralun

Description

@Aralun

🚀 Feature Request

Playwright 1.51 introduced IndexedDB save and restore features.
A clear evolution of this feature is supporting CryptoKeys.

Special handling is needed for SubtleCrypto keys.
Keys must be exported and imported. JSON does not support cryptokeys, so choices would need to be made on how to represent them (algorithm, raw key, usages...). A choice would need to be made about non-extractable crypto keys as well.

Example

  • Persisting authenticated states stored via keys and other cryptographic data
  • Easily re-import keys without having to handle the cumbersome subtle+IndexedDB API combo (these two are not fun)

Motivation

SubtleCrypto is widely adopted. Apps which use this type of API need advanced testing.

Apps which use subtle keys need to manually import them via evaluation, which is very cumbersome and can lead to raw keys appearing on VCS. Apps which rely on authentication via these keys cannot easily rely on saved storage states and instead have to provide fixtures.

Offering out-of-the-box crypto keys handling would vastly improve support for this type of application.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions