Members
number
# readonly size
Returns the current number of keyswitching keys. Only keys that are
non-empty are counted.
Methods
# clone() → {RelinKeys}
Clone and return a new instance of this RelinKeys
Example
const keyA = keyGenerator.createRelinKeys()
const keyB = keyA.clone()
// keyB holds a copy of keyA
# copy(key)
Copy an existing RelinKeys and overwrite this instance
Parameters:
Name | Type | Description |
---|---|---|
key |
RelinKeys
|
RelinKeys to copy |
Example
const keyA = keyGenerator.createRelinKeys()
const keyB = seal.RelinKeys()
keyB.copy(keyA)
// keyB holds a copy of keyA
# delete()
Delete the underlying WASM instance.
Should be called before dereferencing this object to prevent the
WASM heap from growing indefinitely.
# getIndex(keyPower) → {number}
Returns the index of a relinearization key in the backing KSwitchKeys
instance that corresponds to the given secret key power, assuming that
it exists in the backing KSwitchKeys.
Parameters:
Name | Type | Description |
---|---|---|
keyPower |
number
|
The power of the secret key |
The index of the relin key
number
# hasKey(keyPower) → {boolean}
Returns whether a relinearization key corresponding to a given power of
the secret key exists.
Parameters:
Name | Type | Description |
---|---|---|
keyPower |
number
|
The power of the secret key |
True if the power exists
boolean
# load(context, encoded)
Load a RelinKeys from a base64 string
Parameters:
Name | Type | Description |
---|---|---|
context |
Context
|
Encryption context to enforce |
encoded |
string
|
Base64 encoded string |
# loadArray(context, array)
Load a RelinKeys from an Uint8Array holding binary data
Parameters:
Name | Type | Description |
---|---|---|
context |
Context
|
Encryption context to enforce |
array |
Uint8Array
|
TypedArray containing binary data |
# move(key)
Move a RelinKeys into this one and delete the old reference
Parameters:
Name | Type | Description |
---|---|---|
key |
RelinKeys
|
RelinKeys to move |
Example
const keyA = keyGenerator.createRelinKeys()
const keyB = seal.RelinKeys()
keyB.move(keyA)
// keyB holds a the instance of keyA.
// keyA no longer holds an instance
# save(compressionopt) → {string}
Save the Encryption Parameters to a base64 string
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
compression |
ComprModeType
|
<optional> |
ComprModeType.zstd | The compression mode to use |
Base64 encoded string
string
# saveArray(compressionopt) → {Uint8Array}
Save the RelinKeys as a binary Uint8Array
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
compression |
ComprModeType
|
<optional> |
ComprModeType.zstd | The compression mode to use |
A byte array containing the RelinKeys in binary form
Uint8Array