Trush
Trush
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
var cachedSetTimeout = defaultSetTimout;
var cachedClearTimeout = defaultClearTimeout;
if (typeof global$1.setTimeout === 'function') {
cachedSetTimeout = setTimeout;
}
if (typeof global$1.clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
}
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) &&
setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E.
maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so
I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must
have the global object for 'this', hopfully our context correct otherwise it will
throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !
cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E.
maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so
I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must
have the global object for 'this', hopfully our context correct otherwise it will
throw a global error.
// Some versions of I.E. have different rules for
clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
function noop() {}
var on = noop;
var addListener = noop;
var once = noop;
var off = noop;
var removeListener = noop;
var removeAllListeners = noop;
var emit = noop;
function binding(name) {
throw new Error('process.binding is not supported');
}
// from
https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
var performance = global$1.performance || {};
var performanceNow =
performance.now ||
performance.mozNow ||
performance.msNow ||
performance.oNow ||
performance.webkitNow ||
function(){ return (new Date()).getTime() };
var process = {
nextTick: nextTick,
title: title,
browser: browser,
env: env,
argv: argv,
version: version,
versions: versions,
on: on,
addListener: addListener,
once: once,
off: off,
removeListener: removeListener,
removeAllListeners: removeAllListeners,
emit: emit,
binding: binding,
cwd: cwd,
chdir: chdir,
umask: umask,
hrtime: hrtime,
platform: platform,
release: release,
config: config,
uptime: uptime
};
/*--------------------------------------------------------------------------
*/
var TABLE =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// http://whatwg.org/html/common-microsyntaxes.html#space-
character
var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g;
if (padding == 2) {
a = input.charCodeAt(position) << 8;
b = input.charCodeAt(++position);
buffer = a + b;
output += (
TABLE.charAt(buffer >> 10) +
TABLE.charAt((buffer >> 4) & 0x3F) +
TABLE.charAt((buffer << 2) & 0x3F) +
'='
);
} else if (padding == 1) {
buffer = input.charCodeAt(position);
output += (
TABLE.charAt(buffer >> 2) +
TABLE.charAt((buffer << 4) & 0x3F) +
'=='
);
}
return output;
};
var base64 = {
'encode': encode,
'decode': decode,
'version': '0.1.0'
};
}(commonjsGlobal));
});
/**
* Decodes the base64 encoded string into a `string`.
* @hidden
* @param {string} input
* @returns {string}
*/
function base64Decode(input) {
return base64.decode(input);
}
/**
* Encodes the `input` string into a base64 `string`.
* @hidden
* @param {string} input
* @returns {string}
*/
function base64Encode(input) {
return base64.encode(input);
}
/**
* Converts regular base64 encoded string to URL-safe base64 encoded
string.
* @hidden
* @param {string} input - Regular base64 encoded string.
* @returns {string} - URL-safe base64 encoded string.
*/
function base64UrlFromBase64(input) {
input = input.split('=')[0];
input = input.replace(/\+/g, '-').replace(/\//g, '_');
return input;
}
/**
* Converts URL-safe base64 encoded string to regular base64 encoded
string.
* @hidden
* @param {string} input - URL-safe base64 encoded string.
* @returns {string} - Regular base64 encoded string.
*/
function base64UrlToBase64(input) {
input = input.replace(/-/g, '+').replace(/_/g, '/');
switch (input.length % 4) {
case 0: break; // no padding needed
case 2:
input = input + '==';
break;
case 3:
input = input + '=';
break;
default:
throw new Error('Invalid base64 string');
}
return input;
}
/**
* * Encodes the `input` string into a string using URL-safe base64
encoding.
*
* @hidden
*
* @param {string} input - The input.
* @returns {string}
*/
function base64UrlEncode(input) {
let output = base64Encode(input);
return base64UrlFromBase64(output);
}
/**
* Decodes the URL-safe base64-encoded `input` string into a `string`.
*
* @hidden
*
* @param {string} input
* @returns {string}
*/
function base64UrlDecode(input) {
const str = base64UrlToBase64(input);
return base64Decode(str);
}
/**
* Converts javascript date object or timestamp in milliseconds
* to Unix timestamp.
*
* @hidden
*
* @param {Date | number} date - The date or timestamp to convert.
* @returns {number}
*/
function getUnixTimestamp(date) {
let time;
if (typeof date === 'number') {
time = date;
}
else {
time = date.getTime();
}
return Math.floor(time / 1000);
}
/**
* Adds the given number of seconds to the given date.
*
* @hidden
*
* @param {Date | number} date - The date to add seconds to.
* If `date` is a `number` it is treated as a timestamp in
milliseconds.
* @param {number} seconds - The number of seconds to add.
* @returns {Date} - The new date.
*/
function addSeconds(date, seconds) {
if (typeof date === 'number') {
return new Date(date + seconds * 1000);
}
return new Date(date.getTime() + seconds * 1000);
}
/**
* JWT Subject.
* @hidden
*/
const SubjectPrefix = "identity-";
/**
* JWT Issuer.
* @hidden
*/
const IssuerPrefix = "virgil-";
/**
* Class representing the JWT providing access to the
* Virgil Security APIs.
* Implements {@link IAccessToken} interface.
*/
class Jwt {
constructor(header, body, signature) {
if (typeof header === 'string') {
const stringRepresentation = header;
const parts = stringRepresentation.split('.');
if (parts.length !== 3)
throw new Error('Wrong JWT format');
try {
this.header = JSON.parse(base64UrlDecode(parts[0]));
this.body = JSON.parse(base64UrlDecode(parts[1]));
this.signature = base64UrlToBase64(parts[2]);
}
catch (e) {
throw new Error('Wrong JWT format');
}
this.unsignedData = parts[0] + '.' + parts[1];
this.stringRepresentation = stringRepresentation;
}
else if (typeof header === 'object' && typeof body ===
'object') {
this.header = header;
this.body = body;
this.signature = signature;
this.unsignedData = this.headerBase64() + '.' +
this.bodyBase64();
this.stringRepresentation = this.signature == null
? this.unsignedData
: this.unsignedData + '.' + this.signatureBase64();
}
else {
throw new TypeError('Invalid arguments for function Jwt. '
+
'Expected a string representation of a token, or header
and body as objects');
}
}
/**
* Parses the string representation of the JWT into
* an object representation.
*
* @param {string} jwtStr - The JWT string. Must have the following
format:
*
* `base64UrlEncode(Header) + "." + base64UrlEncode(Body) + "." +
base64UrlEncode(Signature)`
*
* See the {@link https://jwt.io/introduction/ | Introduction to
JWT} for more details.
*
* @returns {Jwt}
*/
static fromString(jwtStr) {
return new Jwt(jwtStr);
}
/**
* Returns the string representation of this JWT.
* @returns {string}
*/
toString() {
return this.stringRepresentation;
}
/**
* Retrieves the identity that is the subject of this JWT.
* @returns {string}
*/
identity() {
if (this.body.sub.indexOf(SubjectPrefix) !== 0) {
throw new Error('wrong sub format');
}
return this.body.sub.substr(SubjectPrefix.length);
}
/**
* Retrieves the application ID that is the issuer of this JWT.
* @returns {string}
*/
appId() {
if (this.body.iss.indexOf(IssuerPrefix) !== 0) {
throw new Error('wrong iss format');
}
return this.body.iss.substr(IssuerPrefix.length);
}
/**
* Returns a boolean indicating whether this JWT is (or will be)
* expired at the given date or not.
*
* @param {Date} at - The date to check. Defaults to `new Date()`.
* @returns {boolean} - `true` if token is expired, otherwise
`false`.
*/
isExpired(at = new Date) {
const now = getUnixTimestamp(at);
return this.body.exp < now;
}
headerBase64() {
return base64UrlEncode(JSON.stringify(this.header));
}
bodyBase64() {
return base64UrlEncode(JSON.stringify(this.body));
}
signatureBase64() {
return base64UrlFromBase64(this.signature);
}
}
/**
* Test if `condition` is truthy. If it is not, an `Error` is thrown
with a
* `message` property equal to `message` parameter.
* @hidden
* @param {boolean} condition
* @param {string} message
*/
function assert(condition, message) {
if (!condition) {
throw new Error(message);
}
}
const TOKEN_EXPIRATION_MARGIN = 5;
/**
* Implementation of {@link IAccessTokenProvider} that caches the JWT
* in memory while it's fresh (i.e. not expired) and uses the user-
provided
* callback function to get the JWT when requested by the clients.
*/
class CachingJwtProvider {
/**
* Creates a new instance of `CachingJwtProvider`.
* @param {GetJwtCallback} renewJwtFn - The function that will be
called
* whenever the fresh JWT is needed. If the `renewJwtFn` returns
the JWT
* as a string, it will be converted to {@link Jwt} instance
automatically.
* @param {Jwt|string} [initialToken] - Optional initial JWT.
*/
constructor(renewJwtFn, initialToken) {
if (typeof renewJwtFn !== 'function') {
throw new TypeError('`renewJwtFn` must be a function');
}
if (initialToken) {
let jwt;
if (typeof initialToken === 'string') {
jwt = Jwt.fromString(initialToken);
}
else if (initialToken instanceof Jwt) {
jwt = initialToken;
}
else {
throw new Error(`Expected "initialToken" to be a string
or an instance of Jwt, got ${typeof initialToken}`);
}
this.cachedJwt = jwt;
}
this.getJwt = (context) => {
if (this.cachedJwt && !
this.cachedJwt.isExpired(addSeconds(new Date, TOKEN_EXPIRATION_MARGIN))) {
return Promise.resolve(this.cachedJwt);
}
if (this.jwtPromise) {
return this.jwtPromise;
}
this.jwtPromise = Promise.resolve(renewJwtFn(context))
.then(token => {
const jwt = typeof token === 'string' ?
Jwt.fromString(token) : token;
this.cachedJwt = jwt;
this.jwtPromise = undefined;
return jwt;
}).catch(err => {
this.jwtPromise = undefined;
throw err;
});
return this.jwtPromise;
};
}
/**
* Returns a `Promise` resolved with the cached token if it's
fresh, or the
* token obtained by the call to the `renewJwtCallback` otherwise.
The token
* obtained from the `renewJwtCallback` is then cached. If the
`renewJwtCallback`
* returns the JWT as a string, it is converted to {@link Jwt}
instance before returning.
* @param {ITokenContext} context
* @returns {Promise<IAccessToken>}
*/
getToken(context) {
return this.getJwt(context);
}
}
/*!
*****************************************************************************
Copyright (c) Microsoft Corporation.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols ===
"function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i <
p.length; i++) {
if (e.indexOf(p[i]) < 0 &&
Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
/**
* Intermediate representation of the Virgil Card with
`contentSnapshot`
* and `snapshot`s of the signatures in UTF-8.
*/
class RawSignedModel {
/**
* Initializes a new instance of `RawSignedModel`.
* @param {string} contentSnapshot - The content snapshot in UTF-8.
* @param {IRawSignature[]} signatures - The signatures. If
signatures
* themselves have snapshots, those must also be in UTF-8.
*/
constructor(contentSnapshot, signatures) {
this.contentSnapshot = contentSnapshot;
this.signatures = signatures;
}
/**
* Converts the `str` in base64 encoding into a `RawSignedModel`
object.
*
* @param {string} str - Base64 string representation of the card
as
* returned by {@RawSignedModel.toString} method.
*
* @returns {RawSignedModel}
*/
static fromString(str) {
const jsonStr = base64Decode(str);
let obj;
try {
obj = JSON.parse(jsonStr);
}
catch (error) {
throw new Error('The string to be parsed is in invalid
format');
}
return RawSignedModel.fromJson(obj);
}
/**
* Converts the `json` serializable object into a `RawSignedModel`
object.
* @param {IRawSignedModelJson} json - JSON-serializable object
returned by
* {@link RawSignedModel.toJson} method.
* @returns {RawSignedModel}
*/
static fromJson(json) {
const contentSnapshotUtf8 =
base64Decode(json.content_snapshot);
const signaturesWithUtf8Snapshots = (json.signatures ||
[]).map(({ signer, signature, snapshot }) => {
if (snapshot) {
return {
signer,
signature,
snapshot: base64Decode(snapshot)
};
}
return { signer, signature };
});
return new RawSignedModel(contentSnapshotUtf8,
signaturesWithUtf8Snapshots);
}
/**
* This is to make it work with `JSON.stringify`, calls
* {@link RawSignedModel.toJson} under the hood.
* @returns {IRawSignedModelJson}
*/
toJSON() {
return this.toJson();
}
/**
* Returns a JSON-serializable representation of this model in the
* format it is stored in the Virgil Cards Service. (i.e. with
* `contentSnapshot` and `snapshot`s of the signatures as base64
encoded
* strings.
* @returns {IRawSignedModelJson}
*/
toJson() {
return {
content_snapshot: base64Encode(this.contentSnapshot),
signatures: this.signatures.map(({ signer, signature,
snapshot }) => {
if (snapshot) {
return {
signer,
signature,
snapshot: base64Encode(snapshot)
};
}
return { signer, signature };
})
};
}
/**
* Serializes this model to string in base64 encoding.
* @returns {string}
*/
toString() {
return base64Encode(JSON.stringify(this));
}
/**
* Same as {@link RawSignedModel.toJson}. Please use that instead.
* @returns {IRawSignedModelJson}
*/
exportAsJson() {
return this.toJson();
}
/**
* Same as {@link RawSignedModel.toString}. Please use that
instead.
* @returns {string}
*/
exportAsString() {
return this.toString();
}
}
function fetchPonyfill(options) {
var Promise = options && options.Promise || self.Promise;
var XMLHttpRequest = options && options.XMLHttpRequest ||
self.XMLHttpRequest;
var global = self;
return (function () {
var self = Object.create(global, {
fetch: {
value: undefined,
writable: true
}
});
(function(self) {
if (self.fetch) {
return
}
var support = {
searchParams: 'URLSearchParams' in self,
iterable: 'Symbol' in self && 'iterator' in Symbol,
blob: 'FileReader' in self && 'Blob' in self && (function() {
try {
new Blob();
return true
} catch(e) {
return false
}
})(),
formData: 'FormData' in self,
arrayBuffer: 'ArrayBuffer' in self
};
if (support.arrayBuffer) {
var viewClasses = [
'[object Int8Array]',
'[object Uint8Array]',
'[object Uint8ClampedArray]',
'[object Int16Array]',
'[object Uint16Array]',
'[object Int32Array]',
'[object Uint32Array]',
'[object Float32Array]',
'[object Float64Array]'
];
function normalizeName(name) {
if (typeof name !== 'string') {
name = String(name);
}
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
throw new TypeError('Invalid character in header field
name')
}
return name.toLowerCase()
}
function normalizeValue(value) {
if (typeof value !== 'string') {
value = String(value);
}
return value
}
if (support.iterable) {
iterator[Symbol.iterator] = function() {
return iterator
};
}
return iterator
}
function Headers(headers) {
this.map = {};
Headers.prototype['delete'] = function(name) {
delete this.map[normalizeName(name)];
};
Headers.prototype.get = function(name) {
name = normalizeName(name);
return this.has(name) ? this.map[name] : null
};
Headers.prototype.has = function(name) {
return this.map.hasOwnProperty(normalizeName(name))
};
Headers.prototype.keys = function() {
var items = [];
this.forEach(function(value, name) { items.push(name); });
return iteratorFor(items)
};
Headers.prototype.values = function() {
var items = [];
this.forEach(function(value) { items.push(value); });
return iteratorFor(items)
};
Headers.prototype.entries = function() {
var items = [];
this.forEach(function(value, name) { items.push([name,
value]); });
return iteratorFor(items)
};
if (support.iterable) {
Headers.prototype[Symbol.iterator] =
Headers.prototype.entries;
}
function consumed(body) {
if (body.bodyUsed) {
return Promise.reject(new TypeError('Already read'))
}
body.bodyUsed = true;
}
function fileReaderReady(reader) {
return new Promise(function(resolve, reject) {
reader.onload = function() {
resolve(reader.result);
};
reader.onerror = function() {
reject(reader.error);
};
})
}
function readBlobAsArrayBuffer(blob) {
var reader = new FileReader();
var promise = fileReaderReady(reader);
reader.readAsArrayBuffer(blob);
return promise
}
function readBlobAsText(blob) {
var reader = new FileReader();
var promise = fileReaderReady(reader);
reader.readAsText(blob);
return promise
}
function readArrayBufferAsText(buf) {
var view = new Uint8Array(buf);
var chars = new Array(view.length);
function bufferClone(buf) {
if (buf.slice) {
return buf.slice(0)
} else {
var view = new Uint8Array(buf.byteLength);
view.set(new Uint8Array(buf));
return view.buffer
}
}
function Body() {
this.bodyUsed = false;
this._initBody = function(body) {
this._bodyInit = body;
if (!body) {
this._bodyText = '';
} else if (typeof body === 'string') {
this._bodyText = body;
} else if (support.blob &&
Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body;
} else if (support.formData &&
FormData.prototype.isPrototypeOf(body)) {
this._bodyFormData = body;
} else if (support.searchParams &&
URLSearchParams.prototype.isPrototypeOf(body)) {
this._bodyText = body.toString();
} else if (support.arrayBuffer && support.blob &&
isDataView(body)) {
this._bodyArrayBuffer = bufferClone(body.buffer);
// IE 10-11 can't handle a DataView body.
this._bodyInit = new Blob([this._bodyArrayBuffer]);
} else if (support.arrayBuffer &&
(ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
this._bodyArrayBuffer = bufferClone(body);
} else {
throw new Error('unsupported BodyInit type')
}
if (!this.headers.get('content-type')) {
if (typeof body === 'string') {
this.headers.set('content-type',
'text/plain;charset=UTF-8');
} else if (this._bodyBlob && this._bodyBlob.type) {
this.headers.set('content-type', this._bodyBlob.type);
} else if (support.searchParams &&
URLSearchParams.prototype.isPrototypeOf(body)) {
this.headers.set('content-type', 'application/x-www-
form-urlencoded;charset=UTF-8');
}
}
};
if (support.blob) {
this.blob = function() {
var rejected = consumed(this);
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return Promise.resolve(this._bodyBlob)
} else if (this._bodyArrayBuffer) {
return Promise.resolve(new
Blob([this._bodyArrayBuffer]))
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as blob')
} else {
return Promise.resolve(new Blob([this._bodyText]))
}
};
this.arrayBuffer = function() {
if (this._bodyArrayBuffer) {
return consumed(this) ||
Promise.resolve(this._bodyArrayBuffer)
} else {
return this.blob().then(readBlobAsArrayBuffer)
}
};
}
this.text = function() {
var rejected = consumed(this);
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob)
} else if (this._bodyArrayBuffer) {
return
Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as text')
} else {
return Promise.resolve(this._bodyText)
}
};
if (support.formData) {
this.formData = function() {
return this.text().then(decode)
};
}
this.json = function() {
return this.text().then(JSON.parse)
};
return this
}
function normalizeMethod(method) {
var upcased = method.toUpperCase();
return (methods.indexOf(upcased) > -1) ? upcased : method
}
Request.prototype.clone = function() {
return new Request(this, { body: this._bodyInit })
};
function decode(body) {
var form = new FormData();
body.trim().split('&').forEach(function(bytes) {
if (bytes) {
var split = bytes.split('=');
var name = split.shift().replace(/\+/g, ' ');
var value = split.join('=').replace(/\+/g, ' ');
form.append(decodeURIComponent(name),
decodeURIComponent(value));
}
});
return form
}
function parseHeaders(rawHeaders) {
var headers = new Headers();
// Replace instances of \r\n and \n followed by at least one
space or horizontal tab with a space
// https://tools.ietf.org/html/rfc7230#section-3.2
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g,
' ');
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
var parts = line.split(':');
var key = parts.shift().trim();
if (key) {
var value = parts.join(':').trim();
headers.append(key, value);
}
});
return headers
}
Body.call(Request.prototype);
this.type = 'default';
this.status = options.status === undefined ? 200 :
options.status;
this.ok = this.status >= 200 && this.status < 300;
this.statusText = 'statusText' in options ?
options.statusText : 'OK';
this.headers = new Headers(options.headers);
this.url = options.url || '';
this._initBody(bodyInit);
}
Body.call(Response.prototype);
Response.prototype.clone = function() {
return new Response(this._bodyInit, {
status: this.status,
statusText: this.statusText,
headers: new Headers(this.headers),
url: this.url
})
};
Response.error = function() {
var response = new Response(null, {status: 0, statusText:
''});
response.type = 'error';
return response
};
self.Headers = Headers;
self.Request = Request;
self.Response = Response;
xhr.onload = function() {
var options = {
status: xhr.status,
statusText: xhr.statusText,
headers: parseHeaders(xhr.getAllResponseHeaders() ||
'')
};
options.url = 'responseURL' in xhr ? xhr.responseURL :
options.headers.get('X-Request-URL');
var body = 'response' in xhr ? xhr.response :
xhr.responseText;
resolve(new Response(body, options));
};
xhr.onerror = function() {
reject(new TypeError('Network request failed'));
};
xhr.ontimeout = function() {
reject(new TypeError('Network request failed'));
};
request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value);
});
xhr.send(typeof request._bodyInit === 'undefined' ? null :
request._bodyInit);
})
};
self.fetch.polyfill = true;
})(typeof self !== 'undefined' ? self : this);
return {
fetch: self.fetch,
Headers: self.Headers,
Request: self.Request,
Response: self.Response
};
}());
}
{
module.exports = fetchPonyfill;
}
}(typeof self !== 'undefined' ? self : typeof commonjsGlobal !==
'undefined' ? commonjsGlobal : commonjsGlobal));
});
const OS_LIST = [
/* Windows Phone */
{
name: 'Windows Phone',
test: [/windows phone/i],
},
/* Windows */
{
test: [/windows/i],
name: 'Windows'
},
/* macOS */
{
test: [/macintosh/i],
name: 'macOS'
},
/* iOS */
{
test: [/(ipod|iphone|ipad)/i],
name: 'iOS'
},
/* Android */
{
test: [/android/i],
name: 'Android',
},
/* Linux */
{
test: [/linux/i],
name: 'Linux',
},
/* Chrome OS */
{
test: [/CrOS/],
name: 'Chrome OS'
},
/* Playstation 4 */
{
test: [/PlayStation 4/],
name: 'PlayStation 4',
},
];
/**
* Class responsible for tracking which Virgil SDK is being used to
make requests, its version,
* browser and platform.
*/
class VirgilAgent {
/**
* Initializes a new instance of `VirgilAgent`.
* @param {string} product - name of product eg (sdk, brainkey,
bpp, keyknox, ratchet, e3kit, purekit)
* argument of request methods.
* @param {string} version - version of the product.
* @param {string} [userAgent] - string with device user agent.
Optional
*/
constructor(product, version, userAgent) {
/**
* Detect Cordova / PhoneGap / Ionic frameworks on a mobile
device.
* @return {boolean} true if detects Ionic.
*/
this.isIonic = () => typeof window !== "undefined" &&
!!("cordova" in window || "phonegap" in window ||
"PhoneGap" in window) &&
/android|ios|iphone|ipod|ipad|iemobile/i.test(this.userAgent);
this.userAgent = userAgent || this.getUserAgent();
this.value = `${product};js;${this.getHeaderValue()};$
{version}`;
}
/**
* Returns navigator.userAgent string or '' if it's not defined.
* @return {string} user agent string
*/
getUserAgent() {
if (typeof navigator !== "undefined" && typeof
navigator.userAgent === "string") {
return navigator.userAgent;
}
else {
return "";
}
}
;
/**
* Detects device OS
* @returns {string} returns OS if detected or 'other'.
*/
getOsName() {
const os = OS_LIST.find((os) => os.test.some(condition =>
condition.test(this.userAgent)));
return os ? os.name : 'other';
}
/**
* Detects device browser
* @returns {string} returns browser if detected of 'other'.
*/
getBrowser() {
const browser = BROWSER_LIST.find((browser) =>
browser.test.some(condition => condition.test(this.userAgent)));
return browser ? browser.name : 'other';
}
/**
* Detect React Native.
* @return {boolean} true if detects ReactNative .
*/
isReactNative() {
return typeof navigator === "object" && navigator.product ===
"ReactNative";
}
/**
* Return information for `virgil-agent` header.
* @return {string} string in format:
PRODUCT;FAMILY;PLATFORM;VERSION
*/
getHeaderValue() {
try {
if (this.isReactNative())
return "ReactNative";
if (this.isIonic())
return `Ionic/${this.getOsName()}`;
if (!true && typeof global$1 !== 'undefined') {
const majorVersion = process.version.replace(/\.\d+\.\
d+$/, '').replace('v', '');
return `Node${majorVersion}/${process.platform}`;
}
return `${this.getBrowser()}/${this.getOsName()}`;
}
catch (e) {
return `Unknown`;
}
}
}
/**
* Class responsible for making HTTP requests.
* @hidden
*/
class Connection {
/**
* Initializes a new instance of `Connection`.
* @param {string} prefix - `prefix` will be prepended to the
`endpoint`
* argument of request methods.
* @param {VirgilAgentValue} [virgilAgentValue] - optional instance
of VirgilAgent for products that wraps
* Virgil SDK
*/
constructor(prefix, info) {
this.prefix = prefix;
if (!info)
info = { product: 'sdk', version: "6.1.2" };
this.virgilAgentValue = new VirgilAgent(info.product,
info.version).value;
}
/**
* Issues a GET request against the `endpoint`.
* @param {string} endpoint - Endpoint URL relative to the
`prefix`.
* @param {string} accessToken - Token to authenticate the request.
* @returns {Promise<Response>}
*/
get(endpoint, accessToken) {
const headers = this.createHeaders(accessToken);
return this.send(endpoint, 'GET', { headers });
}
/**
* Issues a POST request against the `endpoint` sending the `data`
as JSON.
* @param {string} endpoint - Endpoint URL relative to the
`prefix`.
* @param {string} accessToken - Token to authenticate the request.
* @param {object} data - Response body.
* @returns {Promise<Response>}
*/
post(endpoint, accessToken, data = {}) {
const headers = this.createHeaders(accessToken);
headers.set('Content-Type', 'application/json');
return this.send(endpoint, 'POST', {
headers: headers,
body: JSON.stringify(data)
});
}
send(endpoint, method, params) {
return fetch$1(this.prefix + endpoint,
Object.assign({ method }, params));
}
createHeaders(accessToken) {
const headers = new Headers();
headers.set('Authorization', `Virgil ${accessToken}`);
headers.set('Virgil-Agent', this.virgilAgentValue);
return headers;
}
}
/**
* Custom error class for errors specific to Virgil SDK.
*/
class VirgilError extends Error {
constructor(m, name = 'VirgilError', DerivedClass = VirgilError) {
super(m);
Object.setPrototypeOf(this, DerivedClass.prototype);
this.name = name;
}
}
var ErrorCode;
(function (ErrorCode) {
ErrorCode[ErrorCode["AccessTokenExpired"] = 20304] =
"AccessTokenExpired";
ErrorCode[ErrorCode["Unknown"] = 0] = "Unknown";
})(ErrorCode || (ErrorCode = {}));
/**
* Error thrown by {@link CardManager} when request to the Virgil Cards
Service
* fails.
*/
class VirgilHttpError extends VirgilError {
constructor(message, status, errorCode) {
super(message, 'VirgilHttpError', VirgilHttpError);
this.httpStatus = status;
this.errorCode = errorCode;
}
}
/**
* Generates error object from response object with HTTP status >= 400
*
* @hidden
*
* @param {Response} response
* @returns {Promise<VirgilHttpError>}
*/
function generateErrorFromResponse(response) {
return __awaiter(this, void 0, void 0, function* () {
if (response.status >= 400 && response.status < 500) {
const reason = yield response.json();
return new VirgilHttpError(reason.message, response.status,
reason.code);
}
else {
return new VirgilHttpError(response.statusText,
response.status, 0);
}
});
}
/**
* @hidden
*/
const SelfSigner = "self";
/**
* @hidden
*/
const VirgilSigner = "virgil";
/**
* @hidden
*/
const CardVersion = '5.0';
/**
* @hidden
*/
const CardIdByteLength = 32;
/**
* Class responsible for generating signatures of the cards.
*/
class ModelSigner {
/**
* Initializes a new instance of `ModelSigner`.
* @param {ICardCrypto} crypto - Object implementing the
* {@link ICardCrypto} interface.
*/
constructor(crypto) {
this.crypto = crypto;
}
/**
* Generates a new signature based on `rawParams`.
* @param {IRawSignParams} rawParams
*/
sign(rawParams) {
const { model, signerPrivateKey, signer, extraSnapshot } =
this.prepareParams(rawParams);
const signedSnapshot = extraSnapshot != null
? model.contentSnapshot + extraSnapshot
: model.contentSnapshot;
const signature = this.crypto.generateSignature({ value:
signedSnapshot, encoding: 'utf8' }, signerPrivateKey);
model.signatures.push({
signer,
signature: signature.toString('base64'),
snapshot: extraSnapshot
});
}
prepareParams({ model, signerPrivateKey, extraFields, signer }) {
signer = signer || SelfSigner;
let extraSnapshot;
if (extraFields != null) {
extraSnapshot = JSON.stringify(extraFields);
}
const final = { model, signerPrivateKey, signer,
extraSnapshot };
this.validate(final);
return final;
}
validate({ model, signerPrivateKey, signer }) {
if (model == null) {
throw new Error("Model is empty");
}
if (signerPrivateKey == null) {
throw new Error("`signerPrivateKey` property is
mandatory");
}
if (model.signatures != null && model.signatures.some(s =>
s.signer == signer)) {
throw new Error("The model already has this signature.");
}
}
}
/**
* Converts an {@link ICard} to a {@link RawSignedModel}.
*
* @hidden
*
* @param {ICard} card - The {@link ICard} to convert.
* @returns {RawSignedModel}
*/
function cardToRawSignedModel(card) {
return new RawSignedModel(card.contentSnapshot,
card.signatures.slice());
}
/**
* Generates a {@link RawSignedModel} from the given `params`.
*
* @hidden
*
* @param {ICardCrypto} crypto - Object implementing the {@link
ICardCrypto}
* interface.
* @param {INewCardParams} params - New card parameters.
* @returns {RawSignedModel}
*/
function generateRawSigned(crypto, params) {
const { identity, publicKey, previousCardId } = params;
const now = getUnixTimestamp(new Date);
const details = {
identity: identity,
previous_card_id: previousCardId,
created_at: now,
version: CardVersion,
public_key:
crypto.exportPublicKey(publicKey).toString('base64'),
};
return new RawSignedModel(JSON.stringify(details), []);
}
/**
* Converts the {@link RawSignedModel} into the {@link ICard}.
*
* @hidden
*
* @param {ICardCrypto} crypto - Object implementing the {@link
ICardCrypto}
* interface.
* @param {RawSignedModel} model - The model to convert.
* @param {boolean} isOutdated - Boolean indicating whether there is a
newer
* Virgil Card replacing the one that `model` represents.
*
* @returns {ICard}
*/
function parseRawSignedModel(crypto, model, isOutdated = false) {
const content = JSON.parse(model.contentSnapshot);
const signatures = model.signatures.map(rawSignToCardSign);
return {
id: generateCardId(crypto, model.contentSnapshot),
publicKey: crypto.importPublicKey({ value: content.public_key,
encoding: 'base64' }),
contentSnapshot: model.contentSnapshot,
identity: content.identity,
version: content.version,
createdAt: new Date(content.created_at * 1000),
previousCardId: content.previous_card_id,
signatures,
isOutdated
};
}
/**
* Given the array of `cards`, returns another array with outdated
cards
* filtered out and the `previousCard` properties of the cards that
replace
* the outdated ones being populated with appropriate outdated cards.
* i.e. turns this (A is for Actual, O is for Outdated):
* ```
* A -> O -> A -> A -> O
* ```
* into this
* ```
* A -> A -> A
* | |
* O O
* ```
*
* @hidden
*
* @param {ICard[]} cards - The cards array to transform.
* @returns {ICard[]} - Transformed array.
*/
function linkedCardList(cards) {
const unsorted = Object.create(null);
for (const card of cards) {
unsorted[card.id] = card;
}
for (const card of cards) {
if (card.previousCardId == null)
continue;
if (unsorted[card.previousCardId] == null)
continue;
unsorted[card.previousCardId].isOutdated = true;
card.previousCard = unsorted[card.previousCardId];
delete unsorted[card.previousCardId];
}
return Object.keys(unsorted).map(key => unsorted[key]);
}
/**
* Calculates ID for the VirgilCard from the `snapshot` of its
contents.
*
* @hidden
*
* @param {ICardCrypto} crypto - Object implementing the {@link
ICardCrypto}
* interface.
* @param {string} snapshot - The VirgilCard's contents snapshot.
* @returns {string} - VirgilCard's ID encoded in HEX.
*/
function generateCardId(crypto, snapshot) {
const fingerprint = crypto
.generateSha512({ value: snapshot, encoding: 'utf8' })
.slice(0, CardIdByteLength);
return fingerprint.toString('hex');
}
function rawSignToCardSign({ snapshot, signature, signer }) {
return {
signer,
signature,
snapshot,
extraFields: tryParseExtraFields(snapshot)
};
}
function tryParseExtraFields(snapshot) {
if (snapshot) {
try {
return JSON.parse(snapshot);
}
catch (ignored) { }
}
return {};
}
/**
* Error thrown by {@link CardManager} instances when the card received
from
* the network (or imported from string\json) fails verification.
*/
class VirgilCardVerificationError extends VirgilError {
constructor(m) {
super(m, 'CardVerificationError', VirgilCardVerificationError);
}
}
const DEFAULTS = {
verifySelfSignature: true,
verifyVirgilSignature: true,
whitelists: []
};
const VIRGIL_CARDS_PUBKEY_BASE64 =
'MCowBQYDK2VwAyEAljOYGANYiVq1WbvVvoYIKtvZi2ji9bAhxyu6iV/LF8M=';
/**
* Class responsible for validating cards by verifying their digital
* signatures.
*/
class VirgilCardVerifier {
/**
* Initializes a new instance of `VirgilCardVerifier`.
* @param {ICardCrypto} crypto - Object implementing the
* {@link ICardCrypto} interface.
* @param {IVirgilCardVerifierParams} options - Initialization
options.
*/
constructor(crypto, options) {
this.crypto = crypto;
const params = Object.assign(Object.assign({}, DEFAULTS),
(options || {}));
this.verifySelfSignature = params.verifySelfSignature;
this.verifyVirgilSignature = params.verifyVirgilSignature;
this.whitelists = params.whitelists;
this.virgilCardsPublicKey = crypto.importPublicKey({ value:
VIRGIL_CARDS_PUBKEY_BASE64, encoding: 'base64' });
}
/**
* Verifies the signatures of the `card`.
* @param {ICard} card
* @returns {boolean} `true` if the signatures to be verified are
present
* and valid, otherwise `false`.
*/
verifyCard(card) {
if (this.selfValidationFailed(card)) {
return false;
}
if (this.virgilValidationFailed(card)) {
return false;
}
if (!this.whitelists || this.whitelists.length === 0) {
return true;
}
const signers = card.signatures.map(s => s.signer);
for (const whitelist of this.whitelists) {
if (whitelist == null || whitelist.length === 0) {
return false;
}
const intersectedCreds = whitelist.filter(x =>
signers.indexOf(x.signer) !== -1);
if (intersectedCreds.length === 0) {
return false;
}
const isValidForSome = intersectedCreds.some(cred =>
this.validateSignerSignature(card, this.getPublicKey(cred.publicKeyBase64),
cred.signer));
if (!isValidForSome) {
return false;
}
}
return true;
}
selfValidationFailed(card) {
return this.verifySelfSignature
&& !this.validateSignerSignature(card, card.publicKey,
SelfSigner);
}
virgilValidationFailed(card) {
return this.verifyVirgilSignature
&& !this.validateSignerSignature(card,
this.virgilCardsPublicKey, VirgilSigner);
}
getPublicKey(signerPublicKeyBase64) {
return this.crypto.importPublicKey({ value:
signerPublicKeyBase64, encoding: 'base64' });
}
validateSignerSignature(card, signerPublicKey, signer) {
const signature = card.signatures.find(s => s.signer ===
signer);
if (signature == null)
return false;
const extendedSnapshot = signature.snapshot == null
? card.contentSnapshot
: card.contentSnapshot + signature.snapshot;
return this.crypto.verifySignature({ value: extendedSnapshot,
encoding: 'utf8' }, { value: signature.signature, encoding: 'base64' },
signerPublicKey);
}
}
function checkScalarValue(codePoint) {
if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
throw Error(
'Lone surrogate U+' +
codePoint.toString(16).toUpperCase() +
' is not a scalar value'
);
}
}
/*--------------------------------------------------------------------------
*/
function encodeCodePoint(codePoint) {
if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
return stringFromCharCode(codePoint);
}
var symbol = '';
if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
symbol = stringFromCharCode(((codePoint >> 6) & 0x1F)
| 0xC0);
}
else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte
sequence
checkScalarValue(codePoint);
symbol = stringFromCharCode(((codePoint >> 12) &
0x0F) | 0xE0);
symbol += createByte(codePoint, 6);
}
else if ((codePoint & 0xFFE00000) == 0) { // 4-byte
sequence
symbol = stringFromCharCode(((codePoint >> 18) &
0x07) | 0xF0);
symbol += createByte(codePoint, 12);
symbol += createByte(codePoint, 6);
}
symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
return symbol;
}
function utf8encode(string) {
var codePoints = ucs2decode(string);
var length = codePoints.length;
var index = -1;
var codePoint;
var byteString = '';
while (++index < length) {
codePoint = codePoints[index];
byteString += encodeCodePoint(codePoint);
}
return byteString;
}
/*--------------------------------------------------------------------------
*/
function readContinuationByte() {
if (byteIndex >= byteCount) {
throw Error('Invalid byte index');
}
function decodeSymbol() {
var byte1;
var byte2;
var byte3;
var byte4;
var codePoint;
if (byteIndex == byteCount) {
return false;
}
// 2-byte sequence
if ((byte1 & 0xE0) == 0xC0) {
byte2 = readContinuationByte();
codePoint = ((byte1 & 0x1F) << 6) | byte2;
if (codePoint >= 0x80) {
return codePoint;
} else {
throw Error('Invalid continuation byte');
}
}
// 4-byte sequence
if ((byte1 & 0xF8) == 0xF0) {
byte2 = readContinuationByte();
byte3 = readContinuationByte();
byte4 = readContinuationByte();
codePoint = ((byte1 & 0x07) << 0x12) | (byte2 <<
0x0C) |
(byte3 << 0x06) | byte4;
if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
return codePoint;
}
}
var byteArray;
var byteCount;
var byteIndex;
function utf8decode(byteString) {
byteArray = ucs2decode(byteString);
byteCount = byteArray.length;
byteIndex = 0;
var codePoints = [];
var tmp;
while ((tmp = decodeSymbol()) !== false) {
codePoints.push(tmp);
}
return ucs2encode(codePoints);
}
/*--------------------------------------------------------------------------
*/
root.version = '3.0.0';
root.encode = utf8encode;
root.decode = utf8decode;
}( exports));
});
/**
* Error thrown by {@link IStorageAdapter.store} method when saving a
value
* with a key that already exists in store.
*/
class StorageEntryAlreadyExistsError extends VirgilError {
constructor(key) {
super(`Storage entry ${key ? 'with key ' + name : 'with the
given key'}already exists`, 'StorageEntryAlreadyExistsError',
StorageEntryAlreadyExistsError);
}
}
// Some code originally from localForage in
// [localForage](https://github.com/localForage/localForage).
// Transaction Modes
const READ_ONLY = 'readonly';
const READ_WRITE = 'readwrite';
const dbContexts = {};
/**
* Implementation of {@link IStorageAdapter} that uses IndexedDB for
* persistence. For use in browsers.
*/
class IndexedDbStorageAdapter {
/**
* Initializes an instance of `IndexedDbStorageAdapter`.
* @param {IStorageAdapterConfig} config - Configuration options.
* Currently only `name` is supported and must be the name of the
* IndexedDB database where the data will be stored.
*/
constructor(config) {
// Open the IndexedDB database (automatically creates one if
one didn't
// previously exist), using any options set in the config.
this._initStorage = () => {
const dbInfo = {
db: null,
name: this._defaultConfig.name,
storeName: this._defaultConfig.storeName,
version: this._defaultConfig.version
};
// Get the current context of the database;
let dbContext = dbContexts[dbInfo.name];
// ...or create a new context.
if (!dbContext) {
dbContext = createDbContext();
// Register the new context in the global container.
dbContexts[dbInfo.name] = dbContext;
}
// Initialize the connection process only when
// all the related storages aren't pending.
return Promise.resolve()
.then(() => {
dbInfo.db = dbContext.db;
// Get the connection or open a new one without
upgrade.
return _getOriginalConnection(dbInfo);
})
.then(db => {
dbInfo.db = db;
if (_isUpgradeNeeded(dbInfo,
this._defaultConfig.version)) {
// Reopen the database for upgrading.
return _getUpgradedConnection(dbInfo);
}
return db;
})
.then(db => {
dbInfo.db = dbContext.db = db;
this._dbInfo = dbInfo;
});
};
// Specialize the default `ready()` function by making it
dependent
// on the current database operations. Thus, the driver will be
actually
// ready when it's been initialized (default) *and* there are
no pending
// operations on the database (initiated by some other
instances).
this.ready = () => {
const promise = this._ready.then(() => {
const dbContext = dbContexts[this._dbInfo.name];
if (dbContext && dbContext.dbReady) {
return dbContext.dbReady;
}
});
return promise;
};
if (!isIndexedDbValid()) {
throw new Error('Cannot use IndexedDbStorageAdapter.
indexedDb is not supported');
}
this._defaultConfig = {
name: config.name,
version: 1,
storeName: 'keyvaluepairs'
};
this._ready = this._initStorage();
}
/**
* @inheritDoc
*/
store(key, data) {
key = normalizeKey(key);
return new Promise((resolve, reject) => {
this.ready().then(() => {
createTransaction(this._dbInfo, READ_WRITE, (err,
transaction) => {
if (err) {
return reject(err);
}
try {
const store =
transaction.objectStore(this._dbInfo.storeName);
const req = store.add(data, key);
transaction.oncomplete = () => {
resolve();
};
transaction.onabort = transaction.onerror = ()
=> {
let error = req.error
? req.error
: req.transaction.error;
if (error && error.name ===
'ConstraintError') {
reject(new
StorageEntryAlreadyExistsError(key));
}
reject(error);
};
}
catch (error) {
reject(error);
}
});
}).catch(reject);
});
}
/**
* @inheritDoc
*/
load(key) {
key = normalizeKey(key);
return new Promise((resolve, reject) => {
this.ready().then(() => {
createTransaction(this._dbInfo, READ_ONLY, (err,
transaction) => {
if (err) {
return reject(err);
}
try {
const store =
transaction.objectStore(this._dbInfo.storeName);
const req = store.get(key);
req.onsuccess = function () {
if (req.result == null) {
return resolve(null);
}
resolve(convertDbValue(req.result));
};
req.onerror = function () {
reject(req.error);
};
}
catch (e) {
reject(e);
}
});
}).catch(reject);
});
}
/**
* @inheritDoc
*/
exists(key) {
key = normalizeKey(key);
return new Promise((resolve, reject) => {
this.ready().then(() => {
createTransaction(this._dbInfo, READ_ONLY, (err,
transaction) => {
if (err) {
return reject(err);
}
try {
const store =
transaction.objectStore(this._dbInfo.storeName);
const req = store.openCursor(key);
req.onsuccess = () => {
const cursor = req.result;
resolve(cursor !== null);
};
req.onerror = () => {
reject(req.error);
};
}
catch (e) {
reject(e);
}
});
}).catch(reject);
});
}
/**
* @inheritDoc
*/
remove(key) {
key = normalizeKey(key);
return new Promise((resolve, reject) => {
this.ready().then(() => {
createTransaction(this._dbInfo, READ_WRITE, (err,
transaction) => {
if (err) {
return reject(err);
}
try {
const store =
transaction.objectStore(this._dbInfo.storeName);
const countReq = store.count(key);
let delReq;
countReq.onsuccess = () => {
const count = countReq.result;
if (count === 0) {
return resolve(false);
}
// safe for IE and some versions of Android
// (including those used by Cordova).
// Normally IE won't like `.delete()` and
will insist on
// using `['delete']()`
delReq = store['delete'](key);
delReq.onsuccess = () => resolve(true);
};
// The request will be also be aborted if we've
exceeded our storage
// space.
transaction.onabort = transaction.onerror = ()
=> {
const req = delReq || countReq;
const err = req.error
? req.error
: req.transaction.error;
reject(err);
};
}
catch (e) {
reject(e);
}
});
}).catch(reject);
});
}
/**
* @inheritDoc
*/
update(key, data) {
key = normalizeKey(key);
return new Promise((resolve, reject) => {
this.ready().then(() => {
createTransaction(this._dbInfo, READ_WRITE, (err,
transaction) => {
if (err) {
return reject(err);
}
try {
const store =
transaction.objectStore(this._dbInfo.storeName);
const req = store.put(data, key);
req.onsuccess = () => {
resolve();
};
req.onerror = () => {
reject(req.error);
};
}
catch (error) {
reject(error);
}
});
}).catch(reject);
});
}
/**
* @inheritDoc
*/
clear() {
return new Promise((resolve, reject) => {
this.ready().then(() => {
createTransaction(this._dbInfo, READ_WRITE, (err,
transaction) => {
if (err) {
return reject(err);
}
try {
const store =
transaction.objectStore(this._dbInfo.storeName);
const req = store.clear();
transaction.oncomplete = () => resolve();
transaction.onabort = transaction.onerror = ()
=> {
const err = req.error
? req.error
: req.transaction.error;
reject(err);
};
}
catch (e) {
reject(e);
}
});
}).catch(reject);
});
}
/**
* @inheritDoc
*/
list() {
return new Promise((resolve, reject) => {
this.ready().then(() => {
createTransaction(this._dbInfo, READ_ONLY, (err,
transaction) => {
if (err) {
return reject(err);
}
try {
const store =
transaction.objectStore(this._dbInfo.storeName);
const req = store.openCursor();
const entries = [];
req.onsuccess = () => {
const cursor = req.result;
if (!cursor) {
resolve(entries);
}
else {
entries.push(convertDbValue(cursor.value));
cursor.continue();
}
};
req.onerror = () => {
reject(req.error);
};
}
catch (e) {
reject(e);
}
});
}).catch(reject);
});
}
}
function createDbContext() {
return {
// Database.
db: null,
// Database readiness (promise).
dbReady: null,
// Deferred operations on the database.
deferredOperations: []
};
}
function _deferReadiness(dbInfo) {
const dbContext = dbContexts[dbInfo.name];
// Create a deferred object representing the current database
operation.
const deferredOperation = {};
deferredOperation.promise = new Promise((resolve, reject) => {
deferredOperation.resolve = resolve;
deferredOperation.reject = reject;
});
// Enqueue the deferred operation.
dbContext.deferredOperations.push(deferredOperation);
// Chain its promise to the database readiness.
if (!dbContext.dbReady) {
dbContext.dbReady = deferredOperation.promise;
}
else {
dbContext.dbReady = dbContext.dbReady.then(() =>
deferredOperation.promise);
}
}
function _advanceReadiness(dbInfo) {
const dbContext = dbContexts[dbInfo.name];
// Dequeue a deferred operation.
const deferredOperation = dbContext.deferredOperations.pop();
// Resolve its promise (which is part of the database readiness
// chain of promises).
if (deferredOperation) {
deferredOperation.resolve();
return deferredOperation.promise;
}
}
function _rejectReadiness(dbInfo, err) {
const dbContext = dbContexts[dbInfo.name];
// Dequeue a deferred operation.
const deferredOperation = dbContext.deferredOperations.pop();
// Reject its promise (which is part of the database readiness
// chain of promises).
if (deferredOperation) {
deferredOperation.reject(err);
return deferredOperation.promise;
}
}
function _getConnection(dbInfo, upgradeNeeded) {
return new Promise(function (resolve, reject) {
dbContexts[dbInfo.name] = dbContexts[dbInfo.name] ||
createDbContext();
if (dbInfo.db) {
if (upgradeNeeded) {
_deferReadiness(dbInfo);
dbInfo.db.close();
}
else {
return resolve(dbInfo.db);
}
}
const dbArgs = [dbInfo.name];
if (upgradeNeeded) {
dbArgs.push(String(dbInfo.version));
}
const openReq = indexedDB.open.apply(indexedDB, dbArgs);
if (upgradeNeeded) {
openReq.onupgradeneeded = (e) => {
const db = openReq.result;
try {
db.createObjectStore(dbInfo.storeName);
}
catch (ex) {
if (ex.name === 'ConstraintError') {
console.warn('The database "' +
dbInfo.name +
'"' +
' has been upgraded from version ' +
e.oldVersion +
' to version ' +
e.newVersion +
', but the storage "' +
dbInfo.storeName +
'" already exists.');
}
else {
throw ex;
}
}
};
}
openReq.onerror = (e) => {
e.preventDefault();
reject(openReq.error);
};
openReq.onsuccess = () => {
resolve(openReq.result);
_advanceReadiness(dbInfo);
};
});
}
function _getOriginalConnection(dbInfo) {
return _getConnection(dbInfo, false);
}
function _getUpgradedConnection(dbInfo) {
return _getConnection(dbInfo, true);
}
function _isUpgradeNeeded(dbInfo, defaultVersion) {
if (!dbInfo.db) {
return true;
}
const isNewStore = !
dbInfo.db.objectStoreNames.contains(dbInfo.storeName);
const isDowngrade = dbInfo.version < dbInfo.db.version;
const isUpgrade = dbInfo.version > dbInfo.db.version;
if (isDowngrade) {
// If the version is not the default one
// then warn for impossible downgrade.
if (dbInfo.version !== defaultVersion) {
console.warn('The database "' +
dbInfo.name +
'"' +
" can't be downgraded from version " +
dbInfo.db.version +
' to version ' +
dbInfo.version +
'.');
}
// Align the versions to prevent errors.
dbInfo.version = dbInfo.db.version;
}
if (isUpgrade || isNewStore) {
// If the store is new then increment the version (if needed).
// This will trigger an "upgradeneeded" event which is required
// for creating a store.
if (isNewStore) {
const incVersion = dbInfo.db.version + 1;
if (incVersion > dbInfo.version) {
dbInfo.version = incVersion;
}
}
return true;
}
return false;
}
// Try to establish a new db connection to replace the
// current one which is broken (i.e. experiencing
// InvalidStateError while creating a transaction).
function _tryReconnect(dbInfo) {
_deferReadiness(dbInfo);
const dbContext = dbContexts[dbInfo.name];
dbInfo.db = null;
return _getOriginalConnection(dbInfo)
.then(db => {
dbInfo.db = db;
if (_isUpgradeNeeded(dbInfo)) {
// Reopen the database for upgrading.
return _getUpgradedConnection(dbInfo);
}
return db;
})
.then(db => {
// store the latest db reference
// in case the db was upgraded
dbInfo.db = dbContext.db = db;
})
.catch(err => {
_rejectReadiness(dbInfo, err);
throw err;
});
}
// FF doesn't like Promises (micro-tasks) and IDDB store operations,
// so we have to do it with callbacks
function createTransaction(dbInfo, mode, callback, retries) {
if (retries === undefined) {
retries = 1;
}
try {
const tx = dbInfo.db.transaction(dbInfo.storeName, mode);
callback(null, tx);
}
catch (err) {
if (retries > 0 &&
(!dbInfo.db ||
err.name === 'InvalidStateError' ||
err.name === 'NotFoundError')) {
Promise.resolve()
.then(() => {
if (!dbInfo.db ||
(err.name === 'NotFoundError' &&
!
dbInfo.db.objectStoreNames.contains(dbInfo.storeName) &&
dbInfo.version <= dbInfo.db.version)) {
// increase the db version, to create the new
ObjectStore
if (dbInfo.db) {
dbInfo.version = dbInfo.db.version + 1;
}
// Reopen the database for upgrading.
return _getUpgradedConnection(dbInfo);
}
})
.then(() => {
return _tryReconnect(dbInfo).then(function () {
createTransaction(dbInfo, mode, callback, retries -
1);
});
})
.catch(callback);
}
callback(err);
}
}
function normalizeKey(key) {
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(`${key} used as a key, but it is not a string.`);
key = String(key);
}
return key;
}
function convertDbValue(value) {
if (value instanceof ArrayBuffer) {
const uint8Array = new Uint8Array(value);
// @ts-ignore
return utf8.decode(String.fromCharCode.apply(null,
uint8Array));
}
if (typeof value === 'string') {
return value;
}
throw new TypeError('Unknown value format');
}
/**
* Error thrown when the value loaded from persistent storage cannot be
* parsed as a {@link IKeyEntry} object.
*/
class InvalidKeyEntryError extends VirgilError {
constructor(message = 'Loaded key entry was in invalid format.') {
super(message, 'InvalidKeyEntryError', InvalidKeyEntryError);
}
}
/**
* Error thrown from {@link KeyEntryStorage.save} method when saving a
* a key entry with the name that already exists in store.
*/
class KeyEntryAlreadyExistsError extends VirgilError {
constructor(name) {
super(`Key entry ${name ? 'named ' + name : 'with same
name'}already exists`, 'KeyEntryAlreadyExistsError', KeyEntryAlreadyExistsError);
}
}
/**
* Error thrown from {@link KeyEntryStorage.update} method when
updating
* a key entry that doesn't exist in store.
*/
class KeyEntryDoesNotExistError extends VirgilError {
constructor(name) {
super(`Key entry ${name ? 'named ' + name : 'with the given
name'} does not exist.`, 'KeyEntryDoesNotExistError', KeyEntryDoesNotExistError);
}
}
const DEFAULTS$2 = {
dir: '.virgil_key_entries',
name: 'VirgilKeyEntries'
};
const CREATION_DATE_KEY = 'creationDate';
const MODIFICATION_DATE_KEY = 'modificationDate';
/**
* Class responsible for persisting private key bytes with optional
* user-defined metadata.
*/
class KeyEntryStorage {
/**
* Initializes a new instance of `KeyEntryStorage`.
*
* @param {IKeyEntryStorageConfig} config - Instance configuration.
*/
constructor(config = {}) {
this.adapter = resolveAdapter$1(config);
}
/**
* @inheritDoc
*/
exists(name) {
validateName$1(name);
return this.adapter.exists(name);
}
/**
* @inheritDoc
*/
load(name) {
validateName$1(name);
return this.adapter.load(name).then(data => {
if (data == null) {
return null;
}
return deserializeKeyEntry(data);
});
}
/**
* @inheritDoc
*/
remove(name) {
validateName$1(name);
return this.adapter.remove(name);
}
/**
* @inheritDoc
*/
save({ name, value, meta }) {
validateNameProperty(name);
validateValueProperty(value);
const keyEntry = {
name: name,
value: value,
meta: meta,
creationDate: new Date(),
modificationDate: new Date()
};
return this.adapter.store(name, serializeKeyEntry(keyEntry))
.then(() => keyEntry)
.catch(error => {
if (error && error.name ===
'StorageEntryAlreadyExistsError') {
throw new KeyEntryAlreadyExistsError(name);
}
throw error;
});
}
/**
* @inheritDoc
*/
list() {
return this.adapter.list()
.then(entries => entries.map(entry =>
deserializeKeyEntry(entry)));
}
/**
* @inheritDoc
*/
update({ name, value, meta }) {
validateNameProperty(name);
if (!(value || meta)) {
throw new TypeError('Invalid argument. Either `value` or
`meta` property is required.');
}
return this.adapter.load(name)
.then(data => {
if (data === null) {
throw new KeyEntryDoesNotExistError(name);
}
const entry = deserializeKeyEntry(data);
const updatedEntry = Object.assign(entry, {
value: value || entry.value,
meta: meta || entry.meta,
modificationDate: new Date()
});
return this.adapter.update(name,
serializeKeyEntry(updatedEntry))
.then(() => updatedEntry);
});
}
/**
* @inheritDoc
*/
clear() {
return this.adapter.clear();
}
}
function serializeKeyEntry(keyEntry) {
return JSON.stringify(keyEntry);
}
function deserializeKeyEntry(data) {
try {
return JSON.parse(data, (key, value) => {
if (key === CREATION_DATE_KEY || key ===
MODIFICATION_DATE_KEY) {
return new Date(value);
}
return value;
});
}
catch (error) {
throw new InvalidKeyEntryError();
}
}
function resolveAdapter$1(config) {
if (typeof config === 'string') {
return new IndexedDbStorageAdapter({ dir: config, name:
config });
}
const { adapter } = config, rest = __rest(config, ["adapter"]);
if (adapter != null) {
return adapter;
}
return new IndexedDbStorageAdapter(Object.assign(Object.assign({},
DEFAULTS$2), rest));
}
const requiredArg = (name) => (value) => {
if (!value)
throw new TypeError(`Argument '${name}' is required.`);
};
const requiredProp = (name) => (value) => {
if (!value)
throw new TypeError(`Invalid argument. Property ${name} is
required`);
};
const validateName$1 = requiredArg('name');
const validateNameProperty = requiredProp('name');
const validateValueProperty = requiredProp('value');
/*global toString:true*/
/**
* Determine if a value is an Array
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Array, otherwise false
*/
function isArray(val) {
return toString.call(val) === '[object Array]';
}
/**
* Determine if a value is undefined
*
* @param {Object} val The value to test
* @returns {boolean} True if the value is undefined, otherwise false
*/
function isUndefined(val) {
return typeof val === 'undefined';
}
/**
* Determine if a value is a Buffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Buffer, otherwise false
*/
function isBuffer(val) {
return val !== null && !isUndefined(val) && val.constructor !== null
&& !isUndefined(val.constructor)
&& typeof val.constructor.isBuffer === 'function' &&
val.constructor.isBuffer(val);
}
/**
* Determine if a value is an ArrayBuffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
*/
function isArrayBuffer(val) {
return toString.call(val) === '[object ArrayBuffer]';
}
/**
* Determine if a value is a FormData
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an FormData, otherwise false
*/
function isFormData(val) {
return (typeof FormData !== 'undefined') && (val instanceof
FormData);
}
/**
* Determine if a value is a view on an ArrayBuffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a view on an ArrayBuffer,
otherwise false
*/
function isArrayBufferView(val) {
var result;
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
result = ArrayBuffer.isView(val);
} else {
result = (val) && (val.buffer) && (val.buffer instanceof
ArrayBuffer);
}
return result;
}
/**
* Determine if a value is a String
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a String, otherwise false
*/
function isString(val) {
return typeof val === 'string';
}
/**
* Determine if a value is a Number
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Number, otherwise false
*/
function isNumber(val) {
return typeof val === 'number';
}
/**
* Determine if a value is an Object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Object, otherwise false
*/
function isObject(val) {
return val !== null && typeof val === 'object';
}
/**
* Determine if a value is a plain Object
*
* @param {Object} val The value to test
* @return {boolean} True if value is a plain Object, otherwise false
*/
function isPlainObject(val) {
if (toString.call(val) !== '[object Object]') {
return false;
}
/**
* Determine if a value is a Date
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Date, otherwise false
*/
function isDate(val) {
return toString.call(val) === '[object Date]';
}
/**
* Determine if a value is a File
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a File, otherwise false
*/
function isFile(val) {
return toString.call(val) === '[object File]';
}
/**
* Determine if a value is a Blob
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Blob, otherwise false
*/
function isBlob(val) {
return toString.call(val) === '[object Blob]';
}
/**
* Determine if a value is a Function
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Function, otherwise false
*/
function isFunction(val) {
return toString.call(val) === '[object Function]';
}
/**
* Determine if a value is a Stream
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Stream, otherwise false
*/
function isStream(val) {
return isObject(val) && isFunction(val.pipe);
}
/**
* Determine if a value is a URLSearchParams object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a URLSearchParams object,
otherwise false
*/
function isURLSearchParams(val) {
return typeof URLSearchParams !== 'undefined' && val instanceof
URLSearchParams;
}
/**
* Trim excess whitespace off the beginning and end of a string
*
* @param {String} str The String to trim
* @returns {String} The String freed of excess whitespace
*/
function trim(str) {
return str.replace(/^\s*/, '').replace(/\s*$/, '');
}
/**
* Determine if we're running in a standard browser environment
*
* This allows axios to run in a web worker, and react-native.
* Both environments support XMLHttpRequest, but not fully standard
globals.
*
* web workers:
* typeof window -> undefined
* typeof document -> undefined
*
* react-native:
* navigator.product -> 'ReactNative'
* nativescript
* navigator.product -> 'NativeScript' or 'NS'
*/
function isStandardBrowserEnv() {
if (typeof navigator !== 'undefined' && (navigator.product ===
'ReactNative' ||
navigator.product ===
'NativeScript' ||
navigator.product === 'NS'))
{
return false;
}
return (
typeof window !== 'undefined' &&
typeof document !== 'undefined'
);
}
/**
* Iterate over an Array or an Object invoking a function for each
item.
*
* If `obj` is an Array callback will be called passing
* the value, index, and complete array for each item.
*
* If 'obj' is an Object callback will be called passing
* the value, key, and complete object for each property.
*
* @param {Object|Array} obj The object to iterate
* @param {Function} fn The callback to invoke for each item
*/
function forEach(obj, fn) {
// Don't bother if no value provided
if (obj === null || typeof obj === 'undefined') {
return;
}
if (isArray(obj)) {
// Iterate over array values
for (var i = 0, l = obj.length; i < l; i++) {
fn.call(null, obj[i], i, obj);
}
} else {
// Iterate over object keys
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
fn.call(null, obj[key], key, obj);
}
}
}
}
/**
* Accepts varargs expecting each argument to be an object, then
* immutably merges the properties of each object and returns result.
*
* When multiple objects contain the same key the later object in
* the arguments list will take precedence.
*
* Example:
*
* ```js
* var result = merge({foo: 123}, {foo: 456});
* console.log(result.foo); // outputs 456
* ```
*
* @param {Object} obj1 Object to merge
* @returns {Object} Result of all merge properties
*/
function merge(/* obj1, obj2, obj3, ... */) {
var result = {};
function assignValue(val, key) {
if (isPlainObject(result[key]) && isPlainObject(val)) {
result[key] = merge(result[key], val);
} else if (isPlainObject(val)) {
result[key] = merge({}, val);
} else if (isArray(val)) {
result[key] = val.slice();
} else {
result[key] = val;
}
}
/**
* Extends object a by mutably adding to it the properties of object b.
*
* @param {Object} a The object to be extended
* @param {Object} b The object to copy properties from
* @param {Object} thisArg The object to bind function to
* @return {Object} The resulting value of object a
*/
function extend(a, b, thisArg) {
forEach(b, function assignValue(val, key) {
if (thisArg && typeof val === 'function') {
a[key] = bind(val, thisArg);
} else {
a[key] = val;
}
});
return a;
}
/**
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
*
* @param {string} content with BOM
* @return {string} content value without BOM
*/
function stripBOM(content) {
if (content.charCodeAt(0) === 0xFEFF) {
content = content.slice(1);
}
return content;
}
var utils = {
isArray: isArray,
isArrayBuffer: isArrayBuffer,
isBuffer: isBuffer,
isFormData: isFormData,
isArrayBufferView: isArrayBufferView,
isString: isString,
isNumber: isNumber,
isObject: isObject,
isPlainObject: isPlainObject,
isUndefined: isUndefined,
isDate: isDate,
isFile: isFile,
isBlob: isBlob,
isFunction: isFunction,
isStream: isStream,
isURLSearchParams: isURLSearchParams,
isStandardBrowserEnv: isStandardBrowserEnv,
forEach: forEach,
merge: merge,
extend: extend,
trim: trim,
stripBOM: stripBOM
};
function encode(val) {
return encodeURIComponent(val).
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, '+').
replace(/%5B/gi, '[').
replace(/%5D/gi, ']');
}
/**
* Build a URL by appending params to the end
*
* @param {string} url The base of the url (e.g.,
http://www.google.com)
* @param {object} [params] The params to be appended
* @returns {string} The formatted url
*/
var buildURL = function buildURL(url, params, paramsSerializer) {
/*eslint no-param-reassign:0*/
if (!params) {
return url;
}
var serializedParams;
if (paramsSerializer) {
serializedParams = paramsSerializer(params);
} else if (utils.isURLSearchParams(params)) {
serializedParams = params.toString();
} else {
var parts = [];
if (utils.isArray(val)) {
key = key + '[]';
} else {
val = [val];
}
serializedParams = parts.join('&');
}
if (serializedParams) {
var hashmarkIndex = url.indexOf('#');
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
return url;
};
function InterceptorManager() {
this.handlers = [];
}
/**
* Add a new interceptor to the stack
*
* @param {Function} fulfilled The function to handle `then` for a
`Promise`
* @param {Function} rejected The function to handle `reject` for a
`Promise`
*
* @return {Number} An ID used to remove interceptor later
*/
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
this.handlers.push({
fulfilled: fulfilled,
rejected: rejected
});
return this.handlers.length - 1;
};
/**
* Remove an interceptor from the stack
*
* @param {Number} id The ID that was returned by `use`
*/
InterceptorManager.prototype.eject = function eject(id) {
if (this.handlers[id]) {
this.handlers[id] = null;
}
};
/**
* Iterate over all the registered interceptors
*
* This method is particularly useful for skipping over any
* interceptors that may have become `null` calling `eject`.
*
* @param {Function} fn The function to call for each interceptor
*/
InterceptorManager.prototype.forEach = function forEach(fn) {
utils.forEach(this.handlers, function forEachHandler(h) {
if (h !== null) {
fn(h);
}
});
};
/**
* Transform the data for a request or a response
*
* @param {Object|String} data The data to be transformed
* @param {Array} headers The headers for the request or response
* @param {Array|Function} fns A single function or Array of functions
* @returns {*} The resulting transformed data
*/
var transformData = function transformData(data, headers, fns) {
/*eslint no-param-reassign:0*/
utils.forEach(fns, function transform(fn) {
data = fn(data, headers);
});
return data;
};
/**
* Update an Error with the specified config, error code, and response.
*
* @param {Error} error The error to update.
* @param {Object} config The config.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
* @param {Object} [request] The request.
* @param {Object} [response] The response.
* @returns {Error} The error.
*/
var enhanceError = function enhanceError(error, config, code, request,
response) {
error.config = config;
if (code) {
error.code = code;
}
error.request = request;
error.response = response;
error.isAxiosError = true;
/**
* Create an Error with the specified message, config, error code,
request and response.
*
* @param {string} message The error message.
* @param {Object} config The config.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
* @param {Object} [request] The request.
* @param {Object} [response] The response.
* @returns {Error} The created error.
*/
var createError = function createError(message, config, code, request,
response) {
var error = new Error(message);
return enhanceError(error, config, code, request, response);
};
/**
* Resolve or reject a Promise based on response status.
*
* @param {Function} resolve A function that resolves the promise.
* @param {Function} reject A function that rejects the promise.
* @param {object} response The response.
*/
var settle = function settle(resolve, reject, response) {
var validateStatus = response.config.validateStatus;
if (!response.status || !validateStatus ||
validateStatus(response.status)) {
resolve(response);
} else {
reject(createError(
'Request failed with status code ' + response.status,
response.config,
null,
response.request,
response
));
}
};
var cookies = (
utils.isStandardBrowserEnv() ?
if (utils.isNumber(expires)) {
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils.isString(path)) {
cookie.push('path=' + path);
}
if (utils.isString(domain)) {
cookie.push('domain=' + domain);
}
/**
* Determines whether the specified URL is absolute
*
* @param {string} url The URL to test
* @returns {boolean} True if the specified URL is absolute, otherwise
false
*/
var isAbsoluteURL = function isAbsoluteURL(url) {
// A URL is considered absolute if it begins with "<scheme>://" or
"//" (protocol-relative URL).
// RFC 3986 defines scheme name as a sequence of characters beginning
with a letter and followed
// by any combination of letters, digits, plus, period, or hyphen.
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
};
/**
* Creates a new URL by combining the specified URLs
*
* @param {string} baseURL The base URL
* @param {string} relativeURL The relative URL
* @returns {string} The combined URL
*/
var combineURLs = function combineURLs(baseURL, relativeURL) {
return relativeURL
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/,
'')
: baseURL;
};
/**
* Creates a new URL by combining the baseURL with the requestedURL,
* only when the requestedURL is not already an absolute URL.
* If the requestURL is absolute, this function returns the
requestedURL untouched.
*
* @param {string} baseURL The base URL
* @param {string} requestedURL Absolute or relative URL to combine
* @returns {string} The combined full path
*/
var buildFullPath = function buildFullPath(baseURL, requestedURL) {
if (baseURL && !isAbsoluteURL(requestedURL)) {
return combineURLs(baseURL, requestedURL);
}
return requestedURL;
};
/**
* Parse headers into an object
*
* ```
* Date: Wed, 27 Aug 2014 08:58:49 GMT
* Content-Type: application/json
* Connection: keep-alive
* Transfer-Encoding: chunked
* ```
*
* @param {String} headers Headers needing to be parsed
* @returns {Object} Headers parsed into an object
*/
var parseHeaders = function parseHeaders(headers) {
var parsed = {};
var key;
var val;
var i;
if (key) {
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
return;
}
if (key === 'set-cookie') {
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
} else {
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
}
}
});
return parsed;
};
var isURLSameOrigin = (
utils.isStandardBrowserEnv() ?
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
(function standardBrowserEnv() {
var msie = /(msie|trident)/i.test(navigator.userAgent);
var urlParsingNode = document.createElement('a');
var originURL;
/**
* Parse a URL to discover it's components
*
* @param {String} url The URL to be parsed
* @returns {Object}
*/
function resolveURL(url) {
var href = url;
if (msie) {
// IE needs attribute set twice to normalize properties
urlParsingNode.setAttribute('href', href);
href = urlParsingNode.href;
}
urlParsingNode.setAttribute('href', href);
originURL = resolveURL(window.location.href);
/**
* Determine if a URL shares the same origin as the current location
*
* @param {String} requestURL The URL to test
* @returns {boolean} True if URL shares the same origin, otherwise
false
*/
return function isURLSameOrigin(requestURL) {
var parsed = (utils.isString(requestURL)) ?
resolveURL(requestURL) : requestURL;
return (parsed.protocol === originURL.protocol &&
parsed.host === originURL.host);
};
})() :
if (utils.isFormData(requestData)) {
delete requestHeaders['Content-Type']; // Let the browser set it
}
var request = new XMLHttpRequest();
// Clean up request
request = null;
};
// Clean up request
request = null;
};
// Clean up request
request = null;
};
// Handle timeout
request.ontimeout = function handleTimeout() {
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms
exceeded';
if (config.timeoutErrorMessage) {
timeoutErrorMessage = config.timeoutErrorMessage;
}
reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
request));
// Clean up request
request = null;
};
if (xsrfValue) {
requestHeaders[config.xsrfHeaderName] = xsrfValue;
}
}
if (config.cancelToken) {
// Handle cancellation
config.cancelToken.promise.then(function onCanceled(cancel) {
if (!request) {
return;
}
request.abort();
reject(cancel);
// Clean up request
request = null;
});
}
if (!requestData) {
requestData = null;
}
var DEFAULT_CONTENT_TYPE = {
'Content-Type': 'application/x-www-form-urlencoded'
};
function getDefaultAdapter() {
var adapter;
if (typeof XMLHttpRequest !== 'undefined') {
// For browsers use XHR adapter
adapter = xhr;
} else if (typeof process !== 'undefined' &&
Object.prototype.toString.call(process) === '[object process]') {
// For node use HTTP adapter
adapter = xhr;
}
return adapter;
}
var defaults = {
adapter: getDefaultAdapter(),
/**
* A timeout in milliseconds to abort a request. If set to 0
(default) a
* timeout is not created.
*/
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
defaults.headers = {
common: {
'Accept': 'application/json, text/plain, */*'
}
};
/**
* Throws a `Cancel` if cancellation has been requested.
*/
function throwIfCancellationRequested(config) {
if (config.cancelToken) {
config.cancelToken.throwIfRequested();
}
}
/**
* Dispatch a request to the server using the configured adapter.
*
* @param {object} config The config that is to be used for the request
* @returns {Promise} The Promise to be fulfilled
*/
var dispatchRequest = function dispatchRequest(config) {
throwIfCancellationRequested(config);
// Flatten headers
config.headers = utils.merge(
config.headers.common || {},
config.headers[config.method] || {},
config.headers
);
utils.forEach(
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
function cleanHeaderConfig(method) {
delete config.headers[method];
}
);
return response;
}, function onAdapterRejection(reason) {
if (!isCancel(reason)) {
throwIfCancellationRequested(config);
return Promise.reject(reason);
});
};
/**
* Config-specific merge-function which creates a new config-object
* by merging two configuration objects together.
*
* @param {Object} config1
* @param {Object} config2
* @returns {Object} New object resulting from merging config2 to
config1
*/
var mergeConfig = function mergeConfig(config1, config2) {
// eslint-disable-next-line no-param-reassign
config2 = config2 || {};
var config = {};
function mergeDeepProperties(prop) {
if (!utils.isUndefined(config2[prop])) {
config[prop] = getMergedValue(config1[prop], config2[prop]);
} else if (!utils.isUndefined(config1[prop])) {
config[prop] = getMergedValue(undefined, config1[prop]);
}
}
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
utils.forEach(otherKeys, mergeDeepProperties);
return config;
};
/**
* Create a new instance of Axios
*
* @param {Object} instanceConfig The default config for the instance
*/
function Axios(instanceConfig) {
this.defaults = instanceConfig;
this.interceptors = {
request: new InterceptorManager_1(),
response: new InterceptorManager_1()
};
}
/**
* Dispatch a request
*
* @param {Object} config The config specific for this request (merged
with this.defaults)
*/
Axios.prototype.request = function request(config) {
/*eslint no-param-reassign:0*/
// Allow for axios('example/url'[, config]) a la fetch API
if (typeof config === 'string') {
config = arguments[1] || {};
config.url = arguments[0];
} else {
config = config || {};
}
this.interceptors.request.forEach(function
unshiftRequestInterceptors(interceptor) {
chain.unshift(interceptor.fulfilled, interceptor.rejected);
});
this.interceptors.response.forEach(function
pushResponseInterceptors(interceptor) {
chain.push(interceptor.fulfilled, interceptor.rejected);
});
while (chain.length) {
promise = promise.then(chain.shift(), chain.shift());
}
return promise;
};
/**
* A `Cancel` is an object that is thrown when an operation is
canceled.
*
* @class
* @param {string=} message The message.
*/
function Cancel(message) {
this.message = message;
}
Cancel.prototype.__CANCEL__ = true;
/**
* A `CancelToken` is an object that can be used to request
cancellation of an operation.
*
* @class
* @param {Function} executor The executor function.
*/
function CancelToken(executor) {
if (typeof executor !== 'function') {
throw new TypeError('executor must be a function.');
}
var resolvePromise;
this.promise = new Promise(function promiseExecutor(resolve) {
resolvePromise = resolve;
});
/**
* Throws a `Cancel` if cancellation has been requested.
*/
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
if (this.reason) {
throw this.reason;
}
};
/**
* Returns an object that contains a new `CancelToken` and a function
that, when called,
* cancels the `CancelToken`.
*/
CancelToken.source = function source() {
var cancel;
var token = new CancelToken(function executor(c) {
cancel = c;
});
return {
token: token,
cancel: cancel
};
};
/**
* Syntactic sugar for invoking a function and expanding an array for
arguments.
*
* Common use case would be to use `Function.prototype.apply`.
*
* ```js
* function f(x, y, z) {}
* var args = [1, 2, 3];
* f.apply(null, args);
* ```
*
* With `spread` this example can be re-written.
*
* ```js
* spread(function(x, y, z) {})([1, 2, 3]);
* ```
*
* @param {Function} callback
* @returns {Function}
*/
var spread = function spread(callback) {
return function wrap(arr) {
return callback.apply(null, arr);
};
};
/**
* Determines whether the payload is an error thrown by Axios
*
* @param {*} payload The value to test
* @returns {boolean} True if the payload is an error thrown by Axios,
otherwise false
*/
var isAxiosError = function isAxiosError(payload) {
return (typeof payload === 'object') && (payload.isAxiosError ===
true);
};
/**
* Create an instance of Axios
*
* @param {Object} defaultConfig The default config for the instance
* @return {Axios} A new instance of Axios
*/
function createInstance(defaultConfig) {
var context = new Axios_1(defaultConfig);
var instance = bind(Axios_1.prototype.request, context);
return instance;
}
// Expose all/spread
axios.all = function all(promises) {
return Promise.all(promises);
};
axios.spread = spread;
// Expose isAxiosError
axios.isAxiosError = isAxiosError;
/*--------------------------------------------------------------------------
*/
var TABLE =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// http://whatwg.org/html/common-microsyntaxes.html#space-
character
var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g;
if (padding == 2) {
a = input.charCodeAt(position) << 8;
b = input.charCodeAt(++position);
buffer = a + b;
output += (
TABLE.charAt(buffer >> 10) +
TABLE.charAt((buffer >> 4) & 0x3F) +
TABLE.charAt((buffer << 2) & 0x3F) +
'='
);
} else if (padding == 1) {
buffer = input.charCodeAt(position);
output += (
TABLE.charAt(buffer >> 2) +
TABLE.charAt((buffer << 4) & 0x3F) +
'=='
);
}
return output;
};
var base64 = {
'encode': encode,
'decode': decode,
'version': '0.1.0'
};
}(commonjsGlobal$1));
});
/*!
*****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use
this file except in compliance with the License. You may obtain a copy
of the
License at http://www.apache.org/licenses/LICENSE-2.0
See the Apache Version 2.0 License for specific language governing
permissions
and limitations under the License.
*****************************************************************************
*/function r(e,t){var i={};for(var r in
e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!
=e&&"function"==typeof Object.getOwnPropertySymbols){var
n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n+
+)t.indexOf(r[n])<0&&(i[r[n]]=e[r[n]]);}return i}function n(e,t,i,r){return new(i||
(i=Promise))((function(n,s){function o(e){try{y(r.next(e));}catch(e)
{s(e);}}function a(e){try{y(r.throw(e));}catch(e){s(e);}}function y(e){e.done?
n(e.value):new i((function(t){t(e.value);})).then(o,a);}y((r=r.apply(e,t||
[])).next());}))}class s extends Error{constructor(e,t="KeyknoxError",i=s)
{super(e),Object.setPrototypeOf(this,i.prototype),this.name=t;}}class o extends
s{constructor(e,t,i)
{super(e,"KeyknoxClientError",o),this.status=t,this.code=i;}}class a extends
s{constructor(){super("CloudKeyStorage is out of
sync","CloudKeyStorageOutOfSyncError",a);}}class y extends s{constructor(e)
{super(`Cloud entry '${e}' already
exists`,"CloudEntryExistsError",y),this.cloudEntryName=e;}}class c extends
s{constructor(e){super(`Cloud entry '${e}' doesn't
exist`,"CloudEntryDoesntExistError",c),this.cloudEntryName=e;}}class u extends
s{constructor(){super("GroupSessionMessageInfo already
exist","GroupTicketAlreadyExistsError",u);}}class l extends s{constructor()
{super("Group ticket doesn't exist","GroupTicketDoesntExistError",l);}}class v
extends s{constructor(){super("Current user has no access to the group
ticket","GroupTicketNoAccessError",v);}}class p{constructor(i,r,n,s)
{this.accessTokenProvider=i,this.axios=n||axios$1.create({baseURL:r||
p.API_URL}),this.virgilAgent=s||new
VirgilAgent("keyknox","1.0.3"),this.axios.interceptors.response.use(void
0,p.responseErrorHandler);}v1Push(e,t,i){return n(this,void 0,void 0,(function*()
{const r={meta:e,value:t},n=yield
this.accessTokenProvider.getToken({service:"keyknox",operation:"put"}),s={headers:p
.getHeaders({accessToken:n,keyknoxHash:i,virgilAgent:this.virgilAgent})},o=yield
this.axios.put("/keyknox/v1",r,s);return p.getKeyknoxValueV1(o)}))}v1Pull(){return
n(this,void 0,void 0,(function*(){const e=yield
this.accessTokenProvider.getToken({service:"keyknox",operation:"get"}),t={headers:p
.getHeaders({accessToken:e,virgilAgent:this.virgilAgent})},i=yield
this.axios.get("/keyknox/v1",t);return p.getKeyknoxValueV1(i)}))}v1Reset(){return
n(this,void 0,void 0,(function*(){const e=yield
this.accessTokenProvider.getToken({service:"keyknox",operation:"delete"}),t={header
s:p.getHeaders({accessToken:e,virgilAgent:this.virgilAgent})},i=yield
this.axios.post("/keyknox/v1/reset",void 0,t);return
p.getKeyknoxValueV1(i)}))}v2Push(e){return n(this,void 0,void 0,(function*()
{const{root:t,path:i,key:r,identities:n,meta:s,value:o,keyknoxHash:a}=e,y={root:t,p
ath:i,key:r,identities:n,meta:s,value:o},c=yield
this.accessTokenProvider.getToken({service:"keyknox",operation:"put"}),d={headers:p
.getHeaders({accessToken:c,keyknoxHash:a,virgilAgent:this.virgilAgent})},h=yield
this.axios.post("/keyknox/v2/push",y,d);return p.getKeyknoxValueV2(h)}))}v2Pull(e)
{return n(this,void 0,void 0,(function*()
{const{root:t,path:i,key:r,identity:n}=e,s={root:t,path:i,key:r,identity:n},o=yield
this.accessTokenProvider.getToken({service:"keyknox",operation:"get"}),a={headers:p
.getHeaders({accessToken:o,virgilAgent:this.virgilAgent})},y=yield
this.axios.post("/keyknox/v2/pull",s,a);return
p.getKeyknoxValueV2(y)}))}v2GetKeys(e){return n(this,void 0,void 0,(function*()
{const{root:t,path:i,identity:r}=e,n={root:t,path:i,identity:r},s=yield
this.accessTokenProvider.getToken({service:"keyknox",operation:"get"}),o={headers:p
.getHeaders({accessToken:s,virgilAgent:this.virgilAgent})};return (yield
this.axios.post("/keyknox/v2/keys",n,o)).data}))}v2Reset(e){return n(this,void
0,void 0,(function*()
{const{root:t,path:i,key:r,identity:n}=e,s={root:t,path:i,key:r,identity:n},o=yield
this.accessTokenProvider.getToken({service:"keyknox",operation:"delete"}),a={header
s:p.getHeaders({accessToken:o,virgilAgent:this.virgilAgent})},y=yield
this.axios.post("/keyknox/v2/reset",s,a);return p.getKeyknoxValueV2(y)}))}static
getKeyknoxValueV1(e){const{data:t,headers:i}=e;return
{meta:t.meta,value:t.value,version:t.version,keyknoxHash:i["virgil-keyknox-
hash"]}}static getKeyknoxValueV2(e){const{data:t,headers:i}=e;return
{owner:t.owner,root:t.root,path:t.path,key:t.key,identities:t.identities,meta:t.met
a,value:t.value,keyknoxHash:i["virgil-keyknox-hash"]}}static getHeaders(e)
{const{virgilAgent:t,accessToken:i,keyknoxHash:r}=e,n={"Virgil-
Agent":t.value};return i&&(n.Authorization="Virgil "+i.toString()),r&&(n["Virgil-
Keyknox-Previous-Hash"]=r),n}static responseErrorHandler(e)
{const{response:t}=e;if(t){const{data:i}=t;return i&&i.code&&i.message?
Promise.reject(new o(i.message,t.status,i.code)):Promise.reject(new
o(e.message,t.status))}return Promise.reject(new
o(e.message))}}p.API_URL="https://api.virgilsecurity.com";class k{constructor(e)
{this.crypto=e;}decrypt(e,t,i,r){if(!t||!e){if(t||e)throw new TypeError("'metadata'
or 'encryptedData' is empty");return t}return
this.crypto.decryptThenVerifyDetached({value:t,encoding:"base64"},
{value:e,encoding:"base64"},i,r).toString("base64")}encrypt(e,t,i)
{const{metadata:r,encryptedData:n}=this.crypto.signThenEncryptDetached({value:e,enc
oding:"base64"},t,i);return
{metadata:r.toString("base64"),encryptedData:n.toString("base64")}}}class
g{constructor(e,t){this.myKeyknoxCrypto=e,this.keyknoxClient=t;}get keyknoxCrypto()
{return this.myKeyknoxCrypto}static create(e,t){const i=new p(e);return new
g(t,i)}v1Push(e,t,i,r){return n(this,void 0,void 0,(function*()
{const{metadata:n,encryptedData:s}=this.myKeyknoxCrypto.encrypt(e,t,i),o=yield
this.keyknoxClient.v1Push(n,s,r);return this.v1Decrypt(o,t,i)}))}v1Pull(e,t){return
n(this,void 0,void 0,(function*(){const i=yield this.keyknoxClient.v1Pull();return
this.v1Decrypt(i,e,t)}))}v1Reset(){return n(this,void 0,void 0,(function*(){return
this.keyknoxClient.v1Reset()}))}v1Update(e){return n(this,void 0,void 0,
(function*()
{const{value:t,privateKey:i,publicKeys:r,keyknoxHash:n,newPrivateKey:s,newPublicKey
s:o}=e;if(!s&&!o)return this.v1Push(t,i,r,n);const a=yield this.v1Pull(i,r),y=s||
i,c=o||r,
{metadata:d,encryptedData:h}=this.myKeyknoxCrypto.encrypt(a.value,y,c),u=yield
this.keyknoxClient.v1Push(d,h,a.keyknoxHash);return
this.v1Decrypt(u,y,c)}))}v1UpdateRecipients(e){return n(this,void 0,void 0,
(function*()
{const{privateKey:t,publicKeys:i,newPrivateKey:r,newPublicKeys:n}=e,s=yield
this.v1Pull(t,i);if(!s.meta&&!s.value)return s;const o=r||t,a=n||i,
{metadata:y,encryptedData:c}=this.myKeyknoxCrypto.encrypt(s.value,o,a),d=yield
this.keyknoxClient.v1Push(y,c,s.keyknoxHash);return
this.v1Decrypt(d,o,a)}))}v2Push(e){return n(this,void 0,void 0,(function*()
{const{value:t,privateKey:i,publicKeys:n}=e,s=r(e,
["value","privateKey","publicKeys"]),
{metadata:o,encryptedData:a}=this.encrypt(t,i,n),y=yield
this.keyknoxClient.v2Push(Object.assign(Object.assign({},s),
{value:a,meta:o}));return this.v2Decrypt(y,i,n)}))}v2Pull(e){return n(this,void
0,void 0,(function*(){const{privateKey:t,publicKeys:i}=e,n=r(e,
["privateKey","publicKeys"]),s=yield this.keyknoxClient.v2Pull(n);return
this.v2Decrypt(s,t,i)}))}v2GetKeys(e){return n(this,void 0,void 0,(function*()
{return this.keyknoxClient.v2GetKeys(e)}))}v2Reset(e){return n(this,void 0,void 0,
(function*(){return this.keyknoxClient.v2Reset(e)}))}v1Decrypt(e,t,i)
{const{meta:n,value:s}=e,o=r(e,
["meta","value"]),a=this.myKeyknoxCrypto.decrypt(n,s,t,i);return
Object.assign(Object.assign({},o),{meta:n,value:a})}v2Decrypt(e,t,i)
{const{meta:n,value:s}=e,o=r(e,
["meta","value"]),a=this.myKeyknoxCrypto.decrypt(n,s,t,i);return
Object.assign(Object.assign({},o),{meta:n,value:a})}encrypt(e,t,i){return
this.myKeyknoxCrypto.encrypt(e,t,i)}}class m{constructor(e)
{const{keyknoxManager:t,identity:i,privateKey:r,publicKey:n,root:s}=e;this.keyknoxM
anager=t,this.identity=i,this.privateKey=r,this.publicKey=n,this.root=s||
m.DEFAULT_ROOT;}static create(e)
{const{accessTokenProvider:t,identity:i,privateKey:r,publicKey:n,virgilCrypto:s,roo
t:o}=e,a=g.create(t,new k(s));return new
m({keyknoxManager:a,identity:i,privateKey:r,publicKey:n,root:o})}store(e,t){return
n(this,void 0,void 0,(function*(){const{epochNumber:i,sessionId:r,data:n}=e;let
s=[this.identity],a=[this.publicKey];if(t){const e=Array.isArray(t)?t:
[t];s=s.concat(e.map(e=>e.identity)),a=a.concat(e.map(e=>e.publicKey));}try{yield
this.keyknoxManager.v2Push({identities:s,publicKeys:a,privateKey:this.privateKey,ro
ot:this.root,path:r,key:i.toString(),value:n});}catch(e){if(e instanceof
o&&50010===e.code)throw new u;throw e}}))}retrieve(e,t,i){return n(this,void 0,void
0,(function*(){let r=this.identity,n=this.publicKey;if(t&&i)r=t,n=i;else
if(Boolean(t)!==Boolean(i))throw new Error("You need to provide both 'identity' and
'publicKey'");const s=yield
this.keyknoxManager.v2GetKeys({root:this.root,path:e,identity:r});if(!
s.length)throw new l;const
o=s.map(t=>this.keyknoxManager.v2Pull({root:this.root,path:e,key:t,identity:r,priva
teKey:this.privateKey,publicKeys:n}));try{const e=yield Promise.all(o);return
e.map(({key:e,path:t,identities:i,value:r})=>({identities:i,groupSessionMessageInfo
:{sessionId:t,epochNumber:Number(e),data:r}}))}catch(e){throw
m.throwIfRecipientIsNotFound(e),e}}))}addRecipients(e,t){return n(this,void 0,void
0,(function*(){const i=(yield
this.keyknoxManager.v2GetKeys({root:this.root,path:e,identity:this.identity})).map(
i=>n(this,void 0,void 0,(function*(){const r=yield
this.keyknoxManager.v2Pull({root:this.root,path:e,key:i,identity:this.identity,priv
ateKey:this.privateKey,publicKeys:this.publicKey});yield
this.keyknoxManager.v2Push(Object.assign(Object.assign({},r),
{identities:t.map(e=>e.identity),publicKeys:
[this.publicKey,...t.map(e=>e.publicKey)],privateKey:this.privateKey}));})));try{yi
eld Promise.all(i);}catch(e){throw
m.throwIfRecipientIsNotFound(e),e}}))}addRecipient(e,t){return n(this,void 0,void
0,(function*(){return this.addRecipients(e,[t])}))}reAddRecipient(e,t){return
n(this,void 0,void 0,(function*(){const i=(yield
this.keyknoxManager.v2GetKeys({root:this.root,path:e,identity:this.identity})).map(
i=>n(this,void 0,void 0,(function*(){const r=yield
this.keyknoxManager.v2Pull({root:this.root,path:e,key:i,identity:this.identity,priv
ateKey:this.privateKey,publicKeys:this.publicKey});yield
this.removeRecipient(e,t.identity,Number(i)),yield
this.keyknoxManager.v2Push({root:this.root,path:e,key:i,identities:
[t.identity],value:r.value,privateKey:this.privateKey,publicKeys:
[this.publicKey,t.publicKey],keyknoxHash:r.keyknoxHash});})));try{yield
Promise.all(i);}catch(e){throw
m.throwIfRecipientIsNotFound(e),e}}))}removeRecipient(e,t,i){return n(this,void
0,void 0,(function*(){yield
this.keyknoxManager.v2Reset({identity:t,root:this.root,path:e,key:"number"==typeof
i?i.toString():void 0});}))}delete(e){return n(this,void 0,void 0,(function*()
{return this.keyknoxManager.v2Reset({root:this.root,path:e})}))}static
throwIfRecipientIsNotFound(e){if("FoundationError"===e.name&&/recipient defined
with id is not found/gi.test(e.message))throw new v}}function K(e){const
t={};return
e.forEach((e,i)=>{t[i]={data:e.data,meta:e.meta,creation_date:Number(e.creationDate
),name:e.name,modification_date:Number(e.modificationDate)},null===t[i].meta&&delet
e t[i].meta;}),base64$1.encode(JSON.stringify(t))}function x(e){const
t=base64$1.decode(e);if(!t.length)return new Map;const r=JSON.parse(t);return
Object.keys(r).reduce((e,t)=>{const i=r[t];return e.set(t,
{name:i.name,data:i.data,creationDate:new
Date(i.creation_date),modificationDate:new Date(i.modification_date),meta:void
0===i.meta?null:i.meta}),e},new Map)}m.DEFAULT_ROOT="group-sessions";class
f{constructor(e,t,i){this.cache=new Map,this.syncWasCalled=!
1,this.keyknoxManager=e,this.privateKey=t,this.publicKeys=i;}static create(e)
{const{accessTokenProvider:t,privateKey:i,publicKeys:r,virgilCrypto:n}=e,s=g.create
(t,new k(n));return new f(s,i,r)}storeEntries(e){return n(this,void 0,void 0,
(function*(){return
this.throwUnlessSyncWasCalled(),e.forEach(e=>{this.throwIfCloudEntryExists(e.name),
this.cache.set(e.name,f.createCloudEntry(e));}),yield
this.pushCacheEntries(),e.map(e=>this.cache.get(e.name))}))}storeEntry(e,t,i)
{return n(this,void 0,void 0,(function*(){if("string"==typeof i){const r=i,n=yield
this.keyknoxManager.v2Pull({root:"e3kit",path:"backup",key:r,identity:e,privateKey:
this.privateKey,publicKeys:this.publicKeys}),s=f.createCloudEntry({name:r,data:t});
return x((yield
this.keyknoxManager.v2Push({root:"e3kit",path:"backup",key:r,identities:
[e],value:K(new
Map([[r,s]])),privateKey:this.privateKey,publicKeys:this.publicKeys,keyknoxHash:n.k
eyknoxHash})).value).values().next().value}{const[r]=yield
this.storeEntries([{name:e,data:t,meta:i}]);return r}}))}updateEntry(e,t,i){return
n(this,void 0,void 0,(function*()
{this.throwUnlessSyncWasCalled(),this.throwUnlessCloudEntryExists(e);const
r=f.createCloudEntry({name:e,data:t,meta:i},this.cache.get(e).creationDate);return
this.cache.set(e,r),yield this.pushCacheEntries(),r}))}retrieveEntry(e){return
this.throwUnlessSyncWasCalled(),this.throwUnlessCloudEntryExists(e),this.cache.get(
e)}fetchEntryByKey(e,t){return n(this,void 0,void 0,(function*(){return x((yield
this.keyknoxManager.v2Pull({root:"e3kit",path:"backup",key:t,identity:e,privateKey:
this.privateKey,publicKeys:this.publicKeys})).value).values().next().value}))}retri
eveAllEntries(){return
this.throwUnlessSyncWasCalled(),Array.from(this.cache.values())}existsEntry(e)
{return this.throwUnlessSyncWasCalled(),this.cache.has(e)}deleteEntry(e){return
n(this,void 0,void 0,(function*(){yield
this.deleteEntries([e]);}))}deleteEntries(e){return n(this,void 0,void 0,
(function*()
{this.throwUnlessSyncWasCalled(),e.forEach(e=>{this.throwUnlessCloudEntryExists(e),
this.cache.delete(e);}),yield this.pushCacheEntries();}))}deleteAllEntries(){return
n(this,void 0,void 0,(function*()
{this.cache.clear(),this.decryptedKeyknoxValue=yield
this.keyknoxManager.v1Reset();}))}updateRecipients(e){return n(this,void 0,void 0,
(function*()
{this.throwUnlessSyncWasCalled();const{newPrivateKey:t,newPublicKeys:i}=e;this.decr
yptedKeyknoxValue=yield
this.keyknoxManager.v1UpdateRecipients({newPrivateKey:t,newPublicKeys:i,privateKey:
this.privateKey,publicKeys:this.publicKeys}),this.privateKey=t||
this.privateKey,this.publicKeys=i||
this.publicKeys,this.cache=x(this.decryptedKeyknoxValue.value);}))}retrieveCloudEnt
ries(){return n(this,void 0,void 0,(function*(){this.decryptedKeyknoxValue=yield
this.keyknoxManager.v1Pull(this.privateKey,this.publicKeys),this.cache=x(this.decry
ptedKeyknoxValue.value),this.syncWasCalled=!0;}))}throwUnlessSyncWasCalled(){if(!
this.syncWasCalled)throw new a}throwUnlessCloudEntryExists(e){if(!
this.cache.has(e))throw new c(e)}throwIfCloudEntryExists(e)
{if(this.cache.has(e))throw new y(e)}pushCacheEntries(){return n(this,void 0,void
0,(function*(){const e=K(this.cache);this.decryptedKeyknoxValue=yield
this.keyknoxManager.v1Push(e,this.privateKey,this.publicKeys,this.decryptedKeyknoxV
alue.keyknoxHash),this.cache=x(this.decryptedKeyknoxValue.value);}))}static
createCloudEntry(e,t){const i=new Date;return {name:e.name,data:e.data,meta:void
0===e.meta?null:e.meta,creationDate:t||i,modificationDate:i}}}
var domain;
function EventEmitter() {
EventEmitter.init.call(this);
}
// nodejs oddity
// require('events') === require('events').EventEmitter
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.usingDomains = false;
EventEmitter.prototype.domain = undefined;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;
EventEmitter.init = function() {
this.domain = null;
if (EventEmitter.usingDomains) {
// if there is an active domain, then attach to it.
if (domain.active ) ;
}
function $getMaxListeners(that) {
if (that._maxListeners === undefined)
return EventEmitter.defaultMaxListeners;
return that._maxListeners;
}
events = this._events;
if (events)
doError = (doError && events.error == null);
else if (!doError)
return false;
domain = this.domain;
handler = events[type];
if (!handler)
return false;
return true;
};
events = target._events;
if (!events) {
events = target._events = new EventHandlers();
target._eventsCount = 0;
} else {
// To avoid recursion in the case that type === "newListener"!
Before
// adding it to the listeners, first emit "newListener".
if (events.newListener) {
target.emit('newListener', type,
listener.listener ? listener.listener : listener);
if (!existing) {
// Optimize the case of one listener. Don't need the extra array
object.
existing = events[type] = listener;
++target._eventsCount;
} else {
if (typeof existing === 'function') {
// Adding the second element, need to change to array.
existing = events[type] = prepend ? [listener, existing] :
[existing, listener];
} else {
// If we've already got an array, just append.
if (prepend) {
existing.unshift(listener);
} else {
existing.push(listener);
}
}
return target;
}
function emitWarning(e) {
typeof console.warn === 'function' ? console.warn(e) :
console.log(e);
}
EventEmitter.prototype.addListener = function addListener(type,
listener) {
return _addListener(this, type, listener, false);
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.prependListener =
function prependListener(type, listener) {
return _addListener(this, type, listener, true);
};
EventEmitter.prototype.prependOnceListener =
function prependOnceListener(type, listener) {
if (typeof listener !== 'function')
throw new TypeError('"listener" argument must be a function');
this.prependListener(type, _onceWrap(this, type, listener));
return this;
};
events = this._events;
if (!events)
return this;
list = events[type];
if (!list)
return this;
if (position < 0)
return this;
if (list.length === 1) {
list[0] = undefined;
if (--this._eventsCount === 0) {
this._events = new EventHandlers();
return this;
} else {
delete events[type];
}
} else {
spliceOne(list, position);
}
if (events.removeListener)
this.emit('removeListener', type, originalListener ||
listener);
}
return this;
};
EventEmitter.prototype.removeAllListeners =
function removeAllListeners(type) {
var listeners, events;
events = this._events;
if (!events)
return this;
listeners = events[type];
return this;
};
if (!events)
ret = [];
else {
evlistener = events[type];
if (!evlistener)
ret = [];
else if (typeof evlistener === 'function')
ret = [evlistener.listener || evlistener];
else
ret = unwrapListeners(evlistener);
}
return ret;
};
if (events) {
var evlistener = events[type];
return 0;
}
function arrayClone(arr, i) {
var copy = new Array(i);
while (i--)
copy[i] = arr[i];
return copy;
}
function unwrapListeners(arr) {
var ret = new Array(arr.length);
for (var i = 0; i < ret.length; ++i) {
ret[i] = arr[i].listener || arr[i];
}
return ret;
}
revLookup['-'.charCodeAt(0)] = 62;
revLookup['_'.charCodeAt(0)] = 63;
}
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
}
var L = 0;
for (i = 0, j = 0; i < l; i += 4, j += 3) {
tmp = (revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6)
| revLookup[b64.charCodeAt(i + 3)];
arr[L++] = (tmp >> 16) & 0xFF;
arr[L++] = (tmp >> 8) & 0xFF;
arr[L++] = tmp & 0xFF;
}
if (placeHolders === 2) {
tmp = (revLookup[b64.charCodeAt(i)] << 2) |
(revLookup[b64.charCodeAt(i + 1)] >> 4);
arr[L++] = tmp & 0xFF;
} else if (placeHolders === 1) {
tmp = (revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
arr[L++] = (tmp >> 8) & 0xFF;
arr[L++] = tmp & 0xFF;
}
return arr
}
// go through the array every three bytes, we'll deal with trailing
stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i +=
maxChunkLength) {
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2
: (i + maxChunkLength)));
}
// pad the end with zeros, but make sure to not forget the extra
bytes
if (extraBytes === 1) {
tmp = uint8[len - 1];
output += lookup[tmp >> 2];
output += lookup[(tmp << 4) & 0x3F];
output += '==';
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
output += lookup[tmp >> 10];
output += lookup[(tmp >> 4) & 0x3F];
output += lookup[(tmp << 2) & 0x3F];
output += '=';
}
parts.push(output);
return parts.join('')
}
i += d;
if (e === 0) {
e = 1 - eBias;
} else if (e === eMax) {
return m ? NaN : ((s ? -1 : 1) * Infinity)
} else {
m = m + Math.pow(2, mLen);
e = e - eBias;
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}
value = Math.abs(value);
e = (e << mLen) | m;
eLen += mLen;
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256,
eLen -= 8) {}
buffer[offset + i - d] |= s * 128;
}
/**
* If `Buffer.TYPED_ARRAY_SUPPORT`:
* === true Use Uint8Array implementation (fastest)
* === false Use Object implementation (most compatible, even IE6)
*
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome
7+, Safari 5.1+,
* Opera 11.6+, iOS 4.2+.
*
* Due to various browser bugs, sometimes the Object implementation
will be used even
* when the browser supports typed arrays.
*
* Note:
*
* - Firefox 4-29 lacks support for adding new properties to
`Uint8Array` instances,
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
*
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray`
function.
*
* - IE10 has a broken `TypedArray.prototype.subarray` function which
returns arrays of
* incorrect length in some situations.
/*
* Export kMaxLength after typed array support is determined.
*/
var _kMaxLength = kMaxLength();
function kMaxLength () {
return Buffer.TYPED_ARRAY_SUPPORT
? 0x7fffffff
: 0x3fffffff
}
return that
}
/**
* The Buffer constructor returns instances of `Uint8Array` that have
their
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a
subclass of
* `Uint8Array`, so the returned instances will have all the node
`Buffer` methods
* and the `Uint8Array` methods. Square bracket notation works as
expected -- it
* returns a single octet.
*
* The `Uint8Array` prototype remains unmodified.
*/
/**
* Functionally equivalent to Buffer(arg, encoding) but throws a
TypeError
* if value is a number.
* Buffer.from(str[, encoding])
* Buffer.from(array)
* Buffer.from(buffer)
* Buffer.from(arrayBuffer[, byteOffset[, length]])
**/
Buffer.from = function (value, encodingOrOffset, length) {
return from(null, value, encodingOrOffset, length)
};
if (Buffer.TYPED_ARRAY_SUPPORT) {
Buffer.prototype.__proto__ = Uint8Array.prototype;
Buffer.__proto__ = Uint8Array;
}
/**
* Creates a new filled Buffer instance.
* alloc(size[, fill[, encoding]])
**/
Buffer.alloc = function (size, fill, encoding) {
return alloc(null, size, fill, encoding)
};
/**
* Equivalent to Buffer(num), by default creates a non-zero-filled
Buffer instance.
* */
Buffer.allocUnsafe = function (size) {
return allocUnsafe(null, size)
};
/**
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled
Buffer instance.
*/
Buffer.allocUnsafeSlow = function (size) {
return allocUnsafe(null, size)
};
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('"encoding" must be a valid string encoding')
}
return that
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = array;
that.__proto__ = Buffer.prototype;
} else {
// Fallback: Return an object instance of the Buffer class
that = fromArrayLike(that, array);
}
return that
}
if (that.length === 0) {
return that
}
obj.copy(that, 0, 0, len);
return that
}
if (obj) {
if ((typeof ArrayBuffer !== 'undefined' &&
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
if (typeof obj.length !== 'number' || isnan(obj.length)) {
return createBuffer(that, 0)
}
return fromArrayLike(that, obj)
}
if (a === b) return 0
var x = a.length;
var y = b.length;
if (x < y) return -1
if (y < x) return 1
return 0
};
if (list.length === 0) {
return Buffer.alloc(0)
}
var i;
if (length === undefined) {
length = 0;
for (i = 0; i < list.length; ++i) {
length += list[i].length;
}
}
var buffer = Buffer.allocUnsafe(length);
var pos = 0;
for (i = 0; i < list.length; ++i) {
var buf = list[i];
if (!internalIsBuffer(buf)) {
throw new TypeError('"list" argument must be an Array of
Buffers')
}
buf.copy(buffer, pos);
pos += buf.length;
}
return buffer
};
if (end <= 0) {
return ''
}
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'latin1':
case 'binary':
return latin1Slice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' +
encoding)
encoding = (encoding + '').toLowerCase();
loweredCase = true;
}
}
}
start >>>= 0;
end >>>= 0;
thisStart >>>= 0;
thisEnd >>>= 0;
if (x < y) return -1
if (y < x) return 1
return 0
};
// Normalize byteOffset
if (typeof byteOffset === 'string') {
encoding = byteOffset;
byteOffset = 0;
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff;
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000;
}
byteOffset = +byteOffset; // Coerce to Number.
if (isNaN(byteOffset)) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search
whole buffer
byteOffset = dir ? 0 : (buffer.length - 1);
}
// Normalize val
if (typeof val === 'string') {
val = Buffer.from(val, encoding);
}
var i;
if (dir) {
var foundIndex = -1;
for (i = byteOffset; i < arrLength; i++) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i -
foundIndex)) {
if (foundIndex === -1) foundIndex = i;
if (i - foundIndex + 1 === valLength) return foundIndex *
indexSize
} else {
if (foundIndex !== -1) i -= i - foundIndex;
foundIndex = -1;
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength -
valLength;
for (i = byteOffset; i >= 0; i--) {
var found = true;
for (var j = 0; j < valLength; j++) {
if (read(arr, i + j) !== read(val, j)) {
found = false;
break
}
}
if (found) return i
}
}
return -1
}
if ((string.length > 0 && (length < 0 || offset < 0)) || offset >
this.length) {
throw new RangeError('Attempt to write outside buffer bounds')
}
case 'utf8':
case 'utf-8':
return utf8Write(this, string, offset, length)
case 'ascii':
return asciiWrite(this, string, offset, length)
case 'latin1':
case 'binary':
return latin1Write(this, string, offset, length)
case 'base64':
// Warning: maxLength not taken into account in base64Write
return base64Write(this, string, offset, length)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return ucs2Write(this, string, offset, length)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' +
encoding)
encoding = ('' + encoding).toLowerCase();
loweredCase = true;
}
}
};
var i = start;
while (i < end) {
var firstByte = buf[i];
var codePoint = null;
var bytesPerSequence = (firstByte > 0xEF) ? 4
: (firstByte > 0xDF) ? 3
: (firstByte > 0xBF) ? 2
: 1;
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte;
}
break
case 2:
secondByte = buf[i + 1];
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte &
0x3F);
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint;
}
}
break
case 3:
secondByte = buf[i + 1];
thirdByte = buf[i + 2];
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) ===
0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte &
0x3F) << 0x6 | (thirdByte & 0x3F);
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 ||
tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint;
}
}
break
case 4:
secondByte = buf[i + 1];
thirdByte = buf[i + 2];
fourthByte = buf[i + 3];
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) ===
0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte &
0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint;
}
}
}
}
res.push(codePoint);
i += bytesPerSequence;
}
return decodeCodePointsArray(res)
}
if (start < 0) {
start += len;
if (start < 0) start = 0;
} else if (start > len) {
start = len;
}
if (end < 0) {
end += len;
if (end < 0) end = 0;
} else if (end > len) {
end = len;
}
var newBuf;
if (Buffer.TYPED_ARRAY_SUPPORT) {
newBuf = this.subarray(start, end);
newBuf.__proto__ = Buffer.prototype;
} else {
var sliceLen = end - start;
newBuf = new Buffer(sliceLen, undefined);
for (var i = 0; i < sliceLen; ++i) {
newBuf[i] = this[i + start];
}
}
return newBuf
};
/*
* Need to make sure that buffer isn't trying to write out of bounds.
*/
function checkOffset (offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is
not uint')
if (offset + ext > length) throw new RangeError('Trying to access
beyond buffer length')
}
return val
};
return val
};
return ((this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16)) +
(this[offset + 3] * 0x1000000)
};
return val
};
var i = byteLength;
var mul = 1;
var val = this[offset + --i];
while (i > 0 && (mul *= 0x100)) {
val += this[offset + --i] * mul;
}
mul *= 0x80;
return val
};
return (this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16) |
(this[offset + 3] << 24)
};
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert)
{
if (!noAssert) checkOffset(offset, 4, this.length);
var mul = 1;
var i = 0;
this[offset] = value & 0xFF;
while (++i < byteLength && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF;
}
return offset + byteLength
};
var i = byteLength - 1;
var mul = 1;
this[offset + i] = value & 0xFF;
while (--i >= 0 && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF;
}
var i = 0;
var mul = 1;
var sub = 0;
this[offset] = value & 0xFF;
while (++i < byteLength && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
sub = 1;
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
}
var i = byteLength - 1;
var mul = 1;
var sub = 0;
this[offset + i] = value & 0xFF;
while (--i >= 0 && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
sub = 1;
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
}
// Are we oob?
if (end > this.length) end = this.length;
if (target.length - targetStart < end - start) {
end = target.length - targetStart + start;
}
if (this === target && start < targetStart && targetStart < end) {
// descending copy from end
for (i = len - 1; i >= 0; --i) {
target[i + targetStart] = this[i + start];
}
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
// ascending copy from start
for (i = 0; i < len; ++i) {
target[i + targetStart] = this[i + start];
}
} else {
Uint8Array.prototype.set.call(
target,
this.subarray(start, start + len),
targetStart
);
}
return len
};
// Usage:
// buffer.fill(number[, offset[, end]])
// buffer.fill(buffer[, offset[, end]])
// buffer.fill(string[, offset[, end]][, encoding])
Buffer.prototype.fill = function fill (val, start, end, encoding) {
// Handle string cases:
if (typeof val === 'string') {
if (typeof start === 'string') {
encoding = start;
start = 0;
end = this.length;
} else if (typeof end === 'string') {
encoding = end;
end = this.length;
}
if (val.length === 1) {
var code = val.charCodeAt(0);
if (code < 256) {
val = code;
}
}
if (encoding !== undefined && typeof encoding !== 'string') {
throw new TypeError('encoding must be a string')
}
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
} else if (typeof val === 'number') {
val = val & 255;
}
// Invalid ranges are not set to a default, so can range check early.
if (start < 0 || this.length < start || this.length < end) {
throw new RangeError('Out of range index')
}
if (!val) val = 0;
var i;
if (typeof val === 'number') {
for (i = start; i < end; ++i) {
this[i] = val;
}
} else {
var bytes = internalIsBuffer(val)
? val
: utf8ToBytes(new Buffer(val, encoding).toString());
var len = bytes.length;
for (i = 0; i < end - start; ++i) {
this[i + start] = bytes[i % len];
}
}
return this
};
// HELPER FUNCTIONS
// ================
// is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
// last char was a lead
if (!leadSurrogate) {
// no lead yet
if (codePoint > 0xDBFF) {
// unexpected trail
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
continue
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
continue
}
// valid lead
leadSurrogate = codePoint;
continue
}
// 2 leads in a row
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
leadSurrogate = codePoint;
continue
}
leadSurrogate = null;
// encode utf8
if (codePoint < 0x80) {
if ((units -= 1) < 0) break
bytes.push(codePoint);
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break
bytes.push(
codePoint >> 0x6 | 0xC0,
codePoint & 0x3F | 0x80
);
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break
bytes.push(
codePoint >> 0xC | 0xE0,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
);
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
);
} else {
throw new Error('Invalid code point')
}
}
return bytes
}
c = str.charCodeAt(i);
hi = c >> 8;
lo = c % 256;
byteArray.push(lo);
byteArray.push(hi);
}
return byteArray
}
var inherits;
if (typeof Object.create === 'function'){
inherits = function inherits(ctor, superCtor) {
// implementation from standard node.js 'util' module
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
inherits = function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
var TempCtor = function () {};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
};
}
var inherits$1 = inherits;
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%%') return '%';
if (i >= len) return x;
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject$1(x)) {
str += ' ' + x;
} else {
str += ' ' + inspect(x);
}
}
return str;
}
return deprecated;
}
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
_extend(ctx, opts);
}
// set default options
if (isUndefined$1(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined$1(ctx.depth)) ctx.depth = 2;
if (isUndefined$1(ctx.colors)) ctx.colors = false;
if (isUndefined$1(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
inspect.colors = {
'bold' : [1, 22],
'italic' : [3, 23],
'underline' : [4, 24],
'inverse' : [7, 27],
'white' : [37, 39],
'grey' : [90, 39],
'black' : [30, 39],
'blue' : [34, 39],
'cyan' : [36, 39],
'green' : [32, 39],
'magenta' : [35, 39],
'red' : [31, 39],
'yellow' : [33, 39]
};
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + inspect.colors[style][1] + 'm';
} else {
return str;
}
}
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
}
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value),
'regexp');
} else {
return ctx.stylize('[Object]', 'special');
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key,
array);
});
}
ctx.seen.pop();
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
}
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}
function isBoolean(arg) {
return typeof arg === 'boolean';
}
function isNull(arg) {
return arg === null;
}
function isNullOrUndefined(arg) {
return arg == null;
}
function isNumber$1(arg) {
return typeof arg === 'number';
}
function isString$1(arg) {
return typeof arg === 'string';
}
function isSymbol(arg) {
return typeof arg === 'symbol';
}
function isUndefined$1(arg) {
return arg === void 0;
}
function isRegExp(re) {
return isObject$1(re) && objectToString(re) === '[object RegExp]';
}
function isObject$1(arg) {
return typeof arg === 'object' && arg !== null;
}
function isDate$1(d) {
return isObject$1(d) && objectToString(d) === '[object Date]';
}
function isError(e) {
return isObject$1(e) &&
(objectToString(e) === '[object Error]' || e instanceof Error);
}
function isFunction$1(arg) {
return typeof arg === 'function';
}
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
}
function isBuffer$2(maybeBuf) {
return isBuffer$1(maybeBuf);
}
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
'Sep',
'Oct', 'Nov', 'Dec'];
// 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
var util = {
inherits: inherits$1,
_extend: _extend,
log: log,
isBuffer: isBuffer$2,
isPrimitive: isPrimitive,
isFunction: isFunction$1,
isError: isError,
isDate: isDate$1,
isObject: isObject$1,
isRegExp: isRegExp,
isUndefined: isUndefined$1,
isSymbol: isSymbol,
isString: isString$1,
isNumber: isNumber$1,
isNullOrUndefined: isNullOrUndefined,
isNull: isNull,
isBoolean: isBoolean,
isArray: isArray$2,
inspect: inspect,
deprecate: deprecate,
format: format,
debuglog: debuglog
};
function extend$1() {
var target = {};
return target
}
function extend$2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
return target
}
return mutable(manifest, {
// Features of abstract-leveldown
bufferKeys: manifest.bufferKeys || false,
snapshots: manifest.snapshots || false,
permanence: manifest.permanence || false,
seek: manifest.seek || false,
clear: manifest.clear || false,
var queueMicrotask = {
test: test,
install: install
};
var mutation = {
test: test$1,
install: install$1
};
var messageChannel = {
test: test$2,
install: install$2
};
scriptEl.onreadystatechange = null;
scriptEl.parentNode.removeChild(scriptEl);
scriptEl = null;
};
commonjsGlobal$1.document.documentElement.appendChild(scriptEl);
return handle;
};
};
var stateChange = {
test: test$3,
install: install$3
};
var timeout = {
test: test$4,
install: install$4
};
var types = [
debugUtil,
queueMicrotask,
mutation,
messageChannel,
stateChange,
timeout
];
var draining$1;
var currentQueue$1;
var queueIndex$1 = -1;
var queue$1 = [];
var scheduled = false;
function cleanUpNextTick$1() {
if (!draining$1 || !currentQueue$1) {
return;
}
draining$1 = false;
if (currentQueue$1.length) {
queue$1 = currentQueue$1.concat(queue$1);
} else {
queueIndex$1 = -1;
}
if (queue$1.length) {
nextTick$1();
}
}
};
var lib = immediate;
function immediate(task) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue$1.push(new Item$1(task, args));
if (!scheduled && !draining$1) {
scheduled = true;
scheduleDrain();
}
}
this.db = db;
this._ended = false;
this._nexting = false;
}
if (self._ended) {
nextTickBrowser(callback, new Error('cannot call next() after
end()'));
return self
}
if (self._nexting) {
nextTickBrowser(callback, new Error('cannot call next() before
previous next() has completed'));
return self
}
self._nexting = true;
self._next(function () {
self._nexting = false;
callback.apply(null, arguments);
});
return self
};
target = this.db._serializeKey(target);
this._seek(target);
};
if (this._ended) {
return nextTickBrowser(callback, new Error('end() already called on
iterator'))
}
this._ended = true;
this._end(callback);
};
this.db = db;
this._operations = [];
this._written = false;
}
AbstractChainedBatch.prototype._checkWritten = function () {
if (this._written) {
throw new Error('write() already called on this batch')
}
};
key = this.db._serializeKey(key);
value = this.db._serializeValue(value);
this._put(key, value);
return this
};
key = this.db._serializeKey(key);
this._del(key);
return this
};
AbstractChainedBatch.prototype.clear = function () {
this._checkWritten();
this._clear();
return this
};
AbstractChainedBatch.prototype._clear = function () {
this._operations = [];
};
this._written = true;
this._write(options, callback);
};
this.status = 'opening';
this._open(options, function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'open';
callback();
});
};
this.status = 'closing';
this._close(function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'closed';
callback();
});
};
AbstractLevelDOWN.prototype._close = function (callback) {
nextTickBrowser(callback);
};
key = this._serializeKey(key);
key = this._serializeKey(key);
value = this._serializeValue(value);
key = this._serializeKey(key);
if (!Array.isArray(array)) {
return nextTickBrowser(callback, new Error('batch(array) requires
an array argument'))
}
if (array.length === 0) {
return nextTickBrowser(callback)
}
var e = immutable(array[i]);
e.key = this._serializeKey(e.key);
e.value = this._serializeValue(e.value);
}
serialized[i] = e;
}
this._clear(options, callback);
};
next();
};
options.reverse = !!options.reverse;
options.keys = options.keys !== false;
options.values = options.values !== false;
options.limit = 'limit' in options ? options.limit : -1;
options.keyAsBuffer = options.keyAsBuffer !== false;
options.valueAsBuffer = options.valueAsBuffer !== false;
return options
};
if (isRangeOption(k)) {
// Note that we don't reject nullish and empty options here.
While
// those types are invalid as keys, they are valid as range
options.
opt = db._serializeKey(opt);
}
result[k] = opt;
}
return result
}
AbstractLevelDOWN.prototype._chainedBatch = function () {
return new abstractChainedBatch(this)
};
var abstractLeveldown$1 = {
AbstractLevelDOWN: AbstractLevelDOWN$1,
AbstractIterator: AbstractIterator$1,
AbstractChainedBatch: AbstractChainedBatch$1
};
this._options = options;
this._iterator = null;
this._operations = [];
}
inherits_browser(DeferredIterator, AbstractIterator$2);
this._db = db;
this._operations = [];
closed(this);
}
inherits_browser(DeferredLevelDOWN, AbstractLevelDOWN$2);
DeferredLevelDOWN.prototype.type = 'deferred-leveldown';
self._operations.forEach(function (op) {
if (op.iterator) {
op.iterator.setDb(self._db);
} else {
self._db[op.method].apply(self._db, op.args);
}
});
self._operations = [];
open(self);
callback();
});
};
this._db.close(function (err) {
if (err) return callback(err)
closed(self);
callback();
});
};
var buffer_list =
/*#__PURE__*/
function () {
function BufferList() {
_classCallCheck(this, BufferList);
this.head = null;
this.tail = null;
this.length = 0;
}
_createClass(BufferList, [{
key: "push",
value: function push(v) {
var entry = {
data: v,
next: null
};
if (this.length > 0) this.tail.next = entry;else this.head =
entry;
this.tail = entry;
++this.length;
}
}, {
key: "unshift",
value: function unshift(v) {
var entry = {
data: v,
next: this.head
};
if (this.length === 0) this.tail = entry;
this.head = entry;
++this.length;
}
}, {
key: "shift",
value: function shift() {
if (this.length === 0) return;
var ret = this.head.data;
if (this.length === 1) this.head = this.tail = null;else
this.head = this.head.next;
--this.length;
return ret;
}
}, {
key: "clear",
value: function clear() {
this.head = this.tail = null;
this.length = 0;
}
}, {
key: "join",
value: function join(s) {
if (this.length === 0) return '';
var p = this.head;
var ret = '' + p.data;
while (p = p.next) {
ret += s + p.data;
}
return ret;
}
}, {
key: "concat",
value: function concat(n) {
if (this.length === 0) return Buffer$2.alloc(0);
var ret = Buffer$2.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
while (p) {
copyBuffer(p.data, ret, i);
i += p.data.length;
p = p.next;
}
return ret;
} // Consumes a specified amount of bytes or characters from the
buffered data.
}, {
key: "consume",
value: function consume(n, hasStrings) {
var ret;
if (n < this.head.data.length) {
// `slice` is the same for buffers and strings.
ret = this.head.data.slice(0, n);
this.head.data = this.head.data.slice(n);
} else if (n === this.head.data.length) {
// First chunk is a perfect match.
ret = this.shift();
} else {
// Result spans more than one buffer.
ret = hasStrings ? this._getString(n) : this._getBuffer(n);
}
return ret;
}
}, {
key: "first",
value: function first() {
return this.head.data;
} // Consumes a specified amount of characters from the buffered
data.
}, {
key: "_getString",
value: function _getString(n) {
var p = this.head;
var c = 1;
var ret = p.data;
n -= ret.length;
while (p = p.next) {
var str = p.data;
var nb = n > str.length ? str.length : n;
if (nb === str.length) ret += str;else ret += str.slice(0, n);
n -= nb;
if (n === 0) {
if (nb === str.length) {
++c;
if (p.next) this.head = p.next;else this.head = this.tail =
null;
} else {
this.head = p;
p.data = str.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
} // Consumes a specified amount of bytes from the buffered data.
}, {
key: "_getBuffer",
value: function _getBuffer(n) {
var ret = Buffer$2.allocUnsafe(n);
var p = this.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) {
if (nb === buf.length) {
++c;
if (p.next) this.head = p.next;else this.head = this.tail =
null;
} else {
this.head = p;
p.data = buf.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
} // Make sure the linked list only shows the minimal necessary
information.
}, {
key: custom,
value: function value(_, options) {
return inspect$1(this, _objectSpread({}, options, {
// Only inspect one level.
depth: 0,
// It should not recurse.
customInspect: false
}));
}
}]);
return BufferList;
}();
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err);
} else if (err) {
if (!this._writableState) {
nextTick(emitErrorNT, this, err);
} else if (!this._writableState.errorEmitted) {
this._writableState.errorEmitted = true;
nextTick(emitErrorNT, this, err);
}
}
return this;
} // we set destroyed to true before firing error callbacks in order
// to make it re-entrance safe in case destroy() is called within
callbacks
if (this._readableState) {
this._readableState.destroyed = true;
} // if this is a duplex stream mark the writable part as destroyed
as well
if (this._writableState) {
this._writableState.destroyed = true;
}
return this;
}
function emitCloseNT(self) {
if (self._writableState && !self._writableState.emitClose) return;
if (self._readableState && !self._readableState.emitClose) return;
self.emit('close');
}
function undestroy() {
if (this._readableState) {
this._readableState.destroyed = false;
this._readableState.reading = false;
this._readableState.ended = false;
this._readableState.endEmitted = false;
}
if (this._writableState) {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
this._writableState.finalCalled = false;
this._writableState.prefinished = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
}
var destroy_1 = {
destroy: destroy,
undestroy: undestroy,
errorOrDestroy: errorOrDestroy
};
var NodeError =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(NodeError, _Base);
return NodeError;
}(Base);
NodeError.prototype.name = Base.name;
NodeError.prototype.code = code;
codes[code] = NodeError;
} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
if (len > 2) {
return "one of ".concat(thing, " ").concat(expected.slice(0, len
- 1).join(', '), ", or ") + expected[len - 1];
} else if (len === 2) {
return "one of ".concat(thing, " ").concat(expected[0], " or
").concat(expected[1]);
} else {
return "of ".concat(thing, " ").concat(expected[0]);
}
} else {
return "of ".concat(thing, " ").concat(String(expected));
}
} //
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/
String/startsWith
var msg;
var errorsBrowser = {
codes: codes_1
};
if (hwm != null) {
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
var name = isDuplex ? duplexKey : 'highWaterMark';
throw new ERR_INVALID_OPT_VALUE(name, hwm);
}
return Math.floor(hwm);
} // Default value
var state = {
getHighWaterMark: getHighWaterMark
};
/**
* Module exports.
*/
/**
* Mark that a method should not be used.
* Returns a modified function which warns once by default.
*
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
*
* If `localStorage.throwDeprecation = true` is set, then deprecated
functions
* will throw an Error when invoked.
*
* If `localStorage.traceDeprecation = true` is set, then deprecated
functions
* will invoke `console.trace()` instead of `console.error()`.
*
* @param {Function} fn - the function to deprecate
* @param {String} msg - the string to print to the console when `fn`
is invoked
* @returns {Function} a new "deprecated" version of `fn`
* @api public
*/
return deprecated;
}
/**
* Checks `localStorage` for boolean values for the given `name`.
*
* @param {String} name
* @returns {Boolean}
* @api private
*/
function CorkedRequest(state) {
var _this = this;
this.next = null;
this.entry = null;
this.finish = function () {
onCorkedFinish(_this, state);
};
}
/* </replacement> */
/*<replacement>*/
var Duplex;
/*</replacement>*/
Writable.WritableState = WritableState;
/*<replacement>*/
var internalUtil = {
deprecate: browser$1
};
/*</replacement>*/
/*<replacement>*/
/*</replacement>*/
function _uint8ArrayToBuffer(chunk) {
return Buffer$3.from(chunk);
}
function _isUint8Array(obj) {
return Buffer$3.isBuffer(obj) || obj instanceof OurUint8Array;
}
inherits_browser(Writable, streamBrowser);
function nop() {}
this.objectMode = !!options.objectMode;
if (isDuplex) this.objectMode = this.objectMode || !!
options.writableObjectMode; // the point at which write() starts returning false
// Note: 0 is a valid value, means that we always return false if
// the entire buffer is not flushed immediately on write()
this.writelen = 0;
this.bufferedRequest = null;
this.lastBufferedRequest = null; // number of pending user-supplied
write callbacks
// this must be 0 before 'finish' can be emitted
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function () {
try {
Object.defineProperty(WritableState.prototype, 'buffer', {
get: internalUtil.deprecate(function writableStateBufferGetter()
{
return this.getBuffer();
}, '_writableState.buffer is deprecated. Use
_writableState.getBuffer ' + 'instead.', 'DEP0003')
});
} catch (_) {}
})(); // Test _writableState for inheritance to account for Duplex
streams,
// whose prototype chain only points to Readable.
var realHasInstance;
function Writable(options) {
Duplex = Duplex || _stream_duplex; // Writable ctor is applied to
Duplexes, too.
// `realHasInstance` is necessary because using plain `instanceof`
// would return false, as no `_writableState` property is attached.
// Trying to use the custom `instanceof` for Writable here will also
break the
// Node.js LazyTransform implementation, which has a non-trivial
getter for
// `_writableState` that would lead to infinite recursion.
// Checking for a Stream.Duplex instance is faster here instead of
inside
// the WritableState constructor, at least with V8 6.5
this.writable = true;
if (options) {
if (typeof options.write === 'function') this._write =
options.write;
if (typeof options.writev === 'function') this._writev =
options.writev;
if (typeof options.destroy === 'function') this._destroy =
options.destroy;
if (typeof options.final === 'function') this._final =
options.final;
}
streamBrowser.call(this);
} // Otherwise people can pipe Writable streams, which is just wrong.
Writable.prototype.pipe = function () {
errorOrDestroy$1(this, new ERR_STREAM_CANNOT_PIPE());
};
errorOrDestroy$1(stream, er);
nextTick(cb, er);
} // Checks that a user-supplied chunk is valid, especially for the
particular
// mode the stream is in. Currently this means that `null` is never
accepted
// and undefined/non-string values are only allowed in object mode.
if (er) {
errorOrDestroy$1(stream, er);
nextTick(cb, er);
return false;
}
return true;
}
Writable.prototype.cork = function () {
this._writableState.corked++;
};
Writable.prototype.uncork = function () {
var state = this._writableState;
if (state.corked) {
state.corked--;
if (!state.writing && !state.corked && !state.bufferProcessing &&
state.bufferedRequest) clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function
setDefaultEncoding(encoding) {
// node::ParseEncoding() requires lower case.
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2',
'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -
1)) throw new ERR_UNKNOWN_ENCODING(encoding);
this._writableState.defaultEncoding = encoding;
return this;
};
Object.defineProperty(Writable.prototype, 'writableBuffer', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState && this._writableState.getBuffer();
}
});
return chunk;
}
Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState.highWaterMark;
}
}); // if we're already writing something, then just put this
// in the queue, and wait our turn. Otherwise, call _write
// If we return false, then we need a drain event, so set that flag.
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = {
chunk: chunk,
encoding: encoding,
isBuf: isBuf,
callback: cb,
next: null
};
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
state.bufferedRequestCount += 1;
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}
return ret;
}
finishMaybe(stream, state);
}
}
function onwriteStateUpdate(state) {
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;
}
if (sync) {
nextTick(afterWrite, stream, state, finished, cb);
} else {
afterWrite(stream, state, finished, cb);
}
}
}
while (entry) {
buffer[count] = entry;
if (!entry.isBuf) allBuffers = false;
entry = entry.next;
count += 1;
}
buffer.allBuffers = allBuffers;
doWrite(stream, state, true, state.length, buffer, '',
holder.finish); // doWrite is almost always async, defer these to save a bit of
time
// as the hot path ends with doWrite
state.pendingcb++;
state.lastBufferedRequest = null;
if (holder.next) {
state.corkedRequestsFree = holder.next;
holder.next = null;
} else {
state.corkedRequestsFree = new CorkedRequest(state);
}
state.bufferedRequestCount = 0;
} else {
// Slow case, write chunks one-by-one
while (entry) {
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
state.bufferedRequestCount--; // if we didn't call the onwrite
immediately, then
// it means that we need to wait until it does.
// also, that means that the chunk and cb are currently
// being processed, so move the buffer counter past them.
if (state.writing) {
break;
}
}
state.bufferedRequest = entry;
state.bufferProcessing = false;
}
Writable.prototype._writev = null;
if (state.corked) {
state.corked = 1;
this.uncork();
} // ignore unnecessary end() calls.
Object.defineProperty(Writable.prototype, 'writableLength', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState.length;
}
});
function needFinish(state) {
return state.ending && state.length === 0 && state.bufferedRequest
=== null && !state.finished && !state.writing;
}
if (err) {
errorOrDestroy$1(stream, err);
}
state.prefinished = true;
stream.emit('prefinish');
finishMaybe(stream, state);
});
}
if (need) {
prefinish(stream, state);
if (state.pendingcb === 0) {
state.finished = true;
stream.emit('finish');
if (state.autoDestroy) {
// In case of duplex streams we need a way to detect
// if the readable side is ready for autoDestroy as well
var rState = stream._readableState;
return need;
}
if (cb) {
if (state.finished) nextTick(cb);else stream.once('finish', cb);
}
state.ended = true;
stream.writable = false;
}
while (entry) {
var cb = entry.callback;
state.pendingcb--;
cb(err);
entry = entry.next;
} // reuse the free corkReq.
state.corkedRequestsFree.next = corkReq;
}
Object.defineProperty(Writable.prototype, 'destroyed', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
if (this._writableState === undefined) {
return false;
}
return this._writableState.destroyed;
},
set: function set(value) {
// we ignore the value if the stream
// has not been initialized yet
if (!this._writableState) {
return;
} // backward compatibility, the user is explicitly
// managing destroyed
this._writableState.destroyed = value;
}
});
Writable.prototype.destroy = destroy_1.destroy;
Writable.prototype._undestroy = destroy_1.undestroy;
/*<replacement>*/
return keys;
};
/*</replacement>*/
inherits_browser(Duplex$1, _stream_readable);
{
// Allow the keys array to be GC'ed.
var keys = objectKeys(_stream_writable.prototype);
function Duplex$1(options) {
if (!(this instanceof Duplex$1)) return new Duplex$1(options);
_stream_readable.call(this, options);
_stream_writable.call(this, options);
this.allowHalfOpen = true;
if (options) {
if (options.readable === false) this.readable = false;
if (options.writable === false) this.writable = false;
Object.defineProperty(Duplex$1.prototype, 'writableHighWaterMark', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState.highWaterMark;
}
});
Object.defineProperty(Duplex$1.prototype, 'writableBuffer', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState && this._writableState.getBuffer();
}
});
Object.defineProperty(Duplex$1.prototype, 'writableLength', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState.length;
}
}); // the no-half-open enforcer
function onend() {
// If the writable side ended, then we're ok.
if (this._writableState.ended) return; // no more data can be
written.
// But allow more writes to happen in this tick.
nextTick(onEndNT, this);
}
function onEndNT(self) {
self.end();
}
Object.defineProperty(Duplex$1.prototype, 'destroyed', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
if (this._readableState === undefined || this._writableState ===
undefined) {
return false;
}
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
});
SafeBuffer.prototype = Object.create(Buffer.prototype);
/*<replacement>*/
function _normalizeEncoding(enc) {
if (!enc) return 'utf8';
var retried;
while (true) {
switch (enc) {
case 'utf8':
case 'utf-8':
return 'utf8';
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return 'utf16le';
case 'latin1':
case 'binary':
return 'latin1';
case 'base64':
case 'ascii':
case 'hex':
return enc;
default:
if (retried) return; // undefined
enc = ('' + enc).toLowerCase();
retried = true;
}
}
}
// Do not cache `Buffer.isEncoding` when checking encoding names as
some
// modules monkey-patch it to support additional encodings
function normalizeEncoding(enc) {
var nenc = _normalizeEncoding(enc);
if (typeof nenc !== 'string' && (Buffer$4.isEncoding === isEncoding
|| !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
return nenc || enc;
}
StringDecoder.prototype.end = utf8End;
// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte,
or a
// continuation byte. If an invalid byte is detected, -2 is returned.
function utf8CheckByte(byte) {
if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else
if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
return byte >> 6 === 0x02 ? -1 : -2;
}
function base64Text(buf, i) {
var n = (buf.length - i) % 3;
if (n === 0) return buf.toString('base64', i);
this.lastNeed = 3 - n;
this.lastTotal = 3;
if (n === 1) {
this.lastChar[0] = buf[buf.length - 1];
} else {
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
}
return buf.toString('base64', i, buf.length - n);
}
function base64End(buf) {
var r = buf && buf.length ? this.write(buf) : '';
if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 -
this.lastNeed);
return r;
}
function simpleEnd(buf) {
return buf && buf.length ? this.write(buf) : '';
}
var string_decoder = {
StringDecoder: StringDecoder_1
};
var ERR_STREAM_PREMATURE_CLOSE =
errorsBrowser.codes.ERR_STREAM_PREMATURE_CLOSE;
function once$1(callback) {
var called = false;
return function () {
if (called) return;
called = true;
callback.apply(this, args);
};
}
function noop$1() {}
function isRequest(stream) {
return stream.setHeader && typeof stream.abort === 'function';
}
if (isRequest(stream)) {
stream.on('complete', onfinish);
stream.on('abort', onclose);
if (stream.req) onrequest();else stream.on('request', onrequest);
} else if (writable && !stream._writableState) {
// legacy streams
stream.on('end', onlegacyfinish);
stream.on('close', onlegacyfinish);
}
stream.on('end', onend);
stream.on('finish', onfinish);
if (opts.error !== false) stream.on('error', onerror);
stream.on('close', onclose);
return function () {
stream.removeListener('complete', onfinish);
stream.removeListener('abort', onclose);
stream.removeListener('request', onrequest);
if (stream.req) stream.req.removeListener('finish', onfinish);
stream.removeListener('end', onlegacyfinish);
stream.removeListener('close', onlegacyfinish);
stream.removeListener('finish', onfinish);
stream.removeListener('end', onend);
stream.removeListener('error', onerror);
stream.removeListener('close', onclose);
};
}
var _Object$setPrototypeO;
function readAndResolve(iter) {
var resolve = iter[kLastResolve];
function onReadable(iter) {
// we wait for the next tick, because it might
// emit an error with process.nextTick
nextTick(readAndResolve, iter);
}
iter[kHandlePromise](resolve, reject);
}, reject);
};
}
if (this[kEnded]) {
return Promise.resolve(createIterResult(undefined, true));
}
if (this[kStream].destroyed) {
// We need to defer via nextTick because if .destroy(err) is
// called, the error will be emitted via nextTick, and
// we cannot guarantee that there is no error lingering around
// waiting to be emitted.
return new Promise(function (resolve, reject) {
nextTick(function () {
if (_this[kError]) {
reject(_this[kError]);
} else {
resolve(createIterResult(undefined, true));
}
});
});
} // if we have multiple next() calls
// we will wait for the previous Promise to finish
// this logic is optimized to support for await loops,
// where next() is only called once at a time
if (lastPromise) {
promise = new Promise(wrapForNext(lastPromise, this));
} else {
// fast path needed to support multiple this.push()
// without triggering the next() queue
var data = this[kStream].read();
this[kLastPromise] = promise;
return promise;
}
}, _defineProperty$1(_Object$setPrototypeO, Symbol.asyncIterator,
function () {
return this;
}), _defineProperty$1(_Object$setPrototypeO, "return", function
_return() {
var _this2 = this;
resolve(createIterResult(undefined, true));
});
});
}), _Object$setPrototypeO), AsyncIteratorPrototype);
if (data) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
resolve(createIterResult(data, false));
} else {
iterator[kLastResolve] = resolve;
iterator[kLastReject] = reject;
}
},
writable: true
}), _Object$create));
iterator[kLastPromise] = null;
endOfStream(stream, function (err) {
if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
var reject = iterator[kLastReject]; // reject if we are waiting
for data in the Promise
// returned by next() and store the error
iterator[kError] = err;
return;
}
iterator[kEnded] = true;
});
stream.on('readable', onReadable.bind(null, iterator));
return iterator;
};
var Duplex$2;
/*</replacement>*/
Readable.ReadableState = ReadableState;
/*<replacement>*/
var EE = require$$0.EventEmitter;
/*<replacement>*/
/*</replacement>*/
function _uint8ArrayToBuffer$1(chunk) {
return Buffer$5.from(chunk);
}
function _isUint8Array$1(obj) {
return Buffer$5.isBuffer(obj) || obj instanceof OurUint8Array$1;
}
/*<replacement>*/
var debug;
inherits_browser(Readable, streamBrowser);
this.objectMode = !!options.objectMode;
if (isDuplex) this.objectMode = this.objectMode || !!
options.readableObjectMode; // the point at which it stops calling _read() to fill
the buffer
// Note: 0 is a valid value, means "don't call _read preemptively
ever"
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
this.resumeScheduled = false;
this.paused = true; // Should close be emitted on destroy. Defaults
to true.
this.readingMore = false;
this.decoder = null;
this.encoding = null;
if (options.encoding) {
if (!StringDecoder$1) StringDecoder$1 =
string_decoder.StringDecoder;
this.decoder = new StringDecoder$1(options.encoding);
this.encoding = options.encoding;
}
}
function Readable(options) {
Duplex$2 = Duplex$2 || _stream_duplex;
if (!(this instanceof Readable)) return new Readable(options); //
Checking for a Stream.Duplex instance is faster here instead of inside
// the ReadableState constructor, at least with V8 6.5
this.readable = true;
if (options) {
if (typeof options.read === 'function') this._read = options.read;
if (typeof options.destroy === 'function') this._destroy =
options.destroy;
}
streamBrowser.call(this);
}
Object.defineProperty(Readable.prototype, 'destroyed', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
if (this._readableState === undefined) {
return false;
}
return this._readableState.destroyed;
},
set: function set(value) {
// we ignore the value if the stream
// has not been initialized yet
if (!this._readableState) {
return;
} // backward compatibility, the user is explicitly
// managing destroyed
this._readableState.destroyed = value;
}
});
Readable.prototype.destroy = destroy_1.destroy;
Readable.prototype._undestroy = destroy_1.undestroy;
if (!state.objectMode) {
if (typeof chunk === 'string') {
encoding = encoding || state.defaultEncoding;
skipChunkCheck = true;
}
} else {
skipChunkCheck = true;
}
if (er) {
errorOrDestroy$2(stream, er);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (typeof chunk !== 'string' && !state.objectMode &&
Object.getPrototypeOf(chunk) !== Buffer$5.prototype) {
chunk = _uint8ArrayToBuffer$1(chunk);
}
if (addToFront) {
if (state.endEmitted) errorOrDestroy$2(stream, new
ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);
} else if (state.ended) {
errorOrDestroy$2(stream, new ERR_STREAM_PUSH_AFTER_EOF());
} else if (state.destroyed) {
return false;
} else {
state.reading = false;
maybeReadMore(stream, state);
}
return er;
}
Readable.prototype.isPaused = function () {
return this._readableState.flowing === false;
}; // backwards compatibility.
this._readableState.encoding =
this._readableState.decoder.encoding; // Iterate over current buffer to convert
already stored Buffers:
var p = this._readableState.buffer.head;
var content = '';
function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
// TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.
n = MAX_HWM;
} else {
// Get the next highest power of 2 to prevent increasing hwm
excessively in
// tiny amounts
n--;
n |= n >>> 1;
n |= n >>> 2;
n |= n >>> 4;
n |= n >>> 8;
n |= n >>> 16;
n++;
}
return n;
} // This function is designed to be inlinable, so please take care
when making
// changes to the function body.
if (n !== n) {
// Only flow one buffer at a time
if (state.flowing && state.length) return
state.buffer.head.data.length;else return state.length;
} // If we're asking for more than the current hwm, then raise the
hwm.
if (!state.ended) {
state.needReadable = true;
return 0;
}
return state.length;
} // you can override either this method, or the async _read(n) below.
this._read(state.highWaterMark);
var ret;
if (n > 0) ret = fromList(n, state);else ret = null;
if (state.length === 0) {
// If we have nothing in the buffer, then we want to know
// as soon as we *do* get something into the buffer.
if (!state.ended) state.needReadable = true; // If we tried to
read() past the EOF, then emit end on the next tick.
if (state.decoder) {
var chunk = state.decoder.end();
state.ended = true;
if (state.sync) {
// if we are sync, wait until next tick to emit the data.
// Otherwise we risk emitting data in the flow()
// the readable code triggers during a read() call
emitReadable(stream);
} else {
// emit 'readable' now to make sure it gets picked up.
state.needReadable = false;
if (!state.emittedReadable) {
state.emittedReadable = true;
emitReadable_(stream);
}
}
} // Don't emit readable right away in sync mode, because this can
trigger
// another read() call => stack overflow. This way, it might trigger
// a nextTick recursion warning, but that's not so bad.
function emitReadable(stream) {
var state = stream._readableState;
debug('emitReadable', state.needReadable, state.emittedReadable);
state.needReadable = false;
if (!state.emittedReadable) {
debug('emitReadable', state.flowing);
state.emittedReadable = true;
nextTick(emitReadable_, stream);
}
}
function emitReadable_(stream) {
var state = stream._readableState;
debug('emitReadable_', state.destroyed, state.length, state.ended);
state.readingMore = false;
} // abstract method. to be overridden in specific implementation
classes.
// call cb(er, data) where data is <= n in length.
// for virtual (non-string, non-buffer) streams, "length" is somewhat
// arbitrary, and perhaps not very meaningful.
switch (state.pipesCount) {
case 0:
state.pipes = dest;
break;
case 1:
state.pipes = [state.pipes, dest];
break;
default:
state.pipes.push(dest);
break;
}
state.pipesCount += 1;
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !==
process.stdout && dest !== process.stderr;
var endFn = doEnd ? onend : unpipe;
if (state.endEmitted) nextTick(endFn);else src.once('end', endFn);
dest.on('unpipe', onunpipe);
function onend() {
debug('onend');
dest.end();
} // when the dest drains, it reduces the awaitDrain counter
// on the source. This would be more elegant with a .once()
// handler in flow(), but adding and removing repeatedly is
// too slow.
dest.removeListener('close', onclose);
dest.removeListener('finish', onfinish);
dest.removeListener('drain', ondrain);
dest.removeListener('error', onerror);
dest.removeListener('unpipe', onunpipe);
src.removeListener('end', onend);
src.removeListener('end', unpipe);
src.removeListener('data', ondata);
cleanedUp = true; // if the reader is waiting for a drain event
from this
// specific writer, then it would cause it to never start
// flowing again.
// So, if this is awaiting a drain, then we just call it now.
// If we don't know, then assume that we are waiting for one.
src.on('data', ondata);
function ondata(chunk) {
debug('ondata');
var ret = dest.write(chunk);
debug('dest.write', ret);
src.pause();
}
} // if the dest has an error, then stop piping into it.
// however, don't suppress the throwing behavior for this.
function onerror(er) {
debug('onerror', er);
unpipe();
dest.removeListener('error', onerror);
if (EElistenerCount(dest, 'error') === 0) errorOrDestroy$2(dest,
er);
} // Make sure our error handler is attached before userland ones.
dest.once('close', onclose);
function onfinish() {
debug('onfinish');
dest.removeListener('close', onclose);
unpipe();
}
dest.once('finish', onfinish);
function unpipe() {
debug('unpipe');
src.unpipe(dest);
} // tell the dest that it's being piped to
if (!state.flowing) {
debug('pipe resume');
src.resume();
}
return dest;
};
function pipeOnDrain(src) {
return function pipeOnDrainFunctionResult() {
var state = src._readableState;
debug('pipeOnDrain', state.awaitDrain);
if (state.awaitDrain) state.awaitDrain--;
if (state.pipesCount === 1) {
// passed in one, but it's not the right one.
if (dest && dest !== state.pipes) return this;
if (!dest) dest = state.pipes; // got a match.
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
if (dest) dest.emit('unpipe', this, unpipeInfo);
return this;
} // slow case. multiple pipe destinations.
if (!dest) {
// remove all.
var dests = state.pipes;
var len = state.pipesCount;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
return this;
} // try to find the right one.
if (state.length) {
emitReadable(this);
} else if (!state.reading) {
nextTick(nReadingNextTick, this);
}
}
}
return res;
};
Readable.prototype.addListener = Readable.prototype.on;
return res;
};
return res;
};
function updateReadableListening(self) {
var state = self._readableState;
state.readableListening = self.listenerCount('readable') > 0;
function nReadingNextTick(self) {
debug('readable nexttick read 0');
self.read(0);
} // pause() and resume() are remnants of the legacy readable stream
API
// If the user uses them, then switch into old mode.
Readable.prototype.resume = function () {
var state = this._readableState;
if (!state.flowing) {
debug('resume'); // we flow only if there is no one listening
// for readable, but we still have to call
// resume()
state.flowing = !state.readableListening;
resume(this, state);
}
state.paused = false;
return this;
};
if (!state.reading) {
stream.read(0);
}
state.resumeScheduled = false;
stream.emit('resume');
flow(stream);
if (state.flowing && !state.reading) stream.read(0);
}
Readable.prototype.pause = function () {
debug('call pause flowing=%j', this._readableState.flowing);
this._readableState.paused = true;
return this;
};
function flow(stream) {
var state = stream._readableState;
debug('flow', state.flowing);
_this.push(null);
});
stream.on('data', function (chunk) {
debug('wrapped data');
if (state.decoder) chunk = state.decoder.write(chunk); // don't
skip over falsy values in objectMode
if (!ret) {
paused = true;
stream.pause();
}
}); // proxy all the other methods.
// important when wrapping filters and duplexes.
if (paused) {
paused = false;
stream.resume();
}
};
return this;
};
return createReadableStreamAsyncIterator$1(this);
};
}
Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._readableState.highWaterMark;
}
});
Object.defineProperty(Readable.prototype, 'readableBuffer', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._readableState && this._readableState.buffer;
}
});
Object.defineProperty(Readable.prototype, 'readableFlowing', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._readableState.flowing;
},
set: function set(state) {
if (this._readableState) {
this._readableState.flowing = state;
}
}
}); // exposed for testing purposes only.
Readable._fromList = fromList;
Object.defineProperty(Readable.prototype, 'readableLength', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._readableState.length;
}
}); // Pluck off n bytes from an array of buffers.
// Length is the combined lengths of all the buffers in the list.
// This function is designed to be inlinable, so please take care when
making
// changes to the function body.
function endReadable(stream) {
var state = stream._readableState;
debug('endReadable', state.endEmitted);
if (!state.endEmitted) {
state.ended = true;
nextTick(endReadableNT, state, stream);
}
}
if (state.autoDestroy) {
// In case of duplex streams we need a way to detect
// if the writable side is ready for autoDestroy as well
var wState = stream._writableState;
function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
}
return -1;
}
inherits_browser(Transform, _stream_duplex);
ts.writechunk = null;
ts.writecb = null;
if (data != null) // single equals check for both `null` and
`undefined`
this.push(data);
cb(er);
var rs = this._readableState;
rs.reading = false;
function Transform(options) {
if (!(this instanceof Transform)) return new Transform(options);
_stream_duplex.call(this, options);
this._transformState = {
afterTransform: afterTransform.bind(this),
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: null
}; // start out asking for a readable event once data is transformed.
this._readableState.sync = false;
if (options) {
if (typeof options.transform === 'function') this._transform =
options.transform;
if (typeof options.flush === 'function') this._flush =
options.flush;
} // When the writable side finishes, then flush out anything
remaining.
this.on('prefinish', prefinish$1);
}
function prefinish$1() {
var _this = this;
if (!ts.transforming) {
var rs = this._readableState;
if (ts.needTransform || rs.needReadable || rs.length <
rs.highWaterMark) this._read(rs.highWaterMark);
}
}; // Doesn't matter what the args are here.
// _transform does all the work.
// That we got here means that the readable side wants more data.
this._transform(ts.writechunk, ts.writeencoding,
ts.afterTransform);
} else {
// mark that we need a transform, so that any data that comes in
// will get processed, now that we've asked for it.
ts.needTransform = true;
}
};
inherits_browser(PassThrough, _stream_transform);
function PassThrough(options) {
if (!(this instanceof PassThrough)) return new PassThrough(options);
_stream_transform.call(this, options);
}
var eos$1;
function once$2(callback) {
var called = false;
return function () {
if (called) return;
called = true;
callback.apply(void 0, arguments);
};
}
function noop$2(err) {
// Rethrow the error if it exists to avoid swallowing it
if (err) throw err;
}
function isRequest$1(stream) {
return stream.setHeader && typeof stream.abort === 'function';
}
function call(fn) {
fn();
}
function popCallback(streams) {
if (!streams.length) return noop$2;
if (typeof streams[streams.length - 1] !== 'function') return noop$2;
return streams.pop();
}
function pipeline() {
for (var _len = arguments.length, streams = new Array(_len), _key =
0; _key < _len; _key++) {
streams[_key] = arguments[_key];
}
if (streams.length < 2) {
throw new ERR_MISSING_ARGS('streams');
}
var error;
var destroys = streams.map(function (stream, i) {
var reading = i < streams.length - 1;
var writing = i > 0;
return destroyer(stream, reading, writing, function (err) {
if (!error) error = err;
if (err) destroys.forEach(call);
if (reading) return;
destroys.forEach(call);
callback(error);
});
});
return streams.reduce(pipe);
}
ReadStream.prototype._read = function () {
var self = this;
var options = this._options;
if (this.destroyed) return
return {
enumerable : op('enumerable')
, configurable : op('configurable')
, writable : op('writable')
, value : value
}
}
return prr
});
});
module.exports.errno = {};
module.exports.code = {};
all.forEach(function (error) {
module.exports.errno[error.errno] = error;
module.exports.code[error.code] = error;
});
module.exports.custom = custom$1(module.exports);
module.exports.create = module.exports.custom.createError;
});
var errno_1 = errno.all;
var errno_2 = errno.errno;
var errno_3 = errno.code;
var errno_4 = errno.custom;
var errno_5 = errno.create;
NotFoundError.prototype.notFound = true;
NotFoundError.prototype.status = 404;
var errors = {
LevelUPError: LevelUPError,
InitializationError: createError$2('InitializationError',
LevelUPError),
OpenError: createError$2('OpenError', LevelUPError),
ReadError: createError$2('ReadError', LevelUPError),
WriteError: createError$2('WriteError', LevelUPError),
NotFoundError: NotFoundError,
EncodingError: createError$2('EncodingError', LevelUPError)
};
function promisify () {
var callback;
var promise = new Promise(function (resolve, reject) {
callback = function callback (err, value) {
if (err) reject(err);
else resolve(value);
};
});
callback.promise = promise;
return callback
}
var common = {
getCallback: getCallback,
getOptions: getOptions
};
return this
};
return this
};
Batch.prototype.clear = function () {
try {
this.batch.clear();
} catch (err) {
throw new WriteError(err)
}
this.ops = [];
this.length = 0;
return this
};
if (!callback) {
callback = promisify_1();
promise = callback.promise;
}
options = getOptions$1(options);
try {
this.batch.write(options, function (err) {
if (err) { return callback(new WriteError(err)) }
levelup.emit('batch', ops);
callback();
});
} catch (err) {
throw new WriteError(err)
}
return promise
};
function compare(a, b) {
if (a === b) {
return 0;
}
var x = a.length;
var y = b.length;
if (x < y) {
return -1;
}
if (y < x) {
return 1;
}
return 0;
}
var hasOwn = Object.prototype.hasOwnProperty;
this.stack = out;
}
}
}
function truncate(s, n) {
if (typeof s === 'string') {
return s.length < n ? s : s.slice(0, n);
} else {
return s;
}
}
function inspect$2(something) {
if (functionsHaveNames() || !isFunction$1(something)) {
return inspect(something);
}
var rawname = getName(something);
var name = rawname ? ': ' + rawname : '';
return '[Function' + name + ']';
}
function getMessage(self) {
return truncate(inspect$2(self.actual), 128) + ' ' +
self.operator + ' ' +
truncate(inspect$2(self.expected), 128);
}
// At present only the three keys mentioned above are used and
// understood by the spec. Implementations or sub modules can pass
// other keys to the AssertionError's constructor - they will be
// ignored.
// 6. The non-equality assertion tests for whether two objects are not
equal
// with != assert.notEqual(actual, expected, message_opt);
assert$1.notEqual = notEqual;
function notEqual(actual, expected, message) {
if (actual == expected) {
fail(actual, expected, message, '!=', notEqual);
}
}
// 7.4. Other pairs that do not both pass typeof value == 'object',
// equivalence is determined by ==.
} else if ((actual === null || typeof actual !== 'object') &&
(expected === null || typeof expected !== 'object')) {
return strict ? actual === expected : actual == expected;
memos.actual.push(actual);
memos.expected.push(expected);
function isArguments(object) {
return Object.prototype.toString.call(object) == '[object
Arguments]';
}
assert$1.notDeepStrictEqual = notDeepStrictEqual;
function notDeepStrictEqual(actual, expected, message) {
if (_deepEqual(actual, expected, true)) {
fail(actual, expected, message, 'notDeepStrictEqual',
notDeepStrictEqual);
}
}
try {
if (actual instanceof expected) {
return true;
}
} catch (e) {
// Ignore. The instanceof check doesn't work for arrow functions.
}
if (Error.isPrototypeOf(expected)) {
return false;
}
function _tryBlock(block) {
var error;
try {
block();
} catch (e) {
error = e;
}
return error;
}
actual = _tryBlock(block);
if ((isUnwantedException &&
userProvidedMessage &&
expectedException(actual, expected)) ||
isUnexpectedException) {
fail(actual, expected, 'Got unwanted exception' + message);
}
assert$1.ifError = ifError;
function ifError(err) {
if (err) throw err;
}
var error;
var self = this;
EventEmitter$1.call(this);
this.setMaxListeners(Infinity);
LevelUP.prototype.emit = EventEmitter$1.prototype.emit;
LevelUP.prototype.once = EventEmitter$1.prototype.once;
inherits$2(LevelUP, EventEmitter$1);
if (!callback) {
callback = promisify_1();
promise = callback.promise;
}
if (!opts) {
opts = this.options;
}
if (this.isOpen()) {
nextTick(callback, null, self);
return promise
}
if (this._isOpening()) {
this.once('open', function () { callback(null, self); });
return promise
}
this.emit('opening');
return promise
};
if (!callback) {
callback = promisify_1();
promise = callback.promise;
}
if (this.isOpen()) {
this.db.close(function () {
self.emit('closed');
callback.apply(null, arguments);
});
this.emit('closing');
this.db = new deferredLeveldown(this._db);
} else if (this.isClosed()) {
nextTick(callback);
} else if (this.db.status === 'closing') {
this.once('closed', callback);
} else if (this._isOpening()) {
this.once('open', function () {
self.close(callback);
});
}
return promise
};
LevelUP.prototype.isOpen = function () {
return this.db.status === 'open'
};
LevelUP.prototype._isOpening = function () {
return this.db.status === 'opening'
};
LevelUP.prototype.isClosed = function () {
return (/^clos|new/).test(this.db.status)
};
if (!callback) {
callback = promisify_1();
promise = callback.promise;
}
options = getOptions$2(options);
return promise
};
if (!callback) {
callback = promisify_1();
promise = callback.promise;
}
options = getOptions$2(options);
return promise
};
if (!callback) {
callback = promisify_1();
promise = callback.promise;
}
options = getOptions$2(options);
return promise
};
if (!callback) {
callback = promisify_1();
promise = callback.promise;
}
options = getOptions$2(options);
return promise
};
if (!callback) {
callback = promisify_1();
promise = callback.promise;
}
if (maybeError(this, callback)) {
return promise
}
return promise
};
LevelUP.prototype.readStream =
LevelUP.prototype.createReadStream = function (options) {
options = immutable({ keys: true, values: true }, options);
if (typeof options.limit !== 'number') { options.limit = -1; }
return new levelIteratorStream(this.db.iterator(options), options)
};
LevelUP.prototype.keyStream =
LevelUP.prototype.createKeyStream = function (options) {
return this.createReadStream(immutable(options, { keys: true, values:
false }))
};
LevelUP.prototype.valueStream =
LevelUP.prototype.createValueStream = function (options) {
return this.createReadStream(immutable(options, { keys: false,
values: true }))
};
LevelUP.prototype.toString = function () {
return 'LevelUP'
};
LevelUP.prototype.type = 'levelup';
LevelUP.errors = errors;
var levelup = LevelUP.default = LevelUP;
var nextTickBrowser$1 = lib;
this.db = db;
this._ended = false;
this._nexting = false;
}
if (self._ended) {
nextTickBrowser$1(callback, new Error('cannot call next() after
end()'));
return self
}
if (self._nexting) {
nextTickBrowser$1(callback, new Error('cannot call next() before
previous next() has completed'));
return self
}
self._nexting = true;
self._next(function () {
self._nexting = false;
callback.apply(null, arguments);
});
return self
};
target = this.db._serializeKey(target);
this._seek(target);
};
if (this._ended) {
return nextTickBrowser$1(callback, new Error('end() already called
on iterator'))
}
this._ended = true;
this._end(callback);
};
this.db = db;
this._operations = [];
this._written = false;
}
AbstractChainedBatch$2.prototype._checkWritten = function () {
if (this._written) {
throw new Error('write() already called on this batch')
}
};
key = this.db._serializeKey(key);
value = this.db._serializeValue(value);
this._put(key, value);
return this
};
key = this.db._serializeKey(key);
this._del(key);
return this
};
AbstractChainedBatch$2.prototype.clear = function () {
this._checkWritten();
this._clear();
return this
};
AbstractChainedBatch$2.prototype._clear = function () {
this._operations = [];
};
this._written = true;
this._write(options, callback);
};
this.status = 'opening';
this._open(options, function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'open';
callback();
});
};
this.status = 'closing';
this._close(function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'closed';
callback();
});
};
key = this._serializeKey(key);
key = this._serializeKey(key);
value = this._serializeValue(value);
key = this._serializeKey(key);
if (!Array.isArray(array)) {
return nextTickBrowser$1(callback, new Error('batch(array) requires
an array argument'))
}
if (array.length === 0) {
return nextTickBrowser$1(callback)
}
var e = immutable(array[i]);
e.key = this._serializeKey(e.key);
e.value = this._serializeValue(e.value);
}
serialized[i] = e;
}
this._clear(options, callback);
};
next();
};
AbstractLevelDOWN$3.prototype._setupIteratorOptions = function
(options) {
options = cleanRangeOptions$1(this, options);
options.reverse = !!options.reverse;
options.keys = options.keys !== false;
options.values = options.values !== false;
options.limit = 'limit' in options ? options.limit : -1;
options.keyAsBuffer = options.keyAsBuffer !== false;
options.valueAsBuffer = options.valueAsBuffer !== false;
return options
};
if (isRangeOption$1(k)) {
// Note that we don't reject nullish and empty options here.
While
// those types are invalid as keys, they are valid as range
options.
opt = db._serializeKey(opt);
}
result[k] = opt;
}
return result
}
AbstractLevelDOWN$3.prototype._chainedBatch = function () {
return new abstractChainedBatch$1(this)
};
var abstractLeveldown$3 = {
AbstractLevelDOWN: AbstractLevelDOWN$4,
AbstractIterator: AbstractIterator$4,
AbstractChainedBatch: AbstractChainedBatch$3
};
if (prefix.gt) {
if (ogte !== undefined) {
xopts.gte = prefix.gt(ogte);
}
else xopts.gt = prefix.gt(opts.gt);
}
else if (gte) {
if (ogte !== undefined) {
xopts.gte = gte(ogte);
}
else xopts.gt = gte(opts.gt);
}
if (prefix.lt) {
if (olte !== undefined) {
xopts.lte = prefix.lt(olte);
}
else xopts.lt = prefix.lt(opts.lt);
}
else if (lte) {
if (olte !== undefined) {
xopts.lte = lte(olte);
}
else xopts.lt = lte(opts.lt);
}
return db
}
function none () {
return false
}
reachdown.is = is;
var reachdown_1 = reachdown;
return true
};
abstractLeveldown$3.AbstractIterator.call(this, db);
}
inherits_browser(SubIterator, abstractLeveldown$3.AbstractIterator);
this.db = db;
this.leveldown = null;
this.ownPrefix = separator + prefix + separator;
this.prefix = this.ownPrefix;
this._beforeOpen = opts.open;
this._wrap = {
gt: function (x) {
return concat(self.prefix, x || '', true)
},
lt: function (x) {
if (isBuffer$1(x) && !x.length) x = END;
return concat(self.prefix, x || '\xff')
}
};
abstractLeveldown$3.AbstractLevelDOWN.call(this);
}
inherits_browser(SubDown, abstractLeveldown$3.AbstractLevelDOWN);
SubDown.prototype.type = 'subleveldown';
this.db.open(function (err) {
if (err) return cb(err)
if (self._beforeOpen) self._beforeOpen(cb);
else cb();
});
};
return target
}
this.db = db;
this._ended = false;
this._nexting = false;
}
if (self._ended) {
nextTickBrowser$2(callback, new Error('cannot call next() after
end()'));
return self
}
if (self._nexting) {
nextTickBrowser$2(callback, new Error('cannot call next() before
previous next() has completed'));
return self
}
self._nexting = true;
self._next(function () {
self._nexting = false;
callback.apply(null, arguments);
});
return self
};
target = this.db._serializeKey(target);
this._seek(target);
};
AbstractIterator$5.prototype._seek = function (target) {};
if (this._ended) {
return nextTickBrowser$2(callback, new Error('end() already called
on iterator'))
}
this._ended = true;
this._end(callback);
};
this.db = db;
this._operations = [];
this._written = false;
}
AbstractChainedBatch$4.prototype._checkWritten = function () {
if (this._written) {
throw new Error('write() already called on this batch')
}
};
key = this.db._serializeKey(key);
value = this.db._serializeValue(value);
this._put(key, value);
return this
};
key = this.db._serializeKey(key);
this._del(key);
return this
};
AbstractChainedBatch$4.prototype.clear = function () {
this._checkWritten();
this._clear();
return this
};
AbstractChainedBatch$4.prototype._clear = function () {
this._operations = [];
};
this._written = true;
this._write(options, callback);
};
this.status = 'opening';
this._open(options, function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'open';
callback();
});
};
this.status = 'closing';
this._close(function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'closed';
callback();
});
};
AbstractLevelDOWN$5.prototype._close = function (callback) {
nextTickBrowser$2(callback);
};
key = this._serializeKey(key);
key = this._serializeKey(key);
value = this._serializeValue(value);
key = this._serializeKey(key);
if (!Array.isArray(array)) {
return nextTickBrowser$2(callback, new Error('batch(array) requires
an array argument'))
}
if (array.length === 0) {
return nextTickBrowser$2(callback)
}
var e = immutable(array[i]);
e.key = this._serializeKey(e.key);
e.value = this._serializeValue(e.value);
}
serialized[i] = e;
}
this._clear(options, callback);
};
next();
};
AbstractLevelDOWN$5.prototype._setupIteratorOptions = function
(options) {
options = cleanRangeOptions$2(this, options);
options.reverse = !!options.reverse;
options.keys = options.keys !== false;
options.values = options.values !== false;
options.limit = 'limit' in options ? options.limit : -1;
options.keyAsBuffer = options.keyAsBuffer !== false;
options.valueAsBuffer = options.valueAsBuffer !== false;
return options
};
if (isRangeOption$3(k)) {
// Note that we don't reject nullish and empty options here.
While
// those types are invalid as keys, they are valid as range
options.
opt = db._serializeKey(opt);
}
result[k] = opt;
}
return result
}
AbstractLevelDOWN$5.prototype._chainedBatch = function () {
return new abstractChainedBatch$2(this)
};
var abstractLeveldown$5 = {
AbstractLevelDOWN: AbstractLevelDOWN$6,
AbstractIterator: AbstractIterator$6,
AbstractChainedBatch: AbstractChainedBatch$5
};
exports.utf8 = exports['utf-8'] = {
encode: function (data) {
return isBinary(data) ? data : String(data)
},
decode: identity,
buffer: false,
type: 'utf8'
};
exports.json = {
encode: JSON.stringify,
decode: JSON.parse,
buffer: false,
type: 'json'
};
exports.binary = {
encode: function (data) {
return isBinary(data) ? data : Buffer.from(data)
},
decode: identity,
buffer: true,
type: 'binary'
};
exports.none = {
encode: identity,
decode: identity,
buffer: false,
type: 'id'
};
exports.id = exports.none;
var bufferEncodings = [
'hex',
'ascii',
'base64',
'ucs2',
'ucs-2',
'utf16le',
'utf-16le'
];
bufferEncodings.forEach(function (type) {
exports[type] = {
encode: function (data) {
return isBinary(data) ? data : Buffer.from(data, type)
},
decode: function (buffer) {
return buffer.toString(type)
},
buffer: true,
type: type
};
});
AbstractLevelDOWN$7.call(this, manifest);
this.supports.encodings = true;
this.supports.additionalMethods = {};
rangeMethods.forEach(function (m) {
// TODO (future major): remove this fallback
var fallback = typeof db[m] === 'function';
if (additionalMethods[m] || fallback) {
this.supports.additionalMethods[m] = true;
this.db = db;
this.codec = new levelCodec(opts);
}
inherits_browser(DB, AbstractLevelDOWN$7);
DB.prototype.type = 'encoding-down';
DB.prototype._serializeKey =
DB.prototype._serializeValue = function (datum) {
return datum
};
DB.prototype._chainedBatch = function () {
return new Batch$1(this)
};
inherits_browser(Iterator, AbstractIterator$7);
inherits_browser(Batch$1, AbstractChainedBatch$6);
Batch$1.prototype._clear = function () {
this.batch.clear();
};
this.db = db;
this._ended = false;
this._nexting = false;
}
if (self._ended) {
nextTickBrowser$3(callback, new Error('cannot call next() after
end()'));
return self
}
if (self._nexting) {
nextTickBrowser$3(callback, new Error('cannot call next() before
previous next() has completed'));
return self
}
self._nexting = true;
self._next(function () {
self._nexting = false;
callback.apply(null, arguments);
});
return self
};
target = this.db._serializeKey(target);
this._seek(target);
};
AbstractIterator$8.prototype._seek = function (target) {};
if (this._ended) {
return nextTickBrowser$3(callback, new Error('end() already called
on iterator'))
}
this._ended = true;
this._end(callback);
};
this.db = db;
this._operations = [];
this._written = false;
}
AbstractChainedBatch$7.prototype._checkWritten = function () {
if (this._written) {
throw new Error('write() already called on this batch')
}
};
key = this.db._serializeKey(key);
value = this.db._serializeValue(value);
this._put(key, value);
return this
};
key = this.db._serializeKey(key);
this._del(key);
return this
};
AbstractChainedBatch$7.prototype.clear = function () {
this._checkWritten();
this._clear();
return this
};
AbstractChainedBatch$7.prototype._clear = function () {
this._operations = [];
};
this._written = true;
this._write(options, callback);
};
this.status = 'opening';
this._open(options, function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'open';
callback();
});
};
this.status = 'closing';
this._close(function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'closed';
callback();
});
};
AbstractLevelDOWN$8.prototype._close = function (callback) {
nextTickBrowser$3(callback);
};
key = this._serializeKey(key);
key = this._serializeKey(key);
value = this._serializeValue(value);
key = this._serializeKey(key);
if (!Array.isArray(array)) {
return nextTickBrowser$3(callback, new Error('batch(array) requires
an array argument'))
}
if (array.length === 0) {
return nextTickBrowser$3(callback)
}
var e = immutable(array[i]);
e.key = this._serializeKey(e.key);
if (e.type === 'put') {
var valueErr = this._checkValue(e.value);
if (valueErr) return nextTickBrowser$3(callback, valueErr)
e.value = this._serializeValue(e.value);
}
serialized[i] = e;
}
this._clear(options, callback);
};
next();
};
AbstractLevelDOWN$8.prototype._setupIteratorOptions = function
(options) {
options = cleanRangeOptions$3(this, options);
options.reverse = !!options.reverse;
options.keys = options.keys !== false;
options.values = options.values !== false;
options.limit = 'limit' in options ? options.limit : -1;
options.keyAsBuffer = options.keyAsBuffer !== false;
options.valueAsBuffer = options.valueAsBuffer !== false;
return options
};
if (isRangeOption$4(k)) {
// Note that we don't reject nullish and empty options here.
While
// those types are invalid as keys, they are valid as range
options.
opt = db._serializeKey(opt);
}
result[k] = opt;
}
return result
}
/*!
*****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use
this file except in compliance with the License. You may obtain a copy
of the
License at http://www.apache.org/licenses/LICENSE-2.0
See the Apache Version 2.0 License for specific language governing
permissions
and limitations under the License.
***************************************************************************** */
function __awaiter$1(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try
{ step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"]
(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) :
new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments ||
[])).next());
});
}
class BrainKey {
constructor(options) {
this.crypto = options.crypto;
this.brainKeyCrypto = options.brainKeyCrypto;
this.pythiaClient = options.pythiaClient;
this.keyPairType = options.keyPairType;
}
generateKeyPair(password, brainKeyId) {
return __awaiter$1(this, void 0, void 0, function* () {
const { blindedPassword, blindingSecret } =
this.brainKeyCrypto.blind(password);
const seed = yield
this.pythiaClient.generateSeed(blindedPassword.toString('base64'), brainKeyId);
const deblindedPassword = this.brainKeyCrypto.deblind({
blindingSecret,
transformedPassword: seed,
});
return
this.crypto.generateKeysFromKeyMaterial(deblindedPassword, this.keyPairType);
});
}
}
class PythiaClient {
constructor(accessTokenProvider, apiUrl, virgilAgent) {
if (accessTokenProvider == null) {
throw new Error('`accessTokenProvider` is required');
}
this.accessTokenProvider = accessTokenProvider;
this.axios = axios$1.create({ baseURL: apiUrl ||
PythiaClient.DEFAULT_URL });
this.virgilAgent =
// eslint-disable-next-line @typescript-eslint/no-non-null-
assertion
virgilAgent || new VirgilAgent("pythia", "1.0.2");
this.axios.interceptors.response.use(undefined,
PythiaClient.onBadResponse);
}
generateSeed(blindedPassword, brainKeyId) {
return __awaiter$1(this, void 0, void 0, function* () {
const body = {
// eslint-disable-next-line
@typescript-eslint/camelcase
blinded_password: blindedPassword,
};
if (brainKeyId) {
// eslint-disable-next-line
@typescript-eslint/camelcase
body.brainkey_id = brainKeyId;
}
const accessToken = yield
this.accessTokenProvider.getToken({
service: 'pythia',
operation: 'seed',
});
const { data: { seed }, } = yield
this.axios.post('/pythia/v1/brainkey', body, {
headers: PythiaClient.getHeaders(this.virgilAgent,
accessToken),
});
return seed;
});
}
transformPassword(options) {
return __awaiter$1(this, void 0, void 0, function* () {
const body = {
// eslint-disable-next-line
@typescript-eslint/camelcase
blinded_password: options.blindedPassword,
// eslint-disable-next-line
@typescript-eslint/camelcase
user_id: options.salt,
};
if (typeof options.version === 'number' && !
Number.isNaN(options.version)) {
body.version = options.version;
}
if (typeof options.includeProof === 'boolean') {
// eslint-disable-next-line
@typescript-eslint/camelcase
body.include_proof = options.includeProof;
}
const accessToken = yield
this.accessTokenProvider.getToken({
service: 'pythia',
operation: 'password',
});
const {
// eslint-disable-next-line @typescript-eslint/camelcase
data: { transformed_password, proof }, } = yield
this.axios.post('/pythia/v1/password', body, {
headers: PythiaClient.getHeaders(this.virgilAgent,
accessToken),
});
const result = {
// eslint-disable-next-line
@typescript-eslint/camelcase
transformedPassword: transformed_password,
};
if (body.include_proof) {
result.proof = {
valueC: proof.value_c,
valueU: proof.value_u,
};
}
return result;
});
}
static getHeaders(virgilAgent, accessToken) {
return {
Authorization: `Virgil ${accessToken.toString()}`,
'Virgil-Agent': virgilAgent.value,
};
}
static onBadResponse(error) {
if (error.response) {
if (error.response.data) {
const message = error.response.data.message ||
error.response.statusText;
throw new PythiaClientError(message,
error.response.data.code, error.response.status);
}
throw new PythiaClientError(error.response.statusText,
undefined, error.response.status);
}
throw new PythiaError('Something bad happened. Please try again
later.');
}
}
PythiaClient.DEFAULT_URL = 'https://api.virgilsecurity.com';
/**
* BSD 3-Clause License
*
* Copyright (c) 2018-2020, Virgil Security, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
are met:
*
* * Redistributions of source code must retain the above copyright
notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
notice,
* this list of conditions and the following disclaimer in the
documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*!
*****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use
this file except in compliance with the License. You may obtain a copy
of the
License at http://www.apache.org/licenses/LICENSE-2.0
See the Apache Version 2.0 License for specific language governing
permissions
and limitations under the License.
***************************************************************************** */
/**
* @hidden
*/
function hasDuplicates(array) {
return new Set(array).size !== array.length;
}
/**
* @hidden
*/
function getObjectValues(obj) {
if (Object.values)
return Object.values(obj);
return Object.keys(obj).map(function (e) {
return obj[e];
});
}
/**
* @hidden
*
* Splits the `array` into separate chunks of the specified `size`
*
* @param array
* @param size
*/
function chunkArray(array, size) {
size = Math.max(size, 0);
const length = array == null ? 0 : array.length;
if (!length || size < 1) {
return [];
}
let index = 0;
let resIndex = 0;
const result = Array(Math.ceil(length / size));
while (index < length) {
result[resIndex++] = array.slice(index, (index += size));
}
return result;
}
/**
* Custom error class for errors specific to Virgil E3kit.
*/
class SdkError extends Error {
constructor(m, name = 'SdkError', DerivedClass = SdkError) {
super(m);
Object.setPrototypeOf(this, DerivedClass.prototype);
this.name = name;
}
}
/**
* Error thrown by {@link EThree.register} when identity is already
registered on Virgil Cloud.
* To load private key use EThree.restorePrivateKey or
EThree.rotatePrivateKey.
*/
class IdentityAlreadyExistsError extends SdkError {
constructor() {
super('This identity is already registered on Virgil Cloud. To
load private key use EThree.restorePrivateKey or EThree.rotatePrivateKey',
'IdentityAlreadyExistsError', IdentityAlreadyExistsError);
}
}
/**
* Error thrown by {@link Ethree.unregister} and {@link
EThree.rotatePrivateKey}
* when current identity of E3kit instance is not registered (i.e.
there is
* no Virgil Card for the current identity in Virgil Cloud).
*/
class RegisterRequiredError extends SdkError {
constructor() {
super('This identity is not registered',
'RegisterRequiredError', RegisterRequiredError);
}
}
/**
* Error thrown by {@link EThree.backupPrivateKey}, {@link
EThree.changePassword} and
* {@link EThree.resetPrivateKeyBackup} when user enters wrong
password.
*/
class WrongKeyknoxPasswordError extends SdkError {
constructor() {
super('Password from remote private key storage is invalid',
'WrongKeyknoxPasswordError', WrongKeyknoxPasswordError);
}
}
/**
* Error thrown by {@link EThree.rotatePrivateKey} and {@link
EThree.restorePrivateKey}
*/
class PrivateKeyAlreadyExistsError extends SdkError {
constructor() {
super('You already have a private key. Use EThree.cleanup() to
delete it. If you delete the last copy of the private key, you will not be able to
decrypt any information encrypted for this private key',
'PrivateKeyAlreadyExistsError', PrivateKeyAlreadyExistsError);
}
}
/**
* Error thrown by {@link EThree.resetPrivateKeyBackup} when backup
copy of private key doesn't exist
*/
class PrivateKeyNoBackupError extends SdkError {
constructor() {
super("Backup copy of private key doesn't exist",
'PrivateKeyNoBackupError', PrivateKeyNoBackupError);
}
}
/**
* Error thrown by {@link EThree.register}, {@link
EThree.rotatePrivateKey} and {@link EThree.lookupPublicKeys}
* when one user has more then one card.
*/
class MultipleCardsError extends SdkError {
constructor(identity) {
super(`There are several public keys registered with $
{identity}, which is not supported.`, 'MultipleCardsError', MultipleCardsError);
this.identity = identity;
}
}
/**
* Error thrown by {@link EThree.lookupPublicKeys} in case if some
identity missing or has multiple cards.
*
* @deprecated and will be removed in next major release.
*/
class LookupError extends SdkError {
constructor(lookupResult) {
super('Failed some public keys lookups. You can see the results
by calling error.lookupResult property of this error instance', 'LookupError',
LookupError);
this.lookupResult = lookupResult;
}
}
/**
* Error thrown by {@link EThree.lookupPublicKeys} in case if sought
identity is not registered.
*
* @deprecated and will be removed in next major release.
*/
class LookupNotFoundError extends SdkError {
constructor(identity) {
super(`${identity} not found`, 'LookupNotFoundError',
LookupNotFoundError);
this.identity = identity;
}
}
/**
* Error thrown by {@link EThree.decryptFile} in case if signature of
the file is not valid.
*/
class IntegrityCheckFailedError extends SdkError {
constructor(message) {
super(message, 'IntegrityCheckFailedError',
IntegrityCheckFailedError);
}
}
/**
* Error thrown by {@link EThree.decryptFile} or {@link
EThree.encryptFile} if user aborts an operation.
*/
class AbortError extends SdkError {
constructor() {
super('Operation aborted by user', 'AbortError', AbortError);
}
}
/**
* Error thrown by {@link EThree.findUsers} when some of the users's
Virgil Cards weren't found.
*/
class UsersNotFoundError extends SdkError {
constructor(identities) {
super("Virgil Cards of some of the users weren't found in
Virgil Cloud.\n" +
'Check the "identities" property of this error to see their
identites', 'UsersNotFoundError', UsersNotFoundError);
this.identities = identities;
}
}
/**
* Error thrown by {@link EThree.findUsers} when some of the users
found have more than one Virgil Card,
* which is not allowed.
*/
class UsersFoundWithMultipleCardsError extends SdkError {
constructor(identities) {
super('Some of the users have multiple Virgil Cards in Virgil
Cloud, which is not allowed.' +
'Check the "identities" property of this error to see their
identities', 'UsersFoundWithMultipleCardsError', UsersFoundWithMultipleCardsError);
this.identities = identities;
}
}
(function (GroupErrorCode) {
GroupErrorCode[GroupErrorCode["LocalGroupNotFound"] = 1] =
"LocalGroupNotFound";
GroupErrorCode[GroupErrorCode["PermissionDenied"] = 2] =
"PermissionDenied";
GroupErrorCode[GroupErrorCode["RemoteGroupNotFound"] = 3] =
"RemoteGroupNotFound";
GroupErrorCode[GroupErrorCode["InvalidGroup"] = 4] =
"InvalidGroup";
GroupErrorCode[GroupErrorCode["InvalidChangeParticipants"] = 5] =
"InvalidChangeParticipants";
GroupErrorCode[GroupErrorCode["InvalidParticipantsCount"] = 6] =
"InvalidParticipantsCount";
GroupErrorCode[GroupErrorCode["DataVerificationFailed"] = 7] =
"DataVerificationFailed";
GroupErrorCode[GroupErrorCode["GroupIdTooShort"] = 8] =
"GroupIdTooShort";
GroupErrorCode[GroupErrorCode["MessageNotFromThisGroup"] = 9] =
"MessageNotFromThisGroup";
GroupErrorCode[GroupErrorCode["GroupIsOutdated"] = 10] =
"GroupIsOutdated";
GroupErrorCode[GroupErrorCode["NoAccess"] = 11] = "NoAccess";
GroupErrorCode[GroupErrorCode["ParticipantAlreadyAdded"] = 12] =
"ParticipantAlreadyAdded";
})(exports.GroupErrorCode || (exports.GroupErrorCode = {}));
class GroupError extends SdkError {
constructor(errorCode, message) {
super(message, 'GroupError', GroupError);
this.errorCode = errorCode;
}
}
/**
* Error thrown when an attempt is made to retrieve the private key
from the
* device's persistent storage, but no private key exists.
*
* Thrown by {@link EThree.encrypt}, {@link EThree.decrypt}, {@link
EThree.backupPrivateKey},
* {@link EThree.createGroup}, {@link EThree.loadGroup}, {@link
EThree.getGroup},
* {@link Group.encrypt}, {@link Group.decrypt}, {@link Group.update},
{@link Group.add},
* {@link Group.remove} and {@link Group.reAdd}.
*/
class MissingPrivateKeyError extends SdkError {
constructor() {
super('No private key found on the device. You should call
"register()" of "restorePrivateKey()"', 'MissingPrivateKeyError',
MissingPrivateKeyError);
}
}
/**
* @hidden
*/
const isArray$3 = (val) => {
return Array.isArray(val);
};
/**
* @hidden
*/
const isString$2 = (val) => {
return typeof val === 'string';
};
/**
* @hidden
*/
function isObject$3(obj) {
return typeof obj === 'object' && obj !== null;
}
/**
* @hidden
*/
function isVirgilCard(obj) {
return isObject$3(obj) && 'identity' in obj && 'publicKey' in obj;
}
/**
* @hidden
*/
function isFindUsersResult(obj) {
if (!isObject$3(obj))
return false;
const values = getObjectValues(obj);
if (values.length === 0)
return false;
return values.every(val => isVirgilCard(val));
}
/**
* @hidden
*/
function isLookupResult(obj, isPublicKeyFn) {
if (!isObject$3(obj))
return false;
const values = getObjectValues(obj);
if (values.length === 0)
return false;
return values.every(val => isPublicKeyFn(val));
}
/**
* @hidden
*/
const DEFAULT_STORAGE_NAME = '.virgil-local-storage';
/**
* @hidden
*/
const DEFAULT_GROUP_STORAGE_NAME = '.virgil-group-storage';
/**
* @hidden
*/
const DEFAULT_API_URL = 'https://api.virgilsecurity.com';
/**
* @hidden
*/
const MAX_IDENTITIES_TO_SEARCH = 50;
/**
* @hidden
*/
const CLOUD_GROUP_SESSIONS_ROOT = 'group-sessions';
/**
* @hidden
*/
const VALID_GROUP_PARTICIPANT_COUNT_RANGE = [1, 100];
/**
* @hidden
*/
const MAX_EPOCHS_IN_GROUP_SESSION = 50;
function warn(message) {
if (typeof console !== 'undefined' && typeof console.warn ===
'function') {
console.warn(message);
}
}
/**
* @hidden
*/
function getCardActiveAtMoment(card, activeAt) {
if (!activeAt) {
return card;
}
const activeAtDate = new Date(activeAt);
if (!isValidDate(activeAtDate)) {
throw new TypeError('Cannot get active card. Second argument,
if provided, must be a Date or a timestamp');
}
let actualCard = card;
while (actualCard && actualCard.createdAt > activeAt) {
actualCard = actualCard.previousCard;
}
if (!actualCard) {
throw new Error('The given sender Virgil Card is newer than the
encrypted data.' +
'This may happen if they un-registered and registered again
with the same identity.' +
'Try loading their Virgil Card by its ID.');
}
return actualCard;
}
/**
* @hidden
*/
const getCardsArray = (cardOrFindUsersResult) => {
if (isVirgilCard(cardOrFindUsersResult)) {
return [cardOrFindUsersResult];
}
if (isFindUsersResult(cardOrFindUsersResult)) {
return getObjectValues(cardOrFindUsersResult);
}
return [];
};
/**
* @hidden
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const isInteger = (val) => {
if (Number.isInteger)
return Number.isInteger(val);
return typeof val === 'number' && isFinite(val) && Math.floor(val)
=== val;
};
/**
* @hidden
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const isSafeInteger = (val) => {
if (Number.isSafeInteger)
return Number.isSafeInteger(val);
return isInteger(val) && Math.abs(val) <= Number.MAX_SAFE_INTEGER;
};
/**
* @hidden
*/
const isNumberInRange = (num, range) => {
return typeof num === 'number' && num >= range[0] && num <=
range[1];
};
/**
* @hidden
*/
const setDifference = (a, b) => {
return new Set([...a].filter(it => !b.has(it)));
};
class GroupManager {
constructor({ identity, privateKeyLoader, cardManager,
groupLocalStorage, }) {
this._selfIdentity = identity;
this._privateKeyLoader = privateKeyLoader;
this._cardManager = cardManager;
this._localGroupStorage = groupLocalStorage;
}
store(ticket, cards) {
return __awaiter$2(this, void 0, void 0, function* () {
const cloudTicketStorage = yield
this.getCloudTicketStorage();
yield cloudTicketStorage.store(ticket.groupSessionMessage,
cards);
const group = new Group({
initiator: this.selfIdentity,
tickets: [ticket],
privateKeyLoader: this._privateKeyLoader,
cardManager: this._cardManager,
groupManager: this,
});
const localGroupStorage = yield
this.getLocalGroupStorage();
localGroupStorage.store({
info: { initiator: this.selfIdentity },
tickets: [ticket],
});
return group;
});
}
pull(sessionId, initiatorCard) {
return __awaiter$2(this, void 0, void 0, function* () {
const localGroupStorage = yield
this.getLocalGroupStorage();
let cloudTickets;
try {
const cloudTicketStorage = yield
this.getCloudTicketStorage();
cloudTickets = yield
cloudTicketStorage.retrieve(sessionId, initiatorCard.identity,
initiatorCard.publicKey);
}
catch (err) {
if (err.name === 'GroupTicketDoesntExistError' ||
err.name === 'GroupTicketNoAccessError') {
yield localGroupStorage.delete(sessionId);
}
switch (err.name) {
case 'GroupTicketDoesntExistError':
throw new
GroupError(exports.GroupErrorCode.NoAccess, 'Current user has no access to the
group ticket');
case 'GroupTicketNoAccessError':
throw new
GroupError(exports.GroupErrorCode.RemoteGroupNotFound, 'Group with given id and
initiator could not be found');
default:
throw err;
}
}
const initiator = initiatorCard.identity;
const tickets = cloudTickets.map(ct => ({
groupSessionMessage: ct.groupSessionMessageInfo,
participants: ct.identities,
}));
const group = new Group({
initiator,
tickets,
privateKeyLoader: this._privateKeyLoader,
cardManager: this._cardManager,
groupManager: this,
});
localGroupStorage.store({ info: { initiator }, tickets });
return group;
});
}
retrieve(sessionId, epochNumber) {
return __awaiter$2(this, void 0, void 0, function* () {
const options = isSafeInteger(epochNumber)
? { epochNumber }
: { ticketCount: MAX_EPOCHS_IN_GROUP_SESSION };
const localGroupStorage = yield
this.getLocalGroupStorage();
try {
const rawGroup = yield
localGroupStorage.retrieve(sessionId, options);
if (!rawGroup)
return null;
return new Group({
initiator: rawGroup.info.initiator,
tickets: rawGroup.tickets,
privateKeyLoader: this._privateKeyLoader,
cardManager: this._cardManager,
groupManager: this,
});
}
catch (error) {
if (error.name === 'GroupTicketNoAccessError') {
throw new
GroupError(exports.GroupErrorCode.NoAccess, 'Current user has no access to the
group ticket');
}
throw error;
}
});
}
addAccess(sessionId, allowedCards) {
return __awaiter$2(this, void 0, void 0, function* () {
const cloudTicketStorage = yield
this.getCloudTicketStorage();
const localGroupStorage = yield
this.getLocalGroupStorage();
try {
yield cloudTicketStorage.addRecipients(sessionId,
allowedCards);
yield localGroupStorage.addParticipants(sessionId,
allowedCards.map(card => card.identity));
}
catch (error) {
if (error.name === 'GroupTicketNoAccessError') {
throw new
GroupError(exports.GroupErrorCode.NoAccess, 'Current user has no access to the
group ticket');
}
throw error;
}
});
}
removeAccess(sessionId, forbiddenIdentities) {
return __awaiter$2(this, void 0, void 0, function* () {
const cloudTicketStorage = yield
this.getCloudTicketStorage();
yield Promise.all(forbiddenIdentities.map(identity =>
cloudTicketStorage.removeRecipient(sessionId, identity)));
});
}
delete(sessionId) {
return __awaiter$2(this, void 0, void 0, function* () {
const cloudTicketStorage = yield
this.getCloudTicketStorage();
yield cloudTicketStorage.delete(sessionId);
const localGroupStorage = yield
this.getLocalGroupStorage();
yield localGroupStorage.delete(sessionId);
});
}
reAddAccess(sessionId, allowedCard) {
return __awaiter$2(this, void 0, void 0, function* () {
const cloudTicketStorage = yield
this.getCloudTicketStorage();
try {
yield cloudTicketStorage.reAddRecipient(sessionId,
allowedCard);
}
catch (error) {
if (error.name === 'GroupTicketNoAccessError') {
throw new
GroupError(exports.GroupErrorCode.NoAccess, 'Current user has no access to the
group ticket');
}
throw error;
}
});
}
cleanup() {
return __awaiter$2(this, void 0, void 0, function* () {
const localGroupStorage = yield
this.getLocalGroupStorage();
yield localGroupStorage.reset();
});
}
get selfIdentity() {
return this._selfIdentity;
}
getLocalGroupStorage() {
return __awaiter$2(this, void 0, void 0, function* () {
const keyPair = yield
this._privateKeyLoader.loadLocalKeyPair();
if (keyPair) {
this._localGroupStorage.setEncryptionKeyPair(keyPair);
}
return this._localGroupStorage;
});
}
getCloudTicketStorage() {
return __awaiter$2(this, void 0, void 0, function* () {
const keyPair = yield
this._privateKeyLoader.loadLocalKeyPair();
if (!keyPair) {
throw new MissingPrivateKeyError();
}
const { virgilCrypto, accessTokenProvider, apiUrl } =
this._privateKeyLoader.options;
const keyknoxManager = new g(new k(virgilCrypto), new
p(accessTokenProvider, apiUrl, undefined,
// eslint-disable-next-line @typescript-eslint/no-non-null-
assertion
new VirgilAgent("e3kit", "2.4.5")));
return new m(Object.assign({ root:
CLOUD_GROUP_SESSIONS_ROOT, identity: this.selfIdentity, keyknoxManager },
keyPair));
});
}
}
class GroupLocalStorage {
constructor({ identity, virgilCrypto, leveldown }) {
this._encryptionLevel = new VirgilEncryptDown(leveldown,
{ virgilCrypto });
const rootLevel = levelup(this._encryptionLevel);
const identityLevel = subleveldown(rootLevel, identity);
this._db = subleveldown(identityLevel, 'GROUPS',
{ valueEncoding: 'json' });
}
store(rawGroup) {
return __awaiter$2(this, void 0, void 0, function* () {
const lastTicket = rawGroup.tickets[rawGroup.tickets.length
- 1];
if (!lastTicket) {
throw new Error('Attempted to store group without
tickets.');
}
const { sessionId } = lastTicket.groupSessionMessage;
const insertInfo = {
type: 'put',
key: sessionId,
value: rawGroup.info,
};
const insertTickets = rawGroup.tickets.map(ticket => ({
type: 'put',
key: this.getTicketKey(sessionId,
ticket.groupSessionMessage.epochNumber),
value: ticket,
}));
yield this._db.batch([insertInfo, ...insertTickets]);
});
}
retrieve(sessionId, options) {
return __awaiter$2(this, void 0, void 0, function* () {
const hasTicketCount = typeof options.ticketCount ===
'number';
const hasEpochNumber = typeof options.epochNumber ===
'number';
if (hasTicketCount === hasEpochNumber) {
throw new Error('Either "ticketCount" or "epochNumber"
option must be provided');
}
const [info, tickets] = yield Promise.all([
this.retrieveGroupInfo(sessionId),
options.ticketCount
? this.retrieveNLastTickets(sessionId,
options.ticketCount)
: // eslint-disable-next-line
@typescript-eslint/no-non-null-assertion
this.retrieveTicketByEpochNumber(sessionId,
options.epochNumber),
]);
if (!info || tickets.length === 0)
return null;
return { info, tickets };
});
}
delete(sessionId) {
return __awaiter$2(this, void 0, void 0, function* () {
const prefix = sessionId;
yield this._db.clear({
gt: prefix,
lte: prefix + '\xff',
});
});
}
reset() {
return __awaiter$2(this, void 0, void 0, function* () {
yield this._db.clear();
});
}
addParticipants(sessionId, participants) {
return __awaiter$2(this, void 0, void 0, function* () {
const [ticket] = yield this.retrieveNLastTickets(sessionId,
1);
const newTicket = {
participants: ticket.participants.concat(participants),
groupSessionMessage: ticket.groupSessionMessage,
};
const key = this.getTicketKey(sessionId,
ticket.groupSessionMessage.epochNumber);
// TODO: figure out why 'this._db.put' doesn't work
// await this._db.put(key, newTicket);
yield this._db.batch([{ type: 'put', key, value:
newTicket }]);
});
}
setEncryptionKeyPair(keyPair) {
this._encryptionLevel.setKeyPair(keyPair);
}
retrieveGroupInfo(sessionId) {
return __awaiter$2(this, void 0, void 0, function* () {
try {
return yield this._db.get(sessionId);
}
catch (err) {
if (err.notFound) {
return null;
}
throw err;
}
});
}
retrieveNLastTickets(sessionId, ticketCount) {
return new Promise((resolve, reject) => {
const tickets = [];
let error = undefined;
const prefix = sessionId + '!';
this._db
.createReadStream({
gt: prefix,
lte: prefix + '\xff',
reverse: true,
limit: ticketCount,
})
.on('data', data => tickets.unshift(data.value))
.on('error', err => (error = err))
.on('end', () => (error ? reject(error) :
resolve(tickets)));
});
}
retrieveTicketByEpochNumber(sessionId, epochNumber) {
return __awaiter$2(this, void 0, void 0, function* () {
const key = this.getTicketKey(sessionId, epochNumber);
try {
const ticket = yield this._db.get(key);
return [ticket];
}
catch (err) {
if (err.notFound) {
return [];
}
throw err;
}
});
}
getTicketKey(sessionId, epochNumber) {
// The structure of the ticket key:
// `<session_id>!
<number_of_digits_in_epoch_number_encoded_as_single_char>!<epoch_number>`
// The reasoning:
// keys in LevelDB are stored in alphabetical (lexicographic)
order,
// which means that if we just put the epoch number in the key
we'll
// start getting wrong results when reading a stream of tickets
because
// '11' is less than '2', for example.
// Storing the number of digits in the key allows us to only
compare
// epochs with the same number of digits to each other and have
tickets
// with larger number of digits always be greater than the ones
with fewer digits.
// Since number of digits is also a number and hence
susceptible to the
// same problem, we encode it in base 36 to get a single
character so we
// can handle epoch numbers with up to 35 digits in them (which
is more than
// necessary since epoch number is uint32 in the virgil crypto
library)
const epochNumberStr = String(epochNumber);
const epochNumberEncodedLength =
epochNumberStr.length.toString(36);
return `${sessionId}!${epochNumberEncodedLength}!$
{epochNumberStr}`;
}
}
class AbstractEThree {
/**
* @hidden
*/
constructor(options) {
this.inProcess = false;
this.identity = options.identity;
this.virgilCrypto = options.virgilCrypto;
this.cardManager = options.cardManager;
this.accessTokenProvider = options.accessTokenProvider;
this.keyEntryStorage = options.keyEntryStorage;
this.keyLoader = options.keyLoader;
this.groupManager = new GroupManager({
identity: options.identity,
privateKeyLoader: options.keyLoader,
cardManager: options.cardManager,
groupLocalStorage: new GroupLocalStorage({
identity: options.identity,
leveldown: options.groupStorageLeveldown,
virgilCrypto: options.virgilCrypto,
}),
});
this.keyPairType = options.keyPairType;
}
/**
* Registers current user in Virgil Cloud. Saves private key
locally and uploads public key to the cloud.
*/
register(keyPair) {
return __awaiter$2(this, void 0, void 0, function* () {
if (this.inProcess) {
this.throwIllegalInvocationError('register');
}
this.inProcess = true;
try {
const [cards, privateKey] = yield Promise.all([
this.cardManager.searchCards(this.identity),
this.keyLoader.loadLocalPrivateKey(),
]);
if (cards.length > 1)
throw new MultipleCardsError(this.identity);
if (cards.length > 0)
throw new IdentityAlreadyExistsError();
if (privateKey)
yield this.keyLoader.resetLocalPrivateKey();
yield this.publishCardThenSavePrivateKeyLocal({ keyPair
});
}
finally {
this.inProcess = false;
}
});
}
/**
* Generates a new private key and saves locally. Replaces old
public key with new one in Cloud.
* Used in case if old private key is lost.
*/
rotatePrivateKey() {
return __awaiter$2(this, void 0, void 0, function* () {
if (this.inProcess) {
this.throwIllegalInvocationError('rotatePrivateKey');
}
this.inProcess = true;
try {
const [cards, privateKey] = yield Promise.all([
this.cardManager.searchCards(this.identity),
this.keyLoader.loadLocalPrivateKey(),
]);
if (cards.length === 0)
throw new RegisterRequiredError();
if (cards.length > 1)
throw new MultipleCardsError(this.identity);
if (privateKey)
throw new PrivateKeyAlreadyExistsError();
yield
this.publishCardThenSavePrivateKeyLocal({ previousCard: cards[0] });
}
finally {
this.inProcess = false;
}
});
}
/**
* Downloads private key from Virgil Cloud. Use
[[backupPrivateKey]] to upload the key first.
* @param pwd User password for access to Virgil Keyknox Storage.
* @param keyName Is a name for the key backup in the cloud.
*/
restorePrivateKey(pwd, keyName) {
return __awaiter$2(this, void 0, void 0, function* () {
try {
yield this.keyLoader.restorePrivateKey(pwd, keyName);
}
catch (e) {
if (e instanceof KeyEntryAlreadyExistsError) {
throw new PrivateKeyAlreadyExistsError();
}
throw e;
}
});
}
/**
* Deletes local private key from key storage. Make sure
[[backupPrivateKey]] method was called
* first.
*/
cleanup() {
return __awaiter$2(this, void 0, void 0, function* () {
yield this.keyLoader.resetLocalPrivateKey();
yield this.onPrivateKeyDeleted();
});
}
resetPrivateKeyBackup(pwd) {
return __awaiter$2(this, void 0, void 0, function* () {
if (!pwd) {
return yield this.keyLoader.resetAll();
}
warn(`'resetPrivateKeyBackup(pwd: string)' was deprecated.
Please use 'resetPrivateKeyBackup()' instead.`);
return this.keyLoader.resetPrivateKeyBackup(pwd);
});
}
/**
* Delete private key saved in Virgil Keyknox Storage.
* @returns {Promise<void>} - Promise that is resolved if
everything went fine.
*/
resetPrivateKeyBackupWithKeyName(keyName) {
return __awaiter$2(this, void 0, void 0, function* () {
return
this.keyLoader.resetPrivateKeyBackupWithKeyName(keyName);
});
}
encrypt(message, recipients) {
return __awaiter$2(this, void 0, void 0, function* () {
const shouldReturnString = isString$2(message);
const privateKey = yield
this.keyLoader.loadLocalPrivateKey();
if (!privateKey) {
throw new MissingPrivateKeyError();
}
const publicKeys =
this.getPublicKeysForEncryption(privateKey, recipients);
if (!publicKeys) {
throw new TypeError('Could not get public keys from the
second argument.\n' +
'Make sure you pass the resolved value of
"EThree.findUsers" or "EThree.lookupPublicKeys" methods ' +
'when encrypting for other users, or nothing when
encrypting for the current user only.');
}
const res = this.virgilCrypto.signThenEncrypt(message,
privateKey, publicKeys);
if (shouldReturnString) {
return res.toString('base64');
}
return res;
});
}
decrypt(message, senderCardOrPublicKey, encryptedAt) {
return __awaiter$2(this, void 0, void 0, function* () {
const shouldReturnString = isString$2(message);
const privateKey = yield
this.keyLoader.loadLocalPrivateKey();
if (!privateKey) {
throw new MissingPrivateKeyError();
}
const senderPublicKey =
this.getPublicKeyForVerification(privateKey, senderCardOrPublicKey, encryptedAt);
if (!senderPublicKey) {
throw new TypeError('Could not get public key from the
second argument.' +
'Expected a Virgil Card or a Public Key object. Got
' +
typeof senderCardOrPublicKey);
}
const res = this.virgilCrypto.decryptThenVerify(message,
privateKey, senderPublicKey);
if (shouldReturnString) {
return res.toString('utf8');
}
return res;
});
}
authEncrypt(arg0, arg1) {
return __awaiter$2(this, void 0, void 0, function* () {
const returnString = isString$2(arg0);
const privateKey = yield
this.keyLoader.loadLocalPrivateKey();
if (!privateKey) {
throw new MissingPrivateKeyError();
}
const publicKeys =
this.getPublicKeysForEncryption(privateKey, arg1);
if (!publicKeys) {
throw new TypeError('Could not get public keys from the
second argument.\n' +
'Make sure you pass the resolved value of the
"EThree.findUsers" method ' +
'when encrypting for other users, or nothing when
encrypting for the current user only.');
}
const encryptedData =
this.virgilCrypto.signAndEncrypt(arg0, privateKey, publicKeys, true);
if (returnString) {
return encryptedData.toString('base64');
}
return encryptedData;
});
}
authDecrypt(arg0, arg1, arg2) {
return __awaiter$2(this, void 0, void 0, function* () {
const returnString = isString$2(arg0);
const privateKey = yield
this.keyLoader.loadLocalPrivateKey();
if (!privateKey) {
throw new MissingPrivateKeyError();
}
const senderPublicKey =
this.getPublicKeyForVerification(privateKey, arg1, arg2);
if (!senderPublicKey) {
throw new TypeError('Could not get public key from the
second argument.' +
'Expected a Virgil Card or a Public Key object. Got
' +
typeof arg1);
}
const decryptedData =
this.virgilCrypto.decryptAndVerify(arg0, privateKey, senderPublicKey);
if (returnString) {
return decryptedData.toString('utf8');
}
return decryptedData;
});
}
findUsers(identities) {
return __awaiter$2(this, void 0, void 0, function* () {
if (!identities) {
throw new TypeError('Argument "identities" is
required');
}
let identitySet;
if (typeof identities === 'string') {
identitySet = new Set([identities]);
}
else if (isArray$3(identities)) {
identitySet = new Set(identities);
}
else {
throw new TypeError(`Expected "identities" to be a
string or an array of strings. Got: "${typeof identities}"`);
}
if (identitySet.size === 0) {
throw new TypeError('"identities" array must not be
empty');
}
const result = Object.create({});
const identitiesWithMultipleCards = new Set();
const identityChunks = chunkArray(Array.from(identitySet),
MAX_IDENTITIES_TO_SEARCH);
for (const identityChunk of identityChunks) {
const cards = yield
this.cardManager.searchCards(identityChunk);
for (const card of cards) {
if (result[card.identity]) {
identitiesWithMultipleCards.add(card.identity);
}
result[card.identity] = card;
}
}
const identitiesFound = new Set(Object.keys(result));
const identitiesNotFound = new
Set([...identitySet].filter(i => !identitiesFound.has(i)));
if (identitiesNotFound.size > 0) {
throw new UsersNotFoundError([...identitiesNotFound]);
}
if (identitiesWithMultipleCards.size > 0) {
throw new
UsersFoundWithMultipleCardsError([...identitiesWithMultipleCards]);
}
if (isArray$3(identities)) {
return result;
}
return result[identities];
});
}
lookupPublicKeys(identities) {
return __awaiter$2(this, void 0, void 0, function* () {
warn('Warning! Method "lookupPublicKeys" has been
deprecated, use "findUsers" instead');
const argument = isArray$3(identities) ? identities :
[identities];
if (argument.length === 0) {
throw new Error('Array should be non empty');
}
if (hasDuplicates(argument)) {
throw new Error('Identities in array should be
unique');
}
const cards = yield this.cardManager.searchCards(argument);
const result = {};
const resultWithErrors = {};
for (const identity of argument) {
const filteredCards = cards.filter(card =>
card.identity === identity);
if (filteredCards.length === 0) {
resultWithErrors[identity] = new
LookupNotFoundError(identity);
}
else if (filteredCards.length > 1) {
resultWithErrors[identity] = new
MultipleCardsError(identity);
}
else {
result[identity] = filteredCards[0].publicKey;
}
}
if (getObjectValues(resultWithErrors).length !== 0) {
throw new LookupError(Object.assign(Object.assign({},
resultWithErrors), result));
}
if (Array.isArray(identities)) {
return result;
}
return result[identities];
});
}
/**
* Changes password for access to current user private key backup.
* @param oldPwd users old password
* @param newPwd users new password
*/
changePassword(oldPwd, newPwd, keyName) {
return __awaiter$2(this, void 0, void 0, function* () {
return yield this.keyLoader.changePassword(oldPwd, newPwd,
keyName);
});
}
/**
* Uploads current user private key to Virgil Keyknox Storage.
* @param pwd User password for access to Virgil Keyknox Storage
* @param keyName Is a name that would be used to store backup in
the cloud.
*/
backupPrivateKey(pwd, keyName) {
return __awaiter$2(this, void 0, void 0, function* () {
const privateKey = yield
this.keyLoader.loadLocalPrivateKey();
if (!privateKey) {
throw new MissingPrivateKeyError();
}
yield this.keyLoader.savePrivateKeyRemote(privateKey, pwd,
keyName);
return;
});
}
/**
* Checks if current user has private key saved locally.
*/
hasLocalPrivateKey() {
return this.keyLoader.hasPrivateKey();
}
/**
* Unregister current user. Revokes public key in Virgil Cloud and
deletes local private key.
*
* @throws {RegisterRequiredError} If current user is not
registered (i.e.
* there is no Virgil Card for this
identity)
* @throws {MultipleCardsError} If there is more than one Virgil
Card for this identity
*/
unregister() {
return __awaiter$2(this, void 0, void 0, function* () {
if (this.inProcess) {
this.throwIllegalInvocationError('unregister');
}
this.inProcess = true;
try {
const cards = yield
this.cardManager.searchCards(this.identity);
if (cards.length === 0) {
throw new RegisterRequiredError();
}
for (const card of cards) {
yield this.cardManager.revokeCard(card.id);
}
yield this.keyLoader.resetLocalPrivateKey();
yield this.onPrivateKeyDeleted();
}
finally {
this.inProcess = false;
}
});
}
createGroup(groupId, participants) {
return __awaiter$2(this, void 0, void 0, function* () {
let participantIdentities = new Set();
let participantCards = [];
if (isVirgilCard(participants)) {
participantIdentities = new
Set([participants.identity]);
participantCards = [participants];
}
else if (isFindUsersResult(participants)) {
participantIdentities = new
Set(Object.keys(participants));
participantCards = getObjectValues(participants);
}
else if (typeof participants !== 'undefined') {
throw new TypeError('Expected participants to be the
result of "findUsers" method call or to be "typeof undefined"');
}
participantIdentities.add(this.identity);
if (!isValidParticipantCount(participantIdentities.size)) {
throw new
GroupError(exports.GroupErrorCode.InvalidParticipantsCount, `Cannot create group
with ${participantIdentities.size} participant(s). Group can have $
{VALID_GROUP_PARTICIPANT_COUNT_RANGE[0]} to $
{VALID_GROUP_PARTICIPANT_COUNT_RANGE[1]} participants.`);
}
const groupSession =
this.virgilCrypto.generateGroupSession(groupId);
const ticket = {
groupSessionMessage: {
epochNumber: groupSession.getCurrentEpochNumber(),
sessionId: groupSession.getSessionId(),
data: groupSession.export()[0].toString('base64'),
},
participants: [...participantIdentities],
};
return yield this.groupManager.store(ticket,
participantCards);
});
}
loadGroup(groupId, initiatorCard) {
return __awaiter$2(this, void 0, void 0, function* () {
const sessionId =
this.virgilCrypto.calculateGroupSessionId(groupId);
return yield this.groupManager.pull(sessionId,
initiatorCard);
});
}
getGroup(groupId) {
return __awaiter$2(this, void 0, void 0, function* () {
const sessionId =
this.virgilCrypto.calculateGroupSessionId(groupId);
return yield this.groupManager.retrieve(sessionId);
});
}
deleteGroup(groupId) {
return __awaiter$2(this, void 0, void 0, function* () {
const sessionId =
this.virgilCrypto.calculateGroupSessionId(groupId);
yield this.groupManager.delete(sessionId);
});
}
/**
* @hidden
*/
publishCardThenSavePrivateKeyLocal(options) {
return __awaiter$2(this, void 0, void 0, function* () {
const { keyPair, previousCard } = options;
const myKeyPair = keyPair ||
this.virgilCrypto.generateKeys(this.keyPairType);
const card = yield this.cardManager.publishCard({
privateKey: myKeyPair.privateKey,
publicKey: myKeyPair.publicKey,
previousCardId: previousCard ? previousCard.id :
undefined,
});
yield
this.keyLoader.savePrivateKeyLocal(myKeyPair.privateKey);
return {
card,
keyPair: myKeyPair,
};
});
}
/**
* @hidden
*/
isOwnPublicKeyIncluded(ownPublicKey, publicKeys) {
const selfPublicKey =
this.virgilCrypto.exportPublicKey(ownPublicKey).toString('base64');
const stringKeys = publicKeys.map(key =>
this.virgilCrypto.exportPublicKey(key).toString('base64'));
return stringKeys.some(key => key === selfPublicKey);
}
throwIllegalInvocationError(method) {
throw new Error(`Calling ${method} two or more times in a row
is not allowed.`);
}
/**
* @hidden
*/
addOwnPublicKey(privateKey, publicKeys) {
const ownPublicKey =
this.virgilCrypto.extractPublicKey(privateKey);
if (!this.isOwnPublicKeyIncluded(ownPublicKey, publicKeys)) {
publicKeys.push(ownPublicKey);
}
}
/**
* @hidden
*/
onPrivateKeyDeleted() {
return __awaiter$2(this, void 0, void 0, function* () {
yield this.groupManager.cleanup();
});
}
/**
* @hidden
*/
getPublicKeysForEncryption(ownPrivateKey, recipients) {
let publicKeys;
if (recipients == null) {
publicKeys = [];
}
else if (isVirgilCard(recipients)) {
publicKeys = [recipients.publicKey];
}
else if (isFindUsersResult(recipients)) {
publicKeys = getObjectValues(recipients).map((card) =>
card.publicKey);
}
else if (this.isPublicKey(recipients)) {
warn('Warning! Calling `encrypt` with the result of
`lookupPublicKeys` method has been deprecated. ' +
'Please use the result of `findUsers` call instead');
publicKeys = [recipients];
}
else if (isLookupResult(recipients,
this.isPublicKey.bind(this))) {
warn('Warning! Calling `encrypt` with the result of
`lookupPublicKeys` method has been deprecated. ' +
'Please use the result of `findUsers` call instead');
publicKeys = getObjectValues(recipients).map((publicKey) =>
publicKey);
}
else {
return null;
}
this.addOwnPublicKey(ownPrivateKey, publicKeys);
return publicKeys;
}
/**
* @hidden
*/
getPublicKeyForVerification(ownPrivateKey, senderCardOrPublicKey,
encryptedAt) {
if (senderCardOrPublicKey == null) {
return this.virgilCrypto.extractPublicKey(ownPrivateKey);
}
if (isVirgilCard(senderCardOrPublicKey)) {
return encryptedAt
? getCardActiveAtMoment(senderCardOrPublicKey,
encryptedAt).publicKey
: senderCardOrPublicKey.publicKey;
}
if (this.isPublicKey(senderCardOrPublicKey)) {
return senderCardOrPublicKey;
}
return null;
}
}
/**
* @hidden
*/
class PrivateKeyLoader {
constructor(identity, options) {
this.identity = identity;
this.options = options;
this.keyknoxClient = new p(this.options.accessTokenProvider,
this.options.apiUrl, undefined,
// eslint-disable-next-line @typescript-eslint/no-non-null-
assertion
new VirgilAgent("e3kit", "2.4.5"));
this.keyknoxCrypto = new k(this.options.virgilCrypto);
this.cachedPrivateKey = null;
this.handleResetError = (e) => {
if (e instanceof c) {
throw new PrivateKeyNoBackupError();
}
throw e;
};
this.localStorage = options.keyEntryStorage;
}
savePrivateKeyRemote(privateKey, password, keyName) {
return __awaiter$2(this, void 0, void 0, function* () {
const storage = yield this.getStorage(password,
isString$2(keyName));
return yield storage.storeEntry(this.identity,
this.options.virgilCrypto.exportPrivateKey(privateKey).toString('base64'),
keyName);
});
}
savePrivateKeyLocal(privateKey) {
return __awaiter$2(this, void 0, void 0, function* () {
this.cachedPrivateKey = privateKey;
return yield this.localStorage.save({
name: this.identity,
value:
this.options.virgilCrypto.exportPrivateKey(privateKey).toString('base64'),
});
});
}
loadLocalPrivateKey() {
return __awaiter$2(this, void 0, void 0, function* () {
if (this.cachedPrivateKey)
return this.cachedPrivateKey;
const privateKeyData = yield
this.localStorage.load(this.identity);
if (!privateKeyData)
return null;
return this.importAndCachePrivateKey(privateKeyData.value);
});
}
loadLocalKeyPair() {
return __awaiter$2(this, void 0, void 0, function* () {
const privateKey = yield this.loadLocalPrivateKey();
if (!privateKey)
return null;
const publicKey =
this.options.virgilCrypto.extractPublicKey(privateKey);
return { privateKey, publicKey };
});
}
resetLocalPrivateKey() {
return __awaiter$2(this, void 0, void 0, function* () {
yield this.localStorage.remove(this.identity);
this.cachedPrivateKey = null;
});
}
resetPrivateKeyBackup(password) {
return __awaiter$2(this, void 0, void 0, function* () {
const storage = yield this.getStorage(password);
yield
storage.deleteEntry(this.identity).catch(this.handleResetError);
});
}
resetPrivateKeyBackupWithKeyName(keyName) {
return __awaiter$2(this, void 0, void 0, function* () {
yield this.keyknoxClient.v2Reset({
root: 'e3kit',
path: 'backup',
key: keyName,
identity: this.identity,
});
});
}
resetAll() {
return __awaiter$2(this, void 0, void 0, function* () {
yield this.keyknoxClient.v1Reset();
});
}
restorePrivateKey(password, keyName) {
return __awaiter$2(this, void 0, void 0, function* () {
const storage = yield this.getStorage(password,
isString$2(keyName));
try {
const rawKey = !isString$2(keyName)
? storage.retrieveEntry(this.identity)
: yield storage.fetchEntryByKey(this.identity,
keyName);
yield this.localStorage.save({ name: this.identity,
value: rawKey.data });
return this.importAndCachePrivateKey(rawKey.data);
}
catch (e) {
if (e instanceof c) {
throw new PrivateKeyNoBackupError();
}
throw e;
}
});
}
changePassword(oldPwd, newPwd, keyName) {
return __awaiter$2(this, void 0, void 0, function* () {
const storage = yield this.getStorage(oldPwd,
isString$2(keyName));
const keyPair = yield this.generateBrainPair(newPwd);
if (!isString$2(keyName)) {
return yield storage.updateRecipients({
newPrivateKey: keyPair.privateKey,
newPublicKeys: [keyPair.publicKey],
});
}
else {
// Change password for key from keyknox v2
const keyknoxManager = new g(this.keyknoxCrypto,
this.keyknoxClient);
const oldKeyPair = yield
this.generateBrainPair(oldPwd);
let decryptedKeyknoxValue;
try {
decryptedKeyknoxValue = yield
keyknoxManager.v2Pull({
root: 'e3kit',
path: 'backup',
key: keyName,
identity: this.identity,
privateKey: oldKeyPair.privateKey,
publicKeys: [oldKeyPair.publicKey],
});
}
catch (e) {
if (e.name === 'FoundationError' || e.name ===
'RNVirgilCryptoError') {
throw new WrongKeyknoxPasswordError();
}
throw e;
}
yield keyknoxManager.v2Push({
root: 'e3kit',
path: 'backup',
key: keyName,
identities: [this.identity],
value: decryptedKeyknoxValue.value,
privateKey: keyPair.privateKey,
publicKeys: [keyPair.publicKey],
keyknoxHash: decryptedKeyknoxValue.keyknoxHash,
});
}
});
}
hasPrivateKey() {
return this.localStorage.exists(this.identity);
}
generateBrainPair(pwd) {
return __awaiter$2(this, void 0, void 0, function* () {
return generateBrainPair(pwd, {
virgilCrypto: this.options.virgilCrypto,
pythiaCrypto: this.options.brainKeyCrypto,
accessTokenProvider: this.options.accessTokenProvider,
apiUrl: this.options.apiUrl,
});
});
}
getStorage(pwd, skipCloudSync = false) {
return __awaiter$2(this, void 0, void 0, function* () {
const keyPair = yield this.generateBrainPair(pwd);
const storage = new f(new g(this.keyknoxCrypto,
this.keyknoxClient), keyPair.privateKey, keyPair.publicKey);
if (!skipCloudSync) {
try {
yield storage.retrieveCloudEntries();
}
catch (e) {
if (e.name === 'FoundationError' || e.name ===
'RNVirgilCryptoError') {
throw new WrongKeyknoxPasswordError();
}
throw e;
}
}
return storage;
});
}
importAndCachePrivateKey(rawKeyData) {
this.cachedPrivateKey =
this.options.virgilCrypto.importPrivateKey({
value: rawKeyData,
encoding: 'base64',
});
return this.cachedPrivateKey;
}
}
exits)"),a.asm.vscf_raw_private_key_delete.apply(null,arguments)},a._vscf_raw_priva
te_key_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_raw_private_key_shallow_copy.apply(null,arguments)},a._vscf_raw
_public_key_data=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_data.apply(null,arguments)},a._vscf_raw_public_k
ey_alg_id=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_alg_id.apply(null,arguments)},a._vscf_raw_public
_key_alg_info=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_alg_info.apply(null,arguments)},a._vscf_raw_publ
ic_key_len=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_len.apply(null,arguments)},a._vscf_raw_public_ke
y_bitlen=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_bitlen.apply(null,arguments)},a._vscf_raw_public
_key_impl_tag=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_impl_tag.apply(null,arguments)},a._vscf_raw_publ
ic_key_is_valid=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_is_valid.apply(null,arguments)},a._vscf_raw_publ
ic_key_new=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_new.apply(null,arguments)},a._vscf_raw_public_ke
y_delete=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_delete.apply(null,arguments)},a._vscf_raw_public
_key_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_raw_public_key_shallow_copy.apply(null,arguments)},a._vscf_roun
d5_setup_defaults=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_setup_defaults.apply(null,arguments)},a._vscf_round5_gen
erate_key=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_round5_generate_key.apply(null,arguments)},a._vscf_round5_gener
ate_ephemeral_key=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_generate_ephemeral_key.apply(null,arguments)},a._vscf_ro
und5_import_public_key=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_import_public_key.apply(null,arguments)},a._vscf_round5_
import_public_key_data=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_import_public_key_data.apply(null,arguments)},a._vscf_ro
und5_export_public_key=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_export_public_key.apply(null,arguments)},a._vscf_round5_
exported_public_key_data_len=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_exported_public_key_data_len.apply(null,arguments)},a._v
scf_round5_export_public_key_data=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_export_public_key_data.apply(null,arguments)},a._vscf_ro
und5_import_private_key=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_import_private_key.apply(null,arguments)},a._vscf_round5
_import_private_key_data=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_import_private_key_data.apply(null,arguments)},a._vscf_r
ound5_export_private_key=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_export_private_key.apply(null,arguments)},a._vscf_round5
_exported_private_key_data_len=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_exported_private_key_data_len.apply(null,arguments)},a._
vscf_round5_export_private_key_data=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_export_private_key_data.apply(null,arguments)},a._vscf_r
ound5_kem_shared_key_len=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_kem_shared_key_len.apply(null,arguments)},a._vscf_round5
_kem_encapsulated_key_len=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_kem_encapsulated_key_len.apply(null,arguments)},a._vscf_
round5_kem_encapsulate=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_kem_encapsulate.apply(null,arguments)},a._vscf_round5_ke
m_decapsulate=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_kem_decapsulate.apply(null,arguments)},a._vscf_round5_re
lease_random=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_round5_release_random.apply(null,arguments)},a._vscf_round5_new
=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_round5_new.apply(null,arguments)},a._vscf_round5_delete=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_round5_delete.apply(null,arguments)},a._vscf_round5_shallow_cop
y=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_round5_shallow_copy.apply(null,arguments)},a._vscf_round5_use_r
andom=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_round5_use_random.apply(null,arguments)},a._vscf_rsa_setup_defa
ults=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_rsa_setup_defaults.apply(null,arguments)},a._vscf_rsa_generate_
key=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_rsa_generate_key.apply(null,arguments)},a._vscf_rsa_generate_ep
hemeral_key=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_generate_ephemeral_key.apply(null,arguments)},a._vscf_rsa_i
mport_public_key=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_import_public_key.apply(null,arguments)},a._vscf_rsa_import
_public_key_data=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_import_public_key_data.apply(null,arguments)},a._vscf_rsa_e
xport_public_key=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_export_public_key.apply(null,arguments)},a._vscf_rsa_export
ed_public_key_data_len=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_exported_public_key_data_len.apply(null,arguments)},a._vscf
_rsa_export_public_key_data=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_export_public_key_data.apply(null,arguments)},a._vscf_rsa_i
mport_private_key=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_import_private_key.apply(null,arguments)},a._vscf_rsa_impor
t_private_key_data=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_import_private_key_data.apply(null,arguments)},a._vscf_rsa_
export_private_key=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_export_private_key.apply(null,arguments)},a._vscf_rsa_expor
ted_private_key_data_len=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_exported_private_key_data_len.apply(null,arguments)},a._vsc
f_rsa_export_private_key_data=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_export_private_key_data.apply(null,arguments)},a._vscf_rsa_
can_encrypt=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_can_encrypt.apply(null,arguments)},a._vscf_rsa_encrypted_le
n=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_rsa_encrypted_len.apply(null,arguments)},a._vscf_rsa_encrypt=fu
nction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_encrypt.apply(null,arguments)},a._vscf_rsa_can_decrypt=func
tion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_can_decrypt.apply(null,arguments)},a._vscf_rsa_decrypted_le
n=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_rsa_decrypted_len.apply(null,arguments)},a._vscf_rsa_decrypt=fu
nction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_decrypt.apply(null,arguments)},a._vscf_rsa_can_sign=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_rsa_can_sign.apply(null,arguments)},a._vscf_rsa_signature_len=f
unction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_signature_len.apply(null,arguments)},a._vscf_rsa_sign_hash=
function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_sign_hash.apply(null,arguments)},a._vscf_rsa_can_verify=fun
ction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_can_verify.apply(null,arguments)},a._vscf_rsa_verify_hash=f
unction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_verify_hash.apply(null,arguments)},a._vscf_rsa_release_rand
om=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_rsa_release_random.apply(null,arguments)},a._vscf_rsa_new=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_new.apply(null,arguments)},a._vscf_rsa_delete=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_rsa_delete.apply(null,arguments)},a._vscf_rsa_shallow_copy=func
tion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_shallow_copy.apply(null,arguments)},a._vscf_rsa_use_random=
function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_rsa_use_random.apply(null,arguments)},a._vscf_rsa_private_key_i
s_valid=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_rsa_private_key_is_valid.apply(null,arguments)},a._vscf_rsa_pri
vate_key_len=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_private_key_len.apply(null,arguments)},a._vscf_rsa_private_
key_alg_id=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_private_key_alg_id.apply(null,arguments)},a._vscf_rsa_priva
te_key_alg_info=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_private_key_alg_info.apply(null,arguments)},a._vscf_rsa_pri
vate_key_bitlen=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_private_key_bitlen.apply(null,arguments)},a._vscf_rsa_priva
te_key_impl_tag=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_private_key_impl_tag.apply(null,arguments)},a._vscf_rsa_pri
vate_key_extract_public_key=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_private_key_extract_public_key.apply(null,arguments)},a._vs
cf_rsa_private_key_new=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_private_key_new.apply(null,arguments)},a._vscf_rsa_private_
key_delete=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.vscf_rsa_private_key_delete.apply(null,arguments)},a._vscf_rsa_priva
te_key_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_private_key_shallow_copy.apply(null,arguments)},a._vscf_rsa
_public_key_key_exponent=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_key_exponent.apply(null,arguments)},a._vscf_rsa_
public_key_is_valid=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_is_valid.apply(null,arguments)},a._vscf_rsa_publ
ic_key_len=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_len.apply(null,arguments)},a._vscf_rsa_public_ke
y_alg_id=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_alg_id.apply(null,arguments)},a._vscf_rsa_public
_key_alg_info=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_alg_info.apply(null,arguments)},a._vscf_rsa_publ
ic_key_bitlen=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_bitlen.apply(null,arguments)},a._vscf_rsa_public
_key_impl_tag=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_impl_tag.apply(null,arguments)},a._vscf_rsa_publ
ic_key_new=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_new.apply(null,arguments)},a._vscf_rsa_public_ke
y_delete=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_delete.apply(null,arguments)},a._vscf_rsa_public
_key_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_rsa_public_key_shallow_copy.apply(null,arguments)},a._vscf_salt
ed_kdf_alg_info_hash_alg_info=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_salted_kdf_alg_info_hash_alg_info.apply(null,arguments)},a._vsc
f_salted_kdf_alg_info_salt=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_salted_kdf_alg_info_salt.apply(null,arguments)},a._vscf_salted_
kdf_alg_info_iteration_count=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_salted_kdf_alg_info_iteration_count.apply(null,arguments)},a._v
scf_salted_kdf_alg_info_alg_id=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_salted_kdf_alg_info_alg_id.apply(null,arguments)},a._vscf_salte
d_kdf_alg_info_new=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_salted_kdf_alg_info_new.apply(null,arguments)},a._vscf_salted_k
df_alg_info_delete=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_salted_kdf_alg_info_delete.apply(null,arguments)},a._vscf_salte
d_kdf_alg_info_shallow_copy=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_salted_kdf_alg_info_shallow_copy.apply(null,arguments)},a._vscf
_sec1_serializer_setup_defaults=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_setup_defaults.apply(null,arguments)},a._vscf_s
ec1_serializer_serialize_public_key_inplace=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_serialize_public_key_inplace.apply(null,argumen
ts)},a._vscf_sec1_serializer_serialized_public_key_len=function(){return p(U,"you
need to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!
0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_serialized_public_key_len.apply(null,arguments)
},a._vscf_sec1_serializer_serialize_private_key_inplace=function(){return p(U,"you
need to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!
0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_serialize_private_key_inplace.apply(null,argume
nts)},a._vscf_sec1_serializer_serialized_private_key_len=function(){return p(U,"you
need to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!
0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_serialized_private_key_len.apply(null,arguments
)},a._vscf_sec1_serializer_serialize_public_key=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_serialize_public_key.apply(null,arguments)},a._
vscf_sec1_serializer_serialize_private_key=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_serialize_private_key.apply(null,arguments)},a.
_vscf_sec1_serializer_release_asn1_writer=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_release_asn1_writer.apply(null,arguments)},a._v
scf_sec1_serializer_new=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_new.apply(null,arguments)},a._vscf_sec1_seriali
zer_delete=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_delete.apply(null,arguments)},a._vscf_sec1_seri
alizer_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_shallow_copy.apply(null,arguments)},a._vscf_sec
1_serializer_use_asn1_writer=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sec1_serializer_use_asn1_writer.apply(null,arguments)},a._vscf_
seed_entropy_source_reset_seed=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_seed_entropy_source_reset_seed.apply(null,arguments)},a._vscf_s
eed_entropy_source_is_strong=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_seed_entropy_source_is_strong.apply(null,arguments)},a._vscf_se
ed_entropy_source_gather=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_seed_entropy_source_gather.apply(null,arguments)},a._vscf_seed_
entropy_source_new=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_seed_entropy_source_new.apply(null,arguments)},a._vscf_seed_ent
ropy_source_delete=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_seed_entropy_source_delete.apply(null,arguments)},a._vscf_seed_
entropy_source_shallow_copy=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_seed_entropy_source_shallow_copy.apply(null,arguments)},a._vscf
_sha224_alg_id=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sha224_alg_id.apply(null,arguments)},a._vscf_sha224_produce_alg
_info=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_sha224_produce_alg_info.apply(null,arguments)},a._vscf_sha224_r
estore_alg_info=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sha224_restore_alg_info.apply(null,arguments)},a._vscf_sha224_h
ash=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha224_hash.apply(null,arguments)},a._vscf_sha224_finish=functi
on(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha224_finish.apply(null,arguments)},a._vscf_sha224_start=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_sha224_start.apply(null,arguments)},a._vscf_sha224_update=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_sha224_update.apply(null,arguments)},a._vscf_sha224_new=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha224_new.apply(null,arguments)},a._vscf_sha224_delete=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha224_delete.apply(null,arguments)},a._vscf_sha224_shallow_cop
y=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha224_shallow_copy.apply(null,arguments)},a._vscf_sha256_alg_i
d=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha256_alg_id.apply(null,arguments)},a._vscf_sha256_produce_alg
_info=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_sha256_produce_alg_info.apply(null,arguments)},a._vscf_sha256_r
estore_alg_info=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sha256_restore_alg_info.apply(null,arguments)},a._vscf_sha256_h
ash=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha256_hash.apply(null,arguments)},a._vscf_sha256_finish=functi
on(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha256_finish.apply(null,arguments)},a._vscf_sha256_start=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_sha256_start.apply(null,arguments)},a._vscf_sha256_update=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_sha256_update.apply(null,arguments)},a._vscf_sha256_new=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha256_new.apply(null,arguments)},a._vscf_sha256_delete=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha256_delete.apply(null,arguments)},a._vscf_sha256_shallow_cop
y=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha256_shallow_copy.apply(null,arguments)},a._vscf_sha384_alg_i
d=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha384_alg_id.apply(null,arguments)},a._vscf_sha384_produce_alg
_info=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_sha384_produce_alg_info.apply(null,arguments)},a._vscf_sha384_r
estore_alg_info=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sha384_restore_alg_info.apply(null,arguments)},a._vscf_sha384_h
ash=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha384_hash.apply(null,arguments)},a._vscf_sha384_finish=functi
on(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha384_finish.apply(null,arguments)},a._vscf_sha384_start=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_sha384_start.apply(null,arguments)},a._vscf_sha384_update=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_sha384_update.apply(null,arguments)},a._vscf_sha384_new=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha384_new.apply(null,arguments)},a._vscf_sha384_delete=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha384_delete.apply(null,arguments)},a._vscf_sha384_shallow_cop
y=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha384_shallow_copy.apply(null,arguments)},a._vscf_sha512_alg_i
d=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha512_alg_id.apply(null,arguments)},a._vscf_sha512_produce_alg
_info=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_sha512_produce_alg_info.apply(null,arguments)},a._vscf_sha512_r
estore_alg_info=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_sha512_restore_alg_info.apply(null,arguments)},a._vscf_sha512_h
ash=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.vscf_sha512_hash.apply(null,arguments)},a._vscf_sha512_finish=functi
on(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha512_finish.apply(null,arguments)},a._vscf_sha512_start=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_sha512_start.apply(null,arguments)},a._vscf_sha512_update=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_sha512_update.apply(null,arguments)},a._vscf_sha512_new=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha512_new.apply(null,arguments)},a._vscf_sha512_delete=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_sha512_delete.apply(null,arguments)},a._vscf_sha512_shallow_cop
y=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_sha512_shallow_copy.apply(null,arguments)},a._vscf_simple_alg_i
nfo_alg_id=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_simple_alg_info_alg_id.apply(null,arguments)},a._vscf_simple_al
g_info_new=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_simple_alg_info_new.apply(null,arguments)},a._vscf_simple_alg_i
nfo_delete=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_simple_alg_info_delete.apply(null,arguments)},a._vscf_simple_al
g_info_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_simple_alg_info_shallow_copy.apply(null,arguments)},a._vscf_sim
ple_alg_info_new_with_alg_id=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_simple_alg_info_new_with_alg_id.apply(null,arguments)},a._vscf_
alg_factory_create_hash_from_info=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_alg_factory_create_hash_from_info.apply(null,arguments)},a._vsc
f_alg_factory_create_mac_from_info=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_alg_factory_create_mac_from_info.apply(null,arguments)},a._vscf
_alg_factory_create_kdf_from_info=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_alg_factory_create_kdf_from_info.apply(null,arguments)},a._vscf
_alg_factory_create_salted_kdf_from_info=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_alg_factory_create_salted_kdf_from_info.apply(null,arguments)},
a._vscf_alg_factory_create_cipher_from_info=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_alg_factory_create_cipher_from_info.apply(null,arguments)},a._v
scf_alg_factory_create_padding_from_info=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_alg_factory_create_padding_from_info.apply(null,arguments)},a._
vscf_base64_encoded_len=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_base64_encoded_len.apply(null,arguments)},a._vscf_base64_encode
=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_base64_encode.apply(null,arguments)},a._vscf_base64_decoded_len
=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_base64_decoded_len.apply(null,arguments)},a._vscf_base64_decode
=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_base64_decode.apply(null,arguments)},a._vscf_brainkey_client_re
lease_random=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_release_random.apply(null,arguments)},a._vscf_b
rainkey_client_release_operation_random=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_release_operation_random.apply(null,arguments)}
,a._vscf_brainkey_client_new=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_new.apply(null,arguments)},a._vscf_brainkey_cli
ent_delete=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_delete.apply(null,arguments)},a._vscf_brainkey_
client_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_shallow_copy.apply(null,arguments)},a._vscf_bra
inkey_client_use_random=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_use_random.apply(null,arguments)},a._vscf_brain
key_client_use_operation_random=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_use_operation_random.apply(null,arguments)},a._
vscf_brainkey_client_setup_defaults=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_setup_defaults.apply(null,arguments)},a._vscf_b
rainkey_client_blind=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_blind.apply(null,arguments)},a._vscf_brainkey_c
lient_deblind=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_client_deblind.apply(null,arguments)},a._vscf_brainkey
_server_release_random=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_release_random.apply(null,arguments)},a._vscf_b
rainkey_server_release_operation_random=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_release_operation_random.apply(null,arguments)}
,a._vscf_brainkey_server_new=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited
(use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_new.apply(null,arguments)},a._vscf_brainkey_ser
ver_delete=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_delete.apply(null,arguments)},a._vscf_brainkey_
server_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_shallow_copy.apply(null,arguments)},a._vscf_bra
inkey_server_use_random=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_use_random.apply(null,arguments)},a._vscf_brain
key_server_use_operation_random=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_use_operation_random.apply(null,arguments)},a._
vscf_brainkey_server_setup_defaults=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_setup_defaults.apply(null,arguments)},a._vscf_b
rainkey_server_generate_identity_secret=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_generate_identity_secret.apply(null,arguments)}
,a._vscf_brainkey_server_harden=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_brainkey_server_harden.apply(null,arguments)},a._vscf_ecies_rel
ease_random=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_ecies_release_random.apply(null,arguments)},a._vscf_ecies_relea
se_cipher=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_ecies_release_cipher.apply(null,arguments)},a._vscf_ecies_relea
se_mac=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_ecies_release_mac.apply(null,arguments)},a._vscf_ecies_release_
kdf=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_ecies_release_kdf.apply(null,arguments)},a._vscf_ecies_release_
ephemeral_key=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_ecies_release_ephemeral_key.apply(null,arguments)},a._vscf_ecie
s_new=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_ecies_new.apply(null,arguments)},a._vscf_ecies_delete=function(
){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_ecies_delete.apply(null,arguments)},a._vscf_ecies_shallow_copy=
function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_ecies_shallow_copy.apply(null,arguments)},a._vscf_ecies_use_ran
dom=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_ecies_use_random.apply(null,arguments)},a._vscf_ecies_use_ciphe
r=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_ecies_use_cipher.apply(null,arguments)},a._vscf_ecies_use_mac=f
unction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_ecies_use_mac.apply(null,arguments)},a._vscf_ecies_use_kdf=func
tion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_ecies_use_kdf.apply(null,arguments)},a._vscf_ecies_use_ephemera
l_key=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_ecies_use_ephemeral_key.apply(null,arguments)},a._vscf_ecies_se
t_key_alg=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_ecies_set_key_alg.apply(null,arguments)},a._vscf_ecies_release_
key_alg=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_ecies_release_key_alg.apply(null,arguments)},a._vscf_ecies_setu
p_defaults=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_ecies_setup_defaults.apply(null,arguments)},a._vscf_ecies_setup
_defaults_no_random=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_ecies_setup_defaults_no_random.apply(null,arguments)},a._vscf_e
cies_encrypted_len=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_ecies_encrypted_len.apply(null,arguments)},a._vscf_ecies_encryp
t=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_ecies_encrypt.apply(null,arguments)},a._vscf_ecies_decrypted_le
n=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_ecies_decrypted_len.apply(null,arguments)},a._vscf_ecies_decryp
t=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_ecies_decrypt.apply(null,arguments)},a._vscf_error_ctx_size=fun
ction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_error_ctx_size.apply(null,arguments)},a._vscf_error_reset=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_error_reset.apply(null,arguments)},a._vscf_error_status=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_error_status.apply(null,arguments)},a._vscf_footer_info_new=fun
ction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_footer_info_new.apply(null,arguments)},a._vscf_footer_info_dele
te=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_footer_info_delete.apply(null,arguments)},a._vscf_footer_info_s
hallow_copy=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_footer_info_shallow_copy.apply(null,arguments)},a._vscf_footer_
info_has_signed_data_info=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_footer_info_has_signed_data_info.apply(null,arguments)},a._vscf
_footer_info_signed_data_info=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.vscf_footer_info_signed_data_info.apply(null,arguments)},a._vscf_foo
ter_info_set_data_size=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_footer_info_set_data_size.apply(null,arguments)},a._vscf_footer
_info_data_size=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_footer_info_data_size.apply(null,arguments)},a._vscf_group_sess
ion_release_rng=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_release_rng.apply(null,arguments)},a._vscf_group_
session_new=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_new.apply(null,arguments)},a._vscf_group_session_
delete=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_group_session_delete.apply(null,arguments)},a._vscf_group_sessi
on_shallow_copy=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_shallow_copy.apply(null,arguments)},a._vscf_group
_session_use_rng=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_use_rng.apply(null,arguments)},a._vscf_group_sess
ion_get_current_epoch=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_get_current_epoch.apply(null,arguments)},a._vscf_
group_session_setup_defaults=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_setup_defaults.apply(null,arguments)},a._vscf_gro
up_session_get_session_id=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_get_session_id.apply(null,arguments)},a._vscf_gro
up_session_add_epoch=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_add_epoch.apply(null,arguments)},a._vscf_group_se
ssion_encrypt=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_encrypt.apply(null,arguments)},a._vscf_group_sess
ion_decrypt_len=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_decrypt_len.apply(null,arguments)},a._vscf_group_
session_decrypt=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_decrypt.apply(null,arguments)},a._vscf_group_sess
ion_create_group_ticket=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_create_group_ticket.apply(null,arguments)},a._vsc
f_group_session_message_new=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_message_new.apply(null,arguments)},a._vscf_group_
session_message_delete=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_message_delete.apply(null,arguments)},a._vscf_gro
up_session_message_shallow_copy=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_message_shallow_copy.apply(null,arguments)},a._vs
cf_group_session_message_get_type=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_message_get_type.apply(null,arguments)},a._vscf_g
roup_session_message_get_session_id=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_message_get_session_id.apply(null,arguments)},a._
vscf_group_session_message_get_epoch=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_message_get_epoch.apply(null,arguments)},a._vscf_
group_session_message_serialize_len=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_message_serialize_len.apply(null,arguments)},a._v
scf_group_session_message_serialize=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_message_serialize.apply(null,arguments)},a._vscf_
group_session_message_deserialize=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_message_deserialize.apply(null,arguments)},a._vsc
f_group_session_ticket_release_rng=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_ticket_release_rng.apply(null,arguments)},a._vscf
_group_session_ticket_new=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_ticket_new.apply(null,arguments)},a._vscf_group_s
ession_ticket_delete=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_ticket_delete.apply(null,arguments)},a._vscf_grou
p_session_ticket_shallow_copy=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_ticket_shallow_copy.apply(null,arguments)},a._vsc
f_group_session_ticket_use_rng=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_ticket_use_rng.apply(null,arguments)},a._vscf_gro
up_session_ticket_setup_defaults=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_ticket_setup_defaults.apply(null,arguments)},a._v
scf_group_session_ticket_setup_ticket_as_new=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_ticket_setup_ticket_as_new.apply(null,arguments)}
,a._vscf_group_session_ticket_get_ticket_message=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_group_session_ticket_get_ticket_message.apply(null,arguments)},
a._vscf_key_alg_factory_create_from_alg_id=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_key_alg_factory_create_from_alg_id.apply(null,arguments)},a._vs
cf_key_alg_factory_create_from_key=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_alg_factory_create_from_key.apply(null,arguments)},a._vscf_
key_alg_factory_create_from_raw_public_key=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_alg_factory_create_from_raw_public_key.apply(null,arguments
)},a._vscf_key_alg_factory_create_from_raw_private_key=function(){return p(U,"you
need to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!
0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_alg_factory_create_from_raw_private_key.apply(null,argument
s)},a._vscf_key_info_new=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_new.apply(null,arguments)},a._vscf_key_info_new_with_a
lg_info=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_key_info_new_with_alg_info.apply(null,arguments)},a._vscf_key_i
nfo_delete=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_delete.apply(null,arguments)},a._vscf_key_info_shallow
_copy=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_key_info_shallow_copy.apply(null,arguments)},a._vscf_key_info_i
s_compound=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_is_compound.apply(null,arguments)},a._vscf_key_info_is
_hybrid=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_key_info_is_hybrid.apply(null,arguments)},a._vscf_key_info_is_c
ompound_hybrid=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_is_compound_hybrid.apply(null,arguments)},a._vscf_key_
info_is_compound_hybrid_cipher=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_is_compound_hybrid_cipher.apply(null,arguments)},a._vs
cf_key_info_is_compound_hybrid_signer=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_is_compound_hybrid_signer.apply(null,arguments)},a._vs
cf_key_info_is_hybrid_post_quantum=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_is_hybrid_post_quantum.apply(null,arguments)},a._vscf_
key_info_is_hybrid_post_quantum_cipher=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_is_hybrid_post_quantum_cipher.apply(null,arguments)},a
._vscf_key_info_is_hybrid_post_quantum_signer=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_is_hybrid_post_quantum_signer.apply(null,arguments)},a
._vscf_key_info_alg_id=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_alg_id.apply(null,arguments)},a._vscf_key_info_compoun
d_cipher_alg_id=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_compound_cipher_alg_id.apply(null,arguments)},a._vscf_
key_info_compound_signer_alg_id=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_compound_signer_alg_id.apply(null,arguments)},a._vscf_
key_info_hybrid_first_key_alg_id=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_hybrid_first_key_alg_id.apply(null,arguments)},a._vscf
_key_info_hybrid_second_key_alg_id=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_hybrid_second_key_alg_id.apply(null,arguments)},a._vsc
f_key_info_compound_hybrid_cipher_first_key_alg_id=function(){return p(U,"you need
to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_info_compound_hybrid_cipher_first_key_alg_id.apply(null,arg
uments)},a._vscf_key_info_compound_hybrid_cipher_second_key_alg_id=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_key_info_compound_hybrid_cipher_second_key_alg_id.apply(null,ar
guments)},a._vscf_key_info_compound_hybrid_signer_first_key_alg_id=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_key_info_compound_hybrid_signer_first_key_alg_id.apply(null,arg
uments)},a._vscf_key_info_compound_hybrid_signer_second_key_alg_id=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_key_info_compound_hybrid_signer_second_key_alg_id.apply(null,ar
guments)},a._vscf_key_provider_release_random=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_release_random.apply(null,arguments)},a._vscf_key_
provider_new=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_new.apply(null,arguments)},a._vscf_key_provider_de
lete=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_key_provider_delete.apply(null,arguments)},a._vscf_key_provider
_shallow_copy=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_shallow_copy.apply(null,arguments)},a._vscf_key_pr
ovider_use_random=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_use_random.apply(null,arguments)},a._vscf_key_prov
ider_setup_defaults=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_setup_defaults.apply(null,arguments)},a._vscf_key_
provider_set_rsa_params=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_set_rsa_params.apply(null,arguments)},a._vscf_key_
provider_generate_private_key=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_generate_private_key.apply(null,arguments)},a._vsc
f_key_provider_generate_post_quantum_private_key=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_key_provider_generate_post_quantum_private_key.apply(null,argum
ents)},a._vscf_key_provider_generate_compound_hybrid_private_key=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.vscf_key_provider_generate_compound_hybrid_private_key.apply(null,ar
guments)},a._vscf_key_provider_generate_hybrid_private_key=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.vscf_key_provider_generate_hybrid_private_key.apply(null,arguments)}
,a._vscf_key_provider_generate_compound_private_key=function(){return p(U,"you need
to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_generate_compound_private_key.apply(null,arguments
)},a._vscf_key_provider_import_private_key=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_import_private_key.apply(null,arguments)},a._vscf_
key_provider_import_public_key=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_import_public_key.apply(null,arguments)},a._vscf_k
ey_provider_exported_public_key_len=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_exported_public_key_len.apply(null,arguments)},a._
vscf_key_provider_export_public_key=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_export_public_key.apply(null,arguments)},a._vscf_k
ey_provider_exported_private_key_len=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_exported_private_key_len.apply(null,arguments)},a.
_vscf_key_provider_export_private_key=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_provider_export_private_key.apply(null,arguments)},a._vscf_
key_recipient_info_new=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_new.apply(null,arguments)},a._vscf_key_recip
ient_info_new_with_data=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_new_with_data.apply(null,arguments)},a._vscf
_key_recipient_info_delete=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_delete.apply(null,arguments)},a._vscf_key_re
cipient_info_shallow_copy=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_shallow_copy.apply(null,arguments)},a._vscf_
key_recipient_info_recipient_id=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_recipient_id.apply(null,arguments)},a._vscf_
key_recipient_info_key_encryption_algorithm=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_key_encryption_algorithm.apply(null,argument
s)},a._vscf_key_recipient_info_encrypted_key=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_encrypted_key.apply(null,arguments)},a._vscf
_key_recipient_info_list_new=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_new.apply(null,arguments)},a._vscf_key_
recipient_info_list_delete=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_delete.apply(null,arguments)},a._vscf_k
ey_recipient_info_list_shallow_copy=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_shallow_copy.apply(null,arguments)},a._
vscf_key_recipient_info_list_has_item=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_has_item.apply(null,arguments)},a._vscf
_key_recipient_info_list_item=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_item.apply(null,arguments)},a._vscf_key
_recipient_info_list_has_next=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_has_next.apply(null,arguments)},a._vscf
_key_recipient_info_list_next=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_next.apply(null,arguments)},a._vscf_key
_recipient_info_list_has_prev=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_has_prev.apply(null,arguments)},a._vscf
_key_recipient_info_list_prev=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_prev.apply(null,arguments)},a._vscf_key
_recipient_info_list_clear=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_key_recipient_info_list_clear.apply(null,arguments)},a._vscf_me
ssage_info_new=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_new.apply(null,arguments)},a._vscf_message_info_de
lete=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_message_info_delete.apply(null,arguments)},a._vscf_message_info
_shallow_copy=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_shallow_copy.apply(null,arguments)},a._vscf_messag
e_info_data_encryption_alg_info=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_data_encryption_alg_info.apply(null,arguments)},a.
_vscf_message_info_key_recipient_info_list=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_key_recipient_info_list.apply(null,arguments)},a._
vscf_message_info_password_recipient_info_list=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_password_recipient_info_list.apply(null,arguments)
},a._vscf_message_info_has_custom_params=function(){return p(U,"you need to wait
for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_has_custom_params.apply(null,arguments)},a._vscf_m
essage_info_custom_params=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params.apply(null,arguments)},a._vscf_messa
ge_info_has_cipher_kdf_alg_info=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_has_cipher_kdf_alg_info.apply(null,arguments)},a._
vscf_message_info_cipher_kdf_alg_info=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_cipher_kdf_alg_info.apply(null,arguments)},a._vscf
_message_info_has_cipher_padding_alg_info=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_has_cipher_padding_alg_info.apply(null,arguments)}
,a._vscf_message_info_cipher_padding_alg_info=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_cipher_padding_alg_info.apply(null,arguments)},a._
vscf_message_info_has_footer_info=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_has_footer_info.apply(null,arguments)},a._vscf_mes
sage_info_footer_info=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_footer_info.apply(null,arguments)},a._vscf_message
_info_clear=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_clear.apply(null,arguments)},a._vscf_message_info_
custom_params_new=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_new.apply(null,arguments)},a._vscf_m
essage_info_custom_params_delete=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_delete.apply(null,arguments)},a._vsc
f_message_info_custom_params_shallow_copy=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_shallow_copy.apply(null,arguments)},
a._vscf_message_info_custom_params_add_int=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_add_int.apply(null,arguments)},a._vs
cf_message_info_custom_params_add_string=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_add_string.apply(null,arguments)},a.
_vscf_message_info_custom_params_add_data=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_add_data.apply(null,arguments)},a._v
scf_message_info_custom_params_clear=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_clear.apply(null,arguments)},a._vscf
_message_info_custom_params_find_int=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_find_int.apply(null,arguments)},a._v
scf_message_info_custom_params_find_string=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_find_string.apply(null,arguments)},a
._vscf_message_info_custom_params_find_data=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_find_data.apply(null,arguments)},a._
vscf_message_info_custom_params_has_params=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_custom_params_has_params.apply(null,arguments)},a.
_vscf_message_info_editor_release_random=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_release_random.apply(null,arguments)},a._vs
cf_message_info_editor_new=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_new.apply(null,arguments)},a._vscf_message_
info_editor_delete=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_delete.apply(null,arguments)},a._vscf_messa
ge_info_editor_shallow_copy=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_shallow_copy.apply(null,arguments)},a._vscf
_message_info_editor_use_random=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_use_random.apply(null,arguments)},a._vscf_m
essage_info_editor_setup_defaults=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_setup_defaults.apply(null,arguments)},a._vs
cf_message_info_editor_unpack=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_unpack.apply(null,arguments)},a._vscf_messa
ge_info_editor_unlock=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_unlock.apply(null,arguments)},a._vscf_messa
ge_info_editor_add_key_recipient=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_add_key_recipient.apply(null,arguments)},a.
_vscf_message_info_editor_remove_key_recipient=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_remove_key_recipient.apply(null,arguments)}
,a._vscf_message_info_editor_remove_all=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_remove_all.apply(null,arguments)},a._vscf_m
essage_info_editor_packed_len=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_packed_len.apply(null,arguments)},a._vscf_m
essage_info_editor_pack=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_editor_pack.apply(null,arguments)},a._vscf_message
_info_footer_new=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.vscf_message_info_footer_new.apply(null,arguments)},a._vscf_message_
info_footer_delete=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_footer_delete.apply(null,arguments)},a._vscf_messa
ge_info_footer_shallow_copy=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_footer_shallow_copy.apply(null,arguments)},a._vscf
_message_info_footer_has_signer_infos=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_footer_has_signer_infos.apply(null,arguments)},a._
vscf_message_info_footer_signer_infos=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_footer_signer_infos.apply(null,arguments)},a._vscf
_message_info_footer_signer_hash_alg_info=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_footer_signer_hash_alg_info.apply(null,arguments)}
,a._vscf_message_info_footer_signer_digest=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_message_info_footer_signer_digest.apply(null,arguments)},a._vsc
f_oid_from_alg_id=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_oid_from_alg_id.apply(null,arguments)},a._vscf_oid_to_alg_id=fu
nction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_oid_to_alg_id.apply(null,arguments)},a._vscf_oid_equal=function
(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_oid_equal.apply(null,arguments)},a._vscf_oid_from_id=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_oid_from_id.apply(null,arguments)},a._vscf_oid_to_id=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_oid_to_id.apply(null,arguments)},a._vscf_oid_id_to_alg_id=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_oid_id_to_alg_id.apply(null,arguments)},a._vscf_padding_params_
new=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_padding_params_new.apply(null,arguments)},a._vscf_padding_param
s_new_with_constraints=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_padding_params_new_with_constraints.apply(null,arguments)},a._v
scf_padding_params_delete=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_padding_params_delete.apply(null,arguments)},a._vscf_padding_pa
rams_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_padding_params_shallow_copy.apply(null,arguments)},a._vscf_padd
ing_params_frame=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_padding_params_frame.apply(null,arguments)},a._vscf_padding_par
ams_frame_max=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_padding_params_frame_max.apply(null,arguments)},a._vscf_passwor
d_recipient_info_new=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_new.apply(null,arguments)},a._vscf_pass
word_recipient_info_new_with_members=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_new_with_members.apply(null,arguments)}
,a._vscf_password_recipient_info_delete=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_delete.apply(null,arguments)},a._vscf_p
assword_recipient_info_shallow_copy=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_shallow_copy.apply(null,arguments)},a._
vscf_password_recipient_info_key_encryption_algorithm=function(){return p(U,"you
need to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!
0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_key_encryption_algorithm.apply(null,arg
uments)},a._vscf_password_recipient_info_encrypted_key=function(){return p(U,"you
need to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!
0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_encrypted_key.apply(null,arguments)},a.
_vscf_password_recipient_info_list_new=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_new.apply(null,arguments)},a._vscf
_password_recipient_info_list_delete=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_delete.apply(null,arguments)},a._v
scf_password_recipient_info_list_shallow_copy=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_shallow_copy.apply(null,arguments)
},a._vscf_password_recipient_info_list_has_item=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_has_item.apply(null,arguments)},a.
_vscf_password_recipient_info_list_item=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_item.apply(null,arguments)},a._vsc
f_password_recipient_info_list_has_next=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_has_next.apply(null,arguments)},a.
_vscf_password_recipient_info_list_next=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_next.apply(null,arguments)},a._vsc
f_password_recipient_info_list_has_prev=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_has_prev.apply(null,arguments)},a.
_vscf_password_recipient_info_list_prev=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited
(use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_prev.apply(null,arguments)},a._vsc
f_password_recipient_info_list_clear=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_password_recipient_info_list_clear.apply(null,arguments)},a._vs
cf_pem_wrapped_len=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_pem_wrapped_len.apply(null,arguments)},a._vscf_pem_wrap=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_pem_wrap.apply(null,arguments)},a._vscf_pem_unwrapped_len=funct
ion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_pem_unwrapped_len.apply(null,arguments)},a._vscf_pem_unwrap=fun
ction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_pem_unwrap.apply(null,arguments)},a._vscf_pem_title=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_pem_title.apply(null,arguments)},a._vscf_recipient_cipher_relea
se_random=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_release_random.apply(null,arguments)},a._vscf_
recipient_cipher_release_encryption_cipher=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_release_encryption_cipher.apply(null,arguments
)},a._vscf_recipient_cipher_release_encryption_padding=function(){return p(U,"you
need to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!
0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_release_encryption_padding.apply(null,argument
s)},a._vscf_recipient_cipher_release_padding_params=function(){return p(U,"you need
to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_release_padding_params.apply(null,arguments)},
a._vscf_recipient_cipher_release_signer_hash=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_release_signer_hash.apply(null,arguments)},a._
vscf_recipient_cipher_new=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_new.apply(null,arguments)},a._vscf_recipient_c
ipher_delete=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_delete.apply(null,arguments)},a._vscf_recipien
t_cipher_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_shallow_copy.apply(null,arguments)},a._vscf_re
cipient_cipher_use_random=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_use_random.apply(null,arguments)},a._vscf_reci
pient_cipher_use_encryption_cipher=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_use_encryption_cipher.apply(null,arguments)},a
._vscf_recipient_cipher_use_encryption_padding=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_use_encryption_padding.apply(null,arguments)},
a._vscf_recipient_cipher_use_padding_params=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_use_padding_params.apply(null,arguments)},a._v
scf_recipient_cipher_use_signer_hash=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_use_signer_hash.apply(null,arguments)},a._vscf
_recipient_cipher_has_key_recipient=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_has_key_recipient.apply(null,arguments)},a._vs
cf_recipient_cipher_add_key_recipient=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_add_key_recipient.apply(null,arguments)},a._vs
cf_recipient_cipher_clear_recipients=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_clear_recipients.apply(null,arguments)},a._vsc
f_recipient_cipher_add_signer=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_add_signer.apply(null,arguments)},a._vscf_reci
pient_cipher_clear_signers=function(){return p(U,"you need to wait for the runtime
to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_clear_signers.apply(null,arguments)},a._vscf_r
ecipient_cipher_custom_params=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_custom_params.apply(null,arguments)},a._vscf_r
ecipient_cipher_start_encryption=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_start_encryption.apply(null,arguments)},a._vsc
f_recipient_cipher_start_signed_encryption=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_start_signed_encryption.apply(null,arguments)}
,a._vscf_recipient_cipher_message_info_len=function(){return p(U,"you need to wait
for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime
was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_message_info_len.apply(null,arguments)},a._vsc
f_recipient_cipher_pack_message_info=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_pack_message_info.apply(null,arguments)},a._vs
cf_recipient_cipher_encryption_out_len=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_encryption_out_len.apply(null,arguments)},a._v
scf_recipient_cipher_message_info_footer_len=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_message_info_footer_len.apply(null,arguments)}
,a._vscf_recipient_cipher_process_encryption=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_process_encryption.apply(null,arguments)},a._v
scf_recipient_cipher_finish_encryption=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_finish_encryption.apply(null,arguments)},a._vs
cf_recipient_cipher_start_decryption_with_key=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_start_decryption_with_key.apply(null,arguments
)},a._vscf_recipient_cipher_start_verified_decryption_with_key=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.vscf_recipient_cipher_start_verified_decryption_with_key.apply(null,
arguments)},a._vscf_recipient_cipher_decryption_out_len=function(){return p(U,"you
need to wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!
0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_decryption_out_len.apply(null,arguments)},a._v
scf_recipient_cipher_process_decryption=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_process_decryption.apply(null,arguments)},a._v
scf_recipient_cipher_finish_decryption=function(){return p(U,"you need to wait for
the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_finish_decryption.apply(null,arguments)},a._vs
cf_recipient_cipher_is_data_signed=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_is_data_signed.apply(null,arguments)},a._vscf_
recipient_cipher_signer_infos=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_signer_infos.apply(null,arguments)},a._vscf_re
cipient_cipher_verify_signer_info=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_verify_signer_info.apply(null,arguments)},a._v
scf_recipient_cipher_pack_message_info_footer=function(){return p(U,"you need to
wait for the runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the
runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_recipient_cipher_pack_message_info_footer.apply(null,arguments)
},a._vscf_signed_data_info_new=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signed_data_info_new.apply(null,arguments)},a._vscf_signed_data
_info_delete=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signed_data_info_delete.apply(null,arguments)},a._vscf_signed_d
ata_info_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signed_data_info_shallow_copy.apply(null,arguments)},a._vscf_si
gned_data_info_hash_alg_info=function(){return p(U,"you need to wait for the
runtime to be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was
exited (use NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signed_data_info_hash_alg_info.apply(null,arguments)},a._vscf_s
igner_release_hash=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_release_hash.apply(null,arguments)},a._vscf_signer_relea
se_random=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_signer_release_random.apply(null,arguments)},a._vscf_signer_new
=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_signer_new.apply(null,arguments)},a._vscf_signer_delete=functio
n(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vscf_signer_delete.apply(null,arguments)},a._vscf_signer_shallow_cop
y=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_signer_shallow_copy.apply(null,arguments)},a._vscf_signer_use_h
ash=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_signer_use_hash.apply(null,arguments)},a._vscf_signer_use_rando
m=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_signer_use_random.apply(null,arguments)},a._vscf_signer_reset=f
unction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_signer_reset.apply(null,arguments)},a._vscf_signer_append_data=
function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_signer_append_data.apply(null,arguments)},a._vscf_signer_signat
ure_len=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_signer_signature_len.apply(null,arguments)},a._vscf_signer_sign
=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_signer_sign.apply(null,arguments)},a._vscf_signer_info_new=func
tion(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_signer_info_new.apply(null,arguments)},a._vscf_signer_info_dele
te=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_signer_info_delete.apply(null,arguments)},a._vscf_signer_info_s
hallow_copy=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_shallow_copy.apply(null,arguments)},a._vscf_signer_
info_signer_id=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_signer_id.apply(null,arguments)},a._vscf_signer_inf
o_signer_alg_info=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_signer_alg_info.apply(null,arguments)},a._vscf_sign
er_info_signature=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_signature.apply(null,arguments)},a._vscf_signer_inf
o_list_new=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_list_new.apply(null,arguments)},a._vscf_signer_info
_list_delete=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_list_delete.apply(null,arguments)},a._vscf_signer_i
nfo_list_shallow_copy=function(){return p(U,"you need to wait for the runtime to be
ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_list_shallow_copy.apply(null,arguments)},a._vscf_si
gner_info_list_has_item=function(){return p(U,"you need to wait for the runtime to
be ready (e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_list_has_item.apply(null,arguments)},a._vscf_signer
_info_list_item=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.vscf_signer_info_list_item.apply(null,arguments)},a._vscf_signer_inf
o_list_has_next=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_list_has_next.apply(null,arguments)},a._vscf_signer
_info_list_next=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_list_next.apply(null,arguments)},a._vscf_signer_inf
o_list_has_prev=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_list_has_prev.apply(null,arguments)},a._vscf_signer
_info_list_prev=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_list_prev.apply(null,arguments)},a._vscf_signer_inf
o_list_clear=function(){return p(U,"you need to wait for the runtime to be ready
(e.g. wait for main() to be called)"),p(!0,"the runtime was exited (use
NO_EXIT_RUNTIME to keep it alive after main()
exits)"),a.asm.vscf_signer_info_list_clear.apply(null,arguments)},a._vscf_verifier_
new=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_verifier_new.apply(null,arguments)},a._vscf_verifier_delete=fun
ction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vscf_verifier_delete.apply(null,arguments)},a._vscf_verifier_shallow
_copy=function(){return p(U,"you need to wait for the runtime to be ready (e.g.
wait for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME
to keep it alive after main()
exits)"),a.asm.vscf_verifier_shallow_copy.apply(null,arguments)},a._vscf_verifier_r
eset=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_verifier_reset.apply(null,arguments)},a._vscf_verifier_append_d
ata=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_verifier_append_data.apply(null,arguments)},a._vscf_verifier_ve
rify=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vscf_verifier_verify.apply(null,arguments)},a._vsc_buffer_new=functi
on(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vsc_buffer_new.apply(null,arguments)},a._vsc_buffer_new_with_capacit
y=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vsc_buffer_new_with_capacity.apply(null,arguments)},a._vsc_buffer_de
lete=function(){return p(U,"you need to wait for the runtime to be ready (e.g. wait
for main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to
keep it alive after main()
exits)"),a.asm.vsc_buffer_delete.apply(null,arguments)},a._vsc_buffer_data=function
(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main()
to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vsc_buffer_data.apply(null,arguments)},a._vsc_buffer_make_secure=fun
ction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vsc_buffer_make_secure.apply(null,arguments)},a._vsc_buffer_bytes=fu
nction(){return p(U,"you need to wait for the runtime to be ready (e.g. wait for
main() to be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it
alive after main()
exits)"),a.asm.vsc_buffer_bytes.apply(null,arguments)},a._vsc_buffer_len=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vsc_buffer_len.apply(null,arguments)},a._vsc_data_ctx_size=function(
){return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vsc_data_ctx_size.apply(null,arguments)},a._vsc_data=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vsc_data.apply(null,arguments)},a._vsc_data_len=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.vsc_data_len.apply(null,arguments)},a._vsc_data_bytes=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.vsc_data_bytes.apply(null,arguments)},a.___errno_location=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.__errno_location.apply(null,arguments)},a._fflush=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main() exits)"),a.asm.fflush.apply(null,arguments)},a._setThrew=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main() exits)"),a.asm.setThrew.apply(null,arguments)},a._malloc=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main() exits)"),a.asm.malloc.apply(null,arguments)}),qb=(a._free=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main() exits)"),a.asm.free.apply(null,arguments)},a.stackSave=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main() exits)"),a.asm.stackSave.apply(null,arguments)}),$b=(a.stackAlloc=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.stackAlloc.apply(null,arguments)},a.stackRestore=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.stackRestore.apply(null,arguments)},a.__growWasmMemory=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main() exits)"),a.asm.__growWasmMemory.apply(null,arguments)});function ew(e)
{function t(){Qb||(Qb=!0,m||(X(),p(!U),U=!0,a.noFSInit||fe.init.initialized||
fe.init(),oe.init(),Z(M),X(),fe.ignorePermissions=!
1,Z(V),a.onRuntimeInitialized&&a.onRuntimeInitialized(),p(!a._main,'compiled
without a main, but one is present. if you added it from JS, use
Module["onRuntimeInitialized"]'),function(){if(X(),a.postRun)for("function"==typeof
a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)e=a.postRun.shift(),B.unshift(
e);var e;Z(B);}()));}G>0||(P(),function(){if(a.preRun)for("function"==typeof
a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)e=a.preRun.shift(),R.unshift(e);va
r e;Z(R);}(),G>0||(a.setStatus?(a.setStatus("Running..."),setTimeout((function()
{setTimeout((function()
{a.setStatus("");}),1),t();}),1)):t(),X()));}if(a.dynCall_ii=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main() exits)"),a.asm.dynCall_ii.apply(null,arguments)},a.dynCall_iiii=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.dynCall_iiii.apply(null,arguments)},a.dynCall_jiji=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.dynCall_jiji.apply(null,arguments)},a.dynCall_iidiiii=function()
{return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.dynCall_iidiiii.apply(null,arguments)},a.dynCall_vii=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.dynCall_vii.apply(null,arguments)},a.dynCall_viii=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main() exits)"),a.asm.dynCall_viii.apply(null,arguments)},a.dynCall_vi=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.dynCall_vi.apply(null,arguments)},a.dynCall_iii=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main() exits)"),a.asm.dynCall_iii.apply(null,arguments)},a.dynCall_viiii=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.dynCall_viiii.apply(null,arguments)},a.dynCall_iiiii=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.dynCall_iiiii.apply(null,arguments)},a.dynCall_iiiiiii=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.dynCall_iiiiiii.apply(null,arguments)},a.dynCall_i=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main() exits)"),a.asm.dynCall_i.apply(null,arguments)},a.dynCall_iiiiii=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.dynCall_iiiiii.apply(null,arguments)},a.dynCall_iij=function()
{return p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to
be called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive
after main()
exits)"),a.asm.dynCall_iij.apply(null,arguments)},a.dynCall_ji=function(){return
p(U,"you need to wait for the runtime to be ready (e.g. wait for main() to be
called)"),p(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after
main()
exits)"),a.asm.dynCall_ji.apply(null,arguments)},a.asm=pe,Object.getOwnPropertyDesc
riptor(a,"intArrayFromString")||(a.intArrayFromString=function()
{D("'intArrayFromString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS
(see the FAQ)");}),Object.getOwnPropertyDescriptor(a,"intArrayToString")||
(a.intArrayToString=function(){D("'intArrayToString' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"ccall")||(a.ccall=function()
{D("'ccall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"cwrap")||(a.cwrap=function()
{D("'cwrap' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"setValue")||(a.setValue=function()
{D("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"getValue")||(a.getValue=function()
{D("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"allocate")||(a.allocate=function()
{D("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"getMemory")||(a.getMemory=function()
{D("'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export
this for you");}),Object.getOwnPropertyDescriptor(a,"AsciiToString")||
(a.AsciiToString=function(){D("'AsciiToString' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"stringToAscii")||
(a.stringToAscii=function(){D("'stringToAscii' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"UTF8ArrayToString")||
(a.UTF8ArrayToString=function(){D("'UTF8ArrayToString' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"UTF8ToString")||
(a.UTF8ToString=function(){D("'UTF8ToString' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"stringToUTF8Array")||
(a.stringToUTF8Array=function(){D("'stringToUTF8Array' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"stringToUTF8")||
(a.stringToUTF8=function(){D("'stringToUTF8' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"lengthBytesUTF8")||
(a.lengthBytesUTF8=function(){D("'lengthBytesUTF8' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"UTF16ToString")||
(a.UTF16ToString=function(){D("'UTF16ToString' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"stringToUTF16")||
(a.stringToUTF16=function(){D("'stringToUTF16' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"lengthBytesUTF16")||
(a.lengthBytesUTF16=function(){D("'lengthBytesUTF16' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"UTF32ToString")||
(a.UTF32ToString=function(){D("'UTF32ToString' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"stringToUTF32")||
(a.stringToUTF32=function(){D("'stringToUTF32' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"lengthBytesUTF32")||
(a.lengthBytesUTF32=function(){D("'lengthBytesUTF32' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"allocateUTF8")||
(a.allocateUTF8=function(){D("'allocateUTF8' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"stackTrace")||(a.stackTrace=function()
{D("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see
the FAQ)");}),Object.getOwnPropertyDescriptor(a,"addOnPreRun")||
(a.addOnPreRun=function(){D("'addOnPreRun' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"addOnInit")||(a.addOnInit=function()
{D("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"addOnPreMain")||
(a.addOnPreMain=function(){D("'addOnPreMain' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"addOnExit")||(a.addOnExit=function()
{D("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"addOnPostRun")||
(a.addOnPostRun=function(){D("'addOnPostRun' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"writeStringToMemory")||
(a.writeStringToMemory=function(){D("'writeStringToMemory' was not exported. add it
to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"writeArrayToMemory")||
(a.writeArrayToMemory=function(){D("'writeArrayToMemory' was not exported. add it
to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"writeAsciiToMemory")||
(a.writeAsciiToMemory=function(){D("'writeAsciiToMemory' was not exported. add it
to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"addRunDependency")||
(a.addRunDependency=function(){D("'addRunDependency' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem
support (-s FORCE_FILESYSTEM=1) can export this for
you");}),Object.getOwnPropertyDescriptor(a,"removeRunDependency")||
(a.removeRunDependency=function(){D("'removeRunDependency' was not exported. add it
to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem
support (-s FORCE_FILESYSTEM=1) can export this for
you");}),Object.getOwnPropertyDescriptor(a,"ENV")||(a.ENV=function(){D("'ENV' was
not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"FS")||(a.FS=function(){D("'FS' was not
exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"FS_createFolder")||
(a.FS_createFolder=function(){D("'FS_createFolder' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem
support (-s FORCE_FILESYSTEM=1) can export this for
you");}),Object.getOwnPropertyDescriptor(a,"FS_createPath")||
(a.FS_createPath=function(){D("'FS_createPath' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem
support (-s FORCE_FILESYSTEM=1)
can export this for
you");}),Object.getOwnPropertyDescriptor(a,"FS_createDataFile")||
(a.FS_createDataFile=function(){D("'FS_createDataFile' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem
support (-s FORCE_FILESYSTEM=1) can export this for
you");}),Object.getOwnPropertyDescriptor(a,"FS_createPreloadedFile")||
(a.FS_createPreloadedFile=function(){D("'FS_createPreloadedFile' was not exported.
add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing
filesystem support (-s FORCE_FILESYSTEM=1) can export this for
you");}),Object.getOwnPropertyDescriptor(a,"FS_createLazyFile")||
(a.FS_createLazyFile=function(){D("'FS_createLazyFile' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem
support (-s FORCE_FILESYSTEM=1) can export this for
you");}),Object.getOwnPropertyDescriptor(a,"FS_createLink")||
(a.FS_createLink=function(){D("'FS_createLink' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem
support (-s FORCE_FILESYSTEM=1) can export this for
you");}),Object.getOwnPropertyDescriptor(a,"FS_createDevice")||
(a.FS_createDevice=function(){D("'FS_createDevice' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem
support (-s FORCE_FILESYSTEM=1) can export this for
you");}),Object.getOwnPropertyDescriptor(a,"FS_unlink")||(a.FS_unlink=function()
{D("'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export
this for you");}),Object.getOwnPropertyDescriptor(a,"GL")||(a.GL=function(){D("'GL'
was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"dynamicAlloc")||
(a.dynamicAlloc=function(){D("'dynamicAlloc' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"loadDynamicLibrary")||
(a.loadDynamicLibrary=function(){D("'loadDynamicLibrary' was not exported. add it
to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"loadWebAssemblyModule")||
(a.loadWebAssemblyModule=function(){D("'loadWebAssemblyModule' was not exported.
add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"getLEB")||(a.getLEB=function()
{D("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"getFunctionTables")||
(a.getFunctionTables=function(){D("'getFunctionTables' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"alignFunctionTables")||
(a.alignFunctionTables=function(){D("'alignFunctionTables' was not exported. add it
to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"registerFunctions")||
(a.registerFunctions=function(){D("'registerFunctions' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"addFunction")||
(a.addFunction=function(){D("'addFunction' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"removeFunction")||
(a.removeFunction=function(){D("'removeFunction' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"getFuncWrapper")||
(a.getFuncWrapper=function(){D("'getFuncWrapper' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"prettyPrint")||
(a.prettyPrint=function(){D("'prettyPrint' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"makeBigInt")||(a.makeBigInt=function()
{D("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see
the FAQ)");}),Object.getOwnPropertyDescriptor(a,"dynCall")||(a.dynCall=function()
{D("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"getCompilerSetting")||
(a.getCompilerSetting=function(){D("'getCompilerSetting' was not exported. add it
to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"stackSave")||(a.stackSave=function()
{D("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"stackRestore")||
(a.stackRestore=function(){D("'stackRestore' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"stackAlloc")||(a.stackAlloc=function()
{D("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see
the FAQ)");}),Object.getOwnPropertyDescriptor(a,"establishStackSpace")||
(a.establishStackSpace=function(){D("'establishStackSpace' was not exported. add it
to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"print")||(a.print=function()
{D("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"printErr")||(a.printErr=function()
{D("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"getTempRet0")||
(a.getTempRet0=function(){D("'getTempRet0' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"setTempRet0")||
(a.setTempRet0=function(){D("'setTempRet0' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"callMain")||(a.callMain=function()
{D("'callMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"abort")||(a.abort=function()
{D("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"Pointer_stringify")||
(a.Pointer_stringify=function(){D("'Pointer_stringify' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"warnOnce")||(a.warnOnce=function()
{D("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),a.writeStackCookie=P,a.checkStackCookie=X,a.abortStackOverflow=function(e
){D("Stack overflow! Attempted to allocate "+e+" bytes on the stack, but stack has
only "+(16e4-qb()+e)+" bytes
available!");},Object.getOwnPropertyDescriptor(a,"intArrayFromBase64")||
(a.intArrayFromBase64=function(){D("'intArrayFromBase64' was not exported. add it
to EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"tryParseAsDataURI")||
(a.tryParseAsDataURI=function(){D("'tryParseAsDataURI' was not exported. add it to
EXTRA_EXPORTED_RUNTIME_METHODS (see the
FAQ)");}),Object.getOwnPropertyDescriptor(a,"ALLOC_NORMAL")||
Object.defineProperty(a,"ALLOC_NORMAL",{configurable:!0,get:function()
{D("'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see
the FAQ)");}}),Object.getOwnPropertyDescriptor(a,"ALLOC_STACK")||
Object.defineProperty(a,"ALLOC_STACK",{configurable:!0,get:function()
{D("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see
the FAQ)");}}),Object.getOwnPropertyDescriptor(a,"ALLOC_DYNAMIC")||
Object.defineProperty(a,"ALLOC_DYNAMIC",{configurable:!0,get:function()
{D("'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see
the FAQ)");}}),Object.getOwnPropertyDescriptor(a,"ALLOC_NONE")||
Object.defineProperty(a,"ALLOC_NONE",{configurable:!0,get:function()
{D("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see
the FAQ)");}}),Object.getOwnPropertyDescriptor(a,"calledRun")||
Object.defineProperty(a,"calledRun",{configurable:!0,get:function(){D("'calledRun'
was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ).
Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this
for you");}}),a.then=function(e){if(Qb)e(a);else {var
t=a.onRuntimeInitialized;a.onRuntimeInitialized=function(){t&&t(),e(a);};}return
a},z=function e(){Qb||ew(),Qb||(z=e);},a.run=ew,a.preInit)for("function"==typeof
a.preInit&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return
ew(),e});e.exports=a;}(t={exports:{}}),t.exports}(),i$1=(e,t)=>{class r extends
Error{constructor(e){super(e),this.name="FoundationError",this.message=e;}static
handleStatusCode(e){if(0!=e){if(-1==e)throw new r("This error should not be
returned if assertions is enabled.");if(-2==e)throw new r("Can be used to define
that not all context prerequisites are satisfied. Note, this error should not be
returned if assertions is enabled.");if(-3==e)throw new r("Define that error code
from one of third-party module was not handled. Note, this error should not be
returned if assertions is enabled.");if(-101==e)throw new r("Buffer capacity is not
enough to hold result.");if(-200==e)throw new r("Unsupported algorithm.");if(-
201==e)throw new r("Authentication failed during decryption.");if(-202==e)throw new
r("Attempt to read data out of buffer bounds.");if(-203==e)throw new r("ASN.1
encoded data is corrupted.");if(-204==e)throw new r("Attempt to read ASN.1 type
that is bigger then requested C type.");if(-205==e)throw new r("ASN.1
representation of PKCS#1 public key is corrupted.");if(-206==e)throw new r("ASN.1
representation of PKCS#1 private key is corrupted.");if(-207==e)throw new r("ASN.1
representation of PKCS#8 public key is corrupted.");if(-208==e)throw new r("ASN.1
representation of PKCS#8 private key is corrupted.");if(-209==e)throw new
r("Encrypted data is corrupted.");if(-210==e)throw new r("Underlying random
operation returns error.");if(-211==e)throw new r("Generation of the
private or secret key failed.");if(-212==e)throw new r("One of the entropy sources
failed.");if(-213==e)throw new r("Requested data to be generated is too big.");if(-
214==e)throw new r("Base64 encoded string contains invalid characters.");if(-
215==e)throw new r("PEM data is corrupted.");if(-216==e)throw new r("Exchange key
return zero.");if(-217==e)throw new r("Ed25519 public key is corrupted.");if(-
218==e)throw new r("Ed25519 private key is corrupted.");if(-219==e)throw new
r("CURVE25519 public key is corrupted.");if(-220==e)throw new r("CURVE25519 private
key is corrupted.");if(-221==e)throw new r("Elliptic curve public key format is
corrupted see RFC 5480.");if(-222==e)throw new r("Elliptic curve public key format
is corrupted see RFC 5915.");if(-223==e)throw new r("ASN.1 representation of a
public key is corrupted.");if(-224==e)throw new r("ASN.1 representation of a
private key is corrupted.");if(-225==e)throw new r("Key algorithm does not accept
given type of public key.");if(-226==e)throw new r("Key algorithm does not accept
given type of private key.");if(-227==e)throw new r("Post-quantum Falcon-Sign
public key is corrupted.");if(-228==e)throw new r("Post-quantum Falcon-Sign private
key is corrupted.");if(-229==e)throw new r("Generic Round5 library error.");if(-
230==e)throw new r("Post-quantum NIST Round5 public key is corrupted.");if(-
231==e)throw new r("Post-quantum NIST Round5 private key is corrupted.");if(-
232==e)throw new r("Compound public key is corrupted.");if(-233==e)throw new
r("Compound private key is corrupted.");if(-234==e)throw new r("Compound public
hybrid key is corrupted.");if(-235==e)throw new r("Compound private hybrid key is
corrupted.");if(-236==e)throw new r("ASN.1 AlgorithmIdentifer is corrupted.");if(-
237==e)throw new r("ASN.1 AlgorithmIdentifer with ECParameters is corrupted.");if(-
238==e)throw new r("ASN.1 AlgorithmIdentifer with CompoundKeyParams is
corrupted.");if(-239==e)throw new r("ASN.1 AlgorithmIdentifer with HybridKeyParams
is corrupted.");if(-301==e)throw new r("Decryption failed, because message info was
not given explicitly, and was not part of an encrypted message.");if(-302==e)throw
new r("Message Info is corrupted.");if(-303==e)throw new r("Recipient defined with
id is not found within message info during data decryption.");if(-304==e)throw new
r("Content encryption key can not be decrypted with a given private key.");if(-
305==e)throw new r("Content encryption key can not be decrypted with a given
password.");if(-306==e)throw new r("Custom parameter with a given key is not found
within message info.");if(-307==e)throw new r("A custom parameter with a given key
is found, but the requested value type does not correspond to the actual
type.");if(-308==e)throw new r("Signature format is corrupted.");if(-309==e)throw
new r("Message Info footer is corrupted.");if(-401==e)throw new r("Brainkey
password length is out of range.");if(-402==e)throw new r("Brainkey number length
should be 32 byte.");if(-403==e)throw new r("Brainkey point length should be 65
bytes.");if(-404==e)throw new r("Brainkey name is out of range.");if(-405==e)throw
new r("Brainkey internal error.");if(-406==e)throw new r("Brainkey point is
invalid.");if(-407==e)throw new r("Brainkey number buffer length capacity should be
>= 32 byte.");if(-408==e)throw new r("Brainkey point buffer length capacity should
be >= 32 byte.");if(-409==e)throw new r("Brainkey seed buffer length capacity
should be >= 32 byte.");if(-410==e)throw new r("Brainkey identity secret is
invalid.");if(-411==e)throw new r("KEM encapsulated key is invalid or does not
correspond to the private key.");if(-501==e)throw new r("Invalid padding.");if(-
601==e)throw new r("Protobuf error.");if(-701==e)throw new r("Session id doesnt
match.");if(-702==e)throw new r("Epoch not found.");if(-703==e)throw new r("Wrong
key type.");if(-704==e)throw new r("Invalid signature.");if(-705==e)throw new
r("Ed25519 error.");if(-706==e)throw new r("Duplicate epoch.");if(-707==e)throw new
r("Plain text too long.");throw new r("Unexpected status code:"+e)}}}return
r};function n$1(e,t){if(!("number"==typeof t||t instanceof Number))throw new
TypeError(`'${e}' is not a number`);if(Number.isNaN(t))throw new TypeError(`'${e}'
is NaN`);if(t===1/0)throw new TypeError(`'${e}' is Infinity`);if(t===-1/0)throw new
TypeError(`'${e}' is -Infinity`)}function o$1(e,t){if(n$1(e,t),0==t)throw new
TypeError(`'${e}' is NULL`)}var _={ensureNumber:n$1,ensureString:function(e,t){if(!
("string"==typeof t||t instanceof String))throw new TypeError(`'${e}' is not a
string`)},ensureBoolean:function(e,t){if("boolean"!=typeof t)throw new
TypeError(`'${e}' is not a boolean`)},ensureByteArray:function(e,t){if(!(t
instanceof Uint8Array))throw new TypeError(`'${e}' is not an
Uint8Array`)},ensureClass:function(e,t,r){if(!(t instanceof r))throw new
TypeError(`'${e}' is not an instance of the class $
{r.name}`);o$1(e,t.ctxPtr);},ensureNotNull:o$1,ensureImplementInterface:function(e,
t,r,a,i){if(o$1(e,t.ctxPtr),!i.isImplemented(t.ctxPtr,a))throw new TypeError(`'$
{e}' does not implement interface '${r}'`)}},s$1=(e,t)=>{class r{constructor(t)
{this.name="MessageInfo",this.ctxPtr=void 0===t?
e._vscf_message_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_message_info_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_message_info_delete(this.ctxPtr),this.ctxPtr=null);}dataEnc
ryptionAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_message_info_data_encryption_a
lg_info(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}keyRecipientInfoLis
t(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_message_info_key_recipient_inf
o_list(this.ctxPtr),t.KeyRecipientInfoList.newAndUseCContext(r)}passwordRecipientIn
foList(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_message_info_password_recipien
t_info_list(this.ctxPtr),t.PasswordRecipientInfoList.newAndUseCContext(r)}hasCustom
Params(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_message_info_has_custom_params
(this.ctxPtr),!!t}customParams(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_message_info_custom_params(thi
s.ctxPtr),t.MessageInfoCustomParams.newAndUseCContext(r)}hasCipherKdfAlgInfo(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_message_info_has_cipher_kdf_al
g_info(this.ctxPtr),!!t}cipherKdfAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_message_info_cipher_kdf_alg_in
fo(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}hasCipherPaddingAlgInfo(
){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_message_info_has_cipher_paddin
g_alg_info(this.ctxPtr),!!t}cipherPaddingAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_message_info_cipher_padding_al
g_info(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}hasFooterInfo(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_message_info_has_footer_info(t
his.ctxPtr),!!t}footerInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_message_info_footer_info(this.
ctxPtr),t.FooterInfo.newAndUseCContext(r)}clear()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_message_info_clear(this.ctxPtr)
;}}return r},c$1=(e,t)=>{class r{constructor(t)
{this.name="KeyRecipientInfo",this.ctxPtr=void 0===t?
e._vscf_key_recipient_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_key_recipient_info_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_key_recipient_info_delete(this.ctxPtr),this.ctxPtr=null);}s
tatic newWithData(a,i,n)
{_.ensureByteArray("recipientId",a),_.ensureImplementInterface("keyEncryptionAlgori
thm",i,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface
),_.ensureByteArray("encryptedKey",n);const
o=a.length*a.BYTES_PER_ELEMENT,s=e._malloc(o);e.HEAP8.set(a,s);const
c=e._vsc_data_ctx_size(),f=e._malloc(c);e._vsc_data(f,s,o);const
l=n.length*n.BYTES_PER_ELEMENT,u=e._malloc(l);e.HEAP8.set(n,u);const
A=e._vsc_data_ctx_size(),d=e._malloc(A);let m;e._vsc_data(d,u,l);try{return
m=e._vscf_key_recipient_info_new_with_data(f,i.ctxPtr,d),r.newAndTakeCContext(m)}fi
nally{e._free(s),e._free(f),e._free(u),e._free(d);}}recipientId()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_key_recipient_info_recipient_id
(r,this.ctxPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}keyEncryptionAlgorithm(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_key_recipient_info_key_encrypt
ion_algorithm(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}encryptedKey(
){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_key_recipient_info_encrypted_ke
y(r,this.ctxPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}}return r},f$1=(e,t)=>{class
r{constructor(t){this.name="KeyRecipientInfoList",this.ctxPtr=void 0===t?
e._vscf_key_recipient_info_list_new():t;}static newAndUseCContext(t){return new
r(e._vscf_key_recipient_info_list_shallow_copy(t))}static newAndTakeCContext(e)
{return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_key_recipient_info_list_delete(this.ctxPtr),this.ctxPtr=nul
l);}hasItem(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_recipient_info_list_has_it
em(this.ctxPtr),!!t}item(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_key_recipient_info_list_item(t
his.ctxPtr),t.KeyRecipientInfo.newAndUseCContext(r)}hasNext(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_recipient_info_list_has_ne
xt(this.ctxPtr),!!t}next(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_recipient_info_list_next(t
his.ctxPtr),r.newAndUseCContext(t)}hasPrev(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_recipient_info_list_has_pr
ev(this.ctxPtr),!!t}prev(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_recipient_info_list_prev(t
his.ctxPtr),r.newAndUseCContext(t)}clear()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_key_recipient_info_list_clear(t
his.ctxPtr);}}return r},l$1=(e,t)=>{class r{constructor(t)
{this.name="PasswordRecipientInfo",this.ctxPtr=void 0===t?
e._vscf_password_recipient_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_password_recipient_info_shallow_copy(t))}static newAndTakeCContext(e)
{return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_password_recipient_info_delete(this.ctxPtr),this.ctxPtr=nul
l);}static newWithMembers(a,i)
{_.ensureImplementInterface("keyEncryptionAlgorithm",a,"Foundation.AlgInfo",t.Found
ationInterfaceTag.ALG_INFO,t.FoundationInterface),_.ensureByteArray("encryptedKey",
i);const n=i.length*i.BYTES_PER_ELEMENT,o=e._malloc(n);e.HEAP8.set(i,o);const
s=e._vsc_data_ctx_size(),c=e._malloc(s);let f;e._vsc_data(c,o,n);try{return
f=e._vscf_password_recipient_info_new_with_members(a.ctxPtr,c),r.newAndTakeCContext
(f)}finally{e._free(o),e._free(c);}}keyEncryptionAlgorithm(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_password_recipient_info_key_en
cryption_algorithm(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}encrypte
dKey(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_password_recipient_info_encrypt
ed_key(r,this.ctxPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}}return r},u$1=(e,t)=>{class
r{constructor(t){this.name="PasswordRecipientInfoList",this.ctxPtr=void 0===t?
e._vscf_password_recipient_info_list_new():t;}static newAndUseCContext(t){return
new r(e._vscf_password_recipient_info_list_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_password_recipient_info_list_delete(this.ctxPtr),this.ctxPt
r=null);}hasItem(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_password_recipient_info_list_h
as_item(this.ctxPtr),!!t}item(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_password_recipient_info_list_i
tem(this.ctxPtr),t.PasswordRecipientInfo.newAndUseCContext(r)}hasNext(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_password_recipient_info_list_h
as_next(this.ctxPtr),!!t}next(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_password_recipient_info_list_n
ext(this.ctxPtr),r.newAndUseCContext(t)}hasPrev(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_password_recipient_info_list_h
as_prev(this.ctxPtr),!!t}prev(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_password_recipient_info_list_p
rev(this.ctxPtr),r.newAndUseCContext(t)}clear()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_password_recipient_info_list_cl
ear(this.ctxPtr);}}return r},A=(e,t)=>{class r{constructor(t)
{this.name="Ecies",this.ctxPtr=void 0===t?e._vscf_ecies_new():t;}static
newAndUseCContext(t){return new r(e._vscf_ecies_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_ecies_delete(this.ctxPtr),this.ctxPtr=null);}set random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_e
cies_release_random(this.ctxPtr),e._vscf_ecies_use_random(this.ctxPtr,r.ctxPtr);}se
t cipher(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("cipher",r,"
Foundation.Cipher",t.FoundationInterfaceTag.CIPHER,t.FoundationInterface),e._vscf_e
cies_release_cipher(this.ctxPtr),e._vscf_ecies_use_cipher(this.ctxPtr,r.ctxPtr);}se
t mac(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("mac",r,"Fou
ndation.Mac",t.FoundationInterfaceTag.MAC,t.FoundationInterface),e._vscf_ecies_rele
ase_mac(this.ctxPtr),e._vscf_ecies_use_mac(this.ctxPtr,r.ctxPtr);}set kdf(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("kdf",r,"Fou
ndation.Kdf",t.FoundationInterfaceTag.KDF,t.FoundationInterface),e._vscf_ecies_rele
ase_kdf(this.ctxPtr),e._vscf_ecies_use_kdf(this.ctxPtr,r.ctxPtr);}set
ephemeralKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("ephemeralKe
y",r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInter
face),e._vscf_ecies_release_ephemeral_key(this.ctxPtr),e._vscf_ecies_use_ephemeral_
key(this.ctxPtr,r.ctxPtr);}setKeyAlg(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("keyAlg",r,"
Foundation.KeyAlg",t.FoundationInterfaceTag.KEY_ALG,t.FoundationInterface),e._vscf_
ecies_set_key_alg(this.ctxPtr,r.ctxPtr);}releaseKeyAlg()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_ecies_release_key_alg(this.ctxP
tr);}setupDefaults(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_ecies_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusCode(r);}
setupDefaultsNoRandom()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_ecies_setup_defaults_no_random(
this.ctxPtr);}encryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_ecies_encrypted_len(this.ctxPtr,r.ctxPtr,a),i
}encrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.encryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_ecies_encrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStatusCod
e(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}decry
ptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_ecies_decrypted_len(this.ctxPtr,r.ctxPtr,a
),i}decrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.decryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_ecies_decrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStatusCod
e(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}}retu
rn r},d=(e,t)=>{class r{constructor(t){this.name="RecipientCipher",this.ctxPtr=void
0===t?e._vscf_recipient_cipher_new():t;}static newAndUseCContext(t){return new
r(e._vscf_recipient_cipher_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_recipient_cipher_delete(this.ctxPtr),this.ctxPtr=null);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_r
ecipient_cipher_release_random(this.ctxPtr),e._vscf_recipient_cipher_use_random(thi
s.ctxPtr,r.ctxPtr);}set encryptionCipher(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("encryptionC
ipher",r,"Foundation.Cipher",t.FoundationInterfaceTag.CIPHER,t.FoundationInterface)
,e._vscf_recipient_cipher_release_encryption_cipher(this.ctxPtr),e._vscf_recipient_
cipher_use_encryption_cipher(this.ctxPtr,r.ctxPtr);}set encryptionPadding(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("encryptionP
adding",r,"Foundation.Padding",t.FoundationInterfaceTag.PADDING,t.FoundationInterfa
ce),e._vscf_recipient_cipher_release_encryption_padding(this.ctxPtr),e._vscf_recipi
ent_cipher_use_encryption_padding(this.ctxPtr,r.ctxPtr);}set paddingParams(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("paddingParams",r,t.Paddi
ngParams),e._vscf_recipient_cipher_release_padding_params(this.ctxPtr),e._vscf_reci
pient_cipher_use_padding_params(this.ctxPtr,r.ctxPtr);}set signerHash(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("signerHash"
,r,"Foundation.Hash",t.FoundationInterfaceTag.HASH,t.FoundationInterface),e._vscf_r
ecipient_cipher_release_signer_hash(this.ctxPtr),e._vscf_recipient_cipher_use_signe
r_hash(this.ctxPtr,r.ctxPtr);}hasKeyRecipient(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("recipientId",t);cons
t r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_recipient_cipher_has_key_recipient(this.ctxPtr,n),!!
o}finally{e._free(a),e._free(n);}}addKeyRecipient(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("recipientId",r),_.en
sureImplementInterface("publicKey",a,"Foundation.PublicKey",t.FoundationInterfaceTa
g.PUBLIC_KEY,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);try{e._vscf_recipient_ci
pher_add_key_recipient(this.ctxPtr,s,a.ctxPtr);}finally{e._free(n),e._free(s);}}cle
arRecipients(){_.ensureNotNull("this.ctxPtr",this.ctx
Ptr),e._vscf_recipient_cipher_clear_recipients(this.ctxPtr);}addSigner(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("signerId",r),_.ensur
eImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInterfaceTag
.PRIVATE_KEY,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);try{const
r=e._vscf_recipient_cipher_add_signer(this.ctxPtr,s,a.ctxPtr);t.FoundationError.han
dleStatusCode(r);}finally{e._free(n),e._free(s);}}clearSigners()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_recipient_cipher_clear_signers(
this.ctxPtr);}customParams(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_recipient_cipher_custom_params
(this.ctxPtr),t.MessageInfoCustomParams.newAndUseCContext(r)}startEncryption()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_recipient_cipher_start_encryption(this.ctxPtr);t.FoundationError.handleSt
atusCode(r);}startSignedEncryption(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataSize",r);const
a=e._vscf_recipient_cipher_start_signed_encryption(this.ctxPtr,r);t.FoundationError
.handleStatusCode(a);}messageInfoLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_recipient_cipher_message_info_
len(this.ctxPtr),t}packMessageInfo()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=this.messageInfoLen(),r=e._vsc_buffer_new_with_capacity(t);try{e._vscf_recipient_
cipher_pack_message_info(this.ctxPtr,r);const
t=e._vsc_buffer_bytes(r),a=e._vsc_buffer_len(r);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(r);}}encryptionOutLen(t){let
r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_re
cipient_cipher_encryption_out_len(this.ctxPtr,t),r}processEncryption(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=this.encryptionOutLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_recipient_cipher_process_encryption(this.ctxPtr,o,c);t.FoundationError.ha
ndleStatusCode(r);const a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}finis
hEncryption(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=this.encryptionOutLen(0),a=e._vsc_buffer_new_with_capacity(r);try{const
r=e._vscf_recipient_cipher_finish_encryption(this.ctxPtr,a);t.FoundationError.handl
eStatusCode(r);const i=e._vsc_buffer_bytes(a),n=e._vsc_buffer_len(a);return
e.HEAPU8.slice(i,i+n)}finally{e._vsc_buffer_delete(a);}}startDecryptionWithKey(r,a,
i)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("recipientId",r),_.en
sureImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInterface
Tag.PRIVATE_KEY,t.FoundationInterface),_.ensureByteArray("messageInfo",i);const
n=r.length*r.BYTES_PER_ELEMENT,o=e._malloc(n);e.HEAP8.set(r,o);const
s=e._vsc_data_ctx_size(),c=e._malloc(s);e._vsc_data(c,o,n);const
f=i.length*i.BYTES_PER_ELEMENT,l=e._malloc(f);e.HEAP8.set(i,l);const
u=e._vsc_data_ctx_size(),A=e._malloc(u);e._vsc_data(A,l,f);try{const
r=e._vscf_recipient_cipher_start_decryption_with_key(this.ctxPtr,c,a.ctxPtr,A);t.Fo
undationError.handleStatusCode(r);}finally{e._free(o),e._free(c),e._free(l),e._free
(A);}}startVerifiedDecryptionWithKey(r,a,i,n)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("recipientId",r),_.en
sureImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInterface
Tag.PRIVATE_KEY,t.FoundationInterface),_.ensureByteArray("messageInfo",i),_.ensureB
yteArray("messageInfoFooter",n);const
o=r.length*r.BYTES_PER_ELEMENT,s=e._malloc(o);e.HEAP8.set(r,s);const
c=e._vsc_data_ctx_size(),f=e._malloc(c);e._vsc_data(f,s,o);const
l=i.length*i.BYTES_PER_ELEMENT,u=e._malloc(l);e.HEAP8.set(i,u);const
A=e._vsc_data_ctx_size(),d=e._malloc(A);e._vsc_data(d,u,l);const
m=n.length*n.BYTES_PER_ELEMENT,p=e._malloc(m);e.HEAP8.set(n,p);const
v=e._vsc_data_ctx_size(),y=e._malloc(v);e._vsc_data(y,p,m);try{const
r=e._vscf_recipient_cipher_start_verified_decryption_with_key(this.ctxPtr,f,a.ctxPt
r,d,y);t.FoundationError.handleStatusCode(r);}finally{e._free(s),e._free(f),e._free
(u),e._free(d),e._free(p),e._free(y);}}decryptionOutLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_re
cipient_cipher_decryption_out_len(this.ctxPtr,t),r}processDecryption(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=this.decryptionOutLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_recipient_cipher_process_decryption(this.ctxPtr,o,c);t.FoundationError.ha
ndleStatusCode(r);const a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}finis
hDecryption(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=this.decryptionOutLen(0),a=e._vsc_buffer_new_with_capacity(r);try{const
r=e._vscf_recipient_cipher_finish_decryption(this.ctxPtr,a);t.FoundationError.handl
eStatusCode(r);const i=e._vsc_buffer_bytes(a),n=e._vsc_buffer_len(a);return
e.HEAPU8.slice(i,i+n)}finally{e._vsc_buffer_delete(a);}}isDataSigned(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_recipient_cipher_is_data_signe
d(this.ctxPtr),!!t}signerInfos(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_recipient_cipher_signer_infos(
this.ctxPtr),t.SignerInfoList.newAndUseCContext(r)}verifySignerInfo(r,a){let
i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("signerInfo",r,t.SignerInf
o),_.ensureImplementInterface("publicKey",a,"Foundation.PublicKey",t.FoundationInte
rfaceTag.PUBLIC_KEY,t.FoundationInterface),i=e._vscf_recipient_cipher_verify_signer
_info(this.ctxPtr,r.ctxPtr,a.ctxPtr),!!i}messageInfoFooterLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_recipient_cipher_message_info_
footer_len(this.ctxPtr),t}packMessageInfoFooter()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=this.messageInfoFooterLen(),a=e._vsc_buffer_new_with_capacity(r);try{const
r=e._vscf_recipient_cipher_pack_message_info_footer(this.ctxPtr,a);t.FoundationErro
r.handleStatusCode(r);const i=e._vsc_buffer_bytes(a),n=e._vsc_buffer_len(a);return
e.HEAPU8.slice(i,i+n)}finally{e._vsc_buffer_delete(a);}}}return
r},m$1=(e,t)=>{class r{constructor(t)
{this.name="MessageInfoCustomParams",this.ctxPtr=void 0===t?
e._vscf_message_info_custom_params_new():t;}static newAndUseCContext(t){return new
r(e._vscf_message_info_custom_params_shallow_copy(t))}static newAndTakeCContext(e)
{return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_message_info_custom_params_delete(this.ctxPtr),this.ctxPtr=
null);}addInt(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",t),_.ensureNumb
er("value",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);try{e._vscf_message_info
_custom_params_add_int(this.ctxPtr,o,r);}finally{e._free(i),e._free(o);}}addString(
t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",t),_.ensureByte
Array("value",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=r.length*r.BYTES_PER_ELEMENT,c=e._malloc(s);e.HEAP8.set(r,c);const
f=e._vsc_data_ctx_size(),l=e._malloc(f);e._vsc_data(l,c,s);try{e._vscf_message_info
_custom_params_add_string(this.ctxPtr,o,l);}finally{e._free(i),e._free(o),e._free(c
),e._free(l);}}addData(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",t),_.ensureByte
Array("value",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=r.length*r.BYTES_PER_ELEMENT,c=e._malloc(s);e.HEAP8.set(r,c);const
f=e._vsc_data_ctx_size(),l=e._malloc(f);e._vsc_data(l,c,s);try{e._vscf_message_info
_custom_params_add_data(this.ctxPtr,o,l);}finally{e._free(i),e._free(o),e._free(c),
e._free(l);}}clear()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_message_info_custom_params_clea
r(this.ctxPtr);}findInt(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);let
f;e._vscf_error_reset(c);try{f=e._vscf_message_info_custom_params_find_int(this.ctx
Ptr,o,c);const r=e._vscf_error_status(c);return
t.FoundationError.handleStatusCode(r),f}finally{e._free(i),e._free(o),e._free(c);}}
findString(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);e._vscf_error_reset(c);const
f=e._vsc_data_ctx_size(),l=e._malloc(f);try{e._vscf_message_info_custom_params_find
_string(l,this.ctxPtr,o,c);const
r=e._vscf_error_status(c);t.FoundationError.handleStatusCode(r);const
a=e._vsc_data_len(l),n=e._vsc_data_bytes(l);return
e.HEAPU8.slice(n,n+a)}finally{e._free(i),e._free(o),e._free(c),e._free(l);}}findDat
a(r){_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);e._vscf_error_reset(c);const
f=e._vsc_data_ctx_size(),l=e._malloc(f);try{e._vscf_message_info_custom_params_find
_data(l,this.ctxPtr,o,c);const
r=e._vscf_error_status(c);t.FoundationError.handleStatusCode(r);const
a=e._vsc_data_len(l),n=e._vsc_data_bytes(l);return
e.HEAPU8.slice(n,n+a)}finally{e._free(i),e._free(o),e._free(c),e._free(l);}}hasPara
ms(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_message_info_custom_params_has
_params(this.ctxPtr),!!t}}return r},p$1=(e,t)=>{class r{constructor(t)
{this.name="KeyProvider",this.ctxPtr=void 0===t?
e._vscf_key_provider_new():t;}static newAndUseCContext(t){return new
r(e._vscf_key_provider_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_key_provider_delete(this.ctxPtr),this.ctxPtr=null);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_k
ey_provider_release_random(this.ctxPtr),e._vscf_key_provider_use_random(this.ctxPtr
,r.ctxPtr);}setupDefaults(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_key_provider_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusCo
de(r);}setRsaParams(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("bitlen",t),e._vscf_key_
provider_set_rsa_params(this.ctxPtr,t);}generatePrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("algId",r);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_key_provider_generate_private_key(this.ctxPt
r,r,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}generatePostQuantumPrivateKey()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_error_ctx_size(),a=e._malloc(r);let
i;e._vscf_error_reset(a);try{i=e._vscf_key_provider_generate_post_quantum_private_k
ey(this.ctxPtr,a);const r=e._vscf_error_status(a);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(i)}f
inally{e._free(a);}}generateCompoundPrivateKey(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("cipherAlgId",r),_.ensur
eNumber("signerAlgId",a);const i=e._vscf_error_ctx_size(),n=e._malloc(i);let
o;e._vscf_error_reset(n);try{o=e._vscf_key_provider_generate_compound_private_key(t
his.ctxPtr,r,a,n);const i=e._vscf_error_status(n);return
t.FoundationError.handleStatusCode(i),t.FoundationInterface.newAndTakeCContext(o)}f
inally{e._free(n);}}generateHybridPrivateKey(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("firstKeyAlgId",r),_.ens
ureNumber("secondKeyAlgId",a);const i=e._vscf_error_ctx_size(),n=e._malloc(i);let
o;e._vscf_error_reset(n);try{o=e._vscf_key_provider_generate_hybrid_private_key(thi
s.ctxPtr,r,a,n);const i=e._vscf_error_status(n);return
t.FoundationError.handleStatusCode(i),t.FoundationInterface.newAndTakeCContext(o)}f
inally{e._free(n);}}generateCompoundHybridPrivateKey(r,a,i,n)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("cipherFirstKeyAlgId",r)
,_.ensureNumber("cipherSecondKeyAlgId",a),_.ensureNumber("signerFirstKeyAlgId",i),_
.ensureNumber("signerSecondKeyAlgId",n);const
o=e._vscf_error_ctx_size(),s=e._malloc(o);let
c;e._vscf_error_reset(s);try{c=e._vscf_key_provider_generate_compound_hybrid_privat
e_key(this.ctxPtr,r,a,i,n,s);const o=e._vscf_error_status(s);return
t.FoundationError.handleStatusCode(o),t.FoundationInterface.newAndTakeCContext(c)}f
inally{e._free(s);}}importPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);let
f;e._vscf_error_reset(c);try{f=e._vscf_key_provider_import_private_key(this.ctxPtr,
o,c);const r=e._vscf_error_status(c);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(f)}f
inally{e._free(i),e._free(o),e._free(c);}}importPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);let
f;e._vscf_error_reset(c);try{f=e._vscf_key_provider_import_public_key(this.ctxPtr,o
,c);const r=e._vscf_error_status(c);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(f)}f
inally{e._free(i),e._free(o),e._free(c);}}exportedPublicKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_key_provider_exported_public_key_len(this.ctxPtr,r.ctxPtr),a}exportPublic
Key(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.exportedPublicKeyLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_key_provider_export_public_key(this.ctxPtr,r.ctxPtr,i);t.FoundationError.
handleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}exportedPrivateKeyLen(r)
{let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_key_provider_exported_private_key_len(this.ctxPtr,r.ctxPtr),a}exportPr
ivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const
a=this.exportedPrivateKeyLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_key_provider_export_private_key(this.ctxPtr,r.ctxPtr,i);t.FoundationError
.handleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}}return
r},v$2=(e,t)=>{class r{constructor(t){this.name="Signer",this.ctxPtr=void 0===t?
e._vscf_signer_new():t;}static newAndUseCContext(t){return new
r(e._vscf_signer_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_signer_delete(this.ctxPtr),this.ctxPtr=null);}set hash(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("hash",r,"Fo
undation.Hash",t.FoundationInterfaceTag.HASH,t.FoundationInterface),e._vscf_signer_
release_hash(this.ctxPtr),e._vscf_signer_use_hash(this.ctxPtr,r.ctxPtr);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_s
igner_release_random(this.ctxPtr),e._vscf_signer_use_random(this.ctxPtr,r.ctxPtr);}
reset()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_signer_reset(this.ctxPtr);}appe
ndData(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_signer_appen
d_data(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}signatureLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_signer_signature_len(this.ctxPtr,r.ctxPtr),a}sign(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const a=this.signatureLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_signer_sign(this.ctxPtr,r.ctxPtr,i);t.FoundationError.handleStatusCode(a)
;const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}}return
r},y$1=(e,t)=>{class r{constructor(t){this.name="Verifier",this.ctxPtr=void 0===t?
e._vscf_verifier_new():t;}static newAndUseCContext(t){return new
r(e._vscf_verifier_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_verifier_delete(this.ctxPtr),this.ctxPtr=null);}reset(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("signature",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);try{const
r=e._vscf_verifier_reset(this.ctxPtr,o);t.FoundationError.handleStatusCode(r);}fina
lly{e._free(i),e._free(o);}}appendData(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_verifier_app
end_data(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}verify(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_verifier_verify(this.ctxPtr,r.ctxPtr),!!a}}return r},h=(e,t)=>{class
r{static get POINT_LEN(){return 65}get POINT_LEN(){return r.POINT_LEN}static get
MPI_LEN(){return 32}get MPI_LEN(){return r.MPI_LEN}static get SEED_LEN(){return
32}get SEED_LEN(){return r.SEED_LEN}static get MAX_PASSWORD_LEN(){return 128}get
MAX_PASSWORD_LEN(){return r.MAX_PASSWORD_LEN}static get MAX_KEY_NAME_LEN(){return
128}get MAX_KEY_NAME_LEN(){return r.MAX_KEY_NAME_LEN}constructor(t)
{this.name="BrainkeyClient",this.ctxPtr=void 0===t?
e._vscf_brainkey_client_new():t;}static newAndUseCContext(t){return new
r(e._vscf_brainkey_client_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_brainkey_client_delete(this.ctxPtr),this.ctxPtr=null);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_b
rainkey_client_release_random(this.ctxPtr),e._vscf_brainkey_client_use_random(this.
ctxPtr,r.ctxPtr);}set operationRandom(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("operationRa
ndom",r,"Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),
e._vscf_brainkey_client_release_operation_random(this.ctxPtr),e._vscf_brainkey_clie
nt_use_operation_random(this.ctxPtr,r.ctxPtr);}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_brainkey_client_setup_defaults(this.ctxPtr);t.FoundationError.handleStatu
sCode(r);}blind(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("password",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=t.BrainkeyClient.MPI_LEN,c=e._vsc_buffer_new_with_capacity(s),f=t.BrainkeyClient.
POINT_LEN,l=e._vsc_buffer_new_with_capacity(f);try{const
r=e._vscf_brainkey_client_blind(this.ctxPtr,o,c,l);t.FoundationError.handleStatusCo
de(r);const
a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c),_=e.HEAPU8.slice(a,a+n),s=e._vsc_bu
ffer_bytes(l),f=e._vsc_buffer_len(l);return
{deblindFactor:_,blindedPoint:e.HEAPU8.slice(s,s+f)}}finally{e._free(i),e._free(o),
e._vsc_buffer_delete(c),e._vsc_buffer_delete(l);}}deblind(r,a,i,n)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("password",r),_.ensur
eByteArray("hardenedPoint",a),_.ensureByteArray("deblindFactor",i),_.ensureByteArra
y("keyName",n);const
o=r.length*r.BYTES_PER_ELEMENT,s=e._malloc(o);e.HEAP8.set(r,s);const
c=e._vsc_data_ctx_size(),f=e._malloc(c);e._vsc_data(f,s,o);const
l=a.length*a.BYTES_PER_ELEMENT,u=e._malloc(l);e.HEAP8.set(a,u);const
A=e._vsc_data_ctx_size(),d=e._malloc(A);e._vsc_data(d,u,l);const
m=i.length*i.BYTES_PER_ELEMENT,p=e._malloc(m);e.HEAP8.set(i,p);const
v=e._vsc_data_ctx_size(),y=e._malloc(v);e._vsc_data(y,p,m);const
h=n.length*n.BYTES_PER_ELEMENT,b=e._malloc(h);e.HEAP8.set(n,b);const
w=e._vsc_data_ctx_size(),k=e._malloc(w);e._vsc_data(k,b,h);const
x=t.BrainkeyClient.POINT_LEN,g=e._vsc_buffer_new_with_capacity(x);try{const
r=e._vscf_brainkey_client_deblind(this.ctxPtr,f,d,y,k,g);t.FoundationError.handleSt
atusCode(r);const a=e._vsc_buffer_bytes(g),i=e._vsc_buffer_len(g);return
e.HEAPU8.slice(a,a+i)}finally{e._free(s),e._free(f),e._free(u),e._free(d),e._free(p
),e._free(y),e._free(b),e._free(k),e._vsc_buffer_delete(g);}}}return
r},b=(e,t)=>{class r{static get POINT_LEN(){return 65}get POINT_LEN(){return
r.POINT_LEN}static get MPI_LEN(){return 32}get MPI_LEN(){return
r.MPI_LEN}constructor(t){this.name="BrainkeyServer",this.ctxPtr=void 0===t?
e._vscf_brainkey_server_new():t;}static newAndUseCContext(t){return new
r(e._vscf_brainkey_server_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_brainkey_server_delete(this.ctxPtr),this.ctxPtr=null);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_b
rainkey_server_release_random(this.ctxPtr),e._vscf_brainkey_server_use_random(this.
ctxPtr,r.ctxPtr);}set operationRandom(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("operationRa
ndom",r,"Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),
e._vscf_brainkey_server_release_operation_random(this.ctxPtr),e._vscf_brainkey_serv
er_use_operation_random(this.ctxPtr,r.ctxPtr);}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_brainkey_server_setup_defaults(this.ctxPtr);t.FoundationError.handleStatu
sCode(r);}generateIdentitySecret(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=t.BrainkeyServer.MPI_LEN,a=e._vsc_buffer_new_with_capacity(r);try{const
r=e._vscf_brainkey_server_generate_identity_secret(this.ctxPtr,a);t.FoundationError
.handleStatusCode(r);const i=e._vsc_buffer_bytes(a),n=e._vsc_buffer_len(a);return
e.HEAPU8.slice(i,i+n)}finally{e._vsc_buffer_delete(a);}}harden(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("identitySecret",r),_
.ensureByteArray("blindedPoint",a);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=a.length*a.BYTES_PER_ELEMENT,f=e._malloc(c);e.HEAP8.set(a,f);const
l=e._vsc_data_ctx_size(),u=e._malloc(l);e._vsc_data(u,f,c);const
A=t.BrainkeyServer.POINT_LEN,d=e._vsc_buffer_new_with_capacity(A);try{const
r=e._vscf_brainkey_server_harden(this.ctxPtr,s,u,d);t.FoundationError.handleStatusC
ode(r);const a=e._vsc_buffer_bytes(d),i=e._vsc_buffer_len(d);return
e.HEAPU8.slice(a,a+i)}finally{e._free(n),e._free(s),e._free(f),e._free(u),e._vsc_bu
ffer_delete(d);}}}return r},w=(e,t)=>{class r{static get MAX_MESSAGE_LEN(){return
30188}get MAX_MESSAGE_LEN(){return r.MAX_MESSAGE_LEN}static get MESSAGE_VERSION()
{return 1}get MESSAGE_VERSION(){return r.MESSAGE_VERSION}constructor(t)
{this.name="GroupSessionMessage",this.ctxPtr=void 0===t?
e._vscf_group_session_message_new():t;}static newAndUseCContext(t){return new
r(e._vscf_group_session_message_shallow_copy(t))}static newAndTakeCContext(e)
{return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_group_session_message_delete(this.ctxPtr),this.ctxPtr=null)
;}getType(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_group_session_message_get_type
(this.ctxPtr),t}getSessionId(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_group_session_message_get_sessi
on_id(r,this.ctxPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}getEpoch(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_group_session_message_get_epoc
h(this.ctxPtr),t}serializeLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_group_session_message_serializ
e_len(this.ctxPtr),t}serialize(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=this.serializeLen(),r=e._vsc_buffer_new_with_capacity(t);try{e._vscf_group_sessio
n_message_serialize(this.ctxPtr,r);const
t=e._vsc_buffer_bytes(r),a=e._vsc_buffer_len(r);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(r);}}static deserialize(a)
{_.ensureByteArray("input",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_group_session_message_deserialize(s,f);const
a=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(a),r.newAndTakeCContext(l)}finally{e._free(n),e.
_free(s),e._free(f);}}}return r},k$1=(e,t)=>{class r{constructor(t)
{this.name="GroupSessionTicket",this.ctxPtr=void 0===t?
e._vscf_group_session_ticket_new():t;}static newAndUseCContext(t){return new
r(e._vscf_group_session_ticket_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_group_session_ticket_delete(this.ctxPtr),this.ctxPtr=null);
}set rng(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("rng",r,"Fou
ndation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_grou
p_session_ticket_release_rng(this.ctxPtr),e._vscf_group_session_ticket_use_rng(this
.ctxPtr,r.ctxPtr);}setupDefaults(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_group_session_ticket_setup_defaults(this.ctxPtr);t.FoundationError.handle
StatusCode(r);}setupTicketAsNew(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("sessionId",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);try{const
r=e._vscf_group_session_ticket_setup_ticket_as_new(this.ctxPtr,o);t.FoundationError
.handleStatusCode(r);}finally{e._free(i),e._free(o);}}getTicketMessage(){let
r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_group_session_ticket_get_ticke
t_message(this.ctxPtr),t.GroupSessionMessage.newAndUseCContext(r)}}return
r},x$1=(e,t)=>{class r{static get SENDER_ID_LEN(){return 32}get SENDER_ID_LEN()
{return r.SENDER_ID_LEN}static get MAX_PLAIN_TEXT_LEN(){return 3e4}get
MAX_PLAIN_TEXT_LEN(){return r.MAX_PLAIN_TEXT_LEN}static get MAX_EPOCHS_COUNT()
{return 50}get MAX_EPOCHS_COUNT(){return r.MAX_EPOCHS_COUNT}static get SALT_SIZE()
{return 32}get SALT_SIZE(){return r.SALT_SIZE}constructor(t)
{this.name="GroupSession",this.ctxPtr=void 0===t?
e._vscf_group_session_new():t;}static newAndUseCContext(t){return new
r(e._vscf_group_session_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_group_session_delete(this.ctxPtr),this.ctxPtr=null);}set
rng(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("rng",r,"Fou
ndation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_grou
p_session_release_rng(this.ctxPtr),e._vscf_group_session_use_rng(this.ctxPtr,r.ctxP
tr);}getCurrentEpoch(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_group_session_get_current_epoc
h(this.ctxPtr),t}setupDefaults(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_group_session_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusC
ode(r);}getSessionId(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_group_session_get_session_id(r,
this.ctxPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}addEpoch(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("message",r,t.GroupSessio
nMessage);const
a=e._vscf_group_session_add_epoch(this.ctxPtr,r.ctxPtr);t.FoundationError.handleSta
tusCode(a);}encrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("plainText",r),_.ensu
reImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInterfaceTa
g.PRIVATE_KEY,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_group_session_encrypt(this.ctxPtr,s,a.ctxPtr
,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.GroupSessionMessage.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}decryptLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("message",r,t.GroupSession
Message),a=e._vscf_group_session_decrypt_len(this.ctxPtr,r.ctxPtr),a}decrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("message",r,t.GroupSessio
nMessage),_.ensureImplementInterface("publicKey",a,"Foundation.PublicKey",t.Foundat
ionInterfaceTag.PUBLIC_KEY,t.FoundationInterface);const
i=this.decryptLen(r),n=e._vsc_buffer_new_with_capacity(i);try{const
i=e._vscf_group_session_decrypt(this.ctxPtr,r.ctxPtr,a.ctxPtr,n);t.FoundationError.
handleStatusCode(i);const o=e._vsc_buffer_bytes(n),_=e._vsc_buffer_len(n);return
e.HEAPU8.slice(o,o+_)}finally{e._vsc_buffer_delete(n);}}createGroupTicket()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_error_ctx_size(),a=e._malloc(r);let
i;e._vscf_error_reset(a);try{i=e._vscf_group_session_create_group_ticket(this.ctxPt
r,a);const r=e._vscf_error_status(a);return
t.FoundationError.handleStatusCode(r),t.GroupSessionTicket.newAndTakeCContext(i)}fi
nally{e._free(a);}}}return r},g$1=(e,t)=>{class r{constructor(t)
{this.name="MessageInfoEditor",this.ctxPtr=void 0===t?
e._vscf_message_info_editor_new():t;}static newAndUseCContext(t){return new
r(e._vscf_message_info_editor_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_message_info_editor_delete(this.ctxPtr),this.ctxPtr=null);}
set random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_m
essage_info_editor_release_random(this.ctxPtr),e._vscf_message_info_editor_use_rand
om(this.ctxPtr,r.ctxPtr);}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_message_info_editor_setup_defaults(this.ctxPtr);t.FoundationError.handleS
tatusCode(r);}unpack(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("messageInfoData",r);
const a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);try{const
r=e._vscf_message_info_editor_unpack(this.ctxPtr,o);t.FoundationError.handleStatusC
ode(r);}finally{e._free(i),e._free(o);}}unlock(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("ownerRecipientId",r)
,_.ensureImplementInterface("ownerPrivateKey",a,"Foundation.PrivateKey",t.Foundatio
nInterfaceTag.PRIVATE_KEY,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);try{const
r=e._vscf_message_info_editor_unlock(this.ctxPtr,s,a.ctxPtr);t.FoundationError.hand
leStatusCode(r);}finally{e._free(n),e._free(s);}}addKeyRecipient(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("recipientId",r),_.en
sureImplementInterface("publicKey",a,"Foundation.PublicKey",t.FoundationInterfaceTa
g.PUBLIC_KEY,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);try{const
r=e._vscf_message_info_editor_add_key_recipient(this.ctxPtr,s,a.ctxPtr);t.Foundatio
nError.handleStatusCode(r);}finally{e._free(n),e._free(s);}}removeKeyRecipient(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("recipientId",t);cons
t r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_message_info_editor_remove_key_recipient(this.ctxPtr,n),!!
o}finally{e._free(a),e._free(n);}}removeAll()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_message_info_editor_remove_all(
this.ctxPtr);}packedLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_message_info_editor_packed_len
(this.ctxPtr),t}pack(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=this.packedLen(),r=e._vsc_buffer_new_with_capacity(t);try{e._vscf_message_info_ed
itor_pack(this.ctxPtr,r);const
t=e._vsc_buffer_bytes(r),a=e._vsc_buffer_len(r);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(r);}}}return r},E=(e,t)=>{class
r{constructor(t){this.name="SignerInfo",this.ctxPtr=void 0===t?
e._vscf_signer_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_signer_info_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_signer_info_delete(this.ctxPtr),this.ctxPtr=null);}signerId
(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_signer_info_signer_id(r,this.ct
xPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}signerAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_signer_info_signer_alg_info(th
is.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}signature()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_signer_info_signature(r,this.ct
xPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}}return r},N=(e,t)=>{class
r{constructor(t){this.name="SignerInfoList",this.ctxPtr=void 0===t?
e._vscf_signer_info_list_new():t;}static newAndUseCContext(t){return new
r(e._vscf_signer_info_list_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_signer_info_list_delete(this.ctxPtr),this.ctxPtr=null);}has
Item(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_signer_info_list_has_item(this
.ctxPtr),!!t}item(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_signer_info_list_item(this.ctx
Ptr),t.SignerInfo.newAndUseCContext(r)}hasNext(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_signer_info_list_has_next(this
.ctxPtr),!!t}next(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_signer_info_list_next(this.ctx
Ptr),r.newAndTakeCContext(t)}hasPrev(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_signer_info_list_has_prev(this
.ctxPtr),!!t}prev(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_signer_info_list_prev(this.ctx
Ptr),r.newAndTakeCContext(t)}clear()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_signer_info_list_clear(this.ctx
Ptr);}}return r},I=(e,t)=>{class r{constructor(t)
{this.name="MessageInfoFooter",this.ctxPtr=void 0===t?
e._vscf_message_info_footer_new():t;}static newAndUseCContext(t){return new
r(e._vscf_message_info_footer_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_message_info_footer_delete(this.ctxPtr),this.ctxPtr=null);}
hasSignerInfos(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_message_info_footer_has_signer
_infos(this.ctxPtr),!!t}signerInfos(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_message_info_footer_signer_inf
os(this.ctxPtr),t.SignerInfoList.newAndUseCContext(r)}signerHashAlgInfo(){let
r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_message_info_footer_signer_has
h_alg_info(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}signerDigest()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_message_info_footer_signer_dige
st(r,this.ctxPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}}return r},T=(e,t)=>{class
r{constructor(t){this.name="SignedDataInfo",this.ctxPtr=void 0===t?
e._vscf_signed_data_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_signed_data_info_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_signed_data_info_delete(this.ctxPtr),this.ctxPtr=null);}has
hAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_signed_data_info_hash_alg_info
(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}}return r},P=(e,t)=>{class
r{constructor(t){this.name="FooterInfo",this.ctxPtr=void 0===t?
e._vscf_footer_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_footer_info_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_footer_info_delete(this.ctxPtr),this.ctxPtr=null);}hasSigne
dDataInfo(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_footer_info_has_signed_data_in
fo(this.ctxPtr),!!t}signedDataInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_footer_info_signed_data_info(t
his.ctxPtr),t.SignedDataInfo.newAndUseCContext(r)}setDataSize(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataSize",t),e._vscf_fo
oter_info_set_data_size(this.ctxPtr,t);}dataSize(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_footer_info_data_size(this.ctx
Ptr),t}}return r},X=(e,t)=>{class r{constructor(t)
{this.name="KeyInfo",this.ctxPtr=void 0===t?e._vscf_key_info_new():t;}static
newAndUseCContext(t){return new r(e._vscf_key_info_shallow_copy(t))}static
newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_key_info_delete(this.ctxPtr),this.ctxPtr=null);}static
newWithAlgInfo(a){let i;return
_.ensureImplementInterface("algInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTa
g.ALG_INFO,t.FoundationInterface),i=e._vscf_key_info_new_with_alg_info(a.ctxPtr),r.
newAndTakeCContext(i)}isCompound(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_is_compound(this.ctxP
tr),!!t}isHybrid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_is_hybrid(this.ctxPtr
),!!t}isCompoundHybrid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_is_compound_hybrid(th
is.ctxPtr),!!t}isCompoundHybridCipher(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_is_compound_hybrid_ci
pher(this.ctxPtr),!!t}isCompoundHybridSigner(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_is_compound_hybrid_si
gner(this.ctxPtr),!!t}isHybridPostQuantum(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_is_hybrid_post_quantu
m(this.ctxPtr),!!t}isHybridPostQuantumCipher(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_is_hybrid_post_quantu
m_cipher(this.ctxPtr),!!t}isHybridPostQuantumSigner(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_is_hybrid_post_quantu
m_signer(this.ctxPtr),!!t}algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_alg_id(this.ctxPtr),t
}compoundCipherAlgId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_compound_cipher_alg_i
d(this.ctxPtr),t}compoundSignerAlgId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_compound_signer_alg_i
d(this.ctxPtr),t}hybridFirstKeyAlgId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_hybrid_first_key_alg_
id(this.ctxPtr),t}hybridSecondKeyAlgId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_hybrid_second_key_alg
_id(this.ctxPtr),t}compoundHybridCipherFirstKeyAlgId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_compound_hybrid_ciphe
r_first_key_alg_id(this.ctxPtr),t}compoundHybridCipherSecondKeyAlgId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_compound_hybrid_ciphe
r_second_key_alg_id(this.ctxPtr),t}compoundHybridSignerFirstKeyAlgId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_compound_hybrid_signe
r_first_key_alg_id(this.ctxPtr),t}compoundHybridSignerSecondKeyAlgId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_key_info_compound_hybrid_signe
r_second_key_alg_id(this.ctxPtr),t}}return r},Z=(e,t)=>{class r{static get
DEFAULT_FRAME_MIN(){return 32}get DEFAULT_FRAME_MIN(){return
r.DEFAULT_FRAME_MIN}static get DEFAULT_FRAME(){return 160}get DEFAULT_FRAME()
{return r.DEFAULT_FRAME}static get DEFAULT_FRAME_MAX(){return 256}get
DEFAULT_FRAME_MAX(){return r.DEFAULT_FRAME_MAX}constructor(t)
{this.name="PaddingParams",this.ctxPtr=void 0===t?
e._vscf_padding_params_new():t;}static newAndUseCContext(t){return new
r(e._vscf_padding_params_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_padding_params_delete(this.ctxPtr),this.ctxPtr=null);}stati
c newWithConstraints(t,a){let i;return
_.ensureNumber("frame",t),_.ensureNumber("frameMax",a),i=e._vscf_padding_params_new
_with_constraints(t,a),r.newAndTakeCContext(i)}frame(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_padding_params_frame(this.ctxP
tr),t}frameMax(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_padding_params_frame_max(this.
ctxPtr),t}}return r},R=(e,t)=>{class r{static get DIGEST_LEN(){return 28}get
DIGEST_LEN(){return r.DIGEST_LEN}static get BLOCK_LEN(){return 64}get BLOCK_LEN()
{return r.BLOCK_LEN}constructor(t){this.name="Sha224",this.ctxPtr=void 0===t?
e._vscf_sha224_new():t;}static newAndUseCContext(t){return new
r(e._vscf_sha224_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_sha224_delete(this.ctxPtr),this.ctxPtr=null);}algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_sha224_alg_id(this.ctxPtr),t}p
roduceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_sha224_produce_alg_info(this.c
txPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_sha224_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handleSta
tusCode(a);}hash(t){_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);const
o=this.DIGEST_LEN,s=e._vsc_buffer_new_with_capacity(o);try{e._vscf_sha224_hash(n,s)
;const t=e._vsc_buffer_bytes(s),r=e._vsc_buffer_len(s);return
e.HEAPU8.slice(t,t+r)}finally{e._free(a),e._free(n),e._vsc_buffer_delete(s);}}start
()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_sha224_start(this.ctxPtr);}upda
te(t){_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_sha224_updat
e(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}finish()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=this.DIGEST_LEN,r=e._vsc_buffer_new_with_capacity(t);try{e._vscf_sha224_finish(th
is.ctxPtr,r);const t=e._vsc_buffer_bytes(r),a=e._vsc_buffer_len(r);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(r);}}}return r},M=(e,t)=>{class
r{static get DIGEST_LEN(){return 32}get DIGEST_LEN(){return r.DIGEST_LEN}static get
BLOCK_LEN(){return 64}get BLOCK_LEN(){return r.BLOCK_LEN}constructor(t)
{this.name="Sha256",this.ctxPtr=void 0===t?e._vscf_sha256_new():t;}static
newAndUseCContext(t){return new r(e._vscf_sha256_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_sha256_delete(this.ctxPtr),this.ctxPtr=null);}algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_sha256_alg_id(this.ctxPtr),t}p
roduceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_sha256_produce_alg_info(this.c
txPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_sha256_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handleSta
tusCode(a);}hash(t){_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);const
o=this.DIGEST_LEN,s=e._vsc_buffer_new_with_capacity(o);try{e._vscf_sha256_hash(n,s)
;const t=e._vsc_buffer_bytes(s),r=e._vsc_buffer_len(s);return
e.HEAPU8.slice(t,t+r)}finally{e._free(a),e._free(n),e._vsc_buffer_delete(s);}}start
()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_sha256_start(this.ctxPtr);}upda
te(t){_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_sha256_updat
e(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}finish()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=this.DIGEST_LEN,r=e._vsc_buffer_new_with_capacity(t);try{e._vscf_sha256_finish(th
is.ctxPtr,r);const t=e._vsc_buffer_bytes(r),a=e._vsc_buffer_len(r);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(r);}}}return r},V=(e,t)=>{class
r{static get DIGEST_LEN(){return 48}get DIGEST_LEN(){return r.DIGEST_LEN}static get
BLOCK_LEN(){return 128}get BLOCK_LEN(){return r.BLOCK_LEN}constructor(t)
{this.name="Sha384",this.ctxPtr=void 0===t?e._vscf_sha384_new():t;}static
newAndUseCContext(t){return new r(e._vscf_sha384_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_sha384_delete(this.ctxPtr),this.ctxPtr=null);}algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_sha384_alg_id(this.ctxPtr),t}p
roduceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_sha384_produce_alg_info(this.c
txPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_sha384_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handleSta
tusCode(a);}hash(t){_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);const
o=this.DIGEST_LEN,s=e._vsc_buffer_new_with_capacity(o);try{e._vscf_sha384_hash(n,s)
;const t=e._vsc_buffer_bytes(s),r=e._vsc_buffer_len(s);return
e.HEAPU8.slice(t,t+r)}finally{e._free(a),e._free(n),e._vsc_buffer_delete(s);}}start
()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_sha384_start(this.ctxPtr);}upda
te(t){_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_sha384_updat
e(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}finish()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=this.DIGEST_LEN,r=e._vsc_buffer_new_with_capacity(t);try{e._vscf_sha384_finish(th
is.ctxPtr,r);const t=e._vsc_buffer_bytes(r),a=e._vsc_buffer_len(r);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(r);}}}return r},B=(e,t)=>{class
r{static get DIGEST_LEN(){return 64}get DIGEST_LEN(){return r.DIGEST_LEN}static get
BLOCK_LEN(){return 128}get BLOCK_LEN(){return r.BLOCK_LEN}constructor(t)
{this.name="Sha512",this.ctxPtr=void 0===t?e._vscf_sha512_new():t;}static
newAndUseCContext(t){return new r(e._vscf_sha512_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_sha512_delete(this.ctxPtr),this.ctxPtr=null);}algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_sha512_alg_id(this.ctxPtr),t}p
roduceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_sha512_produce_alg_info(this.c
txPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_sha512_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handleSta
tusCode(a);}hash(t){_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);const
o=this.DIGEST_LEN,s=e._vsc_buffer_new_with_capacity(o);try{e._vscf_sha512_hash(n,s)
;const t=e._vsc_buffer_bytes(s),r=e._vsc_buffer_len(s);return
e.HEAPU8.slice(t,t+r)}finally{e._free(a),e._free(n),e._vsc_buffer_delete(s);}}start
()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_sha512_start(this.ctxPtr);}upda
te(t){_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_sha512_updat
e(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}finish()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=this.DIGEST_LEN,r=e._vsc_buffer_new_with_capacity(t);try{e._vscf_sha512_finish(th
is.ctxPtr,r);const t=e._vsc_buffer_bytes(r),a=e._vsc_buffer_len(r);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(r);}}}return r},U=(e,t)=>{class
r{static get NONCE_LEN(){return 12}get NONCE_LEN(){return r.NONCE_LEN}static get
KEY_LEN(){return 32}get KEY_LEN(){return r.KEY_LEN}static get KEY_BITLEN(){return
256}get KEY_BITLEN(){return r.KEY_BITLEN}static get BLOCK_LEN(){return 16}get
BLOCK_LEN(){return r.BLOCK_LEN}static get AUTH_TAG_LEN(){return 16}get
AUTH_TAG_LEN(){return r.AUTH_TAG_LEN}constructor(t)
{this.name="Aes256Gcm",this.ctxPtr=void 0===t?e._vscf_aes256_gcm_new():t;}static
newAndUseCContext(t){return new r(e._vscf_aes256_gcm_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_aes256_gcm_delete(this.ctxPtr),this.ctxPtr=null);}algId()
{let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_aes256_gcm_alg_id(this.ctxPtr)
,t}produceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_aes256_gcm_produce_alg_info(th
is.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_aes256_gcm_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handl
eStatusCode(a);}encrypt(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=this.encryptedLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_aes256_gcm_encrypt(this.ctxPtr,o,c);t.FoundationError.handleStatusCode(r)
;const a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}encry
ptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_gcm_encrypted_len(this.ctxPtr,t),r}preciseEncryptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_gcm_precise_encrypted_len(this.ctxPtr,t),r}decrypt(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=this.decryptedLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_aes256_gcm_decrypt(this.ctxPtr,o,c);t.FoundationError.handleStatusCode(r)
;const a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}decry
ptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_gcm_decrypted_len(this.ctxPtr,t),r}setNonce(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("nonce",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_aes256_gcm_s
et_nonce(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}setKey(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_aes256_gcm_s
et_key(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}state(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_aes256_gcm_state(this.ctxPtr),
t}startEncryption()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_aes256_gcm_start_encryption(thi
s.ctxPtr);}startDecryption()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_aes256_gcm_start_decryption(thi
s.ctxPtr);}update(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);const
o=this.outLen(t.length),s=e._vsc_buffer_new_with_capacity(o);try{e._vscf_aes256_gcm
_update(this.ctxPtr,n,s);const
t=e._vsc_buffer_bytes(s),r=e._vsc_buffer_len(s);return
e.HEAPU8.slice(t,t+r)}finally{e._free(a),e._free(n),e._vsc_buffer_delete(s);}}outLe
n(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_gcm_out_len(this.ctxPtr,t),r}encryptedOutLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_gcm_encrypted_out_len(this.ctxPtr,t),r}decryptedOutLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_gcm_decrypted_out_len(this.ctxPtr,t),r}finish()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=this.outLen(0),a=e._vsc_buffer_new_with_capacity(r);try{const
r=e._vscf_aes256_gcm_finish(this.ctxPtr,a);t.FoundationError.handleStatusCode(r);co
nst i=e._vsc_buffer_bytes(a),n=e._vsc_buffer_len(a);return
e.HEAPU8.slice(i,i+n)}finally{e._vsc_buffer_delete(a);}}authEncrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r),_.ensureByt
eArray("authData",a);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=a.length*a.BYTES_PER_ELEMENT,f=e._malloc(c);e.HEAP8.set(a,f);const
l=e._vsc_data_ctx_size(),u=e._malloc(l);e._vsc_data(u,f,c);const
A=this.authEncryptedLen(r.length),d=e._vsc_buffer_new_with_capacity(A),m=this.AUTH_
TAG_LEN,p=e._vsc_buffer_new_with_capacity(m);try{const
r=e._vscf_aes256_gcm_auth_encrypt(this.ctxPtr,s,u,d,p);t.FoundationError.handleStat
usCode(r);const
a=e._vsc_buffer_bytes(d),i=e._vsc_buffer_len(d),o=e.HEAPU8.slice(a,a+i),_=e._vsc_bu
ffer_bytes(p),c=e._vsc_buffer_len(p);return
{out:o,tag:e.HEAPU8.slice(_,_+c)}}finally{e._free(n),e._free(s),e._free(f),e._free(
u),e._vsc_buffer_delete(d),e._vsc_buffer_delete(p);}}authEncryptedLen(t){let
r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_gcm_auth_encrypted_len(this.ctxPtr,t),r}authDecrypt(r,a,i)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r),_.ensureByt
eArray("authData",a),_.ensureByteArray("tag",i);const
n=r.length*r.BYTES_PER_ELEMENT,o=e._malloc(n);e.HEAP8.set(r,o);const
s=e._vsc_data_ctx_size(),c=e._malloc(s);e._vsc_data(c,o,n);const
f=a.length*a.BYTES_PER_ELEMENT,l=e._malloc(f);e.HEAP8.set(a,l);const
u=e._vsc_data_ctx_size(),A=e._malloc(u);e._vsc_data(A,l,f);const
d=i.length*i.BYTES_PER_ELEMENT,m=e._malloc(d);e.HEAP8.set(i,m);const
p=e._vsc_data_ctx_size(),v=e._malloc(p);e._vsc_data(v,m,d);const
y=this.authDecryptedLen(r.length),h=e._vsc_buffer_new_with_capacity(y);try{const
r=e._vscf_aes256_gcm_auth_decrypt(this.ctxPtr,c,A,v,h);t.FoundationError.handleStat
usCode(r);const a=e._vsc_buffer_bytes(h),i=e._vsc_buffer_len(h);return
e.HEAPU8.slice(a,a+i)}finally{e._free(o),e._free(c),e._free(l),e._free(A),e._free(m
),e._free(v),e._vsc_buffer_delete(h);}}authDecryptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_gcm_auth_decrypted_len(this.ctxPtr,t),r}setAuthData(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("authData",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_aes256_gcm_s
et_auth_data(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}finishAuthEncryption()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=this.outLen(0),a=e._vsc_buffer_new_with_capacity(r),i=this.AUTH_TAG_LEN,n=e._vsc_
buffer_new_with_capacity(i);try{const
r=e._vscf_aes256_gcm_finish_auth_encryption(this.ctxPtr,a,n);t.FoundationError.hand
leStatusCode(r);const
i=e._vsc_buffer_bytes(a),o=e._vsc_buffer_len(a),_=e.HEAPU8.slice(i,i+o),s=e._vsc_bu
ffer_bytes(n),c=e._vsc_buffer_len(n);return
{out:_,tag:e.HEAPU8.slice(s,s+c)}}finally{e._vsc_buffer_delete(a),e._vsc_buffer_del
ete(n);}}finishAuthDecryption(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("tag",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=this.outLen(0),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_aes256_gcm_finish_auth_decryption(this.ctxPtr,o,c);t.FoundationError.hand
leStatusCode(r);const a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}}retu
rn r},C=(e,t)=>{class r{static get NONCE_LEN(){return 16}get NONCE_LEN(){return
r.NONCE_LEN}static get KEY_LEN(){return 32}get KEY_LEN(){return r.KEY_LEN}static
get KEY_BITLEN(){return 256}get KEY_BITLEN(){return r.KEY_BITLEN}static get
BLOCK_LEN(){return 16}get BLOCK_LEN(){return r.BLOCK_LEN}constructor(t)
{this.name="Aes256Cbc",this.ctxPtr=void 0===t?e._vscf_aes256_cbc_new():t;}static
newAndUseCContext(t){return new r(e._vscf_aes256_cbc_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_aes256_cbc_delete(this.ctxPtr),this.ctxPtr=null);}algId()
{let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_aes256_cbc_alg_id(this.ctxPtr)
,t}produceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_aes256_cbc_produce_alg_info(th
is.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_aes256_cbc_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handl
eStatusCode(a);}encrypt(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=this.encryptedLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_aes256_cbc_encrypt(this.ctxPtr,o,c);t.FoundationError.handleStatusCode(r)
;const a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}encry
ptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_cbc_encrypted_len(this.ctxPtr,t),r}preciseEncryptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_cbc_precise_encrypted_len(this.ctxPtr,t),r}decrypt(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=this.decryptedLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_aes256_cbc_decrypt(this.ctxPtr,o,c);t.FoundationError.handleStatusCode(r)
;const a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}decry
ptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_cbc_decrypted_len(this.ctxPtr,t),r}setNonce(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("nonce",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_aes256_cbc_s
et_nonce(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}setKey(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_aes256_cbc_s
et_key(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}state(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_aes256_cbc_state(this.ctxPtr),
t}startEncryption()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_aes256_cbc_start_encryption(thi
s.ctxPtr);}startDecryption()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_aes256_cbc_start_decryption(thi
s.ctxPtr);}update(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);const
o=this.outLen(t.length),s=e._vsc_buffer_new_with_capacity(o);try{e._vscf_aes256_cbc
_update(this.ctxPtr,n,s);const
t=e._vsc_buffer_bytes(s),r=e._vsc_buffer_len(s);return
e.HEAPU8.slice(t,t+r)}finally{e._free(a),e._free(n),e._vsc_buffer_delete(s);}}outLe
n(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_cbc_out_len(this.ctxPtr,t),r}encryptedOutLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_cbc_encrypted_out_len(this.ctxPtr,t),r}decryptedOutLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ae
s256_cbc_decrypted_out_len(this.ctxPtr,t),r}finish()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=this.outLen(0),a=e._vsc_buffer_new_with_capacity(r);try{const
r=e._vscf_aes256_cbc_finish(this.ctxPtr,a);t.FoundationError.handleStatusCode(r);co
nst i=e._vsc_buffer_bytes(a),n=e._vsc_buffer_len(a);return
e.HEAPU8.slice(i,i+n)}finally{e._vsc_buffer_delete(a);}}}return r},O=(e,t)=>{class
r{constructor(t){this.name="Asn1rd",this.ctxPtr=void 0===t?
e._vscf_asn1rd_new():t;}static newAndUseCContext(t){return new
r(e._vscf_asn1rd_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_asn1rd_delete(this.ctxPtr),this.ctxPtr=null);}reset(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_asn1rd_reset
(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}leftLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_left_len(this.ctxPtr),t
}hasError(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_has_error(this.ctxPtr),
!!t}status(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_asn1rd_status(this.ctxPtr);t.FoundationError.handleStatusCode(r);}getTag(
){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_get_tag(this.ctxPtr),t}
getLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_get_len(this.ctxPtr),t}
getDataLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_get_data_len(this.ctxPt
r),t}readTag(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("tag",t),r=e._vscf_asn1rd
_read_tag(this.ctxPtr,t),r}readContextTag(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("tag",t),r=e._vscf_asn1rd
_read_context_tag(this.ctxPtr,t),r}readInt(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_int(this.ctxPtr),t
}readInt8(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_int8(this.ctxPtr),
t}readInt16(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_int16(this.ctxPtr)
,t}readInt32(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_int32(this.ctxPtr)
,t}readInt64(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_int64(this.ctxPtr)
,t}readUint(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_uint(this.ctxPtr),
t}readUint8(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_uint8(this.ctxPtr)
,t}readUint16(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_uint16(this.ctxPtr
),t}readUint32(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_uint32(this.ctxPtr
),t}readUint64(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_uint64(this.ctxPtr
),t}readBool(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_bool(this.ctxPtr),
!!t}readNull()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_asn1rd_read_null(this.ctxPtr);}
readNullOptional()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_asn1rd_read_null_optional(this.
ctxPtr);}readOctetStr(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_asn1rd_read_octet_str(r,this.ct
xPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}readBitstringAsOctetStr()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_asn1rd_read_bitstring_as_octet_
str(r,this.ctxPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}readUtf8Str()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_asn1rd_read_utf8_str(r,this.ctx
Ptr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}readOid()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_asn1rd_read_oid(r,this.ctxPtr);
const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}readData(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("len",t);const
r=e._vsc_data_ctx_size(),a=e._malloc(r);try{e._vscf_asn1rd_read_data(a,this.ctxPtr,
t);const r=e._vsc_data_len(a),i=e._vsc_data_bytes(a);return
e.HEAPU8.slice(i,i+r)}finally{e._free(a);}}readSequence(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_sequence(this.ctxP
tr),t}readSet(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1rd_read_set(this.ctxPtr),t
}}return r},F=(e,t)=>{class r{constructor(t){this.name="Asn1wr",this.ctxPtr=void
0===t?e._vscf_asn1wr_new():t;}static newAndUseCContext(t){return new
r(e._vscf_asn1wr_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_asn1wr_delete(this.ctxPtr),this.ctxPtr=null);}reset(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("out",t),_.ensureNumber(
"outLen",r),e._vscf_asn1wr_reset(this.ctxPtr,t,r);}finish(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureBoolean("doNotAdjust",t),r=e._vs
cf_asn1wr_finish(this.ctxPtr,t),r}bytes(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1wr_bytes(this.ctxPtr),t}le
n(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1wr_len(this.ctxPtr),t}writ
tenLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1wr_written_len(this.ctxPtr
),t}unwrittenLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1wr_unwritten_len(this.ctxP
tr),t}hasError(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1wr_has_error(this.ctxPtr),
!!t}status(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_asn1wr_status(this.ctxPtr);t.FoundationError.handleStatusCode(r);}reserve
(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("len",t),r=e._vscf_asn1wr
_reserve(this.ctxPtr,t),r}writeTag(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("tag",t),r=e._vscf_asn1wr
_write_tag(this.ctxPtr,t),r}writeContextTag(t,r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("tag",t),_.ensureNumber("
len",r),a=e._vscf_asn1wr_write_context_tag(this.ctxPtr,t,r),a}writeLen(t){let
r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("len",t),r=e._vscf_asn1wr
_write_len(this.ctxPtr,t),r}writeInt(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_int(this.ctxPtr,t),r}writeInt8(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_int8(this.ctxPtr,t),r}writeInt16(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_int16(this.ctxPtr,t),r}writeInt32(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_int32(this.ctxPtr,t),r}writeInt64(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_int64(this.ctxPtr,t),r}writeUint(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_uint(this.ctxPtr,t),r}writeUint8(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_uint8(this.ctxPtr,t),r}writeUint16(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_uint16(this.ctxPtr,t),r}writeUint32(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_uint32(this.ctxPtr,t),r}writeUint64(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("value",t),r=e._vscf_asn1
wr_write_uint64(this.ctxPtr,t),r}writeBool(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureBoolean("value",t),r=e._vscf_asn
1wr_write_bool(this.ctxPtr,t),r}writeNull(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_asn1wr_write_null(this.ctxPtr)
,t}writeOctetStr(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("value",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_asn1wr_write_octet_str(this.ctxPtr,n),o}finally{e._free(a),e._free(n);}}w
riteOctetStrAsBitstring(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("value",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_asn1wr_write_octet_str_as_bitstring(this.ctxPtr,n),o}finally{e._free(a),e
._free(n);}}writeData(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_asn1wr_write_data(this.ctxPtr,n),o}finally{e._free(a),e._free(n);}}writeU
tf8Str(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("value",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_asn1wr_write_utf8_str(this.ctxPtr,n),o}finally{e._free(a),e._free(n);}}wr
iteOid(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("value",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_asn1wr_write_oid(this.ctxPtr,n),o}finally{e._free(a),e._free(n);}}writeSe
quence(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("len",t),r=e._vscf_asn1wr
_write_sequence(this.ctxPtr,t),r}writeSet(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("len",t),r=e._vscf_asn1wr
_write_set(this.ctxPtr,t),r}}return r},Y=(e,t)=>{class r{constructor(t)
{this.name="RsaPublicKey",this.ctxPtr=void 0===t?
e._vscf_rsa_public_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_rsa_public_key_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_rsa_public_key_delete(this.ctxPtr),this.ctxPtr=null);}algId
(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_public_key_alg_id(this.ctx
Ptr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_rsa_public_key_alg_info(this.c
txPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_public_key_len(this.ctxPtr
),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_public_key_bitlen(this.ctx
Ptr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_public_key_impl_tag(this.c
txPtr),t}isValid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_public_key_is_valid(this.c
txPtr),!!t}keyExponent(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_public_key_key_exponent(th
is.ctxPtr),t}}return r},G=(e,t)=>{class r{constructor(t)
{this.name="RsaPrivateKey",this.ctxPtr=void 0===t?
e._vscf_rsa_private_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_rsa_private_key_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_rsa_private_key_delete(this.ctxPtr),this.ctxPtr=null);}algI
d(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_private_key_alg_id(this.ct
xPtr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_rsa_private_key_alg_info(this.
ctxPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_private_key_len(this.ctxPt
r),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_private_key_bitlen(this.ct
xPtr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_private_key_impl_tag(this.
ctxPtr),t}isValid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_rsa_private_key_is_valid(this.
ctxPtr),!!t}extractPublicKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_rsa_private_key_extract_public
_key(this.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}}return
r},W=(e,t)=>{class r{static get CAN_IMPORT_PUBLIC_KEY(){return !0}get
CAN_IMPORT_PUBLIC_KEY(){return r.CAN_IMPORT_PUBLIC_KEY}static get
CAN_EXPORT_PUBLIC_KEY(){return !0}get CAN_EXPORT_PUBLIC_KEY(){return
r.CAN_EXPORT_PUBLIC_KEY}static get CAN_IMPORT_PRIVATE_KEY(){return !0}get
CAN_IMPORT_PRIVATE_KEY(){return r.CAN_IMPORT_PRIVATE_KEY}static get
CAN_EXPORT_PRIVATE_KEY(){return !0}get CAN_EXPORT_PRIVATE_KEY(){return
r.CAN_EXPORT_PRIVATE_KEY}constructor(t){this.name="Rsa",this.ctxPtr=void 0===t?
e._vscf_rsa_new():t;}static newAndUseCContext(t){return new
r(e._vscf_rsa_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_rsa_delete(this.ctxPtr),this.ctxPtr=null);}set random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_r
sa_release_random(this.ctxPtr),e._vscf_rsa_use_random(this.ctxPtr,r.ctxPtr);}genera
teEphemeralKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Fou
ndation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_rsa_generate_ephemeral_key(this.ctxPtr,r.ctx
Ptr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPublicKey
);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_rsa_import_public_key(this.ctxPtr,r.ctxPtr,i
);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.Alg
Info",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_rsa_import_public_key_data(this.ctxPtr,s,a.c
txPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_rsa_export_public_key(this.ctxPtr,r.ctxPtr,i
);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPublicKey.newAndTakeCContext(n)}finally{
e._free(i);}}exportedPublicKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_rsa_exported_public_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPublicKeyD
ata(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.exportedPublicKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_rsa_export_public_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError.hand
leStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}importPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPrivateKe
y);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_rsa_import_private_key(this.ctxPtr,r.ctxPtr,
i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPrivateKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_rsa_import_private_key_data(this.ctxPtr,s,a.
ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_rsa_export_private_key(this.ctxPtr,r.ctxPtr,
i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPrivateKey.newAndTakeCContext(n)}finally
{e._free(i);}}exportedPrivateKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_rsa_exported_private_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPrivat
eKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const
a=this.exportedPrivateKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_rsa_export_private_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError.han
dleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}canEncrypt(r,a){let
i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_rsa_can_encrypt(this.ctxPtr,r.ctxPtr,a),!!
i}encryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_rsa_encrypted_len(this.ctxPtr,r.ctxPtr,a),i}e
ncrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.encryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_rsa_encrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStatusCode(
a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canDe
crypt(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_rsa_can_decrypt(this.ctxPtr,r.ctxPtr,a),!!
i}decryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_rsa_decrypted_len(this.ctxPtr,r.ctxPtr,a),
i}decrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.decryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_rsa_decrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStatusCode(
a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canSi
gn(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_rsa_can_sign(this.ctxPtr,r.ctxPtr),!!a}signatureLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_rsa_signature_len(this.ctxPtr,r.ctxPtr),a}signHash(r,a,i)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureNumber("hashId",a),_.ensureByteArray("digest",i);const
n=i.length*i.BYTES_PER_ELEMENT,o=e._malloc(n);e.HEAP8.set(i,o);const
s=e._vsc_data_ctx_size(),c=e._malloc(s);e._vsc_data(c,o,n);const
f=this.signatureLen(r),l=e._vsc_buffer_new_with_capacity(f);try{const
i=e._vscf_rsa_sign_hash(this.ctxPtr,r.ctxPtr,a,c,l);t.FoundationError.handleStatusC
ode(i);const n=e._vsc_buffer_bytes(l),_=e._vsc_buffer_len(l);return
e.HEAPU8.slice(n,n+_)}finally{e._free(o),e._free(c),e._vsc_buffer_delete(l);}}canVe
rify(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_rsa_can_verify(this.ctxPtr,r.ctxPtr),!!a}verifyHash(r,a,i,n)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureNumber("hashId",a),_.ensureByteArray("digest",i),_.ensureByteArray("signat
ure",n);const o=i.length*i.BYTES_PER_ELEMENT,s=e._malloc(o);e.HEAP8.set(i,s);const
c=e._vsc_data_ctx_size(),f=e._malloc(c);e._vsc_data(f,s,o);const
l=n.length*n.BYTES_PER_ELEMENT,u=e._malloc(l);e.HEAP8.set(n,u);const
A=e._vsc_data_ctx_size(),d=e._malloc(A);let m;e._vsc_data(d,u,l);try{return
m=e._vscf_rsa_verify_hash(this.ctxPtr,r.ctxPtr,a,f,d),!!
m}finally{e._free(s),e._free(f),e._free(u),e._free(d);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_rsa_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusCode(r);}ge
nerateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("bitlen",r);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_rsa_generate_key(this.ctxPtr,r,i);const
a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}}return r},z=(e,t)=>{class r{constructor(t)
{this.name="EccPublicKey",this.ctxPtr=void 0===t?
e._vscf_ecc_public_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_ecc_public_key_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_ecc_public_key_delete(this.ctxPtr),this.ctxPtr=null);}algId
(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_public_key_alg_id(this.ctx
Ptr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_ecc_public_key_alg_info(this.c
txPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_public_key_len(this.ctxPtr
),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_public_key_bitlen(this.ctx
Ptr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_public_key_impl_tag(this.c
txPtr),t}isValid
(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_public_key_is_valid(this.c
txPtr),!!t}}return r},S=(e,t)=>{class r{constructor(t)
{this.name="EccPrivateKey",this.ctxPtr=void 0===t?
e._vscf_ecc_private_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_ecc_private_key_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_ecc_private_key_delete(this.ctxPtr),this.ctxPtr=null);}algI
d(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_private_key_alg_id(this.ct
xPtr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_ecc_private_key_alg_info(this.
ctxPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_private_key_len(this.ctxPt
r),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_private_key_bitlen(this.ct
xPtr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_private_key_impl_tag(this.
ctxPtr),t}isValid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_private_key_is_valid(this.
ctxPtr),!!t}extractPublicKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_ecc_private_key_extract_public
_key(this.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}}return
r},L=(e,t)=>{class r{static get CAN_IMPORT_PUBLIC_KEY(){return !0}get
CAN_IMPORT_PUBLIC_KEY(){return r.CAN_IMPORT_PUBLIC_KEY}static get
CAN_EXPORT_PUBLIC_KEY(){return !0}get CAN_EXPORT_PUBLIC_KEY(){return
r.CAN_EXPORT_PUBLIC_KEY}static get CAN_IMPORT_PRIVATE_KEY(){return !0}get
CAN_IMPORT_PRIVATE_KEY(){return r.CAN_IMPORT_PRIVATE_KEY}static get
CAN_EXPORT_PRIVATE_KEY(){return !0}get CAN_EXPORT_PRIVATE_KEY(){return
r.CAN_EXPORT_PRIVATE_KEY}constructor(t){this.name="Ecc",this.ctxPtr=void 0===t?
e._vscf_ecc_new():t;}static newAndUseCContext(t){return new
r(e._vscf_ecc_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_ecc_delete(this.ctxPtr),this.ctxPtr=null);}set random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_e
cc_release_random(this.ctxPtr),e._vscf_ecc_use_random(this.ctxPtr,r.ctxPtr);}set
ecies(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("ecies",r,t.Ecies),e._vsc
f_ecc_release_ecies(this.ctxPtr),e._vscf_ecc_use_ecies(this.ctxPtr,r.ctxPtr);}gener
ateEphemeralKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Fou
ndation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ecc_generate_ephemeral_key(this.ctxPtr,r.ctx
Ptr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPublicKey
);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ecc_import_public_key(this.ctxPtr,r.ctxPtr,i
);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_ecc_import_public_key_data(this.ctxPtr,s,a.c
txPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ecc_export_public_key(this.ctxPtr,r.ctxPtr,i
);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPublicKey.newAndTakeCContext(n)}finally{
e._free(i);}}exportedPublicKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_ecc_exported_public_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPublicKeyD
ata(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.exportedPublicKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_ecc_export_public_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError.hand
leStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}importPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPrivateKe
y);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ecc_import_private_key(this.ctxPtr,r.ctxPtr,
i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPrivateKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_ecc_import_private_key_data(this.ctxPtr,s,a.
ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ecc_export_private_key(this.ctxPtr,r.ctxPtr,
i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPrivateKey.newAndTakeCContext(n)}finally
{e._free(i);}}exportedPrivateKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_ecc_exported_private_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPrivat
eKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const
a=this.exportedPrivateKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_ecc_export_private_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError.han
dleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}canEncrypt(r,a){let
i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_ecc_can_encrypt(this.ctxPtr,r.ctxPtr,a),!!
i}encryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_ecc_encrypted_len(this.ctxPtr,r.ctxPtr,a),i}e
ncrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.encryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_ecc_encrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStatusCode(
a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canDe
crypt(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_ecc_can_decrypt(this.ctxPtr,r.ctxPtr,a),!!
i}decryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_ecc_decrypted_len(this.ctxPtr,r.ctxPtr,a),
i}decrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.decryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_ecc_decrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStatusCode(
a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canSi
gn(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_ecc_can_sign(this.ctxPtr,r.ctxPtr),!!a}signatureLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_ecc_signature_len(this.ctxPtr,r.ctxPtr),a}signHash(r,a,i)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureNumber("hashId",a),_.ensureByteArray("digest",i);const
n=i.length*i.BYTES_PER_ELEMENT,o=e._malloc(n);e.HEAP8.set(i,o);const
s=e._vsc_data_ctx_size(),c=e._malloc(s);e._vsc_data(c,o,n);const
f=this.signatureLen(r),l=e._vsc_buffer_new_with_capacity(f);try{const
i=e._vscf_ecc_sign_hash(this.ctxPtr,r.ctxPtr,a,c,l);t.FoundationError.handleStatusC
ode(i);const n=e._vsc_buffer_bytes(l),_=e._vsc_buffer_len(l);return
e.HEAPU8.slice(n,n+_)}finally{e._free(o),e._free(c),e._vsc_buffer_delete(l);}}canVe
rify(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_ecc_can_verify(this.ctxPtr,r.ctxPtr),!!a}verifyHash(r,a,i,n)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureNumber("hashId",a),_.ensureByteArray("digest",i),_.ensureByteArray("signat
ure",n);const o=i.length*i.BYTES_PER_ELEMENT,s=e._malloc(o);e.HEAP8.set(i,s);const
c=e._vsc_data_ctx_size(),f=e._malloc(c);e._vsc_data(f,s,o);const
l=n.length*n.BYTES_PER_ELEMENT,u=e._malloc(l);e.HEAP8.set(n,u);const
A=e._vsc_data_ctx_size(),d=e._malloc(A);let m;e._vsc_data(d,u,l);try{return
m=e._vscf_ecc_verify_hash(this.ctxPtr,r.ctxPtr,a,f,d),!!
m}finally{e._free(s),e._free(f),e._free(u),e._free(d);}}computeSharedKey(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInte
rfaceTag.PRIVATE_KEY,t.FoundationInterface);const
i=this.sharedKeyLen(a),n=e._vsc_buffer_new_with_capacity(i);try{const
i=e._vscf_ecc_compute_shared_key(this.ctxPtr,r.ctxPtr,a.ctxPtr,n);t.FoundationError
.handleStatusCode(i);const o=e._vsc_buffer_bytes(n),_=e._vsc_buffer_len(n);return
e.HEAPU8.slice(o,o+_)}finally{e._vsc_buffer_delete(n);}}sharedKeyLen(r){let
a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Foun
dation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface),a=e._vscf_ecc_share
d_key_len(this.ctxPtr,r.ctxPtr),a}kemSharedKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Foun
dation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface),a=e._vscf_ecc_kem_s
hared_key_len(this.ctxPtr,r.ctxPtr),a}kemEncapsulatedKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_ecc_kem_encapsulated_key_len(this.ctxPtr,r.ctxPtr),a}kemEncapsulate(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.kemSharedKeyLen(r),i=e._vsc_buffer_new_with_capacity(a),n=this.kemEncapsulat
edKeyLen(r),o=e._vsc_buffer_new_with_capacity(n);try{const
a=e._vscf_ecc_kem_encapsulate(this.ctxPtr,r.ctxPtr,i,o);t.FoundationError.handleSta
tusCode(a);const
n=e._vsc_buffer_bytes(i),_=e._vsc_buffer_len(i),s=e.HEAPU8.slice(n,n+_),c=e._vsc_bu
ffer_bytes(o),f=e._vsc_buffer_len(o);return
{sharedKey:s,encapsulatedKey:e.HEAPU8.slice(c,c+f)}}finally{e._vsc_buffer_delete(i)
,e._vsc_buffer_delete(o);}}kemDecapsulate(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("encapsulatedKey",r),
_.ensureImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInter
faceTag.PRIVATE_KEY,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.kemSharedKeyLen(a),f=e._vsc_buffer_new_with_capacity(c);try{const
r=e._vscf_ecc_kem_decapsulate(this.ctxPtr,s,a.ctxPtr,f);t.FoundationError.handleSta
tusCode(r);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}setup
Defaults(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_ecc_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusCode(r);}ge
nerateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("algId",r);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ecc_generate_key(this.ctxPtr,r,i);const
a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}}return r},H=(e,t)=>{class r{static get SOURCES_MAX(){return
15}get SOURCES_MAX(){return r.SOURCES_MAX}constructor(t)
{this.name="EntropyAccumulator",this.ctxPtr=void 0===t?
e._vscf_entropy_accumulator_new():t;}static newAndUseCContext(t){return new
r(e._vscf_entropy_accumulator_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_entropy_accumulator_delete(this.ctxPtr),this.ctxPtr=null);}
isStrong(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_entropy_accumulator_is_strong(
this.ctxPtr),!!t}gather(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("len",r);const
a=r,i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_entropy_accumulator_gather(this.ctxPtr,r,i);t.FoundationError.handleStatu
sCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_entropy_accumulator_setup_defau
lts(this.ctxPtr);}addSource(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("source",r,"
Foundation.EntropySource",t.FoundationInterfaceTag.ENTROPY_SOURCE,t.FoundationInter
face),_.ensureNumber("threshold",a),e._vscf_entropy_accumulator_add_source(this.ctx
Ptr,r.ctxPtr,a);}}return r},D=(e,t)=>{class r{static get RESEED_INTERVAL(){return
1e4}get RESEED_INTERVAL(){return r.RESEED_INTERVAL}static get ENTROPY_LEN(){return
48}get ENTROPY_LEN(){return r.ENTROPY_LEN}constructor(t)
{this.name="CtrDrbg",this.ctxPtr=void 0===t?e._vscf_ctr_drbg_new():t;}static
newAndUseCContext(t){return new r(e._vscf_ctr_drbg_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_ctr_drbg_delete(this.ctxPtr),this.ctxPtr=null);}set
entropySource(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("entropySour
ce",r,"Foundation.EntropySource",t.FoundationInterfaceTag.ENTROPY_SOURCE,t.Foundati
onInterface),e._vscf_ctr_drbg_release_entropy_source(this.ctxPtr);const
a=e._vscf_ctr_drbg_use_entropy_source(this.ctxPtr,r.ctxPtr);t.FoundationError.handl
eStatusCode(a);}random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",r);const
a=r,i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_ctr_drbg_random(this.ctxPtr,r,i);t.FoundationError.handleStatusCode(a);co
nst n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}reseed()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_ctr_drbg_reseed(this.ctxPtr);t.FoundationError.handleStatusCode(r);}setup
Defaults(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_ctr_drbg_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusCode(r
);}enablePredictionResistance()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_ctr_drbg_enable_prediction_resi
stance(this.ctxPtr);}setReseedInterval(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("interval",t),e._vscf_ct
r_drbg_set_reseed_interval(this.ctxPtr,t);}setEntropyLen(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("len",t),e._vscf_ctr_drb
g_set_entropy_len(this.ctxPtr,t);}}return r},K$1=(e,t)=>{class r{constructor(t)
{this.name="Hmac",this.ctxPtr=void 0===t?e._vscf_hmac_new():t;}static
newAndUseCContext(t){return new r(e._vscf_hmac_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_hmac_delete(this.ctxPtr),this.ctxPtr=null);}set hash(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("hash",r,"Fo
undation.Hash",t.FoundationInterfaceTag.HASH,t.FoundationInterface),e._vscf_hmac_re
lease_hash(this.ctxPtr),e._vscf_hmac_use_hash(this.ctxPtr,r.ctxPtr);}algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hmac_alg_id(this.ctxPtr),t}pro
duceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hmac_produce_alg_info(this.ctx
Ptr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_hmac_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handleStatu
sCode(a);}digestLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hmac_digest_len(this.ctxPtr),t
}mac(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",t),_.ensureByte
Array("data",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=r.length*r.BYTES_PER_ELEMENT,c=e._malloc(s);e.HEAP8.set(r,c);const
f=e._vsc_data_ctx_size(),l=e._malloc(f);e._vsc_data(l,c,s);const
u=this.digestLen(),A=e._vsc_buffer_new_with_capacity(u);try{e._vscf_hmac_mac(this.c
txPtr,o,l,A);const t=e._vsc_buffer_bytes(A),r=e._vsc_buffer_len(A);return
e.HEAPU8.slice(t,t+r)}finally{e._free(i),e._free(o),e._free(c),e._free(l),e._vsc_bu
ffer_delete(A);}}start(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("key",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_hmac_start(t
his.ctxPtr,n);}finally{e._free(a),e._free(n);}}update(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_hmac_update(
this.ctxPtr,n);}finally{e._free(a),e._free(n);}}finish()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=this.digestLen(),r=e._vsc_buffer_new_with_capacity(t);try{e._vscf_hmac_finish(thi
s.ctxPtr,r);const t=e._vsc_buffer_bytes(r),a=e._vsc_buffer_len(r);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(r);}}reset()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_hmac_reset(this.ctxPtr);}}retur
n r},Q=(e,t)=>{class r{constructor(t){this.name="Hkdf",this.ctxPtr=void 0===t?
e._vscf_hkdf_new():t;}static newAndUseCContext(t){return new
r(e._vscf_hkdf_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_hkdf_delete(this.ctxPtr),this.ctxPtr=null);}set hash(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("hash",r,"Fo
undation.Hash",t.FoundationInterfaceTag.HASH,t.FoundationInterface),e._vscf_hkdf_re
lease_hash(this.ctxPtr),e._vscf_hkdf_use_hash(this.ctxPtr,r.ctxPtr);}algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hkdf_alg_id(this.ctxPtr),t}pro
duceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hkdf_produce_alg_info(this.ctx
Ptr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_hkdf_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handleStatu
sCode(a);}derive(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t),_.ensureNum
ber("keyLen",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=r,c=e._vsc_buffer_new_with_capacity(s);try{e._vscf_hkdf_derive(this.ctxPtr,o,r,c)
;const t=e._vsc_buffer_bytes(c),a=e._vsc_buffer_len(c);return
e.HEAPU8.slice(t,t+a)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}reset
(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("salt",t),_.ensureNum
ber("iterationCount",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);try{e._vscf_hkdf_reset(t
his.ctxPtr,o,r);}finally{e._free(i),e._free(o);}}setInfo(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("info",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_hkdf_set_inf
o(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}}return r},j=(e,t)=>{class
r{constructor(t){this.name="Kdf1",this.ctxPtr=void 0===t?
e._vscf_kdf1_new():t;}static newAndUseCContext(t){return new
r(e._vscf_kdf1_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_kdf1_delete(this.ctxPtr),this.ctxPtr=null);}set hash(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("hash",r,"Fo
undation.Hash",t.FoundationInterfaceTag.HASH,t.FoundationInterface),e._vscf_kdf1_re
lease_hash(this.ctxPtr),e._vscf_kdf1_use_hash(this.ctxPtr,r.ctxPtr);}algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_kdf1_alg_id(this.ctxPtr),t}pro
duceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_kdf1_produce_alg_info(this.ctx
Ptr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_kdf1_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handleStatu
sCode(a);}derive(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t),_.ensureNum
ber("keyLen",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=r,c=e._vsc_buffer_new_with_capacity(s);try{e._vscf_kdf1_derive(this.ctxPtr,o,r,c)
;const t=e._vsc_buffer_bytes(c),a=e._vsc_buffer_len(c);return
e.HEAPU8.slice(t,t+a)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}}retu
rn r},J=(e,t)=>{class r{constructor(t){this.name="Kdf2",this.ctxPtr=void 0===t?
e._vscf_kdf2_new():t;}static newAndUseCContext(t){return new
r(e._vscf_kdf2_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_kdf2_delete(this.ctxPtr),this.ctxPtr=null);}set hash(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("hash",r,"Fo
undation.Hash",t.FoundationInterfaceTag.HASH,t.FoundationInterface),e._vscf_kdf2_re
lease_hash(this.ctxPtr),e._vscf_kdf2_use_hash(this.ctxPtr,r.ctxPtr);}algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_kdf2_alg_id(this.ctxPtr),t}pro
duceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_kdf2_produce_alg_info(this.ctx
Ptr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_kdf2_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handleStatu
sCode(a);}derive(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t),_.ensureNum
ber("keyLen",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=r,c=e._vsc_buffer_new_with_capacity(s);try{e._vscf_kdf2_derive(this.ctxPtr,o,r,c)
;const t=e._vsc_buffer_bytes(c),a=e._vsc_buffer_len(c);return
e.HEAPU8.slice(t,t+a)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}}retu
rn r},q=(e,t)=>{class r{constructor(t){this.name="FakeRandom",this.ctxPtr=void
0===t?e._vscf_fake_random_new():t;}static newAndUseCContext(t){return new
r(e._vscf_fake_random_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_fake_random_delete(this.ctxPtr),this.ctxPtr=null);}random(r
){_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",r);const
a=r,i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_fake_random_random(this.ctxPtr,r,i);t.FoundationError.handleStatusCode(a)
;const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}reseed()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_fake_random_reseed(this.ctxPtr);t.FoundationError.handleStatusCode(r);}is
Strong(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_fake_random_is_strong(this.ctx
Ptr),!!t}gather(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("len",r);const
a=r,i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_fake_random_gather(this.ctxPtr,r,i);t.FoundationError.handleStatusCode(a)
;const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}setupSourceByte(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("byteSource",t),e._vscf_
fake_random_setup_source_byte(this.ctxPtr,t);}setupSourceData(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("dataSource",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_fake_random_
setup_source_data(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}}return r},
$=(e,t)=>{class r{constructor(t){this.name="Pkcs5Pbkdf2",this.ctxPtr=void 0===t?
e._vscf_pkcs5_pbkdf2_new():t;}static newAndUseCContext(t){return new
r(e._vscf_pkcs5_pbkdf2_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_pkcs5_pbkdf2_delete(this.ctxPtr),this.ctxPtr=null);}set
hmac(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("hmac",r,"Fo
undation.Mac",t.FoundationInterfaceTag.MAC,t.FoundationInterface),e._vscf_pkcs5_pbk
df2_release_hmac(this.ctxPtr),e._vscf_pkcs5_pbkdf2_use_hmac(this.ctxPtr,r.ctxPtr);}
algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_pkcs5_pbkdf2_alg_id(this.ctxPt
r),t}produceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_pkcs5_pbkdf2_produce_alg_info(
this.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_pkcs5_pbkdf2_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.han
dleStatusCode(a);}derive(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t),_.ensureNum
ber("keyLen",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=r,c=e._vsc_buffer_new_with_capacity(s);try{e._vscf_pkcs5_pbkdf2_derive(this.ctxPt
r,o,r,c);const t=e._vsc_buffer_bytes(c),a=e._vsc_buffer_len(c);return
e.HEAPU8.slice(t,t+a)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}reset
(t,r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("salt",t),_.ensureNum
ber("iterationCount",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);try{e._vscf_pkcs5_pbkdf2
_reset(this.ctxPtr,o,r);}finally{e._free(i),e._free(o);}}setInfo(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("info",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_pkcs5_pbkdf2
_set_info(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_pkcs5_pbkdf2_setup_defaults(thi
s.ctxPtr);}}return r},ee=(e,t)=>{class r{constructor(t)
{this.name="Pkcs5Pbes2",this.ctxPtr=void 0===t?e._vscf_pkcs5_pbes2_new():t;}static
newAndUseCContext(t){return new r(e._vscf_pkcs5_pbes2_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_pkcs5_pbes2_delete(this.ctxPtr),this.ctxPtr=null);}set
kdf(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("kdf",r,"Fou
ndation.SaltedKdf",t.FoundationInterfaceTag.SALTED_KDF,t.FoundationInterface),e._vs
cf_pkcs5_pbes2_release_kdf(this.ctxPtr),e._vscf_pkcs5_pbes2_use_kdf(this.ctxPtr,r.c
txPtr);}set cipher(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("cipher",r,"
Foundation.Cipher",t.FoundationInterfaceTag.CIPHER,t.FoundationInterface),e._vscf_p
kcs5_pbes2_release_cipher(this.ctxPtr),e._vscf_pkcs5_pbes2_use_cipher(this.ctxPtr,r
.ctxPtr);}algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_pkcs5_pbes2_alg_id(this.ctxPtr
),t}produceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_pkcs5_pbes2_produce_alg_info(t
his.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_pkcs5_pbes2_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.hand
leStatusCode(a);}encrypt(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=this.encryptedLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_pkcs5_pbes2_encrypt(this.ctxPtr,o,c);t.FoundationError.handleStatusCode(r
);const a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}encry
ptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_pk
cs5_pbes2_encrypted_len(this.ctxPtr,t),r}preciseEncryptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_pk
cs5_pbes2_precise_encrypted_len(this.ctxPtr,t),r}decrypt(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=this.decryptedLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_pkcs5_pbes2_decrypt(this.ctxPtr,o,c);t.FoundationError.handleStatusCode(r
);const a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}decry
ptedLen(t){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_pk
cs5_pbes2_decrypted_len(this.ctxPtr,t),r}reset(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("pwd",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_pkcs5_pbes2_
reset(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}}return r},te=(e,t)=>{class
r{constructor(t){this.name="SeedEntropySource",this.ctxPtr=void 0===t?
e._vscf_seed_entropy_source_new():t;}static newAndUseCContext(t){return new
r(e._vscf_seed_entropy_source_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_seed_entropy_source_delete(this.ctxPtr),this.ctxPtr=null);}
isStrong(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_seed_entropy_source_is_strong(
this.ctxPtr),!!t}gather(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("len",r);const
a=r,i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_seed_entropy_source_gather(this.ctxPtr,r,i);t.FoundationError.handleStatu
sCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}resetSeed(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("seed",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_seed_entropy
_source_reset_seed(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}}return
r},re=(e,t)=>{class r{static get KEY_MATERIAL_LEN_MIN(){return 32}get
KEY_MATERIAL_LEN_MIN(){return r.KEY_MATERIAL_LEN_MIN}static get
KEY_MATERIAL_LEN_MAX(){return 512}get KEY_MATERIAL_LEN_MAX(){return
r.KEY_MATERIAL_LEN_MAX}constructor(t){this.name="KeyMaterialRng",this.ctxPtr=void
0===t?e._vscf_key_material_rng_new():t;}static newAndUseCContext(t){return new
r(e._vscf_key_material_rng_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_key_material_rng_delete(this.ctxPtr),this.ctxPtr=null);}ran
dom(r){_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",r);const
a=r,i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_key_material_rng_random(this.ctxPtr,r,i);t.FoundationError.handleStatusCo
de(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}reseed()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_key_material_rng_reseed(this.ctxPtr);t.FoundationError.handleStatusCode(r
);}resetKeyMaterial(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyMaterial",t);cons
t r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);try{e._vscf_key_material
_rng_reset_key_material(this.ctxPtr,n);}finally{e._free(a),e._free(n);}}}return
r},ae=(e,t)=>{class r{constructor(t){this.name="RawPublicKey",this.ctxPtr=void
0===t?e._vscf_raw_public_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_raw_public_key_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_raw_public_key_delete(this.ctxPtr),this.ctxPtr=null);}algId
(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_public_key_alg_id(this.ctx
Ptr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_raw_public_key_alg_info(this.c
txPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_public_key_len(this.ctxPtr
),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_public_key_bitlen(this.ctx
Ptr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_public_key_impl_tag(this.c
txPtr),t}isValid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_public_key_is_valid(this.c
txPtr),!!t}data(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_raw_public_key_data(r,this.ctxP
tr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}}return r},ie=(e,t)=>{class
r{constructor(t){this.name="RawPrivateKey",this.ctxPtr=void 0===t?
e._vscf_raw_private_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_raw_private_key_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_raw_private_key_delete(this.ctxPtr),this.ctxPtr=null);}algI
d(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_private_key_alg_id(this.ct
xPtr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_raw_private_key_alg_info(this.
ctxPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_private_key_len(this.ctxPt
r),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_private_key_bitlen(this.ct
xPtr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_private_key_impl_tag(this.
ctxPtr),t}isValid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_private_key_is_valid(this.
ctxPtr),!!t}extractPublicKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_raw_private_key_extract_public
_key(this.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}data()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_raw_private_key_data(r,this.ctx
Ptr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}hasPublicKey(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_raw_private_key_has_public_key
(this.ctxPtr),!!t}setPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawPublicKey",r,t.RawPub
licKey),e._vscf_raw_private_key_set_public_key(this.ctxPtr,r.ctxPtr);}getPublicK
ey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_raw_private_key_get_public_key
(this.ctxPtr),t.RawPublicKey.newAndUseCContext(r)}}return r},ne=(e,t)=>{class
r{constructor(t){this.name="Pkcs8Serializer",this.ctxPtr=void 0===t?
e._vscf_pkcs8_serializer_new():t;}static newAndUseCContext(t){return new
r(e._vscf_pkcs8_serializer_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_pkcs8_serializer_delete(this.ctxPtr),this.ctxPtr=null);}set
asn1Writer(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("asn1Writer"
,r,"Foundation.Asn1Writer",t.FoundationInterfaceTag.ASN1_WRITER,t.FoundationInterfa
ce),e._vscf_pkcs8_serializer_release_asn1_writer(this.ctxPtr),e._vscf_pkcs8_seriali
zer_use_asn1_writer(this.ctxPtr,r.ctxPtr);}serializedPublicKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("publicKey",r,t.RawPublicK
ey),a=e._vscf_pkcs8_serializer_serialized_public_key_len(this.ctxPtr,r.ctxPtr),a}se
rializePublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("publicKey",r,t.RawPublic
Key);const
a=this.serializedPublicKeyLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_pkcs8_serializer_serialize_public_key(this.ctxPtr,r.ctxPtr,i);t.Foundatio
nError.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}serializedPrivateKeyLen(r)
{let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("privateKey",r,t.RawPrivat
eKey),a=e._vscf_pkcs8_serializer_serialized_private_key_len(this.ctxPtr,r.ctxPtr),a
}serializePrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("privateKey",r,t.RawPriva
teKey);const
a=this.serializedPrivateKeyLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_pkcs8_serializer_serialize_private_key(this.ctxPtr,r.ctxPtr,i);t.Foundati
onError.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_pkcs8_serializer_setup_defaults
(this.ctxPtr);}serializePublicKeyInplace(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("publicKey",r,t.RawPublic
Key);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_pkcs8_serializer_serialize_public_key_inplac
e(this.ctxPtr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),n}finally{e._free(i);}}serializePrivateKeyInp
lace(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("privateKey",r,t.RawPriva
teKey);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_pkcs8_serializer_serialize_private_key_inpla
ce(this.ctxPtr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),n}finally{e._free(i);}}}return
r},oe=(e,t)=>{class r{constructor(t){this.name="Sec1Serializer",this.ctxPtr=void
0===t?e._vscf_sec1_serializer_new():t;}static newAndUseCContext(t){return new
r(e._vscf_sec1_serializer_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_sec1_serializer_delete(this.ctxPtr),this.ctxPtr=null);}set
asn1Writer(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("asn1Writer"
,r,"Foundation.Asn1Writer",t.FoundationInterfaceTag.ASN1_WRITER,t.FoundationInterfa
ce),e._vscf_sec1_serializer_release_asn1_writer(this.ctxPtr),e._vscf_sec1_serialize
r_use_asn1_writer(this.ctxPtr,r.ctxPtr);}serializedPublicKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("publicKey",r,t.RawPublicK
ey),a=e._vscf_sec1_serializer_serialized_public_key_len(this.ctxPtr,r.ctxPtr),a}ser
ializePublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("publicKey",r,t.RawPublic
Key);const
a=this.serializedPublicKeyLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_sec1_serializer_serialize_public_key(this.ctxPtr,r.ctxPtr,i);t.Foundation
Error.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}serializedPrivateKeyLen(r)
{let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("privateKey",r,t.RawPrivat
eKey),a=e._vscf_sec1_serializer_serialized_private_key_len(this.ctxPtr,r.ctxPtr),a}
serializePrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("privateKey",r,t.RawPriva
teKey);const
a=this.serializedPrivateKeyLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_sec1_serializer_serialize_private_key(this.ctxPtr,r.ctxPtr,i);t.Foundatio
nError.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_sec1_serializer_setup_defaults(
this.ctxPtr);}serializePublicKeyInplace(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("publicKey",r,t.RawPublic
Key);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_sec1_serializer_serialize_public_key_inplace
(this.ctxPtr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),n}finally{e._free(i);}}serializePrivateKeyInp
lace(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("privateKey",r,t.RawPriva
teKey);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_sec1_serializer_serialize_private_key_inplac
e(this.ctxPtr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),n}finally{e._free(i);}}}return
r},_e=(e,t)=>{class r{constructor(t){this.name="KeyAsn1Serializer",this.ctxPtr=void
0===t?e._vscf_key_asn1_serializer_new():t;}static newAndUseCContext(t){return new
r(e._vscf_key_asn1_serializer_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_key_asn1_serializer_delete(this.ctxPtr),this.ctxPtr=null);}
set asn1Writer(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("asn1Writer"
,r,"Foundation.Asn1Writer",t.FoundationInterfaceTag.ASN1_WRITER,t.FoundationInterfa
ce),e._vscf_key_asn1_serializer_release_asn1_writer(this.ctxPtr),e._vscf_key_asn1_s
erializer_use_asn1_writer(this.ctxPtr,r.ctxPtr);}serializedPublicKeyLen(r){let
a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("publicKey",r,t.RawPublicK
ey),a=e._vscf_key_asn1_serializer_serialized_public_key_len(this.ctxPtr,r.ctxPtr),a
}serializePublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("publicKey",r,t.RawPublic
Key);const
a=this.serializedPublicKeyLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_key_asn1_serializer_serialize_public_key(this.ctxPtr,r.ctxPtr,i);t.Founda
tionError.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}serializedPrivateKeyLen(r)
{let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("privateKey",r,t.RawPrivat
eKey),a=e._vscf_key_asn1_serializer_serialized_private_key_len(this.ctxPtr,r.ctxPtr
),a}serializePrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("privateKey",r,t.RawPriva
teKey);const
a=this.serializedPrivateKeyLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_key_asn1_serializer_serialize_private_key(this.ctxPtr,r.ctxPtr,i);t.Found
ationError.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_key_asn1_serializer_setup_defau
lts(this.ctxPtr);}serializePublicKeyInplace(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("publicKey",r,t.RawPublic
Key);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_key_asn1_serializer_serialize_public_key_inp
lace(this.ctxPtr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),n}finally{e._free(i);}}serializePrivateKeyInp
lace(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("privateKey",r,t.RawPriva
teKey);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_key_asn1_serializer_serialize_private_key_in
place(this.ctxPtr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),n}finally{e._free(i);}}}return
r},se=(e,t)=>{class r{constructor(t)
{this.name="KeyAsn1Deserializer",this.ctxPtr=void 0===t?
e._vscf_key_asn1_deserializer_new():t;}static newAndUseCContext(t){return new
r(e._vscf_key_asn1_deserializer_shallow_copy(t))}static newAndTakeCContext(e)
{return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_key_asn1_deserializer_delete(this.ctxPtr),this.ctxPtr=null)
;}set asn1Reader(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("asn1Reader"
,r,"Foundation.Asn1Reader",t.FoundationInterfaceTag.ASN1_READER,t.FoundationInterfa
ce),e._vscf_key_asn1_deserializer_release_asn1_reader(this.ctxPtr),e._vscf_key_asn1
_deserializer_use_asn1_reader(this.ctxPtr,r.ctxPtr);}deserializePublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("publicKeyData",r);co
nst a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);let
f;e._vscf_error_reset(c);try{f=e._vscf_key_asn1_deserializer_deserialize_public_key
(this.ctxPtr,o,c);const r=e._vscf_error_status(c);return
t.FoundationError.handleStatusCode(r),t.RawPublicKey.newAndTakeCContext(f)}finally{
e._free(i),e._free(o),e._free(c);}}deserializePrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("privateKeyData",r);c
onst
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);let
f;e._vscf_error_reset(c);try{f=e._vscf_key_asn1_deserializer_deserialize_private_ke
y(this.ctxPtr,o,c);const r=e._vscf_error_status(c);return
t.FoundationError.handleStatusCode(r),t.RawPrivateKey.newAndTakeCContext(f)}finally
{e._free(i),e._free(o),e._free(c);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_key_asn1_deserializer_setup_def
aults(this.ctxPtr);}deserializePublicKeyInplace()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_error_ctx_size(),a=e._malloc(r);let
i;e._vscf_error_reset(a);try{i=e._vscf_key_asn1_deserializer_deserialize_public_key
_inplace(this.ctxPtr,a);const r=e._vscf_error_status(a);return
t.FoundationError.handleStatusCode(r),t.RawPublicKey.newAndTakeCContext(i)}finally{
e._free(a);}}deserializePrivateKeyInplace()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_error_ctx_size(),a=e._malloc(r);let
i;e._vscf_error_reset(a);try{i=e._vscf_key_asn1_deserializer_deserialize_private_ke
y_inplace(this.ctxPtr,a);const r=e._vscf_error_status(a);return
t.FoundationError.handleStatusCode(r),t.RawPrivateKey.newAndTakeCContext(i)}finally
{e._free(a);}}}return r},ce=(e,t)=>{class r{static get CAN_IMPORT_PUBLIC_KEY()
{return !0}get CAN_IMPORT_PUBLIC_KEY(){return r.CAN_IMPORT_PUBLIC_KEY}static get
CAN_EXPORT_PUBLIC_KEY(){return !0}get CAN_EXPORT_PUBLIC_KEY(){return
r.CAN_EXPORT_PUBLIC_KEY}static get CAN_IMPORT_PRIVATE_KEY(){return !0}get
CAN_IMPORT_PRIVATE_KEY(){return r.CAN_IMPORT_PRIVATE_KEY}static get
CAN_EXPORT_PRIVATE_KEY(){return !0}get CAN_EXPORT_PRIVATE_KEY(){return
r.CAN_EXPORT_PRIVATE_KEY}constructor(t){this.name="Ed25519",this.ctxPtr=void 0===t?
e._vscf_ed25519_new():t;}static newAndUseCContext(t){return new
r(e._vscf_ed25519_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_ed25519_delete(this.ctxPtr),this.ctxPtr=null);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_e
d25519_release_random(this.ctxPtr),e._vscf_ed25519_use_random(this.ctxPtr,r.ctxPtr)
;}set ecies(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("ecies",r,t.Ecies),e._vsc
f_ed25519_release_ecies(this.ctxPtr),e._vscf_ed25519_use_ecies(this.ctxPtr,r.ctxPtr
);}generateEphemeralKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Fou
ndation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ed25519_generate_ephemeral_key(this.ctxPtr,r
.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPublicKey
);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ed25519_import_public_key(this.ctxPtr,r.ctxP
tr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_ed25519_import_public_key_data(this.ctxPtr,s
,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ed25519_export_public_key(this.ctxPtr,r.ctxP
tr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPublicKey.newAndTakeCContext(n)}finally{
e._free(i);}}exportedPublicKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_ed25519_exported_public_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPublic
KeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.exportedPublicKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_ed25519_export_public_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError.
handleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}importPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPrivateKe
y);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ed25519_import_private_key(this.ctxPtr,r.ctx
Ptr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPrivateKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_ed25519_import_private_key_data(this.ctxPtr,
s,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_ed25519_export_private_key(this.ctxPtr,r.ctx
Ptr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPrivateKey.newAndTakeCContext(n)}finally
{e._free(i);}}exportedPrivateKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_ed25519_exported_private_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPr
ivateKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const
a=this.exportedPrivateKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_ed25519_export_private_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError
.handleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}canEncrypt(r,a){let
i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_ed25519_can_encrypt(this.ctxPtr,r.ctxPtr,a),!
!i}encryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_ed25519_encrypted_len(this.ctxPtr,r.ctxPtr,a)
,i}encrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.encryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_ed25519_encrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStatusC
ode(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canDe
crypt(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_ed25519_can_decrypt(this.ctxPtr,r.ctxPtr,a
),!!i}decryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_ed25519_decrypted_len(this.ctxPtr,r.ctxPtr
,a),i}decrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.decryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_ed25519_decrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStatusC
ode(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canSi
gn(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_ed25519_can_sign(this.ctxPtr,r.ctxPtr),!!a}signatureLen(r){let
a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_ed25519_signature_len(this.ctxPtr,r.ctxPtr),a}signHash(r,a,i)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureNumber("hashId",a),_.ensureByteArray("digest",i);const
n=i.length*i.BYTES_PER_ELEMENT,o=e._malloc(n);e.HEAP8.set(i,o);const
s=e._vsc_data_ctx_size(),c=e._malloc(s);e._vsc_data(c,o,n);const
f=this.signatureLen(r),l=e._vsc_buffer_new_with_capacity(f);try{const
i=e._vscf_ed25519_sign_hash(this.ctxPtr,r.ctxPtr,a,c,l);t.FoundationError.handleSta
tusCode(i);const n=e._vsc_buffer_bytes(l),_=e._vsc_buffer_len(l);return
e.HEAPU8.slice(n,n+_)}finally{e._free(o),e._free(c),e._vsc_buffer_delete(l);}}canVe
rify(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_ed25519_can_verify(this.ctxPtr,r.ctxPtr),!!a}verifyHash(r,a,i,n)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureNumber("hashId",a),_.ensureByteArray("digest",i),_.ensureByteArray("signat
ure",n);const o=i.length*i.BYTES_PER_ELEMENT,s=e._malloc(o);e.HEAP8.set(i,s);const
c=e._vsc_data_ctx_size(),f=e._malloc(c);e._vsc_data(f,s,o);const
l=n.length*n.BYTES_PER_ELEMENT,u=e._malloc(l);e.HEAP8.set(n,u);const
A=e._vsc_data_ctx_size(),d=e._malloc(A);let m;e._vsc_data(d,u,l);try{return
m=e._vscf_ed25519_verify_hash(this.ctxPtr,r.ctxPtr,a,f,d),!!
m}finally{e._free(s),e._free(f),e._free(u),e._free(d);}}computeSharedKey(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInte
rfaceTag.PRIVATE_KEY,t.FoundationInterface);const
i=this.sharedKeyLen(a),n=e._vsc_buffer_new_with_capacity(i);try{const
i=e._vscf_ed25519_compute_shared_key(this.ctxPtr,r.ctxPtr,a.ctxPtr,n);t.FoundationE
rror.handleStatusCode(i);const
o=e._vsc_buffer_bytes(n),_=e._vsc_buffer_len(n);return
e.HEAPU8.slice(o,o+_)}finally{e._vsc_buffer_delete(n);}}sharedKeyLen(r){let
a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Foun
dation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface),a=e._vscf_ed25519_s
hared_key_len(this.ctxPtr,r.ctxPtr),a}kemSharedKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Foun
dation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface),a=e._vscf_ed25519_k
em_shared_key_len(this.ctxPtr,r.ctxPtr),a}kemEncapsulatedKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_ed25519_kem_encapsulated_key_len(this.ctxPtr,r.ctxPtr),a}kemEncapsulate(r
)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.kemSharedKeyLen(r),i=e._vsc_buffer_new_with_capacity(a),n=this.kemEncapsulat
edKeyLen(r),o=e._vsc_buffer_new_with_capacity(n);try{const
a=e._vscf_ed25519_kem_encapsulate(this.ctxPtr,r.ctxPtr,i,o);t.FoundationError.handl
eStatusCode(a);const
n=e._vsc_buffer_bytes(i),_=e._vsc_buffer_len(i),s=e.HEAPU8.slice(n,n+_),c=e._vsc_bu
ffer_bytes(o),f=e._vsc_buffer_len(o);return
{sharedKey:s,encapsulatedKey:e.HEAPU8.slice(c,c+f)}}finally{e._vsc_buffer_delete(i)
,e._vsc_buffer_delete(o);}}kemDecapsulate(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("encapsulatedKey",r),
_.ensureImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInter
faceTag.PRIVATE_KEY,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.kemSharedKeyLen(a),f=e._vsc_buffer_new_with_capacity(c);try{const
r=e._vscf_ed25519_kem_decapsulate(this.ctxPtr,s,a.ctxPtr,f);t.FoundationError.handl
eStatusCode(r);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}setup
Defaults(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_ed25519_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusCode(r)
;}generateKey(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_error_ctx_size(),a=e._malloc(r);let
i;e._vscf_error_reset(a);try{i=e._vscf_ed25519_generate_key(this.ctxPtr,a);const
r=e._vscf_error_status(a);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(i)}f
inally{e._free(a);}}}return r},fe=(e,t)=>{class r{static get
CAN_IMPORT_PUBLIC_KEY(){return !0}get CAN_IMPORT_PUBLIC_KEY(){return
r.CAN_IMPORT_PUBLIC_KEY}static get CAN_EXPORT_PUBLIC_KEY(){return !0}get
CAN_EXPORT_PUBLIC_KEY(){return r.CAN_EXPORT_PUBLIC_KEY}static get
CAN_IMPORT_PRIVATE_KEY(){return !0}get CAN_IMPORT_PRIVATE_KEY(){return
r.CAN_IMPORT_PRIVATE_KEY}static get CAN_EXPORT_PRIVATE_KEY(){return !0}get
CAN_EXPORT_PRIVATE_KEY(){return r.CAN_EXPORT_PRIVATE_KEY}constructor(t)
{this.name="Curve25519",this.ctxPtr=void 0===t?e._vscf_curve25519_new():t;}static
newAndUseCContext(t){return new r(e._vscf_curve25519_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_curve25519_delete(this.ctxPtr),this.ctxPtr=null);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_c
urve25519_release_random(this.ctxPtr),e._vscf_curve25519_use_random(this.ctxPtr,r.c
txPtr);}set ecies(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("ecies",r,t.Ecies),e._vsc
f_curve25519_release_ecies(this.ctxPtr),e._vscf_curve25519_use_ecies(this.ctxPtr,r.
ctxPtr);}generateEphemeralKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Fou
ndation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_curve25519_generate_ephemeral_key(this.ctxPt
r,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPublicKey
);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_curve25519_import_public_key(this.ctxPtr,r.c
txPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_curve25519_import_public_key_data(this.ctxPt
r,s,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_curve25519_export_public_key(this.ctxPtr,r.c
txPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPublicKey.newAndTakeCContext(n)}finally{
e._free(i);}}exportedPublicKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_curve25519_exported_public_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPub
licKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.exportedPublicKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_curve25519_export_public_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationErr
or.handleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}importPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPrivateKe
y);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_curve25519_import_private_key(this.ctxPtr,r.
ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPrivateKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_curve25519_import_private_key_data(this.ctxP
tr,s,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_curve25519_export_private_key(this.ctxPtr,r.
ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPrivateKey.newAndTakeCContext(n)}finally
{e._free(i);}}exportedPrivateKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_curve25519_exported_private_key_data_len(this.ctxPtr,r.ctxPtr),a}expor
tPrivateKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const
a=this.exportedPrivateKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_curve25519_export_private_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationEr
ror.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}canEncrypt(r,a){let
i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_curve25519_can_encrypt(this.ctxPtr,r.ctxPtr,a
),!!i}encryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_curve25519_encrypted_len(this.ctxPtr,r.ctxPtr
,a),i}encrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.encryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_curve25519_encrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStat
usCode(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canDe
crypt(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_curve25519_can_decrypt(this.ctxPtr,r.ctxPt
r,a),!!i}decryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_curve25519_decrypted_len(this.ctxPtr,r.ctx
Ptr,a),i}decrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.decryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_curve25519_decrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handleStat
usCode(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}compu
teSharedKey(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInte
rfaceTag.PRIVATE_KEY,t.FoundationInterface);const
i=this.sharedKeyLen(a),n=e._vsc_buffer_new_with_capacity(i);try{const
i=e._vscf_curve25519_compute_shared_key(this.ctxPtr,r.ctxPtr,a.ctxPtr,n);t.Foundati
onError.handleStatusCode(i);const
o=e._vsc_buffer_bytes(n),_=e._vsc_buffer_len(n);return
e.HEAPU8.slice(o,o+_)}finally{e._vsc_buffer_delete(n);}}sharedKeyLen(r){let
a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Foun
dation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface),a=e._vscf_curve2551
9_shared_key_len(this.ctxPtr,r.ctxPtr),a}kemSharedKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Foun
dation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface),a=e._vscf_curve2551
9_kem_shared_key_len(this.ctxPtr,r.ctxPtr),a}kemEncapsulatedKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_curve25519_kem_encapsulated_key_len(this.ctxPtr,r.ctxPtr),a}kemEncapsulat
e(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.kemSharedKeyLen(r),i=e._vsc_buffer_new_with_capacity(a),n=this.kemEncapsulat
edKeyLen(r),o=e._vsc_buffer_new_with_capacity(n);try{const
a=e._vscf_curve25519_kem_encapsulate(this.ctxPtr,r.ctxPtr,i,o);t.FoundationError.ha
ndleStatusCode(a);const
n=e._vsc_buffer_bytes(i),_=e._vsc_buffer_len(i),s=e.HEAPU8.slice(n,n+_),c=e._vsc_bu
ffer_bytes(o),f=e._vsc_buffer_len(o);return
{sharedKey:s,encapsulatedKey:e.HEAPU8.slice(c,c+f)}}finally{e._vsc_buffer_delete(i)
,e._vsc_buffer_delete(o);}}kemDecapsulate(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("encapsulatedKey",r),
_.ensureImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInter
faceTag.PRIVATE_KEY,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.kemSharedKeyLen(a),f=e._vsc_buffer_new_with_capacity(c);try{const
r=e._vscf_curve25519_kem_decapsulate(this.ctxPtr,s,a.ctxPtr,f);t.FoundationError.ha
ndleStatusCode(r);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}setup
Defaults(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_curve25519_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusCode
(r);}generateKey(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_error_ctx_size(),a=e._malloc(r);let
i;e._vscf_error_reset(a);try{i=e._vscf_curve25519_generate_key(this.ctxPtr,a);const
r=e._vscf_error_status(a);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(i)}f
inally{e._free(a);}}}return r},le=(e,t)=>{class r{static get
CAN_IMPORT_PUBLIC_KEY(){return !0}get CAN_IMPORT_PUBLIC_KEY(){return
r.CAN_IMPORT_PUBLIC_KEY}static get CAN_EXPORT_PUBLIC_KEY(){return !0}get
CAN_EXPORT_PUBLIC_KEY(){return r.CAN_EXPORT_PUBLIC_KEY}static get
CAN_IMPORT_PRIVATE_KEY(){return !0}get CAN_IMPORT_PRIVATE_KEY(){return
r.CAN_IMPORT_PRIVATE_KEY}static get CAN_EXPORT_PRIVATE_KEY(){return !0}get
CAN_EXPORT_PRIVATE_KEY(){return r.CAN_EXPORT_PRIVATE_KEY}constructor(t)
{this.name="Falcon",this.ctxPtr=void 0===t?e._vscf_falcon_new():t;}static
newAndUseCContext(t){return new r(e._vscf_falcon_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_falcon_delete(this.ctxPtr),this.ctxPtr=null);}set random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_f
alcon_release_random(this.ctxPtr),e._vscf_falcon_use_random(this.ctxPtr,r.ctxPtr);}
algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_falcon_alg_id(this.ctxPtr),t}p
roduceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_falcon_produce_alg_info(this.c
txPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_falcon_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.handleSta
tusCode(a);}generateEphemeralKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Fou
ndation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_falcon_generate_ephemeral_key(this.ctxPtr,r.
ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPublicKey
);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_falcon_import_public_key(this.ctxPtr,r.ctxPt
r,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationI
nterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_falcon_import_public_key_data(this.ctxPtr,s,
a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_falcon_export_public_key(this.ctxPtr,r.ctxPt
r,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPublicKey.newAndTakeCContext(n)}finally{
e._free(i);}}exportedPublicKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_falcon_exported_public_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPublicK
eyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.exportedPublicKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_falcon_export_public_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError.h
andleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}importPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPrivateKe
y);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_falcon_import_private_key(this.ctxPtr,r.ctxP
tr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPrivateKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_falcon_import_private_key_data(this.ctxPtr,s
,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_falcon_export_private_key(this.ctxPtr,r.ctxP
tr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPrivateKey.newAndTakeCContext(n)}finally
{e._free(i);}}exportedPrivateKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_falcon_exported_private_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPri
vateKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const
a=this.exportedPrivateKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_falcon_export_private_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError.
handleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}canSign(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_falcon_can_sign(this.ctxPtr,r.ctxPtr),!!a}signatureLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_falcon_signature_len(this.ctxPtr,r.ctxPtr),a}signHash(r,a,i)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureNumber("hashId",a),_.ensureByteArray("digest",i);const
n=i.length*i.BYTES_PER_ELEMENT,o=e._malloc(n);e.HEAP8.set(i,o);const
s=e._vsc_data_ctx_size(),c=e._malloc(s);e._vsc_data(c,o,n);const
f=this.signatureLen(r),l=e._vsc_buffer_new_with_capacity(f);try{const
i=e._vscf_falcon_sign_hash(this.ctxPtr,r.ctxPtr,a,c,l);t.FoundationError.handleStat
usCode(i);const n=e._vsc_buffer_bytes(l),_=e._vsc_buffer_len(l);return
e.HEAPU8.slice(n,n+_)}finally{e._free(o),e._free(c),e._vsc_buffer_delete(l);}}canVe
rify(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_falcon_can_verify(this.ctxPtr,r.ctxPtr),!!a}verifyHash(r,a,i,n)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureNumber("hashId",a),_.ensureByteArray("digest",i),_.ensureByteArray("signat
ure",n);const o=i.length*i.BYTES_PER_ELEMENT,s=e._malloc(o);e.HEAP8.set(i,s);const
c=e._vsc_data_ctx_size(),f=e._malloc(c);e._vsc_data(f,s,o);const
l=n.length*n.BYTES_PER_ELEMENT,u=e._malloc(l);e.HEAP8.set(n,u);const
A=e._vsc_data_ctx_size(),d=e._malloc(A);let m;e._vsc_data(d,u,l);try{return
m=e._vscf_falcon_verify_hash(this.ctxPtr,r.ctxPtr,a,f,d),!!
m}finally{e._free(s),e._free(f),e._free(u),e._free(d);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_falcon_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusCode(r);
}generateKey(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_error_ctx_size(),a=e._malloc(r);let
i;e._vscf_error_reset(a);try{i=e._vscf_falcon_generate_key(this.ctxPtr,a);const
r=e._vscf_error_status(a);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(i)}f
inally{e._free(a);}}}return r},ue=(e,t)=>{class r{static get
CAN_IMPORT_PUBLIC_KEY(){return !0}get CAN_IMPORT_PUBLIC_KEY(){return
r.CAN_IMPORT_PUBLIC_KEY}static get CAN_EXPORT_PUBLIC_KEY(){return !0}get
CAN_EXPORT_PUBLIC_KEY(){return r.CAN_EXPORT_PUBLIC_KEY}static get
CAN_IMPORT_PRIVATE_KEY(){return !0}get CAN_IMPORT_PRIVATE_KEY(){return
r.CAN_IMPORT_PRIVATE_KEY}static get CAN_EXPORT_PRIVATE_KEY(){return !0}get
CAN_EXPORT_PRIVATE_KEY(){return r.CAN_EXPORT_PRIVATE_KEY}constructor(t)
{this.name="Round5",this.ctxPtr=void 0===t?e._vscf_round5_new():t;}static
newAndUseCContext(t){return new r(e._vscf_round5_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_round5_delete(this.ctxPtr),this.ctxPtr=null);}set random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_r
ound5_release_random(this.ctxPtr),e._vscf_round5_use_random(this.ctxPtr,r.ctxPtr);}
generateEphemeralKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Fou
ndation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_round5_generate_ephemeral_key(this.ctxPtr,r.
ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPublicKey
);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_round5_import_public_key(this.ctxPtr,r.ctxPt
r,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_round5_import_public_key_data(this.ctxPtr,s,
a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_round5_export_public_key(this.ctxPtr,r.ctxPt
r,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPublicKey.newAndTakeCContext(n)}finally{
e._free(i);}}exportedPublicKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_round5_exported_public_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPublicK
eyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,
t.FoundationInterface);const
a=this.exportedPublicKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_round5_export_public_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError.h
andleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}importPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPrivateKe
y);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_round5_import_private_key(this.ctxPtr,r.ctxP
tr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPrivateKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_round5_import_private_key_data(this.ctxPtr,s
,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_round5_export_private_key(this.ctxPtr,r.ctxP
tr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPrivateKey.newAndTakeCContext(n)}finally
{e._free(i);}}exportedPrivateKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_round5_exported_private_key_data_len(this.ctxPtr,r.ctxPtr),a}exportPri
vateKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const
a=this.exportedPrivateKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_round5_export_private_key_data(this.ctxPtr,r.ctxPtr,i);t.FoundationError.
handleStatusCode(a);const n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}kemSharedKeyLen(r){let
a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Foun
dation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface),a=e._vscf_round5_ke
m_shared_key_len(this.ctxPtr,r.ctxPtr),a}kemEncapsulatedKeyLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_round5_kem_encapsulated_key_len(this.ctxPtr,r.ctxPtr),a}kemEncapsulate(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.kemSharedKeyLen(r),i=e._vsc_buffer_new_with_capacity(a),n=this.kemEncapsulat
edKeyLen(r),o=e._vsc_buffer_new_with_capacity(n);try{const
a=e._vscf_round5_kem_encapsulate(this.ctxPtr,r.ctxPtr,i,o);t.FoundationError.handle
StatusCode(a);const
n=e._vsc_buffer_bytes(i),_=e._vsc_buffer_len(i),s=e.HEAPU8.slice(n,n+_),c=e._vsc_bu
ffer_bytes(o),f=e._vsc_buffer_len(o);return
{sharedKey:s,encapsulatedKey:e.HEAPU8.slice(c,c+f)}}finally{e._vsc_buffer_delete(i)
,e._vsc_buffer_delete(o);}}kemDecapsulate(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("encapsulatedKey",r),
_.ensureImplementInterface("privateKey",a,"Foundation.PrivateKey",t.FoundationInter
faceTag.PRIVATE_KEY,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.kemSharedKeyLen(a),f=e._vsc_buffer_new_with_capacity(c);try{const
r=e._vscf_round5_kem_decapsulate(this.ctxPtr,s,a.ctxPtr,f);t.FoundationError.handle
StatusCode(r);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}setup
Defaults(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_round5_setup_defaults(this.ctxPtr);t.FoundationError.handleStatusCode(r);
}generateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("algId",r);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_round5_generate_key(this.ctxPtr,r,i);const
a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}}return r},Ae=(e,t)=>{class r{constructor(t)
{this.name="CompoundKeyAlgInfo",this.ctxPtr=void 0===t?
e._vscf_compound_key_alg_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_compound_key_alg_info_shallow_copy(t))}static newAndTakeCContext(e)
{return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_compound_key_alg_info_delete(this.ctxPtr),this.ctxPtr=null)
;}algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_key_alg_info_alg_id(t
his.ctxPtr),t}cipherAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_key_alg_info_cipher_a
lg_info(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}signerAlgInfo(){let
r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_key_alg_info_signer_a
lg_info(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}}return
r},de=(e,t)=>{class r{constructor(t){this.name="CompoundPublicKey",this.ctxPtr=void
0===t?e._vscf_compound_public_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_compound_public_key_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_compound_public_key_delete(this.ctxPtr),this.ctxPtr=null);}
algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_public_key_alg_id(thi
s.ctxPtr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_public_key_alg_info(t
his.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_public_key_len(this.c
txPtr),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_public_key_bitlen(thi
s.ctxPtr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_public_key_impl_tag(t
his.ctxPtr),t}isValid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_public_key_is_valid(t
his.ctxPtr),!!t}cipherKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_public_key_cipher_key
(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}signerKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_public_key_signer_key
(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}}return
r},me=(e,t)=>{class r{constructor(t)
{this.name="CompoundPrivateKey",this.ctxPtr=void 0===t?
e._vscf_compound_private_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_compound_private_key_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_compound_private_key_delete(this.ctxPtr),this.ctxPtr=null);
}algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_private_key_alg_id(th
is.ctxPtr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_private_key_alg_info(
this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_private_key_len(this.
ctxPtr),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_private_key_bitlen(th
is.ctxPtr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_private_key_impl_tag(
this.ctxPtr),t}isValid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_private_key_is_valid(
this.ctxPtr),!!t}extractPublicKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_private_key_extract_p
ublic_key(this.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}cipherKey(){let
r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_private_key_cipher_ke
y(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}signerKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_private_key_signer_ke
y(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}}return
r},pe=(e,t)=>{class r{static get CAN_IMPORT_PUBLIC_KEY(){return !0}get
CAN_IMPORT_PUBLIC_KEY(){return r.CAN_IMPORT_PUBLIC_KEY}static get
CAN_EXPORT_PUBLIC_KEY(){return !0}get CAN_EXPORT_PUBLIC_KEY(){return
r.CAN_EXPORT_PUBLIC_KEY}static get CAN_IMPORT_PRIVATE_KEY(){return !0}get
CAN_IMPORT_PRIVATE_KEY(){return r.CAN_IMPORT_PRIVATE_KEY}static get
CAN_EXPORT_PRIVATE_KEY(){return !0}get CAN_EXPORT_PRIVATE_KEY(){return
r.CAN_EXPORT_PRIVATE_KEY}constructor(t){this.name="CompoundKeyAlg",this.ctxPtr=void
0===t?e._vscf_compound_key_alg_new():t;}static newAndUseCContext(t){return new
r(e._vscf_compound_key_alg_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_compound_key_alg_delete(this.ctxPtr),this.ctxPtr=null);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_c
ompound_key_alg_release_random(this.ctxPtr),e._vsc
f_compound_key_alg_use_random(this.ctxPtr,r.ctxPtr);}algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_compound_key_alg_alg_id(this.c
txPtr),t}produceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_compound_key_alg_produce_alg_i
nfo(this.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_compound_key_alg_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError
.handleStatusCode(a);}generateEphemeralKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Fou
ndation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_compound_key_alg_generate_ephemeral_key(this
.ctxPtr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPublicKey
);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_compound_key_alg_import_public_key(this.ctxP
tr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_compound_key_alg_import_public_key_data(this
.ctxPtr,s,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_compound_key_alg_export_public_key(this.ctxP
tr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPublicKey.newAndTakeCContext(n)}finally{
e._free(i);}}exportedPublicKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_compound_key_alg_exported_public_key_data_len(this.ctxPtr,r.ctxPtr),a}exp
ortPublicKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.exportedPublicKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_compound_key_alg_export_public_key_data(this.ctxPtr,r.ctxPtr,i);t.Foundat
ionError.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}importPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPrivateKe
y);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_compound_key_alg_import_private_key(this.ctx
Ptr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPrivateKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_compound_key_alg_import_private_key_data(thi
s.ctxPtr,s,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_compound_key_alg_export_private_key(this.ctx
Ptr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPrivateKey.newAndTakeCContext(n)}finally
{e._free(i);}}exportedPrivateKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_compound_key_alg_exported_private_key_data_len(this.ctxPtr,r.ctxPtr),a
}exportPrivateKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const
a=this.exportedPrivateKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_compound_key_alg_export_private_key_data(this.ctxPtr,r.ctxPtr,i);t.Founda
tionError.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}canEncrypt(r,a){let
i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_compound_key_alg_can_encrypt(this.ctxPtr,r.ct
xPtr,a),!!i}encryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_compound_key_alg_encrypted_len(this.ctxPtr,r.
ctxPtr,a),i}encrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.encryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_compound_key_alg_encrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.hand
leStatusCode(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canDe
crypt(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_compound_key_alg_can_decrypt(this.ctxPtr,r
.ctxPtr,a),!!i}decryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_compound_key_alg_decrypted_len(this.ctxPtr
,r.ctxPtr,a),i}decrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.decryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_compound_key_alg_decrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.hand
leStatusCode(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canSi
gn(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_compound_key_alg_can_sign(this.ctxPtr,r.ctxPtr),!!a}signatureLen(r)
{let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_compound_key_alg_signature_len(this.ctxPtr,r.ctxPtr),a}signHash(r,a,i)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureNumber("hashId",a),_.ensureByteArray("digest",i);const
n=i.length*i.BYTES_PER_ELEMENT,o=e._malloc(n);e.HEAP8.set(i,o);const
s=e._vsc_data_ctx_size(),c=e._malloc(s);e._vsc_data(c,o,n);const
f=this.signatureLen(r),l=e._vsc_buffer_new_with_capacity(f);try{const
i=e._vscf_compound_key_alg_sign_hash(this.ctxPtr,r.ctxPtr,a,c,l);t.FoundationError.
handleStatusCode(i);const n=e._vsc_buffer_bytes(l),_=e._vsc_buffer_len(l);return
e.HEAPU8.slice(n,n+_)}finally{e._free(o),e._free(c),e._vsc_buffer_delete(l);}}canVe
rify(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_compound_key_alg_can_verify(this.ctxPtr,r.ctxPtr),!!a}verifyHash(r,a,i,n)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureNumber("hashId",a),_.ensureByteArray("digest",i),_.en
sureByteArray("signature",n);const
o=i.length*i.BYTES_PER_ELEMENT,s=e._malloc(o);e.HEAP8.set(i,s);const
c=e._vsc_data_ctx_size(),f=e._malloc(c);e._vsc_data(f,s,o);const
l=n.length*n.BYTES_PER_ELEMENT,u=e._malloc(l);e.HEAP8.set(n,u);const
A=e._vsc_data_ctx_size(),d=e._malloc(A);let m;e._vsc_data(d,u,l);try{return
m=e._vscf_compound_key_alg_verify_hash(this.ctxPtr,r.ctxPtr,a,f,d),!!
m}finally{e._free(s),e._free(f),e._free(u),e._free(d);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_compound_key_alg_setup_defaults(this.ctxPtr);t.FoundationError.handleStat
usCode(r);}makeKey(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("cipherKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureImplementInterface("signerKey",a,"Foundation.PrivateKey",t.FoundationInt
erfaceTag.PRIVATE_KEY,t.FoundationInterface);const
i=e._vscf_error_ctx_size(),n=e._malloc(i);let
o;e._vscf_error_reset(n);try{o=e._vscf_compound_key_alg_make_key(this.ctxPtr,r.ctxP
tr,a.ctxPtr,n);const i=e._vscf_error_status(n);return
t.FoundationError.handleStatusCode(i),t.FoundationInterface.newAndTakeCContext(o)}f
inally{e._free(n);}}}return r},ve=(e,t)=>{class r{constructor(t)
{this.name="HybridKeyAlgInfo",this.ctxPtr=void 0===t?
e._vscf_hybrid_key_alg_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_hybrid_key_alg_info_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_hybrid_key_alg_info_delete(this.ctxPtr),this.ctxPtr=null);}
algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_key_alg_info_alg_id(thi
s.ctxPtr),t}firstKeyAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hybrid_key_alg_info_first_key_
alg_info(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}secondKeyAlgInfo()
{let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hybrid_key_alg_info_second_key
_alg_info(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}}return
r},ye=(e,t)=>{class r{constructor(t){this.name="HybridPublicKey",this.ctxPtr=void
0===t?e._vscf_hybrid_public_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_hybrid_public_key_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_hybrid_public_key_delete(this.ctxPtr),this.ctxPtr=null);}al
gId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_public_key_alg_id(this.
ctxPtr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hybrid_public_key_alg_info(thi
s.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_public_key_len(this.ctx
Ptr),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_public_key_bitlen(this.
ctxPtr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_public_key_impl_tag(thi
s.ctxPtr),t}isValid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_public_key_is_valid(thi
s.ctxPtr),!!t}firstKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hybrid_public_key_first_key(th
is.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}secondKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hybrid_public_key_second_key(t
his.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}}return r},he=(e,t)=>{class
r{constructor(t){this.name="HybridPrivateKey",this.ctxPtr=void 0===t?
e._vscf_hybrid_private_key_new():t;}static newAndUseCContext(t){return new
r(e._vscf_hybrid_private_key_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_hybrid_private_key_delete(this.ctxPtr),this.ctxPtr=null);}a
lgId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_private_key_alg_id(this
.ctxPtr),t}algInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hybrid_private_key_alg_info(th
is.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_private_key_len(this.ct
xPtr),t}bitlen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_private_key_bitlen(this
.ctxPtr),t}implTag(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_private_key_impl_tag(th
is.ctxPtr),t}isValid(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hybrid_private_key_is_valid(th
is.ctxPtr),!!t}extractPublicKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hybrid_private_key_extract_pub
lic_key(this.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}firstKey(){let
r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hybrid_private_key_first_key(t
his.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}secondKey(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hybrid_private_key_second_key(
this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}}return r},be=(e,t)=>{class
r{static get CAN_IMPORT_PUBLIC_KEY(){return !0}get CAN_IMPORT_PUBLIC_KEY(){return
r.CAN_IMPORT_PUBLIC_KEY}static get CAN_EXPORT_PUBLIC_KEY(){return !0}get
CAN_EXPORT_PUBLIC_KEY(){return r.CAN_EXPORT_PUBLIC_KEY}static get
CAN_IMPORT_PRIVATE_KEY(){return !0}get CAN_IMPORT_PRIVATE_KEY(){return
r.CAN_IMPORT_PRIVATE_KEY}static get CAN_EXPORT_PRIVATE_KEY(){return !0}get
CAN_EXPORT_PRIVATE_KEY(){return r.CAN_EXPORT_PRIVATE_KEY}constructor(t)
{this.name="HybridKeyAlg",this.ctxPtr=void 0===t?
e._vscf_hybrid_key_alg_new():t;}static newAndUseCContext(t){return new
r(e._vscf_hybrid_key_alg_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_hybrid_key_alg_delete(this.ctxPtr),this.ctxPtr=null);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_h
ybrid_key_alg_release_random(this.ctxPtr),e._vscf_hybrid_key_alg_use_random(this.ct
xPtr,r.ctxPtr);}set cipher(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("cipher",r,"
Foundation.CipherAuth",t.FoundationInterfaceTag.CIPHER_AUTH,t.FoundationInterface),
e._vscf_hybrid_key_alg_release_cipher(this.ctxPtr),e._vscf_hybrid_key_alg_use_ciphe
r(this.ctxPtr,r.ctxPtr);}set hash(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("hash",r,"Fo
undation.Hash",t.FoundationInterfaceTag.HASH,t.FoundationInterface),e._vscf_hybrid_
key_alg_release_hash(this.ctxPtr),e._vscf_hybrid_key_alg_use_hash(this.ctxPtr,r.ctx
Ptr);}generateEphemeralKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("key",r,"Fou
ndation.Key",t.FoundationInterfaceTag.KEY,t.FoundationInterface);const
a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_hybrid_key_alg_generate_ephemeral_key(this.c
txPtr,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPublicKey
);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_hybrid_key_alg_import_public_key(this.ctxPtr
,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPublicKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("keyData",r),_.ensure
ImplementInterface("keyAlgInfo",a,"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG
_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_hybrid_key_alg_import_public_key_data(this.c
txPtr,s,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPublicKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_hybrid_key_alg_export_public_key(this.ctxPtr
,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPublicKey.newAndTakeCContext(n)}finally{
e._free(i);}}exportedPublicKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_hybrid_key_alg_exported_public_key_data_len(this.ctxPtr,r.ctxPtr),a}expor
tPublicKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
;const
a=this.exportedPublicKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_hybrid_key_alg_export_public_key_data(this.ctxPtr,r.ctxPtr,i);t.Foundatio
nError.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}importPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("rawKey",r,t.RawPrivateKe
y);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_hybrid_key_alg_import_private_key(this.ctxPt
r,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.FoundationInterface.newAndTakeCContext(n)}f
inally{e._free(i);}}importPrivateKeyData(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensure
ByteArray("keyData",r),_.ensureImplementInterface("keyAlgInfo",a,"Foundation.AlgInf
o",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
i=r.length*r.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(r,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=e._vscf_error_ctx_size(),f=e._malloc(c);let
l;e._vscf_error_reset(f);try{l=e._vscf_hybrid_key_alg_import_private_key_data(this.
ctxPtr,s,a.ctxPtr,f);const r=e._vscf_error_status(f);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(l)}f
inally{e._free(n),e._free(s),e._free(f);}}exportPrivateKey(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const a=e._vscf_error_ctx_size(),i=e._malloc(a);let
n;e._vscf_error_reset(i);try{n=e._vscf_hybrid_key_alg_export_private_key(this.ctxPt
r,r.ctxPtr,i);const a=e._vscf_error_status(i);return
t.FoundationError.handleStatusCode(a),t.RawPrivateKey.newAndTakeCContext(n)}finally
{e._free(i);}}exportedPrivateKeyDataLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_hybrid_key_alg_exported_private_key_data_len(this.ctxPtr,r.ctxPtr),a}e
xportPrivateKeyData(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce);const
a=this.exportedPrivateKeyDataLen(r),i=e._vsc_buffer_new_with_capacity(a);try{const
a=e._vscf_hybrid_key_alg_export_private_key_data(this.ctxPtr,r.ctxPtr,i);t.Foundati
onError.handleStatusCode(a);const
n=e._vsc_buffer_bytes(i),o=e._vsc_buffer_len(i);return
e.HEAPU8.slice(n,n+o)}finally{e._vsc_buffer_delete(i);}}canEncrypt(r,a){let
i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_hybrid_key_alg_can_encrypt(this.ctxPtr,r.ctxP
tr,a),!!i}encryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
_.ensureNumber("dataLen",a),i=e._vscf_hybrid_key_alg_encrypted_len(this.ctxPtr,r.ct
xPtr,a),i}encrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.encryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_hybrid_key_alg_encrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handle
StatusCode(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canDe
crypt(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_hybrid_key_alg_can_decrypt(this.ctxPtr,r.c
txPtr,a),!!i}decryptedLen(r,a){let i;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),_.ensureNumber("dataLen",a),i=e._vscf_hybrid_key_alg_decrypted_len(this.ctxPtr,r
.ctxPtr,a),i}decrypt(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=this.decryptedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{const
a=e._vscf_hybrid_key_alg_decrypt(this.ctxPtr,r.ctxPtr,s,f);t.FoundationError.handle
StatusCode(a);const i=e._vsc_buffer_bytes(f),o=e._vsc_buffer_len(f);return
e.HEAPU8.slice(i,i+o)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}canSi
gn(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_hybrid_key_alg_can_sign(this.ctxPtr,r.ctxPtr),!!a}signatureLen(r){let
a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey",
r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfac
e),a=e._vscf_hybrid_key_alg_signature_len(this.ctxPtr,r.ctxPtr),a}signHash(r,a,i)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("privateKey"
,r,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterfa
ce),_.ensureNumber("hashId",a),_.ensureByteArray("digest",i);const
n=i.length*i.BYTES_PER_ELEMENT,o=e._malloc(n);e.HEAP8.set(i,o);const
s=e._vsc_data_ctx_size(),c=e._malloc(s);e._vsc_data(c,o,n);const
f=this.signatureLen(r),l=e._vsc_buffer_new_with_capacity(f);try{const
i=e._vscf_hybrid_key_alg_sign_hash(this.ctxPtr,r.ctxPtr,a,c,l);t.FoundationError.ha
ndleStatusCode(i);const n=e._vsc_buffer_bytes(l),_=e._vsc_buffer_len(l);return
e.HEAPU8.slice(n,n+_)}finally{e._free(o),e._free(c),e._vsc_buffer_delete(l);}}canVe
rify(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",r
,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface),
a=e._vscf_hybrid_key_alg_can_verify(this.ctxPtr,r.ctxPtr),!!a}verifyHash(r,a,i,n)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("publicKey",
r,"Foundation.PublicKey",t.FoundationInterfaceTag.PUBLIC_KEY,t.FoundationInterface)
,_.ensureNumber("hashId",a),_.ensureByteArray("digest",i),_.ensureByteArray("signat
ure",n);const o=i.length*i.BYTES_PER_ELEMENT,s=e._malloc(o);e.HEAP8.set(i,s);const
c=e._vsc_data_ctx_size(),f=e._malloc(c);e._vsc_data(f,s,o);const
l=n.length*n.BYTES_PER_ELEMENT,u=e._malloc(l);e.HEAP8.set(n,u);const
A=e._vsc_data_ctx_size(),d=e._malloc(A);let m;e._vsc_data(d,u,l);try{return
m=e._vscf_hybrid_key_alg_verify_hash(this.ctxPtr,r.ctxPtr,a,f,d),!!
m}finally{e._free(s),e._free(f),e._free(u),e._free(d);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_hybrid_key_alg_setup_defaults(this.ctxPtr);t.FoundationError.handleStatus
Code(r);}makeKey(r,a)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("firstKey",r
,"Foundation.PrivateKey",t.FoundationInterfaceTag.PRIVATE_KEY,t.FoundationInterface
),_.ensureImplementInterface("secondKey",a,"Foundation.PrivateKey",t.FoundationInte
rfaceTag.PRIVATE_KEY,t.FoundationInterface);const
i=e._vscf_error_ctx_size(),n=e._malloc(i);let
o;e._vscf_error_reset(n);try{o=e._vscf_hybrid_key_alg_make_key(this.ctxPtr,r.ctxPtr
,a.ctxPtr,n);const i=e._vscf_error_status(n);return
t.FoundationError.handleStatusCode(i),t.FoundationInterface.newAndTakeCContext(o)}f
inally{e._free(n);}}}return r},we=(e,t)=>{class r{constructor(t)
{this.name="SimpleAlgInfo",this.ctxPtr=void 0===t?
e._vscf_simple_alg_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_simple_alg_info_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_simple_alg_info_delete(this.ctxPtr),this.ctxPtr=null);}stat
ic newWithAlgId(t){let a;return
_.ensureNumber("algId",t),a=e._vscf_simple_alg_info_new_with_alg_id(t),r.newAndTake
CContext(a)}algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_simple_alg_info_alg_id(this.ct
xPtr),t}}return r},ke=(e,t)=>{class r{constructor(t)
{this.name="HashBasedAlgInfo",this.ctxPtr=void 0===t?
e._vscf_hash_based_alg_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_hash_based_alg_info_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_hash_based_alg_info_delete(this.ctxPtr),this.ctxPtr=null);}
algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_hash_based_alg_info_alg_id(thi
s.ctxPtr),t}hashAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_hash_based_alg_info_hash_alg_i
nfo(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}}return
r},xe=(e,t)=>{class r{constructor(t){this.name="CipherAlgInfo",this.ctxPtr=void
0===t?e._vscf_cipher_alg_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_cipher_alg_info_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_cipher_alg_info_delete(this.ctxPtr),this.ctxPtr=null);}stat
ic newWithMembers(t,a){_.ensureNumber("algId",t),_.ensureByteArray("nonce",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);let c;e._vsc_data(s,n,i);try{return
c=e._vscf_cipher_alg_info_new_with_members(t,s),r.newAndTakeCContext(c)}finally{e._
free(n),e._free(s);}}algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_cipher_alg_info_alg_id(this.ct
xPtr),t}nonce(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_cipher_alg_info_nonce(r,this.ct
xPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}}return r},ge=(e,t)=>{class
r{constructor(t){this.name="SaltedKdfAlgInfo",this.ctxPtr=void 0===t?
e._vscf_salted_kdf_alg_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_salted_kdf_alg_info_shallow_copy(t))}static newAndTakeCContext(e){return
new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_salted_kdf_alg_info_delete(this.ctxPtr),this.ctxPtr=null);}
algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_salted_kdf_alg_info_alg_id(thi
s.ctxPtr),t}hashAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_salted_kdf_alg_info_hash_alg_i
nfo(this.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}salt()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
t=e._vsc_data_ctx_size(),r=e._malloc(t);try{e._vscf_salted_kdf_alg_info_salt(r,this
.ctxPtr);const t=e._vsc_data_len(r),a=e._vsc_data_bytes(r);return
e.HEAPU8.slice(a,a+t)}finally{e._free(r);}}iterationCount(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_salted_kdf_alg_info_iteration_
count(this.ctxPtr),t}}return r},Ee=(e,t)=>{class r{constructor(t)
{this.name="PbeAlgInfo",this.ctxPtr=void 0===t?e._vscf_pbe_alg_info_new():t;}static
newAndUseCContext(t){return new r(e._vscf_pbe_alg_info_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_pbe_alg_info_delete(this.ctxPtr),this.ctxPtr=null);}algId()
{let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_pbe_alg_info_alg_id(this.ctxPt
r),t}kdfAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_pbe_alg_info_kdf_alg_info(this
.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}cipherAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_pbe_alg_info_cipher_alg_info(t
his.ctxPtr),t.FoundationInterface.newAndUseCContext(r)}}return r},Ne=(e,t)=>{class
r{constructor(t){this.name="EccAlgInfo",this.ctxPtr=void 0===t?
e._vscf_ecc_alg_info_new():t;}static newAndUseCContext(t){return new
r(e._vscf_ecc_alg_info_shallow_copy(t))}static newAndTakeCContext(e){return new
r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_ecc_alg_info_delete(this.ctxPtr),this.ctxPtr=null);}static
newWithMembers(t,a,i){let n;return
_.ensureNumber("algId",t),_.ensureNumber("keyId",a),_.ensureNumber("domainId",i),n=
e._vscf_ecc_alg_info_new_with_members(t,a,i),r.newAndTakeCContext(n)}algId(){let
t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_alg_info_alg_id(this.ctxPt
r),t}keyId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_alg_info_key_id(this.ctxPt
r),t}domainId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_ecc_alg_info_domain_id(this.ct
xPtr),t}}return r},Ie=(e,t)=>{class r{constructor(t)
{this.name="AlgInfoDerSerializer",this.ctxPtr=void 0===t?
e._vscf_alg_info_der_serializer_new():t;}static newAndUseCContext(t){return new
r(e._vscf_alg_info_der_serializer_shallow_copy(t))}static newAndTakeCContext(e)
{return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_alg_info_der_serializer_delete(this.ctxPtr),this.ctxPtr=nul
l);}set asn1Writer(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("asn1Writer"
,r,"Foundation.Asn1Writer",t.FoundationInterfaceTag.ASN1_WRITER,t.FoundationInterfa
ce),e._vscf_alg_info_der_serializer_release_asn1_writer(this.ctxPtr),e._vscf_alg_in
fo_der_serializer_use_asn1_writer(this.ctxPtr,r.ctxPtr);}serializedLen(r){let
a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,"
Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface),a=e._v
scf_alg_info_der_serializer_serialized_len(this.ctxPtr,r.ctxPtr),a}serialize(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=this.serializedLen(r),i=e._vsc_buffer_new_with_capacity(a);try{e._vscf_alg_info_d
er_serializer_serialize(this.ctxPtr,r.ctxPtr,i);const
t=e._vsc_buffer_bytes(i),a=e._vsc_buffer_len(i);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(i);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_alg_info_der_serializer_setup_d
efaults(this.ctxPtr);}serializeInplace(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,"
Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface),a=e._v
scf_alg_info_der_serializer_serialize_inplace(this.ctxPtr,r.ctxPtr),a}}return
r},Te=(e,t)=>{class r{constructor(t)
{this.name="AlgInfoDerDeserializer",this.ctxPtr=void 0===t?
e._vscf_alg_info_der_deserializer_new():t;}static newAndUseCContext(t){return new
r(e._vscf_alg_info_der_deserializer_shallow_copy(t))}static newAndTakeCContext(e)
{return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_alg_info_der_deserializer_delete(this.ctxPtr),this.ctxPtr=n
ull);}set asn1Reader(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("asn1Reader"
,r,"Foundation.Asn1Reader",t.FoundationInterfaceTag.ASN1_READER,t.FoundationInterfa
ce),e._vscf_alg_info_der_deserializer_release_asn1_reader(this.ctxPtr),e._vscf_alg_
info_der_deserializer_use_asn1_reader(this.ctxPtr,r.ctxPtr);}deserialize(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);let
f;e._vscf_error_reset(c);try{f=e._vscf_alg_info_der_deserializer_deserialize(this.c
txPtr,o,c);const r=e._vscf_error_status(c);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(f)}f
inally{e._free(i),e._free(o),e._free(c);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_alg_info_der_deserializer_setup
_defaults(this.ctxPtr);}deserializeInplace()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=e._vscf_error_ctx_size(),a=e._malloc(r);let
i;e._vscf_error_reset(a);try{i=e._vscf_alg_info_der_deserializer_deserialize_inplac
e(this.ctxPtr,a);const r=e._vscf_error_status(a);return
t.FoundationError.handleStatusCode(r),t.FoundationInterface.newAndTakeCContext(i)}f
inally{e._free(a);}}}return r},Pe=(e,t)=>{class r{static get PREFIX_LEN(){return
32}get PREFIX_LEN(){return r.PREFIX_LEN}constructor(t)
{this.name="MessageInfoDerSerializer",this.ctxPtr=void 0===t?
e._vscf_message_info_der_serializer_new():t;}static newAndUseCContext(t){return new
r(e._vscf_message_info_der_serializer_shallow_copy(t))}static newAndTakeCContext(e)
{return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_message_info_der_serializer_delete(this.ctxPtr),this.ctxPtr
=null);}set asn1Reader(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("asn1Reader"
,r,"Foundation.Asn1Reader",t.FoundationInterfaceTag.ASN1_READER,t.FoundationInterfa
ce),e._vscf_message_info_der_serializer_release_asn1_reader(this.ctxPtr),e._vscf_me
ssage_info_der_serializer_use_asn1_reader(this.ctxPtr,r.ctxPtr);}set asn1Writer(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("asn1Writer"
,r,"Foundation.Asn1Writer",t.FoundationInterfaceTag.ASN1_WRITER,t.FoundationInterfa
ce),e._vscf_message_info_der_serializer_release_asn1_writer(this.ctxPtr),e._vscf_me
ssage_info_der_serializer_use_asn1_writer(this.ctxPtr,r.ctxPtr);}serializedLen(r)
{let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("messageInfo",r,t.MessageI
nfo),a=e._vscf_message_info_der_serializer_serialized_len(this.ctxPtr,r.ctxPtr),a}s
erialize(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("messageInfo",r,t.Message
Info);const
a=this.serializedLen(r),i=e._vsc_buffer_new_with_capacity(a);try{e._vscf_message_in
fo_der_serializer_serialize(this.ctxPtr,r.ctxPtr,i);const
t=e._vsc_buffer_bytes(i),a=e._vsc_buffer_len(i);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(i);}}readPrefix(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_message_info_der_serializer_read_prefix(this.ctxPtr,n),o}finally{e._free(
a),e._free(n);}}deserialize(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);let
f;e._vscf_error_reset(c);try{f=e._vscf_message_info_der_serializer_deserialize(this
.ctxPtr,o,c);const r=e._vscf_error_status(c);return
t.FoundationError.handleStatusCode(r),t.MessageInfo.newAndTakeCContext(f)}finally{e
._free(i),e._free(o),e._free(c);}}serializedFooterLen(r){let a;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("messageInfoFooter",r,t.Me
ssageInfoFooter),a=e._vscf_message_info_der_serializer_serialized_footer_len(this.c
txPtr,r.ctxPtr),a}serializeFooter(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("messageInfoFooter",r,t.M
essageInfoFooter);const
a=this.serializedFooterLen(r),i=e._vsc_buffer_new_with_capacity(a);try{e._vscf_mess
age_info_der_serializer_serialize_footer(this.ctxPtr,r.ctxPtr,i);const
t=e._vsc_buffer_bytes(i),a=e._vsc_buffer_len(i);return
e.HEAPU8.slice(t,t+a)}finally{e._vsc_buffer_delete(i);}}deserializeFooter(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=e._vscf_error_ctx_size(),c=e._malloc(s);let
f;e._vscf_error_reset(c);try{f=e._vscf_message_info_der_serializer_deserialize_foot
er(this.ctxPtr,o,c);const r=e._vscf_error_status(c);return
t.FoundationError.handleStatusCode(r),t.MessageInfoFooter.newAndTakeCContext(f)}fin
ally{e._free(i),e._free(o),e._free(c);}}setupDefaults()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_message_info_der_serializer_set
up_defaults(this.ctxPtr);}}return r},Xe=(e,t)=>{class r{constructor(t)
{this.name="RandomPadding",this.ctxPtr=void 0===t?
e._vscf_random_padding_new():t;}static newAndUseCContext(t){return new
r(e._vscf_random_padding_shallow_copy(t))}static
newAndTakeCContext(e){return new r(e)}delete(){void 0!==this.ctxPtr&&null!
==this.ctxPtr&&(e._vscf_random_padding_delete(this.ctxPtr),this.ctxPtr=null);}set
random(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("random",r,"
Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),e._vscf_r
andom_padding_release_random(this.ctxPtr),e._vscf_random_padding_use_random(this.ct
xPtr,r.ctxPtr);}algId(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_random_padding_alg_id(this.ctx
Ptr),t}produceAlgInfo(){let r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),r=e._vscf_random_padding_produce_alg_inf
o(this.ctxPtr),t.FoundationInterface.newAndTakeCContext(r)}restoreAlgInfo(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureImplementInterface("algInfo",r,
"Foundation.AlgInfo",t.FoundationInterfaceTag.ALG_INFO,t.FoundationInterface);const
a=e._vscf_random_padding_restore_alg_info(this.ctxPtr,r.ctxPtr);t.FoundationError.h
andleStatusCode(a);}configure(r)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureClass("params",r,t.PaddingParam
s),e._vscf_random_padding_configure(this.ctxPtr,r.ctxPtr);}paddedDataLen(t){let
r;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureNumber("dataLen",t),r=e._vscf_ra
ndom_padding_padded_data_len(this.ctxPtr,t),r}len(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_random_padding_len(this.ctxPtr
),t}lenMax(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_random_padding_len_max(this.ct
xPtr),t}startDataProcessing()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_random_padding_start_data_proce
ssing(this.ctxPtr);}processData(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);try{e._vscf_random_padding_process_data(s,t
his.ctxPtr,n);const t=e._vsc_data_len(s),r=e._vsc_data_bytes(s);return
e.HEAPU8.slice(r,r+t)}finally{e._free(a),e._free(n),e._free(s);}}finishDataProcessi
ng(){_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=this.len(),a=e._vsc_buffer_new_with_capacity(r);try{const
r=e._vscf_random_padding_finish_data_processing(this.ctxPtr,a);t.FoundationError.ha
ndleStatusCode(r);const i=e._vsc_buffer_bytes(a),n=e._vsc_buffer_len(a);return
e.HEAPU8.slice(i,i+n)}finally{e._vsc_buffer_delete(a);}}startPaddedDataProcessing()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),e._vscf_random_padding_start_padded_dat
a_processing(this.ctxPtr);}processPaddedData(t)
{_.ensureNotNull("this.ctxPtr",this.ctxPtr),_.ensureByteArray("data",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);const
o=r,s=e._vsc_buffer_new_with_capacity(o);try{e._vscf_random_padding_process_padded_
data(this.ctxPtr,n,s);const t=e._vsc_buffer_bytes(s),r=e._vsc_buffer_len(s);return
e.HEAPU8.slice(t,t+r)}finally{e._free(a),e._free(n),e._vsc_buffer_delete(s);}}finis
hPaddedDataProcessingOutLen(){let t;return
_.ensureNotNull("this.ctxPtr",this.ctxPtr),t=e._vscf_random_padding_finish_padded_d
ata_processing_out_len(this.ctxPtr),t}finishPaddedDataProcessing()
{_.ensureNotNull("this.ctxPtr",this.ctxPtr);const
r=this.finishPaddedDataProcessingOutLen(),a=e._vsc_buffer_new_with_capacity(r);try{
const
r=e._vscf_random_padding_finish_padded_data_processing(this.ctxPtr,a);t.FoundationE
rror.handleStatusCode(r);const
i=e._vsc_buffer_bytes(a),n=e._vsc_buffer_len(a);return
e.HEAPU8.slice(i,i+n)}finally{e._vsc_buffer_delete(a);}}}return r};var
Ze,Re=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var
t=Object.prototype.hasOwnProperty,r="~";function a(){}function i(e,t,r)
{this.fn=e,this.context=t,this.once=r||!1;}function n(e,t,a,n,o){if("function"!
=typeof a)throw new TypeError("The listener must be a function");var _=new i(a,n||
e,o),s=r?r+t:t;return e._events[s]?e._events[s].fn?
e._events[s]=[e._events[s],_]:e._events[s].push(_):(e._events[s]=_,e._eventsCount+
+),e}function o(e,t){0==--e._eventsCount?e._events=new a:delete
e._events[t];}function _(){this._events=new
a,this._eventsCount=0;}Object.create&&(a.prototype=Object.create(null),(new
a).__proto__||(r=!1)),_.prototype.eventNames=function(){var
e,a,i=[];if(0===this._eventsCount)return i;for(a in
e=this._events)t.call(e,a)&&i.push(r?a.slice(1):a);return
Object.getOwnPropertySymbols?
i.concat(Object.getOwnPropertySymbols(e)):i},_.prototype.listeners=function(e){var
t=r?r+e:e,a=this._events[t];if(!a)return [];if(a.fn)return [a.fn];for(var
i=0,n=a.length,o=new Array(n);i<n;i++)o[i]=a[i].fn;return
o},_.prototype.listenerCount=function(e){var t=r?r+e:e,a=this._events[t];return a?
a.fn?1:a.length:0},_.prototype.emit=function(e,t,a,i,n,o){var _=r?r+e:e;if(!
this._events[_])return !1;var s,c,f=this._events[_],l=arguments.length;if(f.fn)
{switch(f.once&&this.removeListener(e,f.fn,void 0,!0),l){case 1:return
f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return
f.fn.call(f.context,t,a),!0;case 4:return f.fn.call(f.context,t,a,i),!0;case
5:return f.fn.call(f.context,t,a,i,n),!0;case 6:return
f.fn.call(f.context,t,a,i,n,o),!0}for(c=1,s=new Array(l-1);c<l;c++)s[c-
1]=arguments[c];f.fn.apply(f.context,s);}else {var u,A=f.length;for(c=0;c<A;c+
+)switch(f[c].once&&this.removeListener(e,f[c].fn,void 0,!0),l){case
1:f[c].fn.call(f[c].context);break;case 2:f[c].fn.call(f[c].context,t);break;case
3:f[c].fn.call(f[c].context,t,a);break;case
4:f[c].fn.call(f[c].context,t,a,i);break;default:if(!s)for(u=1,s=new Array(l-
1);u<l;u++)s[u-1]=arguments[u];f[c].fn.apply(f[c].context,s);}}return !
0},_.prototype.on=function(e,t,r){return n(this,e,t,r,!
1)},_.prototype.once=function(e,t,r){return n(this,e,t,r,!
0)},_.prototype.removeListener=function(e,t,a,i){var n=r?r+e:e;if(!
this._events[n])return this;if(!t)return o(this,n),this;var
_=this._events[n];if(_.fn)_.fn!==t||i&&!_.once||a&&_.context!==a||o(this,n);else
{for(var s=0,c=[],f=_.length;s<f;s++)(_[s].fn!==t||i&&!_[s].once||a&&_[s].context!
==a)&&c.push(_[s]);c.length?this._events[n]=1===c.length?c[0]:c:o(this,n);}return
this},_.prototype.removeAllListeners=function(e){var t;return e?(t=r?
r+e:e,this._events[t]&&o(this,t)):(this._events=new
a,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype
.addListener=_.prototype.on,_.prefixed=r,_.EventEmitter=_,e.exports=_;}));class Me
extends Error{constructor(){super("Module already
exists."),Object.setPrototypeOf(this,Me.prototype),this.name="ModuleAlreadyExistsEr
ror";}}class Ve extends Error{constructor(){super("Module not
found."),Object.setPrototypeOf(this,Ve.prototype),this.name="ModuleNotFoundError";}
}!function(e){e.load="load",e.remove="remove",e.error="error";}(Ze||(Ze={}));let
Be,Ue;const Ce=()=>{if(!Be||!Ue)throw new Error("Cannot use global instances if the
'resetGlobalInstances' function has been called or 'createGlobalInstances' function
has not been called yet.")},Oe=()=>(Ce(),Be),Fe=()=>(Ce(),Ue),Ye=()=>{(Be||
Ue)&&(Ce(),Be.delete(),Ue.delete(),Be=void 0,Ue=void 0);},Ge=new class extends
Re{constructor(){super(...arguments),this.initFns=new Map,this.initPromises=new
Map,this.modules=new Map,this.addModule=(e,t)=>{if(this.initFns.has(e)){const r=new
Me;throw this.emit(Ze.error,r,e,t),r}this.loadModulesPromise=void
0,this.initFns.set(e,t);},this.getModule=e=>{if(!this.modules.has(e)){const t=new
Ve;throw this.emit(Ze.error,t,e),t}return
this.modules.get(e)},this.hasModule=e=>this.modules.has(e),this.setModule=(e,t)=>{t
his.modules.set(e,t),this.emit(Ze.load,e,t);},this.removeModule=e=>{if(this.initFns
.delete(e),this.initPromises.delete(e),this.modules.has(e)){const
t=this.modules.get(e);this.modules.delete(e),this.emit(Ze.remove,e,t);}},this.loadM
odule=(e,...t)=>{if(!this.initFns.has(e)){const r=new Ve;throw
this.emit(Ze.error,r,e,...t),r}if(this.initPromises.has(e))return
this.initPromises.get(e);const r=this.initFns.get(e)
(...t).then(r=>(this.modules.set(e,r),this.emit(Ze.load,e,r,...t),Promise.resolve()
));return
this.initPromises.set(e,r),r},this.loadModules=e=>{if(this.loadModulesPromise)retur
n this.loadModulesPromise;const t=e||
{},r=Array.from(this.initFns.keys()).map(e=>t[e]?
this.loadModule(e,...t[e]):this.loadModule(e));return
this.loadModulesPromise=Promise.all(r).then(()=>Promise.resolve()),this.loadModules
Promise};}};Ge.addModule("foundation",e=>{const t=new a$1(e);return new
Promise((e,r)=>{t.onRuntimeInitialized=()=>{const
r={};r.FoundationInterfaceTag=Object.freeze({ALG:1,ALG_INFO:2,ALG_INFO_DESERIALIZER
:3,ALG_INFO_SERIALIZER:4,ASN1_READER:5,ASN1_WRITER:6,AUTH_DECRYPT:7,AUTH_ENCRYPT:8,
CIPHER:9,CIPHER_AUTH:10,CIPHER_AUTH_INFO:11,CIPHER_INFO:12,COMPUTE_SHARED_KEY:13,DE
CRYPT:14,ENCRYPT:15,ENTROPY_SOURCE:16,HASH:17,KDF:18,KEM:19,KEY:20,KEY_ALG:21,KEY_C
IPHER:22,KEY_DESERIALIZER:23,KEY_SERIALIZER:24,KEY_SIGNER:25,MAC:26,MESSAGE_INFO_FO
OTER_SERIALIZER:27,MESSAGE_INFO_SERIALIZER:28,PADDING:29,PRIVATE_KEY:30,PUBLIC_KEY:
31,RANDOM:32,SALTED_KDF:33}),r.FoundationInterface=((e,t)=>class{static
newAndTakeCContext(r){const a=e._vscf_impl_tag(r);switch(a){case
t.FoundationImplTag.SHA224:return t.Sha224.newAndTakeCContext(r);case
t.FoundationImplTag.SHA256:return t.Sha256.newAndTakeCContext(r);case
t.FoundationImplTag.SHA384:return t.Sha384.newAndTakeCContext(r);case
t.FoundationImplTag.SHA512:return t.Sha512.newAndTakeCContext(r);case
t.FoundationImplTag.AES256_GCM:return t.Aes256Gcm.newAndTakeCContext(r);case
t.FoundationImplTag.AES256_CBC:return t.Aes256Cbc.newAndTakeCContext(r);case
t.FoundationImplTag.ASN1RD:return t.Asn1rd.newAndTakeCContext(r);case
t.FoundationImplTag.ASN1WR:return t.Asn1wr.newAndTakeCContext(r);case
t.FoundationImplTag.RSA_PUBLIC_KEY:return t.RsaPublicKey.newAndTakeCContext(r);case
t.FoundationImplTag.RSA_PRIVATE_KEY:return
t.RsaPrivateKey.newAndTakeCContext(r);case t.FoundationImplTag.RSA:return
t.Rsa.newAndTakeCContext(r);case t.FoundationImplTag.ECC_PUBLIC_KEY:return
t.EccPublicKey.newAndTakeCContext(r);case
t.FoundationImplTag.ECC_PRIVATE_KEY:return
t.EccPrivateKey.newAndTakeCContext(r);case t.FoundationImplTag.ECC:return
t.Ecc.newAndTakeCContext(r);case t.FoundationImplTag.ENTROPY_ACCUMULATOR:return
t.EntropyAccumulator.newAndTakeCContext(r);case t.FoundationImplTag.CTR_DRBG:return
t.CtrDrbg.newAndTakeCContext(r);case t.FoundationImplTag.HMAC:return
t.Hmac.newAndTakeCContext(r);case t.FoundationImplTag.HKDF:return
t.Hkdf.newAndTakeCContext(r);case t.FoundationImplTag.KDF1:return
t.Kdf1.newAndTakeCContext(r);case t.FoundationImplTag.KDF2:return
t.Kdf2.newAndTakeCContext(r);case t.FoundationImplTag.FAKE_RANDOM:return
t.FakeRandom.newAndTakeCContext(r);case t.FoundationImplTag.PKCS5_PBKDF2:return
t.Pkcs5Pbkdf2.newAndTakeCContext(r);case t.FoundationImplTag.PKCS5_PBES2:return
t.Pkcs5Pbes2.newAndTakeCContext(r);case
t.FoundationImplTag.SEED_ENTROPY_SOURCE:return
t.SeedEntropySource.newAndTakeCContext(r);case
t.FoundationImplTag.KEY_MATERIAL_RNG:return
t.KeyMaterialRng.newAndTakeCContext(r);case
t.FoundationImplTag.RAW_PUBLIC_KEY:return t.RawPublicKey.newAndTakeCContext(r);case
t.FoundationImplTag.RAW_PRIVATE_KEY:return
t.RawPrivateKey.newAndTakeCContext(r);case
t.FoundationImplTag.PKCS8_SERIALIZER:return
t.Pkcs8Serializer.newAndTakeCContext(r);case
t.FoundationImplTag.SEC1_SERIALIZER:return
t.Sec1Serializer.newAndTakeCContext(r);case
t.FoundationImplTag.KEY_ASN1_SERIALIZER:return
t.KeyAsn1Serializer.newAndTakeCContext(r);case
t.FoundationImplTag.KEY_ASN1_DESERIALIZER:return
t.KeyAsn1Deserializer.newAndTakeCContext(r);case t.FoundationImplTag.ED25519:return
t.Ed25519.newAndTakeCContext(r);case t.FoundationImplTag.CURVE25519:return
t.Curve25519.newAndTakeCContext(r);case t.FoundationImplTag.FALCON:return
t.Falcon.newAndTakeCContext(r);case t.FoundationImplTag.ROUND5:return
t.Round5.newAndTakeCContext(r);case
t.FoundationImplTag.COMPOUND_KEY_ALG_INFO:return
t.CompoundKeyAlgInfo.newAndTakeCContext(r);case
t.FoundationImplTag.COMPOUND_PUBLIC_KEY:return
t.CompoundPublicKey.newAndTakeCContext(r);case
t.FoundationImplTag.COMPOUND_PRIVATE_KEY:return
t.CompoundPrivateKey.newAndTakeCContext(r);case
t.FoundationImplTag.COMPOUND_KEY_ALG:return
t.CompoundKeyAlg.newAndTakeCContext(r);case
t.FoundationImplTag.HYBRID_KEY_ALG_INFO:return
t.HybridKeyAlgInfo.newAndTakeCContext(r);case
t.FoundationImplTag.HYBRID_PUBLIC_KEY:return
t.HybridPublicKey.newAndTakeCContext(r);case
t.FoundationImplTag.HYBRID_PRIVATE_KEY:return
t.HybridPrivateKey.newAndTakeCContext(r);case
t.FoundationImplTag.HYBRID_KEY_ALG:return t.HybridKeyAlg.newAndTakeCContext(r);case
t.FoundationImplTag.SIMPLE_ALG_INFO:return
t.SimpleAlgInfo.newAndTakeCContext(r);case
t.FoundationImplTag.HASH_BASED_ALG_INFO:return
t.HashBasedAlgInfo.newAndTakeCContext(r);case
t.FoundationImplTag.CIPHER_ALG_INFO:return
t.CipherAlgInfo.newAndTakeCContext(r);case
t.FoundationImplTag.SALTED_KDF_ALG_INFO:return
t.SaltedKdfAlgInfo.newAndTakeCContext(r);case
t.FoundationImplTag.PBE_ALG_INFO:return t.PbeAlgInfo.newAndTakeCContext(r);case
t.FoundationImplTag.ECC_ALG_INFO:return t.EccAlgInfo.newAndTakeCContext(r);case
t.FoundationImplTag.ALG_INFO_DER_SERIALIZER:return
t.AlgInfoDerSerializer.newAndTakeCContext(r);case
t.FoundationImplTag.ALG_INFO_DER_DESERIALIZER:return
t.AlgInfoDerDeserializer.newAndTakeCContext(r);case
t.FoundationImplTag.MESSAGE_INFO_DER_SERIALIZER:return
t.MessageInfoDerSerializer.newAndTakeCContext(r);case
t.FoundationImplTag.RANDOM_PADDING:return
t.RandomPadding.newAndTakeCContext(r);default:throw new Error("Unexpected
implementation tag found: "+a)}}static newAndUseCContext(r){return new
t.FoundationInterface.newAndTakeCContext(e._vscf_impl_shallow_copy(r))}static
isImplemented(t,r){return 0!=e._vscf_impl_api(t,r)}})
(t,r),r.FoundationImplTag=Object.freeze({AES256_CBC:1,AES256_GCM:2,ALG_INFO_DER_DES
ERIALIZER:3,ALG_INFO_DER_SERIALIZER:4,ASN1RD:5,ASN1WR:6,CIPHER_ALG_INFO:7,COMPOUND_
KEY_ALG:8,COMPOUND_KEY_ALG_INFO:9,COMPOUND_PRIVATE_KEY:10,COMPOUND_PUBLIC_KEY:11,CT
R_DRBG:12,CURVE25519:13,ECC:14,ECC_ALG_INFO:15,ECC_PRIVATE_KEY:16,ECC_PUBLIC_KEY:17
,ED25519:18,ENTROPY_ACCUMULATOR:19,FAKE_RANDOM:20,FALCON:21,HASH_BASED_ALG_INFO:22,
HKDF:23,HMAC:24,HYBRID_KEY_ALG:25,HYBRID_KEY_ALG_INFO:26,HYBRID_PRIVATE_KEY:27,HYBR
ID_PUBLIC_KEY:28,KDF1:29,KDF2:30,KEY_ASN1_DESERIALIZER:31,KEY_ASN1_SERIALIZER:32,KE
Y_MATERIAL_RNG:33,MESSAGE_INFO_DER_SERIALIZER:34,PBE_ALG_INFO:35,PKCS5_PBES2:36,PKC
S5_PBKDF2:37,PKCS8_SERIALIZER:38,RANDOM_PADDING:39,RAW_PRIVATE_KEY:40,RAW_PUBLIC_KE
Y:41,ROUND5:42,RSA:43,RSA_PRIVATE_KEY:44,RSA_PUBLIC_KEY:45,SALTED_KDF_ALG_INFO:46,S
EC1_SERIALIZER:47,SEED_ENTROPY_SOURCE:48,SHA224:49,SHA256:50,SHA384:51,SHA512:52,SI
MPLE_ALG_INFO:53}),r.FoundationError=i$1(),r.Asn1Tag=Object.freeze({BOOLEAN:0,INTEG
ER:1,BIT_STRING:2,OCTET_STRING:3,NULL:4,OID:5,UTF8_STRING:6,SEQUENCE:7,SET:8,PRINTA
BLE_STRING:9,T61_STRING:10,IA5_STRING:11,UTC_TIME:12,GENERALIZED_TIME:13,UNIVERSAL_
STRING:14,BMP_STRING:15,PRIMITIVE:16,CONSTRUCTED:17,CONTEXT_SPECIFIC:18}),r.AlgId=O
bject.freeze({NONE:0,SHA224:1,SHA256:2,SHA384:3,SHA512:4,KDF1:5,KDF2:6,RSA:7,ED2551
9:8,CURVE25519:9,SECP256R1:10,AES256_GCM:11,AES256_CBC:12,HMAC:13,HKDF:14,PKCS5_PBK
DF2:15,PKCS5_PBES2:16,COMPOUND_KEY:17,HYBRID_KEY:18,FALCON:19,ROUND5_ND_1CCA_5D:20,
RANDOM_PADDING:21}),r.OidId=Object.freeze({NONE:0,RSA:1,ED25519:2,CURVE25519:3,SHA2
24:4,SHA256:5,SHA384:6,SHA512:7,KDF1:8,KDF2:9,AES256_GCM:10,AES256_CBC:11,PKCS5_PBK
DF2:12,PKCS5_PBES2:13,CMS_DATA:14,CMS_ENVELOPED_DATA:15,HKDF_WITH_SHA256:16,HKDF_WI
TH_SHA384:17,HKDF_WITH_SHA512:18,HMAC_WITH_SHA224:19,HMAC_WITH_SHA256:20,HMAC_WITH_
SHA384:21,HMAC_WITH_SHA512:22,EC_GENERIC_KEY:23,EC_DOMAIN_SECP256R1:24,COMPOUND_KEY
:25,HYBRID_KEY:26,FALCON:27,ROUND5_ND_1CCA_5D:28,RANDOM_PADDING:29}),r.GroupMsgType
=Object.freeze({GROUP_INFO:0,REGULAR:1}),r.CipherState=Object.freeze({INITIAL:0,ENC
RYPTION:1,DECRYPTION:2}),r.Oid=((e,t)=>class{static fromAlgId(t)
{_.ensureNumber("algId",t);const
r=e._vsc_data_ctx_size(),a=e._malloc(r);try{e._vscf_oid_from_alg_id(a,t);const
r=e._vsc_data_len(a),i=e._vsc_data_bytes(a);return
e.HEAPU8.slice(i,i+r)}finally{e._free(a);}}static toAlgId(t)
{_.ensureByteArray("oid",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_oid_to_alg_id(n),o}finally{e._free(a),e._free(n);}}static fromId(t)
{_.ensureNumber("oidId",t);const
r=e._vsc_data_ctx_size(),a=e._malloc(r);try{e._vscf_oid_from_id(a,t);const
r=e._vsc_data_len(a),i=e._vsc_data_bytes(a);return
e.HEAPU8.slice(i,i+r)}finally{e._free(a);}}static toId(t)
{_.ensureByteArray("oid",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);let o;e._vsc_data(n,a,r);try{return
o=e._vscf_oid_to_id(n),o}finally{e._free(a),e._free(n);}}static idToAlgId(t){let
r;return _.ensureNumber("oidId",t),r=e._vscf_oid_id_to_alg_id(t),r}static
equal(t,r){_.ensureByteArray("lhs",t),_.ensureByteArray("rhs",r);const
a=t.length*t.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(t,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=r.length*r.BYTES_PER_ELEMENT,c=e._malloc(s);e.HEAP8.set(r,c);const
f=e._vsc_data_ctx_size(),l=e._malloc(f);let u;e._vsc_data(l,c,s);try{return
u=e._vscf_oid_equal(o,l),!!
u}finally{e._free(i),e._free(o),e._free(c),e._free(l);}}})
(t),r.Base64=((e,t)=>class{static encodedLen(t){let r;return
_.ensureNumber("dataLen",t),r=e._vscf_base64_encoded_len(t),r}static encode(r)
{_.ensureByteArray("data",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=t.Base64.encodedLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{e._vscf_ba
se64_encode(o,c);const t=e._vsc_buffer_bytes(c),r=e._vsc_buffer_len(c);return
e.HEAPU8.slice(t,t+r)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}stati
c decodedLen(t){let r;return
_.ensureNumber("strLen",t),r=e._vscf_base64_decoded_len(t),r}static decode(r)
{_.ensureByteArray("str",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=t.Base64.decodedLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_base64_decode(o,c);t.FoundationError.handleStatusCode(r);const
a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}})
(t,r),r.Pem=((e,t)=>class{static wrappedLen(t,r){let a;return
_.ensureNumber("title",t),_.ensureNumber("dataLen",r),a=e._vscf_pem_wrapped_len(t,r
),a}static wrap(r,a){_.ensureNumber("title",r),_.ensureByteArray("data",a);const
i=a.length*a.BYTES_PER_ELEMENT,n=e._malloc(i);e.HEAP8.set(a,n);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);e._vsc_data(s,n,i);const
c=t.Pem.wrappedLen(r,a.length),f=e._vsc_buffer_new_with_capacity(c);try{e._vscf_pem
_wrap(r,s,f);const t=e._vsc_buffer_bytes(f),a=e._vsc_buffer_len(f);return
e.HEAPU8.slice(t,t+a)}finally{e._free(n),e._free(s),e._vsc_buffer_delete(f);}}stati
c unwrappedLen(t){let r;return
_.ensureNumber("pemLen",t),r=e._vscf_pem_unwrapped_len(t),r}static unwrap(r)
{_.ensureByteArray("pem",r);const
a=r.length*r.BYTES_PER_ELEMENT,i=e._malloc(a);e.HEAP8.set(r,i);const
n=e._vsc_data_ctx_size(),o=e._malloc(n);e._vsc_data(o,i,a);const
s=t.Pem.unwrappedLen(r.length),c=e._vsc_buffer_new_with_capacity(s);try{const
r=e._vscf_pem_unwrap(o,c);t.FoundationError.handleStatusCode(r);const
a=e._vsc_buffer_bytes(c),n=e._vsc_buffer_len(c);return
e.HEAPU8.slice(a,a+n)}finally{e._free(i),e._free(o),e._vsc_buffer_delete(c);}}stati
c title(t){_.ensureByteArray("pem",t);const
r=t.length*t.BYTES_PER_ELEMENT,a=e._malloc(r);e.HEAP8.set(t,a);const
i=e._vsc_data_ctx_size(),n=e._malloc(i);e._vsc_data(n,a,r);const
o=e._vsc_data_ctx_size(),s=e._malloc(o);try{e._vscf_pem_title(s,n);const
t=e._vsc_data_len(s),r=e._vsc_data_bytes(s);return
e.HEAPU8.slice(r,r+t)}finally{e._free(a),e._free(n),e._free(s);}}})
(t,r),r.MessageInfo=s$1(t,r),r.KeyRecipientInfo=c$1(t,r),r.KeyRecipientInfoList=f$1
(t,r),r.PasswordRecipientInfo=l$1(t,r),r.PasswordRecipientInfoList=u$1(t,r),r.AlgFa
ctory=((e,t)=>class{static createHashFromInfo(r){let a;return
_.ensureImplementInterface("algInfo",r,"Foundation.AlgInfo",t.FoundationInterfaceTa
g.ALG_INFO,t.FoundationInterface),a=e._vscf_alg_factory_create_hash_from_info(r.ctx
Ptr),t.FoundationInterface.newAndTakeCContext(a)}static createMacFromInfo(r){let
a;return
_.ensureImplementInterface("algInfo",r,"Foundation.AlgInfo",t.FoundationInterfaceTa
g.ALG_INFO,t.FoundationInterface),a=e._vscf_alg_factory_create_mac_from_info(r.ctxP
tr),t.FoundationInterface.newAndTakeCContext(a)}static createKdfFromInfo(r){let
a;return
_.ensureImplementInterface("algInfo",r,"Foundation.AlgInfo",t.FoundationInterfaceTa
g.ALG_INFO,t.FoundationInterface),a=e._vscf_alg_factory_create_kdf_from_info(r.ctxP
tr),t.FoundationInterface.newAndTakeCContext(a)}static createSaltedKdfFromInfo(r)
{let a;return
_.ensureImplementInterface("algInfo",r,"Foundation.AlgInfo",t.FoundationInterfaceTa
g.ALG_INFO,t.FoundationInterface),a=e._vscf_alg_factory_create_salted_kdf_from_info
(r.ctxPtr),t.FoundationInterface.newAndTakeCContext(a)}static
createCipherFromInfo(r){let a;return
_.ensureImplementInterface("algInfo",r,"Foundation.AlgInfo",t.FoundationInterfaceTa
g.ALG_INFO,t.FoundationInterface),a=e._vscf_alg_factory_create_cipher_from_info(r.c
txPtr),t.FoundationInterface.newAndTakeCContext(a)}static
createPaddingFromInfo(r,a){let i;return
_.ensureImplementInterface("algInfo",r,"Foundation.AlgInfo",t.FoundationInterfaceTa
g.ALG_INFO,t.FoundationInterface),_.ensureImplementInterface("random",a,"Foundation
.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface),i=e._vscf_alg_facto
ry_create_padding_from_info(r.ctxPtr,a.ctxPtr),t.FoundationInterface.newAndTakeCCon
text(i)}})(t,r),r.KeyAlgFactory=((e,t)=>class{static createFromAlgId(r,a)
{_.ensureNumber("algId",r),_.ensureImplementInterface("random",a,"Foundation.Random
",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface);const
i=e._vscf_error_ctx_size(),n=e._malloc(i);let
o;e._vscf_error_reset(n);try{o=e._vscf_key_alg_factory_create_from_alg_id(r,a.ctxPt
r,n);const i=e._vscf_error_status(n);return
t.FoundationError.handleStatusCode(i),t.FoundationInterface.newAndTakeCContext(o)}f
inally{e._free(n);}}static createFromKey(r,a)
{_.ensureImplementInterface("key",r,"Foundation.Key",t.FoundationInterfaceTag.KEY,t
.FoundationInterface),_.ensureImplementInterface("random",a,"Foundation.Random",t.F
oundationInterfaceTag.RANDOM,t.FoundationInterface);const
i=e._vscf_error_ctx_size(),n=e._malloc(i);let
o;e._vscf_error_reset(n);try{o=e._vscf_key_alg_factory_create_from_key(r.ctxPtr,a.c
txPtr,n);const i=e._vscf_error_status(n);return
t.FoundationError.handleStatusCode(i),t.FoundationInterface.newAndTakeCContext(o)}f
inally{e._free(n);}}static createFromRawPublicKey(r,a)
{_.ensureClass("publicKey",r,t.RawPublicKey),_.ensureImplementInterface("random",a,
"Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface);const
i=e._vscf_error_ctx_size(),n=e._malloc(i);let
o;e._vscf_error_reset(n);try{o=e._vscf_key_alg_factory_create_from_raw_public_key(r
.ctxPtr,a.ctxPtr,n);const i=e._vscf_error_status(n);return
t.FoundationError.handleStatusCode(i),t.FoundationInterface.newAndTakeCContext(o)}f
inally{e._free(n);}}static createFromRawPrivateKey(r,a)
{_.ensureClass("privateKey",r,t.RawPrivateKey),_.ensureImplementInterface("random",
a,"Foundation.Random",t.FoundationInterfaceTag.RANDOM,t.FoundationInterface);const
i=e._vscf_error_ctx_size(),n=e._malloc(i);let
o;e._vscf_error_reset(n);try{o=e._vscf_key_alg_factory_create_from_raw_private_key(
r.ctxPtr,a.ctxPtr,n);const i=e._vscf_error_status(n);return
t.FoundationError.handleStatusCode(i),t.FoundationInterface.newAndTakeCContext(o)}f
inally{e._free(n);}}})
(t,r),r.Ecies=A(t,r),r.RecipientCipher=d(t,r),r.MessageInfoCustomParams=m$1(t,r),r.
KeyProvider=p$1(t,r),r.Signer=v$2(t,r),r.Verifier=y$1(t,r),r.BrainkeyClient=h(t,r),
r.BrainkeyServer=b(t,r),r.GroupSessionMessage=w(t,r),r.GroupSessionTicket=k$1(t,r),
r.GroupSession=x$1(t,r),r.MessageInfoEditor=g$1(t,r),r.SignerInfo=E(t,r),r.SignerIn
foList=N(t,r),r.MessageInfoFooter=I(t,r),r.SignedDataInfo=T(t,r),r.FooterInfo=P(t,r
),r.KeyInfo=X(t,r),r.PaddingParams=Z(t),r.Sha224=R(t,r),r.Sha256=M(t,r),r.Sha384=V(
t,r),r.Sha512=B(t,r),r.Aes256Gcm=U(t,r),r.Aes256Cbc=C(t,r),r.Asn1rd=O(t,r),r.Asn1wr
=F(t,r),r.RsaPublicKey=Y(t,r),r.RsaPrivateKey=G(t,r),r.Rsa=W(t,r),r.EccPublicKey=z(
t,r),r.EccPrivateKey=S(t,r),r.Ecc=L(t,r),r.EntropyAccumulator=H(t,r),r.CtrDrbg=D(t,
r),r.Hmac=K$1(t,r),r.Hkdf=Q(t,r),r.Kdf1=j(t,r),r.Kdf2=J(t,r),r.FakeRandom=q(t,r),r.
Pkcs5Pbkdf2=$
(t,r),r.Pkcs5Pbes2=ee(t,r),r.SeedEntropySource=te(t,r),r.KeyMaterialRng=re(t,r),r.R
awPublicKey=ae(t,r),r.RawPrivateKey=ie(t,r),r.Pkcs8Serializer=ne(t,r),r.Sec1Seriali
zer=oe(t,r),r.KeyAsn1Serializer=_e(t,r),r.KeyAsn1Deserializer=se(t,r),r.Ed25519=ce(
t,r),r.Curve25519=fe(t,r),r.Falcon=le(t,r),r.Round5=ue(t,r),r.CompoundKeyAlgInfo=Ae
(t,r),r.CompoundPublicKey=de(t,r),r.CompoundPrivateKey=me(t,r),r.CompoundKeyAlg=pe(
t,r),r.HybridKeyAlgInfo=ve(t,r),r.HybridPublicKey=ye(t,r),r.HybridPrivateKey=he(t,r
),r.HybridKeyAlg=be(t,r),r.SimpleAlgInfo=we(t),r.HashBasedAlgInfo=ke(t,r),r.CipherA
lgInfo=xe(t),r.SaltedKdfAlgInfo=ge(t,r),r.PbeAlgInfo=Ee(t,r),r.EccAlgInfo=Ne(t),r.A
lgInfoDerSerializer=Ie(t,r),r.AlgInfoDerDeserializer=Te(t,r),r.MessageInfoDerSerial
izer=Pe(t,r),r.RandomPadding=Xe(t,r),e(r);},t.onAbort=e=>{r(new
Error(e));};})}),Ge.on("load",(e,t)=>{"foundation"===e&&(Ye(),(e=>{Be=new
e.CtrDrbg;try{Be.setupDefaults();}catch(e){throw Be.delete(),e}Ue=new
e.KeyProvider,Ue.random=Be;try{Ue.setupDefaults();}catch(e){throw
Be.delete(),Ue.delete(),e}})
(t));}),Ge.on("remove",e=>{"foundation"===e&&Ye();});const
ze=()=>Ge.getModule("foundation"),Le=Ge.loadModules;var He;!function(e)
{e.SHA224="SHA224",e.SHA256="SHA256",e.SHA384="SHA384",e.SHA512="SHA512";}(He||
(He={})),function(e)
{e.DEFAULT="DEFAULT",e.ED25519="ED25519",e.CURVE25519="CURVE25519",e.SECP256R1="SEC
P256R1",e.RSA_2048="RSA_2048",e.RSA_3072="RSA_3072",e.RSA_4096="RSA_4096",e.RSA_819
2="RSA_8192",e.CURVE25519_ROUND5_ED25519_FALCON="CURVE25519_ROUND5_ED25519_FALCON",
e.CURVE25519_ED25519="CURVE25519_ED25519";}(exports.KeyPairType||
(exports.KeyPairType={}));const
Ke=e=>{const{AlgId:t}=Ge.getModule("foundation");switch(e){case
exports.KeyPairType.DEFAULT:return
{type:exports.KeyPairType.DEFAULT,algId:t.ED25519};case
exports.KeyPairType.ED25519:return
{type:exports.KeyPairType.ED25519,algId:t.ED25519};case
exports.KeyPairType.CURVE25519:return
{type:exports.KeyPairType.CURVE25519,algId:t.CURVE25519};case
exports.KeyPairType.SECP256R1:return
{type:exports.KeyPairType.SECP256R1,algId:t.SECP256R1};case
exports.KeyPairType.RSA_2048:return
{type:exports.KeyPairType.RSA_2048,algId:t.RSA,bitlen:2048};case
exports.KeyPairType.RSA_3072:return
{type:exports.KeyPairType.RSA_3072,algId:t.RSA,bitlen:3072};case
exports.KeyPairType.RSA_4096:return
{type:exports.KeyPairType.RSA_4096,algId:t.RSA,bitlen:4096};case
exports.KeyPairType.RSA_8192:return
{type:exports.KeyPairType.RSA_8192,algId:t.RSA,bitlen:8192};case
exports.KeyPairType.CURVE25519_ROUND5_ED25519_FALCON:return
{type:exports.KeyPairType.CURVE25519_ROUND5_ED25519_FALCON,cipherAlgIds:
[t.CURVE25519,t.ROUND5_ND_1CCA_5D],signerAlgIds:[t.ED25519,t.FALCON]};case
exports.KeyPairType.CURVE25519_ED25519:return
{type:exports.KeyPairType.CURVE25519_ED25519,cipherAlgIds:
[t.CURVE25519,t.NONE],signerAlgIds:[t.ED25519,t.NONE]};default:throw new
TypeError(`Unknown key pair type '${e}'.`)}};for(var Qe=function(e){var
t=it(e),r=t[0],a=t[1];return 3*(r+a)/4-a},je=function(e){var
t,r,a=it(e),i=a[0],n=a[1],o=new et(function(e,t,r){return 3*(t+r)/4-r}
(0,i,n)),_=0,s=n>0?i-4:i;for(r=0;r<s;r+=4)t=$e[e.charCodeAt(r)]<<18|
$e[e.charCodeAt(r+1)]<<12|$e[e.charCodeAt(r+2)]<<6|$e[e.charCodeAt(r+3)],o[_+
+]=t>>16&255,o[_++]=t>>8&255,o[_++]=255&t;2===n&&(t=$e[e.charCodeAt(r)]<<2|
$e[e.charCodeAt(r+1)]>>4,o[_++]=255&t);1===n&&(t=$e[e.charCodeAt(r)]<<10|
$e[e.charCodeAt(r+1)]<<4|$e[e.charCodeAt(r+2)]>>2,o[_++]=t>>8&255,o[_+
+]=255&t);return o},Je=function(e){for(var t,r=e.length,a=r%3,i=[],n=0,o=r-
a;n<o;n+=16383)i.push(nt(e,n,n+16383>o?o:n+16383));1===a?(t=e[r-
1],i.push(qe[t>>2]+qe[t<<4&63]+"==")):2===a&&(t=(e[r-2]<<8)+e[r-
1],i.push(qe[t>>10]+qe[t>>4&63]+qe[t<<2&63]+"="));return i.join("")},qe=[],
$e=[],et="undefined"!=typeof Uint8Array?
Uint8Array:Array,tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
+/",rt=0,at=tt.length;rt<at;++rt)qe[rt]=tt[rt],$e[tt.charCodeAt(rt)]=rt;function
it(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a
multiple of 4");var r=e.indexOf("=");return -1===r&&(r=t),[r,r===t?0:4-r
%4]}function nt(e,t,r){for(var a,i,n=[],o=t;o<r;o+=3)a=(e[o]<<16&16711680)+
(e[o+1]<<8&65280)+(255&e[o+2]),n.push(qe[(i=a)>>18&63]+qe[i>>12&63]+qe[i>>6&63]+qe[
63&i]);return n.join("")}$e["-".charCodeAt(0)]=62,$e["_".charCodeAt(0)]=63;var
ot,_t={byteLength:Qe,toByteArray:je,fromByteArray:Je},st=function(e,t,r,a,i){var
n,o,_=8*i-a-1,s=(1<<_)-1,c=s>>1,f=-7,l=r?i-1:0,u=r?-1:1,A=e[t+l];for(l+=u,n=A&(1<<-
f)-1,A>>=-f,f+=_;f>0;n=256*n+e[t+l],l+=u,f-=8);for(o=n&(1<<-f)-1,n>>=-
f,f+=a;f>0;o=256*o+e[t+l],l+=u,f-=8);if(0===n)n=1-c;else {if(n===s)return o?
NaN:1/0*(A?-1:1);o+=Math.pow(2,a),n-=c;}return (A?-1:1)*o*Math.pow(2,n-
a)},ct=function(e,t,r,a,i,n){var o,_,s,c=8*n-i-1,f=(1<<c)-1,l=f>>1,u=23===i?
Math.pow(2,-24)-Math.pow(2,-77):0,A=a?0:n-1,d=a?1:-1,m=t<0||0===t&&1/t<0?
1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(_=isNaN(t)?1:0,o=f):
(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),(t+=o+l>=1?
u/s:u*Math.pow(2,1-l))*s>=2&&(o++,s/=2),o+l>=f?(_=0,o=f):o+l>=1?(_=(t*s-
1)*Math.pow(2,i),o+=l):(_=t*Math.pow(2,l-
1)*Math.pow(2,i),o=0));i>=8;e[r+A]=255&_,A+=d,_/=256,i-=8);for(o=o<<i|
_,c+=i;c>0;e[r+A]=25
5&o,A+=d,o/=256,c-=8);e[r+A-d]|=128*m;},ft=(function(e,t){var r="function"==typeof
Symbol&&"function"==typeof Symbol.for?
Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>2147483647)throw
new RangeError('The value "'+e+'" is invalid for option "size"');var t=new
Uint8Array(e);return Object.setPrototypeOf(t,i.prototype),t}function i(e,t,r)
{if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string"
argument must be of type string. Received type number');return _(e)}return
n(e,t,r)}function n(e,t,r){if("string"==typeof e)return function(e,t)
{if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new
TypeError("Unknown encoding: "+t);var r=0|l(e,t),n=a(r),o=n.write(e,t);return o!
==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return s(e);if(null==e)throw
new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer,
Array, or Array-like Object. Received type "+typeof e);if(C(e,ArrayBuffer)||
e&&C(e.buffer,ArrayBuffer))return c(e,t,r);if("undefined"!=typeof
SharedArrayBuffer&&(C(e,SharedArrayBuffer)||
e&&C(e.buffer,SharedArrayBuffer)))return c(e,t,r);if("number"==typeof e)throw new
TypeError('The "value" argument must not be of type number. Received type
number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return i.from(n,t,r);var
o=function(e){if(i.isBuffer(e)){var t=0|f(e.length),r=a(t);return 0===r.length||
e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||O(e.length)?
a(0):s(e):"Buffer"===e.type&&Array.isArray(e.data)?s(e.data):void 0}(e);if(o)return
o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof
e[Symbol.toPrimitive])return i.from(e[Symbol.toPrimitive]("string"),t,r);throw new
TypeError("The first argument must be one of type string, Buffer, ArrayBuffer,
Array, or Array-like Object. Received type "+typeof e)}function o(e){if("number"!
=typeof e)throw new TypeError('"size" argument must be of type
number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option
"size"')}function _(e){return o(e),a(e<0?0:0|f(e))}function s(e){for(var
t=e.length<0?0:0|f(e.length),r=a(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}function
c(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer
bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of
buffer bounds');var a;return a=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?
new Uint8Array(e,t):new
Uint8Array(e,t,r),Object.setPrototypeOf(a,i.prototype),a}function f(e)
{if(e>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than
maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|e}function l(e,t)
{if(i.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||C(e,ArrayBuffer))return
e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must
be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var
r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var
n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return
r;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-
2":case"utf16le":case"utf-16le":return 2*r;case"hex":return
r>>>1;case"base64":return B(e).length;default:if(n)return a?-
1:V(e).length;t=(""+t).toLowerCase(),n=!0;}}function u(e,t,r){var a=!1;if((void
0===t||t<0)&&(t=0),t>this.length)return "";if((void 0===r||
r>this.length)&&(r=this.length),r<=0)return "";if((r>>>=0)<=(t>>>=0))return
"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,r);case"utf8":case"utf-
8":return x(this,t,r);case"ascii":return
g(this,t,r);case"latin1":case"binary":return E(this,t,r);case"base64":return
k(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return
I(this,t,r);default:if(a)throw new TypeError("Unknown encoding:
"+e);e=(e+"").toLowerCase(),a=!0;}}function A(e,t,r){var
a=e[t];e[t]=e[r],e[r]=a;}function d(e,t,r,a,n){if(0===e.length)return -
1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-
2147483648),O(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)
{if(n)return -1;r=e.length-1;}else if(r<0){if(!n)return -1;r=0;}if("string"==typeof
t&&(t=i.from(t,a)),i.isBuffer(t))return 0===t.length?-
1:m(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof
Uint8Array.prototype.indexOf?n?
Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,
r):m(e,[t],r,a,n);throw new TypeError("val must be string, number or
Buffer")}function m(e,t,r,a,i){var n,o=1,_=e.length,s=t.length;if(void 0!
==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-
16le"===a)){if(e.length<2||t.length<2)return -1;o=2,_/=2,s/=2,r/=2;}function c(e,t)
{return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(n=r;n<_;n+
+)if(c(e,n)===c(t,-1===f?0:n-f)){if(-1===f&&(f=n),n-f+1===s)return f*o}else -1!
==f&&(n-=n-f),f=-1;}else for(r+s>_&&(r=_-s),n=r;n>=0;n--){for(var l=!0,u=0;u<s;u+
+)if(c(e,n+u)!==c(t,u)){l=!1;break}if(l)return n}return -1}function p(e,t,r,a)
{r=Number(r)||0;var i=e.length-r;a?(a=Number(a))>i&&(a=i):a=i;var
n=t.length;a>n/2&&(a=n/2);for(var o=0;o<a;++o){var
_=parseInt(t.substr(2*o,2),16);if(O(_))return o;e[r+o]=_;}return o}function
v(e,t,r,a){return U(V(t,e.length-r),e,r,a)}function y(e,t,r,a){return U(function(e)
{for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}
(t),e,r,a)}function h(e,t,r,a){return y(e,t,r,a)}function b(e,t,r,a){return
U(B(t),e,r,a)}function w(e,t,r,a){return U(function(e,t){for(var
r,a,i,n=[],o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),a=r>>8,i=r
%256,n.push(i),n.push(a);return n}(t,e.length-r),e,r,a)}function k(e,t,r){return
0===t&&r===e.length?_t.fromByteArray(e):_t.fromByteArray(e.slice(t,r))}function
x(e,t,r){r=Math.min(e.length,r);for(var a=[],i=t;i<r;){var
n,o,_,s,c=e[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case
1:c<128&&(f=c);break;case 2:128==(192&(n=e[i+1]))&&(s=(31&c)<<6|
63&n)>127&&(f=s);break;case
3:n=e[i+1],o=e[i+2],128==(192&n)&&128==(192&o)&&(s=(15&c)<<12|(63&n)<<6|
63&o)>2047&&(s<55296||s>57343)&&(f=s);break;case
4:n=e[i+1],o=e[i+2],_=e[i+3],128==(192&n)&&128==(192&o)&&128==(192&_)&&(s=(15&c)<<1
8|(63&n)<<12|(63&o)<<6|63&_)>65535&&s<1114112&&(f=s);}null===f?
(f=65533,l=1):f>65535&&(f-=65536,a.push(f>>>10&1023|55296),f=56320|
1023&f),a.push(f),i+=l;}return function(e){var t=e.length;if(t<=4096)return
String.fromCharCode.apply(String,e);for(var
r="",a=0;a<t;)r+=String.fromCharCode.apply(String,e.slice(a,a+=4096));return r}
(a)}function g(e,t,r){var a="";r=Math.min(e.length,r);for(var i=t;i<r;+
+i)a+=String.fromCharCode(127&e[i]);return a}function E(e,t,r){var
a="";r=Math.min(e.length,r);for(var i=t;i<r;++i)a+=String.fromCharCode(e[i]);return
a}function N(e,t,r){var a=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>a)&&(r=a);for(var
i="",n=t;n<r;++n)i+=F[e[n]];return i}function I(e,t,r){for(var
a=e.slice(t,r),i="",n=0;n<a.length;n+=2)i+=String.fromCharCode(a[n]
+256*a[n+1]);return i}function T(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset
is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer
length")}function P(e,t,r,a,n,o){if(!i.isBuffer(e))throw new TypeError('"buffer"
argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value"
argument is out of bounds');if(r+a>e.length)throw new RangeError("Index out of
range")}function X(e,t,r,a,i,n){if(r+a>e.length)throw new RangeError("Index out of
range");if(r<0)throw new RangeError("Index out of range")}function Z(e,t,r,a,i)
{return t=+t,r>>>=0,i||X(e,0,r,4),ct(e,t,r,a,23,4),r+4}function R(e,t,r,a,i){return
t=+t,r>>>=0,i||X(e,0,r,8),ct(e,t,r,a,52,8),r+8}t.Buffer=i,t.SlowBuffer=function(e)
{return +e!
=e&&(e=0),i.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=2147483647,i.TYPED_ARRAY
_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return
42}};return
Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo
()}catch(e){return !1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof
console||"function"!=typeof console.error||console.error("This browser lacks typed
array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if
you require old browser support."),Object.defineProperty(i.prototype,"parent",
{enumerable:!0,get:function(){if(i.isBuffer(this))return
this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!
0,get:function(){if(i.isBuffer(this))return
this.byteOffset}}),i.poolSize=8192,i.from=function(e,t,r){return
n(e,t,r)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototy
peOf(i,Uint8Array),i.alloc=function(e,t,r){return function(e,t,r){return o(e),e<=0?
a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}
(e,t,r)},i.allocUnsafe=function(e){return _(e)},i.allocUnsafeSlow=function(e)
{return _(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!
==i.prototype},i.compare=function(e,t)
{if(C(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),C(t,Uint8Array)&&(t=i.from
(t,t.offset,t.byteLength)),!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError('The
"buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return
0;for(var r=e.length,a=t.length,n=0,o=Math.min(r,a);n<o;++n)if(e[n]!==t[n])
{r=e[n],a=t[n];break}return r<a?-1:a<r?1:0},i.isEncoding=function(e)
{switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-
8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-
2":case"utf16le":case"utf-16le":return !0;default:return !
1}},i.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list"
argument must be an Array of Buffers');if(0===e.length)return i.alloc(0);var
r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var
a=i.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var
o=e[r];if(C(o,Uint8Array)&&(o=i.from(o)),!i.isBuffer(o))throw new TypeError('"list"
argument must be an Array of Buffers');o.copy(a,n),n+=o.length;}return
a},i.byteLength=l,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var
e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of
16-bits");for(var t=0;t<e;t+=2)A(this,t,t+1);return
this},i.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new
RangeError("Buffer size must be a multiple of 32-bits");for(var
t=0;t<e;t+=4)A(this,t,t+3),A(this,t+1,t+2);return
this},i.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new
RangeError("Buffer size must be a multiple of 64-bits");for(var
t=0;t<e;t+=8)A(this,t,t+7),A(this,t+1,t+6),A(this,t+2,t+5),A(this,t+3,t+4);return
this},i.prototype.toString=function(){var e=this.length;return
0===e?"":0===arguments.length?
x(this,0,e):u.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toStrin
g,i.prototype.equals=function(e){if(!i.isBuffer(e))throw new TypeError("Argument
must be a Buffer");return this===e||
0===i.compare(this,e)},i.prototype.inspect=function(){var
e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1
").trim(),this.length>r&&(e+=" ... "),"<Buffer
"+e+">"},r&&(i.prototype[r]=i.prototype.inspect),i.prototype.compare=function(e,t,r
,a,n){if(C(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(e))throw
new TypeError('The "target" argument must be one of type Buffer or Uint8Array.
Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void
0===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw
new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return -
1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(a>>>=0),_=(r>>>=0)-
(t>>>=0),s=Math.min(o,_),c=this.slice(a,n),f=e.slice(t,r),l=0;l<s;++l)if(c[l]!
==f[l]){o=c[l],_=f[l];break}return o<_?-1:_<o?
1:0},i.prototype.includes=function(e,t,r){return -1!
==this.indexOf(e,t,r)},i.prototype.indexOf=function(e,t,r){return d(this,e,t,r,!
0)},i.prototype.lastIndexOf=function(e,t,r){return d(this,e,t,r,!
1)},i.prototype.write=function(e,t,r,a){if(void
0===t)a="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof
t)a=t,r=this.length,t=0;else {if(!isFinite(t))throw new Error("Buffer.write(string,
encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?
(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0);}var i=this.length-t;if((void
0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new
RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var n=!
1;;)switch(a){case"hex":return p(this,e,t,r);case"utf8":case"utf-8":return
v(this,e,t,r);case"ascii":return y(this,e,t,r);case"latin1":case"binary":return
h(this,e,t,r);case"base64":return b(this,e,t,r);case"ucs2":case"ucs-
2":case"utf16le":case"utf-16le":return w(this,e,t,r);default:if(n)throw new
TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),n=!
0;}},i.prototype.toJSON=function(){return
{type:"Buffer",data:Array.prototype.slice.call(this._arr||
this,0)}},i.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?
(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?
(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var a=this.subarray(e,t);return
Object.setPrototypeOf(a,i.prototype),a},i.prototype.readUIntLE=function(e,t,r)
{e>>>=0,t>>>=0,r||T(e,t,this.length);for(var a=this[e],i=1,n=0;+
+n<t&&(i*=256);)a+=this[e+n]*i;return a},i.prototype.readUIntBE=function(e,t,r)
{e>>>=0,t>>>=0,r||T(e,t,this.length);for(var a=this[e+--
t],i=1;t>0&&(i*=256);)a+=this[e+--t]*i;return
a},i.prototype.readUInt8=function(e,t){return e>>>=0,t||
T(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return
e>>>=0,t||T(e,2,this.length),this[e]|
this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||
T(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t)
{return e>>>=0,t||T(e,4,this.length),(this[e]|this[e+1]<<8|
this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return
e>>>=0,t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|
this[e+3])},i.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||
T(e,t,this.length);for(var a=this[e],i=1,n=0;++n<t&&(i*=256);)a+=this[e+n]*i;return
a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},i.prototype.readIntBE=function(e,t,r)
{e>>>=0,t>>>=0,r||T(e,t,this.length);for(var a=t,i=1,n=this[e+--
a];a>0&&(i*=256);)n+=this[e+--a]*i;return n>=(i*=128)&&(n-
=Math.pow(2,8*t)),n},i.prototype.readInt8=function(e,t){return e>>>=0,t||
T(e,1,this.length),128&this[e]?-1*(255-this[e]
+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||T(e,2,this.length);var
r=this[e]|this[e+1]<<8;return 32768&r?4294901760|
r:r},i.prototype.readInt16BE=function(e,t){e>>>=0,t||T(e,2,this.length);var
r=this[e+1]|this[e]<<8;return 32768&r?4294901760|
r:r},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||
T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|
this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||
T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|
this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||
T(e,4,this.length),st(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return
e>>>=0,t||T(e,4,this.length),st(this,e,!
1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||
T(e,8,this.length),st(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t)
{return e>>>=0,t||T(e,8,this.length),st(this,e,!
1,52,8)},i.prototype.writeUIntLE=function(e,t,r,a){e=+e,t>>>=0,r>>>=0,a||
P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,n=0;for(this[t]=255&e;+
+n<r&&(i*=256);)this[t+n]=e/i&255;return
t+r},i.prototype.writeUIntBE=function(e,t,r,a){e=+e,t>>>=0,r>>>=0,a||
P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,n=1;for(this[t+i]=255&e;--
i>=0&&(n*=256);)this[t+i]=e/n&255;return
t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||
P(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r)
{return e=+e,t>>>=0,r||
P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=
function(e,t,r){return e=+e,t>>>=0,r||
P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=
function(e,t,r){return e=+e,t>>>=0,r||
P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t
]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||
P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3
]=255&e,t+4},i.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var
i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i);}var n=0,o=1,_=0;for(this[t]=255&e;+
+n<r&&(o*=256);)e<0&&0===_&&0!==this[t+n-1]&&(_=1),this[t+n]=(e/o>>0)-_&255;return
t+r},i.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var
i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i);}var n=r-1,o=1,_=0;for(this[t+n]=255&e;--
n>=0&&(o*=256);)e<0&&0===_&&0!==this[t+n+1]&&(_=1),this[t+n]=(e/o>>0)-_&255;return
t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,127,-
128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r)
{return e=+e,t>>>=0,r||P(this,e,t,2,32767,-
32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,r)
{return e=+e,t>>>=0,r||P(this,e,t,2,32767,-
32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,r)
{return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-
2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.
prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||
P(this,e,t,4,2147483647,-
2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8
,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,r){return Z(this,e,t,!
0,r)},i.prototype.writeFloatBE=function(e,t,r){return Z(this,e,t,!
1,r)},i.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!
0,r)},i.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!
1,r)},i.prototype.copy=function(e,t,r,a){if(!i.isBuffer(e))throw new
TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||
(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a<r&&(a=r),a===r)return
0;if(0===e.length||0===this.length)return 0;if(t<0)throw new
RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new
RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of
bounds");a>this.length&&(a=this.length),e.length-t<a-r&&(a=e.length-t+r);var n=a-
r;if(this===e&&"function"==typeof
Uint8Array.prototype.copyWithin)this.copyWithin(t,r,a);else
if(this===e&&r<t&&t<a)for(var o=n-1;o>=0;--o)e[o+t]=this[o+r];else
Uint8Array.prototype.set.call(e,this.subarray(r,a),t);return
n},i.prototype.fill=function(e,t,r,a){if("string"==typeof e){if("string"==typeof t?
(a=t,t=0,r=this.length):"string"==typeof r&&(a=r,r=this.length),void 0!
==a&&"string"!=typeof a)throw new TypeError("encoding must be a
string");if("string"==typeof a&&!i.isEncoding(a))throw new TypeError("Unknown
encoding: "+a);if(1===e.length){var n=e.charCodeAt(0);
("utf8"===a&&n<128||"latin1"===a)&&(e=n);}}else "number"==typeof e?
e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||
this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var
o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;
++o)this[o]=e;else {var _=i.isBuffer(e)?e:i.from(e,a),s=_.length;if(0===s)throw new
TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;+
+o)this[o+t]=_[o%s];}return this};var M=/[^+/0-9A-Za-z-_]/g;function V(e,t){var
r;t=t||1/0;for(var a=e.length,i=null,n=[],o=0;o<a;++o)
{if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-
1&&n.push(239,191,189);continue}if(o+1===a){(t-=3)>-
1&&n.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-
1&&n.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320);}else i&&(t-=3)>-
1&&n.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;n.push(r);}else
if(r<2048){if((t-=2)<0)break;n.push(r>>6|192,63&r|128);}else if(r<65536){if((t-
=3)<0)break;n.push(r>>12|224,r>>6&63|128,63&r|128);}else {if(!(r<1114112))throw
new Error("Invalid code point");if((t-=4)<0)break;n.push(r>>18|240,r>>12&63|
128,r>>6&63|128,63&r|128);}}return n}function B(e){return
_t.toByteArray(function(e){if((e=(e=e.split("=")
[0]).trim().replace(M,"")).length<2)return "";for(;e.length%4!=0;)e+="=";return e}
(e))}function U(e,t,r,a){for(var i=0;i<a&&!(i+r>=t.length||i>=e.length);+
+i)t[i+r]=e[i];return i}function C(e,t){return e instanceof t||null!=e&&null!
=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function O(e)
{return e!=e}var F=function(){for(var e=new Array(256),t=0;t<16;++t)for(var
r=16*t,a=0;a<16;++a)e[r+a]="0123456789abcdef"[t]+"0123456789abcdef"[a];return e}
();}(ot={exports:
{}},ot.exports),ot.exports),lt=ft.Buffer;ft.SlowBuffer,ft.INSPECT_MAX_BYTES,ft.kMax
Length;const ut=(At=lt,(e,t)=>{if("string"==typeof e){if("string"==typeof t&&!
At.isEncoding(t))throw new TypeError("Invalid default encoding.");return
At.from(e,t)}if(e instanceof Uint8Array)return e;if("object"==typeof
e&&"string"==typeof e.value&&At.isEncoding(e.encoding))return
At.from(e.value,e.encoding);throw new TypeError("Invalid format of 'Data'.")});var
At;const dt=(e=>t=>{let r=e.from(t.buffer);return t.byteLength!
==t.buffer.byteLength&&(r=r.slice(t.byteOffset,t.byteOffset+t.byteLength)),r})
(lt),mt=lt.from("VIRGIL-DATA-SIGNATURE","utf8"),pt=lt.from("VIRGIL-DATA-SIGNER-
ID","utf8");class vt{constructor(e,t)
{this.identifier=dt(e),this.lowLevelPrivateKey=t,this._isDisposed=!1;}get
isDisposed(){return this._isDisposed}dispose()
{this.lowLevelPrivateKey.delete(),this._isDisposed=!0;}}class yt{constructor(e,t)
{this.identifier=dt(e),this.lowLevelPublicKey=t,this._isDisposed=!1;}get
isDisposed(){return this._isDisposed}get key(){const
e=new(ze().KeyAsn1Serializer);try{return
e.setupDefaults(),e.serializePublicKey(this.lowLevelPublicKey)}finally{e.delete();}
}dispose(){this.lowLevelPublicKey.delete(),this._isDisposed=!0;}}function ht(e)
{if(!(e instanceof vt))throw new TypeError("An argument is not an instance of
'VirgilPrivateKey' class.");if(e.isDisposed)throw new TypeError("Cannot use an
instance of 'VirgilPrivateKey' class after it was disposed.")}function bt(e){if(!(e
instanceof yt))throw new TypeError("An argument is not a
'VirgilPublicKey'.");if(e.isDisposed)throw new TypeError("Cannot use an instance of
'VirgilPublicKey' class after it was disposed.")}function wt(e){if(!
Array.isArray(e))throw new TypeError("An argument is not an array.");if(!
e.length)throw new TypeError("An array of 'VirgilPublicKey' instances should not be
empty.");e.forEach(bt);}function kt(e){if(!(e instanceof Uint8Array))throw new
TypeError("An argument is not an instance of 'Uint8Array'
class.");if(e.byteLength<10)throw new TypeError("An argument byte length is too
small. Expected to be at least '10' bytes.")}function xt(e){const
t=ze().GroupSessionMessage.deserialize(e),r={epochNumber:t.getEpoch(),sessionId:dt(
t.getSessionId()).toString("hex"),data:dt(e).toString("base64")};return
t.delete(),r}function gt(e){const
t=ze().GroupSessionMessage.deserialize(e),r=t.getEpoch();return
t.delete(),r}function Et(e){const t=new(ze().GroupSession);t.rng=Oe();const
r=[];try{for(const a of e){const
e=ze().GroupSessionMessage.deserialize(a);r.push(e),t.addEpoch(e);}return
t}finally{for(;r.length;){const e=r.pop();e&&e.delete();}}}function Nt(e){const
t=new(ze().Sha512);try{return
t.hash(e).subarray(0,32)}finally{t.delete();}}function It(e){return
e=e.slice().sort((e,t)=>gt(e)-gt(t)),{getSessionId(){const
t=Et(e),r=t.getSessionId();return
t.delete(),dt(r).toString("hex")},getCurrentEpochNumber:()=>gt(e[e.length-
1]),encrypt(t,r){const a=ut(t,"utf8");let i;ht(r);try{i=Et(e);const
t=i.encrypt(a,r.lowLevelPrivateKey),n=t.serialize();return
t.delete(),dt(n)}finally{i&&i.delete();}},decrypt(t,r){const a=ut(t,"base64");let
i,n;bt(r);try{return
i=Et(e),n=ze().GroupSessionMessage.deserialize(a),dt(i.decrypt(n,r.lowLevelPublicKe
y))}finally{n&&n.delete(),i&&i.delete();}},addNewEpoch(){const t=Et(e);try{const
r=t.createGroupTicket(),a=r.getTicketMessage(),i=a.serialize();return
e.push(i),a.delete(),r.delete(),xt(i)}finally{t.delete();}},export:
()=>e.map(dt),parseMessage:e=>xt(ut(e,"base64"))}}const Tt=e=>null==e?
[]:Array.isArray(e)?e:[e];var Pt;!function(e)
{e.STREAM_ILLEGAL_STATE="STREAM_ILLEGAL_STATE",e.DATA_NOT_SIGNED="DATA_NOT_SIGNED",
e.SIGNER_NOT_FOUND="SIGNER_NOT_FOUND",e.INVALID_SIGNATURE="INVALID_SIGNATURE";}
(Pt||(Pt={}));class Xt extends Error{constructor(e,t){super(t||
Xt.DEFAULT_MESSAGE),Object.setPrototypeOf(this,Xt.prototype),this.name="VirgilCrypt
oError",this.status=e;}}Xt.DEFAULT_MESSAGE="Use the 'status' property and
'VirgilCryptoErrorStatus' enum to check for specific error.";class
Zt{constructor(e,t){const r=ze(),a=Tt(e);if(wt(a),this.recipientCipher=new
r.RecipientCipher,this.aes256Gcm=new
r.Aes256Gcm,this.recipientCipher.encryptionCipher=this.aes256Gcm,this.recipientCiph
er.random=Oe(),a.forEach(e=>{this.recipientCipher.addKeyRecipient(e.identifier,e.lo
wLevelPublicKey);}),t){const
e=ut(t,"base64");this.messageInfoCustomParams=this.recipientCipher.customParams(),t
his.messageInfoCustomParams.addData(mt,e);}this._isFinished=!1,this._isRunning=!
1,this._isDisposed=!1;}get isRunning(){return this._isRunning}get isFinished()
{return this._isFinished}get isDisposed(){return this._isDisposed}start(){return
this.ensureLegalState(),this.recipientCipher.startEncryption(),this._isRunning=!
0,dt(this.recipientCipher.packMessageInfo())}update(e)
{this.ensureLegalState(),this.ensureIsRunning();const t=ut(e,"utf8");return
dt(this.recipientCipher.processEncryption(t))}final(e=!0)
{this.ensureLegalState(),this.ensureIsRunning();try{return
dt(this.recipientCipher.finishEncryption())}finally{this._isFinished=!
0,this._isRunning=!1,e&&this.dispose();}}dispose()
{this.messageInfoCustomParams&&this.messageInfoCustomParams.delete(),this.aes256Gcm
.delete(),this.recipientCipher.delete(),this._isDisposed=!0;}ensureLegalState()
{if(this._isDisposed)throw new Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot
use cipher after the 'dispose' method has been called.");if(this._isFinished)throw
new Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use cipher after the 'final'
method has been called.")}ensureIsRunning(){if(!this._isRunning)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use cipher before the 'start'
method.")}}class Rt{constructor(e){this._isFinished=!1,this._isDisposed=!1;const
t=ze();ht(e),this.recipientCipher=new
t.RecipientCipher;try{this.recipientCipher.startDecryptionWithKey(e.identifier,e.lo
wLevelPrivateKey,new Uint8Array);}catch(e){throw
this.recipientCipher.delete(),e}}get isFinished(){return this._isFinished}get
isDisposed(){return this._isDisposed}getSignature(){if(this._isDisposed)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot get signature after the 'dispose'
method has been called.");if(!this._isFinished)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot get signature before the 'final'
method has been called.");const e=this.recipientCipher.customParams();try{return
dt(e.findData(mt))}finally{e.delete();}}update(e){this.ensureLegalState();const
t=ut(e,"utf8");return dt(this.recipientCipher.processDecryption(t))}final(e=!0)
{this.ensureLegalState();try{return
dt(this.recipientCipher.finishDecryption())}finally{this._isFinished=!
0,e&&this.dispose();}}dispose(){this.recipientCipher.delete(),this._isDisposed=!
0;}ensureLegalState(){if(this._isDisposed)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use cipher after the 'dispose'
method has been called.");if(this._isFinished)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use cipher after the 'final'
method has been called.")}}class Mt{constructor(){const
e=ze();this.paddingParams=e.PaddingParams.newWithConstraints(160,160),this.recipien
tCipher=new
e.RecipientCipher,this.recipientCipher.random=Oe(),this.recipientCipher.paddingPara
ms=this.paddingParams,this._isDisposed=!1,this._isFinished=!1;}start(e)
{this.ensureLegalState(),ht(e),this.recipientCipher.startDecryptionWithKey(e.identi
fier,e.lowLevelPrivateKey,new Uint8Array);}update(e){this.ensureLegalState();const
t=ut(e),r=this.recipientCipher.processDecryption(t);return dt(r)}final()
{this.ensureLegalState();const e=this.recipientCipher.finishDecryption();try{return
dt(e)}finally{this._isFinished=!0;}}verify(e,t=!0){const
r=Tt(e);if(wt(r),this._isDisposed)throw new Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal
state. Cannot verify signature after the 'dispose' method has been called.");if(!
this._isFinished)throw new Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot verify
signature before the 'final' method has been called.");let a;try{if(!
this.recipientCipher.isDataSigned())throw new
Xt(Pt.DATA_NOT_SIGNED);if(a=this.recipientCipher.signerInfos(),!a.hasItem())throw
new Xt(Pt.DATA_NOT_SIGNED);const e=a.item();let i;for(let t=0;t<r.length;t+=1)
{if(0===lt.compare(e.signerId(),r[t].identifier)){i=r[t];break}if(t===r.length-
1)throw new Xt(Pt.SIGNER_NOT_FOUND)}if(!
this.recipientCipher.verifySignerInfo(e,i.lowLevelPublicKey))throw new
Xt(Pt.INVALID_SIGNATURE)}finally{a&&a.delete(),t&&this.dispose();}}dispose()
{this.paddingParams.delete(),this.recipientCipher.delete(),this._isDisposed=!
0;}ensureLegalState(){if(this._isDisposed)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use cipher after the 'dispose'
method has been called.");if(this._isFinished)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use cipher after the 'final'
method has been called.")}}class Vt{constructor(e,t,r){ht(e);const
a=Tt(t);wt(a);const i=ze(),n=Oe();this.recipientCipher=new
i.RecipientCipher,this.aes256Gcm=new i.Aes256Gcm,this.sha512=new
i.Sha512,this.recipientCipher.encryptionCipher=this.aes256Gcm,this.recipientCipher.
random=n,this.recipientCipher.signerHash=this.sha512,r&&(this.randomPadding=new
i.RandomPadding,this.randomPadding.random=n,this.recipientCipher.encryptionPadding=
this.randomPadding,this.paddingParams=i.PaddingParams.newWithConstraints(160,160),t
his.recipientCipher.paddi
ngParams=this.paddingParams),a.forEach(e=>{this.recipientCipher.addKeyRecipient(e.i
dentifier,e.lowLevelPublicKey);});try{this.recipientCipher.addSigner(e.identifier,e
.lowLevelPrivateKey),this._isDisposed=!1,this._isRunning=!1,this._isFinished=!
1;}catch(e){throw this.dispose(),e}}get isRunning(){return this._isRunning}get
isFinished(){return this._isFinished}get isDisposed(){return
this._isDisposed}start(e)
{this.ensureLegalState(),this.recipientCipher.startSignedEncryption(e);const
t=this.recipientCipher.packMessageInfo();return this._isRunning=!0,dt(t)}update(e)
{this.ensureLegalState(),this.ensureIsRunning();const
t=ut(e),r=this.recipientCipher.processEncryption(t);return dt(r)}final(e=!0)
{this.ensureLegalState(),this.ensureIsRunning();const
t=this.recipientCipher.finishEncryption(),r=this.recipientCipher.packMessageInfoFoo
ter();try{return lt.concat([t,r])}finally{this._isFinished=!0,this._isRunning=!
1,e&&this.dispose();}}dispose()
{this.sha512.delete(),this.aes256Gcm.delete(),this.randomPadding&&this.randomPaddin
g.delete(),this.paddingParams&&this.paddingParams.delete(),this.recipientCipher.del
ete(),this._isDisposed=!0;}ensureLegalState(){if(this._isDisposed)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use cipher after the 'dispose'
method has been called.");if(this._isFinished)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use cipher after the 'final'
method has been called.")}ensureIsRunning(){if(!this._isRunning)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use cipher before the 'start'
method.")}}class Bt{constructor(){this._isDisposed=!1;const e=ze();this.signer=new
e.Signer,this.sha512=new
e.Sha512,this.signer.hash=this.sha512,this.signer.random=Oe(),this.signer.reset();}
get isDisposed(){return this._isDisposed}update(e){if(this._isDisposed)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use signer after the 'dispose'
method has been called.");const t=ut(e,"utf8");return
this.signer.appendData(t),this}sign(e,t=!0){if(this._isDisposed)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. The VirgilStreamSigner has been
disposed. Pass 'false' as the second argument to the 'sign' method if you need to
generate more than one signature.");ht(e);const
r=this.signer.sign(e.lowLevelPrivateKey);return t&&this.dispose(),dt(r)}dispose()
{this.sha512.delete(),this.signer.delete(),this._isDisposed=!0;}}class
Ut{constructor(e){this._isDisposed=!1;const
t=ze(),r=ut(e,"base64");this.verifier=new
t.Verifier;try{this.verifier.reset(r);}catch(e){throw this.verifier.delete(),e}}get
isDisposed(){return this._isDisposed}update(e){if(this._isDisposed)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. Cannot use signer after the 'dispose'
method has been called.");const t=ut(e,"utf8");return
this.verifier.appendData(t),this}verify(e,t=!0){if(this._isDisposed)throw new
Xt(Pt.STREAM_ILLEGAL_STATE,"Illegal state. The VirgilStreamVerifier has been
disposed. Pass 'false' as the second argument to the 'verify' method if you need to
verify with more than one public key.");bt(e);const
r=this.verifier.verify(e.lowLevelPublicKey);return t&&this.dispose(),r}dispose()
{this.verifier.delete(),this._isDisposed=!0;}}class Ct{constructor(e={})
{this.hashAlgorithm=He,this.keyPairType=exports.KeyPairType,this.defaultKeyPairType
=e.defaultKeyPairType||
exports.KeyPairType.DEFAULT,this.useSha256Identifiers=e.useSha256Identifiers||!
1;}generateKeys(e){const t=e||this.defaultKeyPairType,r=Ke(t);return
this.generateKeyPair(Fe(),r)}generateKeysFromKeyMaterial(e,t){const r=t||
this.defaultKeyPairType,a=Ke(r),i=ut(e,"base64"),n=ze(),o=new
n.KeyMaterialRng;o.resetKeyMaterial(i);const _=new
n.KeyProvider;_.random=o;try{_.setupDefaults();}catch(e){throw
o.delete(),_.delete(),e}try{return
this.generateKeyPair(_,a)}finally{o.delete(),_.delete();}}importPrivateKey(e){const
t=Fe(),r=ut(e,"base64"),a=t.importPrivateKey(r),i=a.extractPublicKey();try{const
e=t.exportPublicKey(i),r=this.calculateKeyPairIdentifier(e);return new
vt(r,a)}finally{i.delete();}}exportPrivateKey(e){ht(e);const
t=Fe().exportPrivateKey(e.lowLevelPrivateKey);return dt(t)}importPublicKey(e){const
t=ut(e,"base64"),r=Fe().importPublicKey(t),a=this.calculateKeyPairIdentifier(t);ret
urn new yt(a,r)}exportPublicKey(e){bt(e);const
t=Fe().exportPublicKey(e.lowLevelPublicKey);return dt(t)}encrypt(e,t,r){const
a=ut(e,"utf8"),i=Tt(t);wt(i);const n=ze(),o=Oe(),_=new n.RecipientCipher,s=new
n.Aes256Gcm;let c,f;_.encryptionCipher=s,_.random=o,r&&(c=new
n.RandomPadding,c.random=o,_.encryptionPadding=c,f=n.PaddingParams.newWithConstrain
ts(160,160),_.paddingParams=f),i.forEach(({identifier:e},t)=>{_.addKeyRecipient(e,i
[t].lowLevelPublicKey);});try{_.startEncryption();const
e=_.packMessageInfo(),t=_.processEncryption(a),r=_.finishEncryption();return
lt.concat([e,t,r])}finally{s.delete(),f&&f.delete(),c&&c.delete(),_.delete();}}decr
ypt(e,t){const r=ut(e,"base64");ht(t);const a=ze(),i=new
a.RecipientCipher;i.random=Oe();const
n=a.PaddingParams.newWithConstraints(160,160);i.paddingParams=n;try{i.startDecrypti
onWithKey(t.identifier,t.lowLevelPrivateKey,new Uint8Array);const
e=i.processDecryption(r),a=i.finishDecryption();return
lt.concat([e,a])}finally{n.delete(),i.delete();}}calculateHash(e,t=He.SHA512){const
r=ut(e,"utf8");let a;switch(t){case
He.SHA224:a=this.createHash(r,ze().Sha224);break;case
He.SHA256:a=this.createHash(r,ze().Sha256);break;case
He.SHA384:a=this.createHash(r,ze().Sha384);break;case
He.SHA512:a=this.createHash(r,ze().Sha512);break;default:throw new
TypeError("Unknown hash algorithm")}return dt(a)}extractPublicKey(e){ht(e);const
t=e.lowLevelPrivateKey.extractPublicKey();return new
yt(e.identifier,t)}calculateSignature(e,t){const r=ut(e,"utf8");ht(t);const
a=ze(),i=new a.Signer,n=new
a.Sha512;i.random=Oe(),i.hash=n,i.reset(),i.appendData(r);try{const
e=i.sign(t.lowLevelPrivateKey);return
dt(e)}finally{i.delete(),n.delete();}}verifySignature(e,t,r){const
a=ut(e,"utf8"),i=ut(t,"base64");bt(r);const
n=new(ze().Verifier);try{n.reset(i);}catch(e){throw
n.delete(),e}n.appendData(a);const o=n.verify(r.lowLevelPublicKey);return
n.delete(),o}signAndEncrypt(e,t,r,a){const i=ut(e,"utf8");ht(t);const
n=Tt(r);wt(n);const{messageInfo:o,processEncryption:_,finishEncryption:s,messageInf
oFooter:c}=this._signAndEncrypt(i,t,n,a);return
lt.concat([o,_,s,c])}signThenEncrypt(e,t,r,a){const i=ut(e,"utf8");ht(t);const
n=Tt(r);wt(n);const{messageInfo:o,processEncryption:_,finishEncryption:s}=this._sig
nThenEncrypt(i,t,n,a);return lt.concat([o,_,s])}decryptAndVerify(e,t,r){const
a=ut(e,"base64");ht(t);const i=Tt(r);return wt(i),this._decryptAndVerify(a,new
Uint8Array,t,i)}decryptThenVerify(e,t,r){const a=ut(e,"base64");ht(t);const
i=Tt(r);return wt(i),this._decryptThenVerify(a,new
Uint8Array,t,i)}getRandomBytes(e){!function(e){if("number"!=typeof e)throw new
TypeError("An argument is not a number.");if(e<=0)throw new TypeError(`An argument
should be greater that '0', but received '${e}'.`)}(e);const
t=Oe().random(e);return dt(t)}signThenEncryptDetached(e,t,r,a){const
i=ut(e,"utf8");ht(t);const
n=Tt(r);wt(n);const{messageInfo:o,processEncryption:_,finishEncryption:s}=this._sig
nThenEncrypt(i,t,n,a);return
{encryptedData:lt.concat([_,s]),metadata:dt(o)}}decryptThenVerifyDetached(e,t,r,a)
{const i=ut(e,"base64"),n=ut(t,"base64");ht(r);const o=Tt(a);return
wt(o),this._decryptThenVerify(i,n,r,o)}createStreamCipher(e,t){return new
Zt(e,t)}createStreamDecipher(e){return new Rt(e)}createStreamSignAndEncrypt(e,t,r)
{return new Vt(e,t,r)}createStreamDecryptAndVerify(){return new
Mt}createStreamSigner(){return new Bt}createStreamVerifier(e){return new
Ut(e)}generateGroupSession(e){const t=ut(e,"utf8");kt(t);const r=function(e){const
t=new(ze().GroupSessionTicket);t.rng=Oe();try{return
t.setupTicketAsNew(e),t.getTicketMessage()}finally{t.delete();}}
(Nt(t)),a=r.serialize();return r.delete(),It([a])}importGroupSession(e){if(!
Array.isArray(e))throw new TypeError("Epoch messages must be an
array.");if(0===e.length)throw new TypeError("Epoch messages must not be
empty.");return It(e.map(e=>ut(e,"base64")))}calculateGroupSessionId(e){const
t=ut(e,"utf8");return kt(t),dt(Nt(t)).toString("hex")}createHash(e,t){const r=new
t,a=r.hash(e);return r.delete(),a}calculateKeyPairIdentifier(e){return
this.useSha256Identifiers?
this.createHash(e,ze().Sha256):this.createHash(e,ze().Sha512).slice(0,8)}generateKe
yPair(e,t){let
r;if((a=t.type)===exports.KeyPairType.CURVE25519_ROUND5_ED25519_FALCON||
a===exports.KeyPairType.CURVE25519_ED25519){const[a,i]=t.cipherAlgIds,
[n,o]=t.signerAlgIds;r=e.generateCompoundHybridPrivateKey(a,i,n,o);}else
(e=>e===exports.KeyPairType.RSA_2048||e===exports.KeyPairType.RSA_3072||
e===exports.KeyPairType.RSA_4096||e===exports.KeyPairType.RSA_8192)
(t.type)&&e.setRsaParams(t.bitlen),r=e.generatePrivateKey(t.algId);var a;const
i=r.extractPublicKey();let n;try{n=e.exportPublicKey(i);}catch(e){throw
r.delete(),i.delete(),e}const o=this.calculateKeyPairIdentifier(n);return
{privateKey:new vt(o,r),publicKey:new yt(o,i)}}_signAndEncrypt(e,t,r,a){const
i=ze(),n=Oe(),o=new i.RecipientCipher,_=new i.Aes256Gcm,s=new i.Sha512;let
c,f;o.encryptionCipher=_,o.random=n,o.signerHash=s,a&&(c=new
i.RandomPadding,c.random=n,o.encryptionPadding=c,f=i.PaddingParams.newWithConstrain
ts(160,160),o.paddingParams=f),r.forEach(({identifier:e},t)=>{o.addKeyRecipient(e,r
[t].lowLevelPublicKey);});try{return
o.addSigner(t.identifier,t.lowLevelPrivateKey),o.startSignedEncryption(e.length),
{messageInfo:o.packMessageInfo(),processEncryption:o.processEncryption(e),finishEnc
ryption:o.finishEncryption(),messageInfoFooter:o.packMessageInfoFooter()}}finally{s
.delete(),_.delete(),c&&c.delete(),f&&f.delete(),o.delete();}}_signThenEncrypt(e,t,
r,a){const i=ze(),n=Oe(),o=new i.RecipientCipher,_=new i.Aes256Gcm;let
s,c;o.encryptionCipher=_,o.random=n,a&&(s=new
i.RandomPadding,s.random=n,o.encryptionPadding=s,c=i.PaddingParams.newWithConstrain
ts(160,160),o.paddingParams=c),r.forEach(({identifier:e},t)=>{o.addKeyRecipient(e,r
[t
].lowLevelPublicKey);});const f=o.customParams();try{const
r=this.calculateSignature(e,t);return
f.addData(mt,r),f.addData(pt,t.identifier),o.startEncryption(),
{messageInfo:o.packMessageInfo(),processEncryption:o.processEncryption(e),finishEnc
ryption:o.finishEncryption()}}finally{f.delete(),_.delete(),s&&s.delete(),c&&c.dele
te(),o.delete();}}_decryptAndVerify(e,t,r,a){const
i=ze(),n=i.PaddingParams.newWithConstraints(160,160),o=new i.RecipientCipher;let
_;o.random=Oe(),o.paddingParams=n;try{o.startDecryptionWithKey(r.identifier,r.lowLe
velPrivateKey,t);const
a=o.processDecryption(e),i=o.finishDecryption();_=lt.concat([a,i]);}catch(e){throw
n.delete(),o.delete(),e}if(!o.isDataSigned())throw n.delete(),o.delete(),new
Xt(Pt.DATA_NOT_SIGNED);const s=o.signerInfos();if(!s.hasItem())throw
n.delete(),s.delete(),o.delete(),new Xt(Pt.DATA_NOT_SIGNED);const c=s.item();let
f;for(let e=0;e<a.length;e+=1){if(0===lt.compare(c.signerId(),a[e].identifier))
{f=a[e];break}if(e===a.length-1)throw
n.delete(),c.delete(),s.delete(),o.delete(),new Xt(Pt.SIGNER_NOT_FOUND)}if(!
o.verifySignerInfo(c,f.lowLevelPublicKey))throw
n.delete(),c.delete(),s.delete(),o.delete(),new Xt(Pt.INVALID_SIGNATURE);return
n.delete(),c.delete(),s.delete(),o.delete(),_}_decryptThenVerify(e,t,r,a){const
i=ze(),n=i.PaddingParams.newWithConstraints(160,160),o=new i.RecipientCipher;let
_;o.random=Oe(),o.paddingParams=n;try{o.startDecryptionWithKey(r.identifier,r.lowLe
velPrivateKey,t);const
a=o.processDecryption(e),i=o.finishDecryption();_=lt.concat([a,i]);}catch(e){throw
n.delete(),o.delete(),e}const s=o.customParams();let c;if(1===a.length)c=a[0];else
{let e;try{e=s.findData(pt);}catch(e){throw
n.delete(),o.delete(),s.delete(),e}for(let
t=0;t<a.length;t+=1)if(0===lt.compare(e,a[t].identifier)){c=a[t];break}if(!c)throw
s.delete(),n.delete(),o.delete(),new Xt(Pt.SIGNER_NOT_FOUND)}try{const
e=s.findData(mt);if(!this.verifySignature(_,e,c))throw new
Xt(Pt.INVALID_SIGNATURE);return _}finally{s.delete(),n.delete(),o.delete();}}}
/*!
*****************************************************************************
Copyright (c) Microsoft Corporation.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
this.db = db;
this._ended = false;
this._nexting = false;
}
if (self._ended) {
nextTickBrowser$4(callback, new Error('cannot call next() after
end()'));
return self
}
if (self._nexting) {
nextTickBrowser$4(callback, new Error('cannot call next() before
previous next() has completed'));
return self
}
self._nexting = true;
self._next(function () {
self._nexting = false;
callback.apply(null, arguments);
});
return self
};
target = this.db._serializeKey(target);
this._seek(target);
};
AbstractIterator$a.prototype._seek = function (target) {};
if (this._ended) {
return nextTickBrowser$4(callback, new Error('end() already called
on iterator'))
}
this._ended = true;
this._end(callback);
};
this.db = db;
this._operations = [];
this._written = false;
}
AbstractChainedBatch$8.prototype._checkWritten = function () {
if (this._written) {
throw new Error('write() already called on this batch')
}
};
key = this.db._serializeKey(key);
value = this.db._serializeValue(value);
this._put(key, value);
return this
};
key = this.db._serializeKey(key);
this._del(key);
return this
};
AbstractChainedBatch$8.prototype.clear = function () {
this._checkWritten();
this._clear();
return this
};
AbstractChainedBatch$8.prototype._clear = function () {
this._operations = [];
};
this._written = true;
this._write(options, callback);
};
this.status = 'opening';
this._open(options, function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'open';
callback();
});
};
this.status = 'closing';
this._close(function (err) {
if (err) {
self.status = oldStatus;
return callback(err)
}
self.status = 'closed';
callback();
});
};
AbstractLevelDOWN$a.prototype._close = function (callback) {
nextTickBrowser$4(callback);
};
key = this._serializeKey(key);
key = this._serializeKey(key);
value = this._serializeValue(value);
key = this._serializeKey(key);
if (!Array.isArray(array)) {
return nextTickBrowser$4(callback, new Error('batch(array) requires
an array argument'))
}
if (array.length === 0) {
return nextTickBrowser$4(callback)
}
var e = immutable(array[i]);
e.key = this._serializeKey(e.key);
e.value = this._serializeValue(e.value);
}
serialized[i] = e;
}
this._clear(options, callback);
};
next();
};
AbstractLevelDOWN$a.prototype._setupIteratorOptions = function
(options) {
options = cleanRangeOptions$4(this, options);
options.reverse = !!options.reverse;
options.keys = options.keys !== false;
options.values = options.values !== false;
options.limit = 'limit' in options ? options.limit : -1;
options.keyAsBuffer = options.keyAsBuffer !== false;
options.valueAsBuffer = options.valueAsBuffer !== false;
return options
};
if (isRangeOption$5(k)) {
// Note that we don't reject nullish and empty options here.
While
// those types are invalid as keys, they are valid as range
options.
opt = db._serializeKey(opt);
}
result[k] = opt;
}
return result
}
AbstractLevelDOWN$a.prototype._chainedBatch = function () {
return new abstractChainedBatch$4(this)
};
var abstractLeveldown$8 = {
AbstractLevelDOWN: AbstractLevelDOWN$b,
AbstractIterator: AbstractIterator$b,
AbstractChainedBatch: AbstractChainedBatch$9
};
if(isBuffer$1(a)) {
var l = Math.min(a.length, b.length);
for(var i = 0; i < l; i++) {
var cmp = a[i] - b[i];
if(cmp) return cmp
}
return a.length - b.length
}
if(ub) {
if(ub === 'lt') _range.lt = map(range.lt, true);
else _range.lte = map(range[ub], true);
}
else if(defaults)
_range.lte = map(upper, true);
if(range.reverse != null)
_range.reverse = !!range.reverse;
return _range
};
var lb = lowerBound(range);
if(isDef(lb)) {
var cmp = compare(key, lb);
if(cmp < 0 || (cmp === 0 && lowerBoundExclusive(range)))
return false
}
var ub = upperBound(range);
if(isDef(ub)) {
var cmp = compare(key, ub);
if(cmp > 0 || (cmp === 0) && upperBoundExclusive(range))
return false
}
return true
};
this._limit = options.limit;
this._count = 0;
this._callback = null;
this._cache = [];
this._completed = false;
this._aborted = false;
this._error = null;
this._transaction = null;
this._keys = options.keys;
this._values = options.values;
this._keyAsBuffer = options.keyAsBuffer;
this._valueAsBuffer = options.valueAsBuffer;
if (this._limit === 0) {
this._completed = true;
return
}
try {
var keyRange$1 = keyRange(options);
} catch (e) {
// The lower key is greater than the upper key.
// IndexedDB throws an error, but we'll just return 0 results.
this._completed = true;
return
}
inherits_browser(Iterator$1, AbstractIterator$c);
this._transaction = transaction;
transaction.oncomplete = function () {
self.onComplete();
};
};
this.maybeNext();
};
Iterator$1.prototype.onComplete = function () {
this._completed = true;
this.maybeNext();
};
Iterator$1.prototype.maybeNext = function () {
if (this._callback) {
this._next(this._callback);
this._callback = null;
}
};
transaction.oncomplete = function () {
callback();
};
transaction.onabort = function () {
callback(transaction.error || new Error('aborted by user'));
};
if (cursor) {
// Wait for a request to complete before continuing, saving CPU.
store.delete(cursor.key).onsuccess = function () {
if (options.limit <= 0 || ++count < options.limit) {
cursor.continue();
}
};
}
};
};
AbstractLevelDOWN$c.call(this, {
bufferKeys: support.bufferKeys(indexedDB),
snapshots: true,
permanence: true,
clear: true
});
this.location = location;
this.prefix = opts.prefix == null ? DEFAULT_PREFIX : opts.prefix;
this.version = parseInt(opts.version || 1, 10);
}
inherits_browser(Level, AbstractLevelDOWN$c);
Level.prototype.type = 'level-js';
req.onerror = function () {
callback(req.error || new Error('unknown error'));
};
req.onsuccess = function () {
self.db = req.result;
callback();
};
if (!db.objectStoreNames.contains(self.location)) {
db.createObjectStore(self.location);
}
};
};
transaction.oncomplete = function () {
callback(null, request.result);
};
};
Level.prototype._get = function (key, options, callback) {
var store = this.store('readonly');
try {
var req = store.get(key);
} catch (err) {
return this._nextTick(callback, err)
}
try {
var req = store.delete(key);
} catch (err) {
return this._nextTick(callback, err)
}
this.await(req, callback);
};
try {
// Will throw a DataError or DataCloneError if the environment
// does not support serializing the key or value respectively.
var req = store.put(value, key);
} catch (err) {
return this._nextTick(callback, err)
}
this.await(req, callback);
};
transaction.onabort = function () {
callback(error || transaction.error || new Error('aborted by
user'));
};
transaction.oncomplete = function () {
callback();
};
// Wait for a request to complete before making the next, saving CPU.
function loop () {
var op = operations[index++];
var key = op.key;
try {
var req = op.type === 'del' ? store.delete(key) :
store.put(op.value, key);
} catch (err) {
error = err;
transaction.abort();
return
}
loop();
};
if (options.limit >= 0) {
// IDBObjectStore#delete(range) doesn't have such an option.
// Fall back to cursor-based implementation.
return clear(this, this.location, keyRange$1, options, callback)
}
try {
var store = this.store('readwrite');
var req = keyRange$1 ? store.delete(keyRange$1) : store.clear();
} catch (err) {
return this._nextTick(callback, err)
}
this.await(req, callback);
};
var it = this.iterator();
var batchOptions = {};
var self = this;
/**
* @hidden
*/
function processFile({ file, chunkSize, signal, onChunkCallback,
onFinishCallback, onErrorCallback, }) {
const reader = new FileReader();
const dataSize = file.size;
let offset = 0;
let endOffset = Math.min(offset + chunkSize, dataSize);
if (signal) {
const onAbort = () => {
reader.abort();
onErrorCallback(new AbortError());
};
if (signal.aborted)
return onAbort();
else
signal.addEventListener('abort', onAbort);
}
reader.onload = () => {
if (!reader.result)
throw new Error('reader.result is null');
try {
onChunkCallback(reader.result, endOffset);
}
catch (err) {
return onErrorCallback(err);
}
offset = endOffset;
endOffset = Math.min(offset + chunkSize, dataSize);
if (offset === dataSize) {
try {
onFinishCallback();
}
catch (err) {
onErrorCallback(err);
}
}
else {
reader.readAsArrayBuffer(file.slice(offset, endOffset));
}
};
reader.onerror = () => onErrorCallback(reader.error);
reader.readAsArrayBuffer(file.slice(offset, endOffset));
}
/**
* @hidden
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const isFile$1 = (val) => {
return val instanceof File;
};
encryptedChunks.push(streamCipher.update(this.toData(chunk)));
if (options.onProgress) {
options.onProgress({
state: VIRGIL_STREAM_ENCRYPTING_STATE,
bytesProcessed: offset,
fileSize: fileSize,
});
}
};
const onFinishCallback = () => {
encryptedChunks.push(streamCipher.final());
resolve(encryptedChunks);
};
const onErrorCallback = (err) => {
reject(err);
streamCipher.dispose();
};
processFile({
file,
chunkSize,
onChunkCallback,
onFinishCallback,
onErrorCallback,
signal: options.signal,
});
});
const encryptedChunks = yield encryptedChunksPromise;
if (isFile$1(file))
return new File(encryptedChunks, file.name, { type:
file.type });
return new Blob(encryptedChunks, { type: file.type });
});
}
/**
* @deprecated and will be removed in next major release.
* Decrypts and verifies integrity of File or Blob for recipient
public key. If there is no recipient
* and the message is encrypted for the current user, omit the
public key parameter. You can define
* chunk size and a callback, that will be invoked on each chunk.
*
* The file will be read twice during this method execution:
* 1. To decrypt encrypted file.
* 2. To verify the validity of the signature over the decrypted
file for the public key.
*/
decryptFile(file, senderCardOrPublicKey, options = {}) {
return __awaiter$3(this, void 0, void 0, function* () {
const fileSize = file.size;
const chunkSize = options.chunkSize ? options.chunkSize :
64 * 1024;
if (!Number.isInteger(chunkSize))
throw TypeError('chunkSize should be an integer
value');
const privateKey = (yield
this.keyLoader.loadLocalPrivateKey());
if (!privateKey)
throw new RegisterRequiredError();
const publicKey =
this.getPublicKeyForVerification(privateKey, senderCardOrPublicKey,
options.encryptedOn);
if (!publicKey) {
throw new TypeError('Could not get public key from the
second argument.' +
'Expected a Virgil Card or a Public Key object. Got
' +
typeof senderCardOrPublicKey);
}
const streamDecipher =
this.virgilCrypto.createStreamDecipher(privateKey);
const decryptedChunksPromise = new Promise((resolve,
reject) => {
const decryptedChunks = [];
const onChunkCallback = (chunk, offset) => {
decryptedChunks.push(streamDecipher.update(this.toData(chunk)));
if (options.onProgress) {
options.onProgress({
state: VIRGIL_STREAM_DECRYPTING_STATE,
bytesProcessed: offset,
fileSize: fileSize,
});
}
};
const onFinishCallback = () => {
decryptedChunks.push(streamDecipher.final(false));
const signature = streamDecipher.getSignature();
streamDecipher.dispose();
if (!signature)
throw new IntegrityCheckFailedError('Signature
not present.');
resolve({ decryptedChunks, signature });
};
const onErrorCallback = (err) => {
streamDecipher.dispose();
reject(err);
};
processFile({
file,
chunkSize,
onChunkCallback,
onFinishCallback,
onErrorCallback,
signal: options.signal,
});
});
const { decryptedChunks, signature } = yield
decryptedChunksPromise;
const streamVerifier =
this.virgilCrypto.createStreamVerifier(signature);
let decryptedFile;
if (isFile$1(file))
decryptedFile = new File(decryptedChunks, file.name,
{ type: file.type });
decryptedFile = new Blob(decryptedChunks, { type: file.type
});
const decryptedFileSize = decryptedFile.size;
const verifyPromise = new Promise((resolve, reject) => {
const onChunkCallback = (chunk, offset) => {
streamVerifier.update(this.toData(chunk));
if (options.onProgress) {
options.onProgress({
state: VIRGIL_STREAM_VERIFYING_STATE,
bytesProcessed: offset,
fileSize: decryptedFileSize,
});
}
};
const onFinishCallback = () =>
resolve(streamVerifier.verify(publicKey));
const onErrorCallback = (err) => {
streamVerifier.dispose();
reject(err);
};
processFile({
file: decryptedFile,
chunkSize,
onChunkCallback,
onFinishCallback,
onErrorCallback,
signal: options.signal,
});
});
const isVerified = yield verifyPromise;
if (!isVerified) {
throw new IntegrityCheckFailedError('Signature
verification has failed.');
}
return decryptedFile;
});
}
authEncryptFile(file, recipients, options = {}) {
return __awaiter$3(this, void 0, void 0, function* () {
const chunkSize = options.chunkSize ? options.chunkSize :
64 * 1024;
if (!Number.isInteger(chunkSize))
throw TypeError('chunkSize should be an integer
value');
const fileSize = file.size;
const privateKey = yield
this.keyLoader.loadLocalPrivateKey();
if (!privateKey)
throw new RegisterRequiredError();
const publicKeys =
this.getPublicKeysForEncryption(privateKey, recipients);
if (!publicKeys) {
throw new TypeError('Could not get public keys from the
second argument.\n' +
'Make sure you pass the resolved value of
"EThree.findUsers" or "EThree.lookupPublicKeys" methods ' +
'when encrypting for other users, or nothing when
encrypting for the current user only.');
}
const streamCipher =
this.virgilCrypto.createStreamSignAndEncrypt(privateKey, publicKeys, true);
const encryptedChunksPromise = new Promise((resolve,
reject) => {
const encryptedChunks = [];
encryptedChunks.push(streamCipher.start(fileSize));
const onChunkCallback = (chunk, offset) => {
encryptedChunks.push(streamCipher.update(this.toData(chunk)));
if (options.onProgress) {
options.onProgress({
bytesProcessed: offset,
fileSize: fileSize,
});
}
};
const onFinishCallback = () => {
encryptedChunks.push(streamCipher.final());
resolve(encryptedChunks);
};
const onErrorCallback = (err) => {
reject(err);
streamCipher.dispose();
};
processFile({
file,
chunkSize,
onChunkCallback,
onFinishCallback,
onErrorCallback,
signal: options.signal,
});
});
const encryptedChunks = yield encryptedChunksPromise;
if (isFile$1(file))
return new File(encryptedChunks, file.name, { type:
file.type });
return new Blob(encryptedChunks, { type: file.type });
});
}
/**
* Decrypts and verifies integrity of File or Blob for recipient
public key. If there is no recipient
* and the message is encrypted for the current user, omit the
public key parameter. You can define
* chunk size and a callback, that will be invoked on each chunk.
*
* The file will be read twice during this method execution:
* 1. To decrypt encrypted file.
* 2. To verify the validity of the signature over the decrypted
file for the public key.
*/
authDecryptFile(file, senderCardOrPublicKey, options = {}) {
return __awaiter$3(this, void 0, void 0, function* () {
const fileSize = file.size;
const chunkSize = options.chunkSize ? options.chunkSize :
64 * 1024;
if (!Number.isInteger(chunkSize))
throw TypeError('chunkSize should be an integer
value');
const privateKey = (yield
this.keyLoader.loadLocalPrivateKey());
if (!privateKey)
throw new RegisterRequiredError();
const publicKey =
this.getPublicKeyForVerification(privateKey, senderCardOrPublicKey,
options.encryptedOn);
if (!publicKey) {
throw new TypeError('Could not get public key from the
second argument.' +
'Expected a Virgil Card or a Public Key object. Got
' +
typeof senderCardOrPublicKey);
}
const streamDecipher =
this.virgilCrypto.createStreamDecryptAndVerify();
const decryptedChunksPromise = new Promise((resolve,
reject) => {
const decryptedChunks = [];
streamDecipher.start(privateKey);
const onChunkCallback = (chunk, offset) => {
decryptedChunks.push(streamDecipher.update(this.toData(chunk)));
if (options.onProgress) {
options.onProgress({
bytesProcessed: offset,
fileSize: fileSize,
});
}
};
const onFinishCallback = () => {
decryptedChunks.push(streamDecipher.final());
streamDecipher.verify(publicKey);
streamDecipher.dispose();
resolve(decryptedChunks);
};
const onErrorCallback = (err) => {
streamDecipher.dispose();
reject(err);
};
processFile({
file,
chunkSize,
onChunkCallback,
onFinishCallback,
onErrorCallback,
signal: options.signal,
});
});
const decryptedFile = yield decryptedChunksPromise;
if (isFile$1(file))
return new File(decryptedFile, file.name, { type:
file.type });
return new Blob(decryptedFile, { type: file.type });
});
}
encryptSharedFile(file, options = {}) {
return __awaiter$3(this, void 0, void 0, function* () {
const chunkSize = options.chunkSize ? options.chunkSize :
64 * 1024;
if (!Number.isInteger(chunkSize))
throw TypeError('chunkSize should be an integer
value');
const fileSize = file.size;
const privateKey = (yield
this.keyLoader.loadLocalPrivateKey());
const { privateKey: fileKey, publicKey: filePublicKey } =
this.virgilCrypto.generateKeys();
const streamCipher =
this.virgilCrypto.createStreamSignAndEncrypt(privateKey, filePublicKey, true);
const encryptedChunksPromise = new Promise((resolve,
reject) => {
const encryptedChunks = [];
encryptedChunks.push(streamCipher.start(fileSize));
const onChunkCallback = (chunk, offset) => {
encryptedChunks.push(streamCipher.update(this.toData(chunk)));
if (options.onProgress) {
options.onProgress({
bytesProcessed: offset,
fileSize: fileSize,
});
}
};
const onFinishCallback = () => {
encryptedChunks.push(streamCipher.final());
resolve(encryptedChunks);
};
const onErrorCallback = (err) => {
reject(err);
streamCipher.dispose();
};
processFile({
file,
chunkSize,
onChunkCallback,
onFinishCallback,
onErrorCallback,
signal: options.signal,
});
});
const encryptedChunks = yield encryptedChunksPromise;
const encryptedSharedFile = isFile$1(file)
? new File(encryptedChunks, file.name, { type:
file.type })
: new Blob(encryptedChunks, { type: file.type });
return {
encryptedSharedFile,
fileKey: this.virgilCrypto.exportPrivateKey(fileKey),
};
});
}
/**
* Decrypts File or Blob with `fileKey` and verifies integrity with
`senderCardOrPublicKey`. If there is no recipient
* and the message is encrypted for the current user, omit the
`senderCardOrPublicKey` parameter. You can define
* chunk size and a callback, that will be invoked on each chunk.
*
*/
decryptSharedFile(file, fileKey, senderCardOrPublicKey, options =
{}) {
return __awaiter$3(this, void 0, void 0, function* () {
const fileSize = file.size;
const chunkSize = options.chunkSize ? options.chunkSize :
64 * 1024;
if (!Number.isInteger(chunkSize))
throw TypeError('chunkSize should be an integer
value');
const privateKey = (yield
this.keyLoader.loadLocalPrivateKey());
if (!privateKey)
throw new RegisterRequiredError();
const publicKey =
this.getPublicKeyForVerification(privateKey, senderCardOrPublicKey,
options.encryptedOn);
if (!publicKey) {
throw new TypeError('Could not get public key from the
second argument.' +
'Expected a Virgil Card or a Public Key object. Got
' +
typeof senderCardOrPublicKey);
}
const formatedFileKey =
this.virgilCrypto.importPrivateKey(fileKey);
const streamDecipher =
this.virgilCrypto.createStreamDecryptAndVerify();
const decryptedChunksPromise = new Promise((resolve,
reject) => {
const decryptedChunks = [];
streamDecipher.start(formatedFileKey);
const onChunkCallback = (chunk, offset) => {
decryptedChunks.push(streamDecipher.update(this.toData(chunk)));
if (options.onProgress) {
options.onProgress({
bytesProcessed: offset,
fileSize: fileSize,
});
}
};
const onFinishCallback = () => {
decryptedChunks.push(streamDecipher.final());
streamDecipher.verify(publicKey);
streamDecipher.dispose();
resolve(decryptedChunks);
};
const onErrorCallback = (err) => {
streamDecipher.dispose();
reject(err);
};
processFile({
file,
chunkSize,
onChunkCallback,
onFinishCallback,
onErrorCallback,
signal: options.signal,
});
});
const decryptedFile = yield decryptedChunksPromise;
if (isFile$1(file))
return new File(decryptedFile, file.name, { type:
file.type });
return new Blob(decryptedFile, { type: file.type });
});
}
/**
* @hidden
*/
static getFoundationLibraryOptions(options) {
return options.foundationWasmPath
? { foundation: [{ locateFile: () =>
options.foundationWasmPath }] }
: undefined;
}
/**
* @hidden
*/
static getPythiaLibraryOptions(options) {
return options.pythiaWasmPath
? { pythia: [{ locateFile: () =>
options.pythiaWasmPath }] }
: undefined;
}
/**
* @hidden
*/
static prepareConstructorParams(identity, options) {
const opts = Object.assign({ apiUrl: DEFAULT_API_URL,
storageName: DEFAULT_STORAGE_NAME, groupStorageName: DEFAULT_GROUP_STORAGE_NAME,
useSha256Identifiers: false }, options);
const accessTokenProvider = opts.accessTokenProvider;
const keyEntryStorage = opts.keyEntryStorage || new
KeyEntryStorage(opts.storageName);
const virgilCrypto = new Ct({ useSha256Identifiers:
opts.useSha256Identifiers });
const cardCrypto = new t(virgilCrypto);
const brainKeyCrypto = new k$2();
const cardVerifier = new VirgilCardVerifier(cardCrypto, {
verifySelfSignature: opts.apiUrl === DEFAULT_API_URL,
verifyVirgilSignature: opts.apiUrl === DEFAULT_API_URL,
});
const keyLoader = new PrivateKeyLoader(identity, {
accessTokenProvider,
virgilCrypto,
brainKeyCrypto,
keyEntryStorage,
apiUrl: opts.apiUrl,
});
const cardManager = new CardManager({
cardCrypto,
cardVerifier,
accessTokenProvider,
retryOnUnauthorized: true,
apiUrl: opts.apiUrl,
productInfo: {
// eslint-disable-next-line @typescript-eslint/no-non-
null-assertion
product: "e3kit",
// eslint-disable-next-line @typescript-eslint/no-non-
null-assertion
version: "2.4.5",
},
});
// eslint-disable-next-line @typescript-eslint/no-non-null-
assertion
const groupStorageLeveldown = levelJs(opts.groupStorageName);
return {
identity,
virgilCrypto,
cardManager,
accessTokenProvider,
keyEntryStorage,
keyLoader,
groupStorageLeveldown,
keyPairType: options.keyPairType,
};
}
/**
* @hidden
*/
isPublicKey(publicKey) {
return publicKey instanceof yt;
}
}
exports.AbortError = AbortError;
exports.EThree = EThree;
exports.GroupError = GroupError;
exports.IdentityAlreadyExistsError = IdentityAlreadyExistsError;
exports.IntegrityCheckFailedError = IntegrityCheckFailedError;
exports.LookupError = LookupError;
exports.LookupNotFoundError = LookupNotFoundError;
exports.MissingPrivateKeyError = MissingPrivateKeyError;
exports.MultipleCardsError = MultipleCardsError;
exports.PrivateKeyAlreadyExistsError = PrivateKeyAlreadyExistsError;
exports.PrivateKeyNoBackupError = PrivateKeyNoBackupError;
exports.RegisterRequiredError = RegisterRequiredError;
exports.SdkError = SdkError;
exports.VIRGIL_STREAM_DECRYPTING_STATE =
VIRGIL_STREAM_DECRYPTING_STATE;
exports.VIRGIL_STREAM_ENCRYPTING_STATE =
VIRGIL_STREAM_ENCRYPTING_STATE;
exports.VIRGIL_STREAM_SIGNING_STATE = VIRGIL_STREAM_SIGNING_STATE;
exports.VIRGIL_STREAM_VERIFYING_STATE = VIRGIL_STREAM_VERIFYING_STATE;
exports.WrongKeyknoxPasswordError = WrongKeyknoxPasswordError;