Skip to content

crypto and it's deprecated package #597

@japgolly

Description

@japgolly
Contributor

I'd really love to have dom.crypto be of type js.UndefOr[Crypto]. It seems the impediment is the old deprecated package with the same name.

These are my ideas:

  1. change dom.crypto to be of type js.UndefOr[Crypto with DeprecatedCryptoPackage] so that at least in userland we can use it Crypto -- actually this won't work - deprecated crypto imports wouldn't be stable, not to mention that there's a js.UndefOr there

  2. Building on @sjrd's suggestion we could keep The great migration to dom #588 as it but also add a webCrypto: js.UndefOr[Crypto] which we could deprecate in 3.x to be replaced by crypto

  3. just nuke the deprecated package, 2.0 is a new world

Any more ideas? I'm kinda happy with 3, but 2 would definitely be acceptable.

Activity

armanbilge

armanbilge commented on Oct 17, 2021

@armanbilge
Member

It's a bit ugly, but what if we add an implicit conversion to Crypto that brings in all the deprecated aliases? So that dom.crypto can still be used as if it is the old package. Would this work?

japgolly

japgolly commented on Oct 17, 2021

@japgolly
ContributorAuthor

I don't think so. Cos source-compat is the concern the direct import statements would stop working. Plus maybe it wouldn't be worth it if the cost is an implicit anyway :)

armanbilge

armanbilge commented on Oct 17, 2021

@armanbilge
Member

Right, imports 😕

Regarding your idea 2, we already have a deprecated GlobalCrypto object or similar that could be used like that I think. Otherwise I'm 👍 with it, I think I suggested something similar as well.

japgolly

japgolly commented on Oct 17, 2021

@japgolly
ContributorAuthor

Oh another idea, we could add

object Crypto {
  def ifAvailable: js.UndefOr[Cypto]
}

It would be the same as option 2 above except instead of webCrypto it would be Crypto.ifAvailable. More of a 2b

japgolly

japgolly commented on Oct 17, 2021

@japgolly
ContributorAuthor

GlobalCrypto has the wrong type for crypto and it's deprecated anyway.

Regarding your idea 2, we already have a deprecated GlobalCrypto object or similar that could be used like that I think. Otherwise I'm +1 with it, I think I suggested something similar as well.

Nice, so we'll go with a 2x option? Do you have a preference between webCrypto or Crypto.ifAvailable or something else?

armanbilge

armanbilge commented on Oct 17, 2021

@armanbilge
Member

IMO dom.webCrypto is best since it's very close to our eventual target of dom.crypto.

japgolly

japgolly commented on Oct 17, 2021

@japgolly
ContributorAuthor

ok np, I'll do PR that after #588 is in 👍

added this to the v2.0.0 milestone on Oct 17, 2021
added 2 commits that reference this issue on Oct 17, 2021
9d316ec
ec63c63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @japgolly@armanbilge

      Issue actions

        `crypto` and it's deprecated package · Issue #597 · scala-js/scala-js-dom