Constructor
new ClientKey(alg, privateKey, publicJwk, thumbprint)
Use ClientKey.create() or ClientKey.loadOrCreate() rather than this.
Parameters:
| Name | Type | Description |
|---|---|---|
alg |
string | |
privateKey |
CryptoKey | |
publicJwk |
Record.<string, any> | |
thumbprint |
string |
Classes
Members
alg :string
Type:
- string
keyPair :CryptoKeyPair|undefined
Type:
- CryptoKeyPair | undefined
publicJwk
The public JWK, with alg and kid. @type {Record<string, any>}
thumbprint
RFC 7638 SHA-256 thumbprint of the public key; also its kid. @type {string}
Methods
keyObject() → {Object}
The key object a grant request carries by value (RFC 9635 section 7.1): the proof method and the
public JWK. Register exactly this on the AS (iya-sts: the application's gnapKey).
Returns:
- Type
- Object
(async) sign(data) → {Promise.<Uint8Array>}
Signs bytes with the private key, as RFC 9421 section 3.3.7 does for a JWS algorithm: ECDSA
signatures are the raw r || s concatenation, which is what WebCrypto produces.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Uint8Array |
Returns:
- Type
- Promise.<Uint8Array>
(async, static) create(optsopt) → {Promise.<ClientKey>}
Builds a key from a CryptoKeyPair, generating a new pair if none is given.
Generated keys are non-extractable unless extractable is set, which sessionStorage requires.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
opts |
Object |
<optional> |
(TypeScript: |
Returns:
- Type
- Promise.<ClientKey>
(async, static) loadOrCreate(store, optsopt) → {Promise.<ClientKey>}
Loads the key held in store, or creates one and stores it.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
store |
KeyStore | ||
opts |
Object |
<optional> |
(TypeScript: |
Returns:
- Type
- Promise.<ClientKey>