Skip to main content

Jwk

@iota/identity-wasm API documentation


Class: Jwk

JSON Web Key.

More Info

Methods​

kty()​

kty(): JwkType

Returns the value for the key type parameter (kty).

Returns​

JwkType


use()​

use(): undefined | JwkUse

Returns the value for the use property (use).

Returns​

undefined | JwkUse


alg()​

alg(): undefined | JwsAlgorithm

Returns the value for the algorithm property (alg).

Returns​

undefined | JwsAlgorithm


kid()​

kid(): undefined | string

Returns the value of the key ID property (kid).

Returns​

undefined | string


setKid()​

setKid(kid): void

Sets a value for the key ID property (kid).

Parameters​

kid​

string

Returns​

void


x5u()​

x5u(): undefined | string

Returns the value of the X.509 URL property (x5u).

Returns​

undefined | string


x5c()​

x5c(): string[]

Returns the value of the X.509 certificate chain property (x5c).

Returns​

string[]


x5t()​

x5t(): undefined | string

Returns the value of the X.509 certificate SHA-1 thumbprint property (x5t).

Returns​

undefined | string


x5t256()​

x5t256(): undefined | string

Returns the value of the X.509 certificate SHA-256 thumbprint property (x5t#S256).

Returns​

undefined | string


paramsEc()​

paramsEc(): undefined | JwkParamsEc

If this JWK is of kty EC, returns those parameters.

Returns​

undefined | JwkParamsEc


paramsOkp()​

paramsOkp(): undefined | JwkParamsOkp

If this JWK is of kty OKP, returns those parameters.

Returns​

undefined | JwkParamsOkp


paramsOct()​

paramsOct(): undefined | JwkParamsOct

If this JWK is of kty OCT, returns those parameters.

Returns​

undefined | JwkParamsOct


paramsRsa()​

paramsRsa(): undefined | JwkParamsRsa

If this JWK is of kty RSA, returns those parameters.

Returns​

undefined | JwkParamsRsa


thumbprintSha256B64()​

thumbprintSha256B64(): string

Creates a Thumbprint of the JSON Web Key according to RFC7638.

SHA2-256 is used as the hash function H.

The thumbprint is returned as a base64url-encoded string.

Returns​

string


toPublic()​

toPublic(): undefined | Jwk

Returns a clone of the Jwk with all private key components unset. Nothing is returned when kty = oct as this key type is not considered public by this library.

Returns​

undefined | Jwk


isPublic()​

isPublic(): boolean

Returns true if all private key components of the key are unset, false otherwise.

Returns​

boolean


isPrivate()​

isPrivate(): boolean

Returns true if all private key components of the key are set, false otherwise.

Returns​

boolean


toJSON()​

toJSON(): any

Serializes this to a JSON object.

Returns​

any


fromJSON()​

static fromJSON(json): Jwk

Deserializes an instance from a JSON object.

Parameters​

json​

any

Returns​

Jwk


clone()​

clone(): Jwk

Deep clones the object.

Returns​

Jwk