Skip to content

✨ Add support for subtle.importKey and subtle.sign with HMAC #632

@Ldoppea

Description

@Ldoppea

What feature or enhancement are you suggesting?

Hi,

First, thanks for maintaining this library.

My team would like to use RNQC in our mobile app. The best candidate is 0.x version but there are lacking 2 methods for our login workflow: sublte.importKey and subtle.sign with HMAC.

Here is the list of all methods we use:

Algorithm supported 0.x supported 1.x
crypto.getRandomValues(array)
crypto.subtle.digest('SHA-256', data) SHA-256
crypto.subtle.generateKey('RSA-OAEP' ... ) RSA-OAEP
crypto.subtle.importKey('raw' ... 'PBKDF2' ...) raw PBKDF2
crypto.subtle.importKey('raw' ... 'AES-CBC' ...) raw AES-CBC
crypto.subtle.importKey('raw' ... 'HMAC'... 'SHA-256' ...) raw HMAC
crypto.subtle.exportKey('spki' ...) (RSA-AOEP) spki RSA-AOEP
crypto.subtle.exportKey('pkcs8' ...) (RSA-AOEP) pkcs8 RSA-AOEP
crypto.subtle.deriveBits('PBKDF2' ... 'SHA-256' ...) PBKDF2
crypto.subtle.encrypt('AES-CBC' ...) AES-CBC
crypto.subtle.sign('HMAC' ... 'SHA-256' ...) HMAC

Are there any plan to implement missing methods?

With this compatibility array, I imagine that the "easiest" solution would be to implement them in 0.x. But if there are plans to improve the 1.x support in a short term we can wait.

I'm not sure how to help for this. My direct team has only a few knowledge on cryptography, but we can learn and try to do a PR on 0.x if you don't plan to implement it on your side. However if you have a first idea on the complexity of such a task this would help us to negociate some time to do it.

Thanks

What Platforms whould this feature/enhancement affect?

iOS, Android

Alternatives/Workarounds

For now we are using a bridge to a hidden webview that execute all the crypto methods and return them to RN.

This works well but it is way slower. Especially this impacts the app's boot time because initializing a webview can take hundred of milliseconds.

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions