4.0.0 • Published 3 years ago

webkms-client v4.0.0

Weekly downloads
215
License
BSD-3-Clause
Repository
github
Last release
3 years ago

webkms-client

A JavaScript WebKMS client library

Spec Reference

W3C CCG Latest Draft

API Reference

Modules

Functions

webkms

WebKMS client for Javascript.

webkms.KmsClient

A WebKMS Client used to interface with a KMS.

Kind: instance class of webkms

new exports.KmsClient(options)

Creates a new KmsClient.

Returns: KmsClient - The new instance.

ParamTypeDescription
optionsobjectThe options to use.
options.keystorestringThe ID of the keystore that must be a URL that refers to the keystore's root storage location; if not given, then a separate capability must be given to each method called on the client instance.
options.httpsAgentobjectAn optional node.js https.Agent instance to use when making requests.

webkms:generateKey(options) ⇒ Promise.<object>

Generates a new cryptographic key in the keystore.

Kind: global function
Returns: Promise.<object> - The key description for the key.

ParamTypeDescription
optionsobjectThe options to use.
options.kmsModulestringThe KMS module to use.
options.typestringThe key type (e.g. 'AesKeyWrappingKey2019').
options.capabilitystringThe OCAP-LD authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:getKeyDescription(options) ⇒ Promise.<object>

Gets the key description for the given key ID.

Kind: global function
Returns: Promise.<object> - The key description.

ParamTypeDescription
optionsobjectThe options to use.
options.keyIdstringThe ID of the key.
options.capabilitystringThe OCAP-LD authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:revokeCapability(options) ⇒ Promise.<object>

Store a capability revocation.

Kind: global function
Returns: Promise.<object> - Resolves once the operation completes.

ParamTypeDescription
optionsobjectThe options to use.
options.capabilityToRevokeobjectThe capability to enable.
options.capabilitystringThe zcap authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:wrapKey(options) ⇒ Promise.<string>

Wraps a cryptographic key using a key encryption key (KEK).

Kind: global function
Returns: Promise.<string> - The base64url-encoded wrapped key bytes.

ParamTypeDescription
optionsobjectThe options to use.
options.kekIdstringThe ID of the wrapping key to use.
options.unwrappedKeyUint8ArrayThe unwrapped key material as a Uint8Array.
options.capabilitystringThe OCAP-LD authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:unwrapKey(options) ⇒ Promise.<(Uint8Array|null)>

Unwraps a cryptographic key using a key encryption key (KEK).

Kind: global function
Returns: Promise.<(Uint8Array|null)> - Resolves to the unwrapped key material or null if the unwrapping failed because the key did not match.

ParamTypeDescription
optionsobjectThe options to use.
options.kekIdstringThe ID of the unwrapping key to use.
options.wrappedKeystringThe wrapped key material as a base64url-encoded string.
options.capabilitystringThe OCAP-LD authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:sign(options) ⇒ Promise.<string>

Signs some data. Note that the data will be sent to the server, so if this data is intended to be secret it should be hashed first. However, hashing the data first may present interoperability issues so choose wisely.

Kind: global function
Returns: Promise.<string> - The base64url-encoded signature.

ParamTypeDescription
optionsobjectThe options to use.
options.keyIdstringThe ID of the signing key to use.
options.dataUint8ArrayThe data to sign as a Uint8Array.
options.capabilitystringThe OCAP-LD authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:verify(options) ⇒ Promise.<boolean>

Verifies some data. Note that the data will be sent to the server, so if this data is intended to be secret it should be hashed first. However, hashing the data first may present interoperability issues so choose wisely.

Kind: global function
Returns: Promise.<boolean> - true if verified, false if not.

ParamTypeDescription
optionsobjectThe options to use.
options.keyIdstringThe ID of the signing key to use.
options.dataUint8ArrayThe data to verify as a Uint8Array.
options.signaturestringThe base64url-encoded signature to verify.
options.capabilitystringThe OCAP-LD authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:deriveSecret(options) ⇒ Promise.<Uint8Array>

Derives a shared secret via the given peer public key, typically for use as one parameter for computing a shared key. It should not be used as a shared key itself, but rather input into a key derivation function (KDF) to produce a shared key.

Kind: global function
Returns: Promise.<Uint8Array> - The shared secret bytes.

ParamTypeDescription
optionsobjectThe options to use.
options.keyIdstringThe ID of the key agreement key to use.
options.publicKeyobjectThe public key to compute the shared secret against; the public key type must match the key agreement key's type.
options.capabilitystringThe OCAP-LD authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:enableCapability(options) ⇒ Promise.<object>

Stores a delegated authorization capability, enabling it to be invoked by its designated invoker.

Kind: global function
Returns: Promise.<object> - Resolves once the operation completes.

ParamTypeDescription
optionsobjectThe options to use.
options.capabilityToEnableobjectThe capability to enable.
options.capabilitystringThe OCAP-LD authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:disableCapability(options) ⇒ Promise.<boolean>

Removes a previously stored delegated authorization capability, preventing it from being invoked by its designated invoker.

Kind: global function
Returns: Promise.<boolean> - Resolves to true if the document was deleted and false if it did not exist.

ParamTypeDescription
optionsobjectThe options to use.
options.idobjectThe ID of the capability to revoke.
options.capabilitystringThe OCAP-LD authorization capability to use to authorize the invocation of this operation.
options.invocationSignerobjectAn API with an id property and a sign function for signing a capability invocation.

webkms:createKeystore(options) ⇒ Promise.<object>

Creates a new keystore using the given configuration.

Kind: global function
Returns: Promise.<object> - Resolves to the configuration for the newly created keystore.

ParamTypeDescription
optionsobjectThe options to use.
options.urlstringThe url to post the configuration to.
options.configstringThe keystore's configuration.
options.httpsAgentobjectAn optional node.js https.Agent instance to use when making requests.

webkms:getKeystore(options) ⇒ Promise.<object>

Gets the configuration for a keystore by its ID.

Kind: global function
Returns: Promise.<object> - Resolves to the configuration for the keystore.

ParamTypeDescription
optionsobjectThe options to use.
options.idstringThe keystore's ID.
options.httpsAgentobjectAn optional node.js https.Agent instance to use when making requests.

webkms:findKeystore(options) ⇒ Promise.<object>

Finds the configuration for a keystore by its controller and reference ID.

Kind: global function
Returns: Promise.<object> - Resolves to the configuration for the keystore.

ParamTypeDescription
optionsobjectThe options to use.
options.urlstringThe url to query.
options.controllerstringThe keystore's controller.
options.referenceIdstringThe keystore's reference ID.
options.httpsAgentobjectAn optional node.js https.Agent instance to use when making requests.
4.0.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.5.0

3 years ago

2.4.0

3 years ago

2.3.2

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago