iso-signatures
v0.3.2
Published
Signatures tooling.
Downloads
240
Maintainers
Readme
iso-signatures
Isomorphic signatures tooling
Install
pnpm install iso-signatures
Usage
import { EdDSASigner } from 'iso-signatures/signers/eddsa'
import * as EdDSA from 'iso-signatures/verifiers/eddsa'
import { Resolver } from 'iso-signatures/verifiers/resolver'
const message = new TextEncoder().encode('hello world')
const resolver = new Resolver({
...EdDSA.verifier,
})
const signer = await EdDSASigner.generate()
const signature = await signer.sign(message)
const verified = await resolver.verify({
signature,
message,
...signer,
})
import { EdDSASigner } from 'iso-signatures/signers/eddsa'
import * as EdDSA from 'iso-signatures/verifiers/eddsa'
import * as ECDSA from 'iso-signatures/verifiers/ecdsa'
import * as RSA from 'iso-signatures/verifiers/rsa'
import { Resolver } from 'iso-signatures/verifiers/resolver'
const message = new TextEncoder().encode('hello world')
const resolver = new Resolver(
{
...ECDSA.verifier,
...EdDSA.verifier,
},
{ cache: true }
)
const signer = await EdDSASigner.generate()
const signature = await signer.sign(message)
const verified = await resolver.verify({
signature,
message,
...signer.did, // Signer and DID both have `alg` property that the resolver uses to find the correct verifier
})
Docs
Check https://hugomrdias.github.io/iso-repo/modules/iso_signatures.html
License
MIT © Hugo Dias