JoseSigner
@twine-protocol/twine-builder v0.1.0 • Docs
twine-js / @twine-protocol/twine-builder / JoseSigner
Class: JoseSigner
A signer that uses the jose library to sign twines
Example
import { JoseSigner } from '@twine-protocol/twine-builder'
const signer = await JoseSigner.fromRandomness()Implements
Signer
Constructors
new JoseSigner()
new JoseSigner(
privateKey,publicKey,alg):JoseSigner
Create a new JoseSigner from a JWK
Parameters
privateKey
KeyLike
The private key
publicKey
KeyLike
The public key
alg
string
The algorithm to use
Returns
Defined in
Properties
Methods
fromRandomness()
staticfromRandomness(alg,options):Promise<JoseSigner>
Create a new JoseSigner from a random key pair
Parameters
alg
string
'ES256'
The algorithm to use
options
GenerateKeyPairOptions
{}
Options for the key pair
Returns
Promise<JoseSigner>
See
https://github.com/panva/jose/blob/main/src/runtime/node/generate.ts#L42
Defined in
getPublicJWK()
getPublicJWK():
Promise<JWK>
Get the public JWK
Returns
Promise<JWK>
See
Implementation of
Signer.getPublicJWK
Defined in
sign()
sign(
bytes):Promise<string>
Sign some bytes
Parameters
bytes
Uint8Array
Returns
Promise<string>
See
Implementation of
Signer.sign
Defined in
Last updated