Skip to content

SubtleCrypto: sign() method missing Ed25519 in Supported algorithms #30886

Closed
@guest271314

Description

@guest271314

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign

What specific section or headline is this issue about?

Supported algorithms

What information was incorrect, unhelpful, or incomplete?

Missing Ed25519.

What did you expect to see?

Ed25519 algorithm listed.

Do you have any supporting links, references, or citations?

GoogleChromeLabs/webbundle-plugins#11 (comment)

Yes. Node support is unfortunately required as long as Ed25519 keys are not supported by SubtleCrypto so that JS-only library would be possible. So node is needed in order to sign a web bundle, as Node's Crypto API supports Ed25519 keys.

GoogleChromeLabs/webbundle-plugins#11 (comment)

It's not limited to node-only as there's also golang version of the package. Whenever the support for ed25519 keys is added to SubtleCrypto, it'll be rather simple to create a browser-only version of the wbn-sign package. Web bundles are still experimental and I'm sure the tooling coverage improves when use of IWAs increases.

This modified version of Deno test code https://github.com/denoland/deno/blob/ca64771257d23ceee97e882965269702c359f6aa/cli/tests/node_compat/test/parallel/test-webcrypto-sign-verify.js#L115-L133 logs true on Chromium Version 122.0.6170.0 (Developer Build) (64-bit).

// Test Sign/Verify Ed25519
{
  
  async function test(data) {
    const {subtle} = self.crypto;
    const ec = new TextEncoder();
    const { publicKey, privateKey } = await subtle.generateKey({
      name: 'Ed25519',
    }, true, ['sign', 'verify']);

    const signature = await subtle.sign({
      name: 'Ed25519',
    }, privateKey, ec.encode(data));

    console.log(await subtle.verify({
      name: 'Ed25519',
    }, publicKey, signature, ec.encode(data)));
  }

  test('hello world').catch(console.error);
}

Do you have anything more you want to share?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions