oddsdk / ts-odd

An SDK for building apps with decentralized identity and storage.
https://odd.dev/
Apache License 2.0
178 stars 24 forks source link

import { ed25519Verify } from 'webnative/crypto/browser' #437

Closed gotjoshua closed 1 year ago

gotjoshua commented 1 year ago

Summary

I want to verify signatures created with wnfs.crypto.keystore.sign() i tried to

import { ed25519Verify } from 'webnative/crypto/browser'

vs-code finds it, but esbuild fails ✘ [ERROR] Could not resolve "webnative/crypto/browser"

Problem

I want to verify signatures created with wnfs.crypto.keystore.sign()

Solution

Expose the verify fx at the top level webnative, on the wnfs.crypto.keystore object or where it lives 'webnative/crypto/browser'

Detail

I most prefer to be able to call wnfs.crypto.keystore.ed25519Verify()

icidasset commented 1 year ago

It is exposed yeah. I think you'd need to import from webnative/crypto/browser.js instead, note the .js suffix.

This'll change a bit in the upcoming 0.35 release. In that release you'll be able to the following:

// When a `Program` is built via `webnative.program()`
program.components.crypto.did.keyTypes["ed25519"].verify()

// Or import directly (without .js suffix this time, or with depending on bundler used)
import { ed25519Verify } from "webnative/components/crypto/implementation/browser"
gotjoshua commented 1 year ago
program.components.crypto.did.keyTypes["ed25519"].verify()

Sounds great! Looking forward

icidasset commented 1 year ago

0.35 release is out with the code mentioned above.