matrix-js-sdk
Version:
Matrix Client-Server SDK for Javascript
1,729 lines (1,625 loc) • 8.23 MB
JavaScript
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){(function (){
let imports = {};
imports['__wbindgen_placeholder__'] = module.exports;
let wasm;
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
let cachedUint8Memory0 = new Uint8Array();
function getUint8Memory0() {
if (cachedUint8Memory0.byteLength === 0) {
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8Memory0;
}
function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}
const heap = new Array(32).fill(undefined);
heap.push(undefined, null, true, false);
let heap_next = heap.length;
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
heap[idx] = obj;
return idx;
}
function getObject(idx) { return heap[idx]; }
function dropObject(idx) {
if (idx < 36) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
let WASM_VECTOR_LEN = 0;
let cachedTextEncoder = new TextEncoder('utf-8');
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
? function (arg, view) {
return cachedTextEncoder.encodeInto(arg, view);
}
: function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
});
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length);
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len);
const mem = getUint8Memory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3);
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
offset += ret.written;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
function isLikeNone(x) {
return x === undefined || x === null;
}
let cachedInt32Memory0 = new Int32Array();
function getInt32Memory0() {
if (cachedInt32Memory0.byteLength === 0) {
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachedInt32Memory0;
}
let cachedFloat64Memory0 = new Float64Array();
function getFloat64Memory0() {
if (cachedFloat64Memory0.byteLength === 0) {
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return cachedFloat64Memory0;
}
function debugString(val) {
// primitive types
const type = typeof val;
if (type == 'number' || type == 'boolean' || val == null) {
return `${val}`;
}
if (type == 'string') {
return `"${val}"`;
}
if (type == 'symbol') {
const description = val.description;
if (description == null) {
return 'Symbol';
} else {
return `Symbol(${description})`;
}
}
if (type == 'function') {
const name = val.name;
if (typeof name == 'string' && name.length > 0) {
return `Function(${name})`;
} else {
return 'Function';
}
}
// objects
if (Array.isArray(val)) {
const length = val.length;
let debug = '[';
if (length > 0) {
debug += debugString(val[0]);
}
for(let i = 1; i < length; i++) {
debug += ', ' + debugString(val[i]);
}
debug += ']';
return debug;
}
// Test for built-in
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
let className;
if (builtInMatches.length > 1) {
className = builtInMatches[1];
} else {
// Failed to match the standard '[object ClassName]'
return toString.call(val);
}
if (className == 'Object') {
// we're a user defined class or Object
// JSON.stringify avoids problems with cycles, and is generally much
// easier than looping through ownProperties of `val`.
try {
return 'Object(' + JSON.stringify(val) + ')';
} catch (_) {
return 'Object';
}
}
// errors
if (val instanceof Error) {
return `${val.name}: ${val.message}\n${val.stack}`;
}
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}
const CLOSURE_DTORS = new FinalizationRegistry(state => {
wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b)
});
function makeMutClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
const a = state.a;
state.a = 0;
try {
return f(a, state.b, ...args);
} finally {
if (--state.cnt === 0) {
wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
CLOSURE_DTORS.unregister(state)
} else {
state.a = a;
}
}
};
real.original = state;
CLOSURE_DTORS.register(real, state, state);
return real;
}
function __wbg_adapter_38(arg0, arg1, arg2) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h24315f10dc29b428(retptr, arg0, arg1, addHeapObject(arg2));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
function makeClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
try {
return f(state.a, state.b, ...args);
} finally {
if (--state.cnt === 0) {
wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b);
state.a = 0;
CLOSURE_DTORS.unregister(state)
}
}
};
real.original = state;
CLOSURE_DTORS.register(real, state, state);
return real;
}
function __wbg_adapter_41(arg0, arg1) {
wasm._dyn_core__ops__function__Fn_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h547570a0e740e1a5(arg0, arg1);
}
function __wbg_adapter_44(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9f8c3b455b95c8c5(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_47(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h036a3dade9d25772(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_50(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hac2e89ce4055d537(arg0, arg1);
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
function getArrayU8FromWasm0(ptr, len) {
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
function __wbg_adapter_147(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h2e4d3917e135a32c(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
}
/**
* Run some stuff when the Wasm module is instantiated.
*
* Right now, it does the following:
*
* * Redirect Rust panics to JavaScript console.
*/
module.exports.start = function() {
wasm.start();
};
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
return instance.ptr;
}
let stack_pointer = 32;
function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/**
* Who can see a room's history.
*/
module.exports.HistoryVisibility = Object.freeze({
/**
* Previous events are accessible to newly joined members from
* the point they were invited onwards.
*
* Events stop being accessible when the member's state changes
* to something other than *invite* or *join*.
*/
Invited:0,"0":"Invited",
/**
* Previous events are accessible to newly joined members from
* the point they joined the room onwards.
*
* Events stop being accessible when the member's state changes
* to something other than *join*.
*/
Joined:1,"1":"Joined",
/**
* Previous events are always accessible to newly joined members.
*
* All events in the room are accessible, even those sent when
* the member was not a part of the room.
*/
Shared:2,"2":"Shared",
/**
* All events while this is the `HistoryVisibility` value may be
* shared by any participating homeserver with anyone, regardless
* of whether they have ever joined the room.
*/
WorldReadable:3,"3":"WorldReadable", });
/**
* The local trust state of a device.
*/
module.exports.LocalTrust = Object.freeze({
/**
* The device has been verified and is trusted.
*/
Verified:0,"0":"Verified",
/**
* The device been blacklisted from communicating.
*/
BlackListed:1,"1":"BlackListed",
/**
* The trust state of the device is being ignored.
*/
Ignored:2,"2":"Ignored",
/**
* The trust state is unset.
*/
Unset:3,"3":"Unset", });
/**
* Represent the type of a request.
*/
module.exports.RequestType = Object.freeze({
/**
* Represents a `KeysUploadRequest`.
*/
KeysUpload:0,"0":"KeysUpload",
/**
* Represents a `KeysQueryRequest`.
*/
KeysQuery:1,"1":"KeysQuery",
/**
* Represents a `KeysClaimRequest`.
*/
KeysClaim:2,"2":"KeysClaim",
/**
* Represents a `ToDeviceRequest`.
*/
ToDevice:3,"3":"ToDevice",
/**
* Represents a `SignatureUploadRequest`.
*/
SignatureUpload:4,"4":"SignatureUpload",
/**
* Represents a `RoomMessageRequest`.
*/
RoomMessage:5,"5":"RoomMessage",
/**
* Represents a `KeysBackupRequest`.
*/
KeysBackup:6,"6":"KeysBackup", });
/**
* Logger level.
*/
module.exports.LoggerLevel = Object.freeze({
/**
* `TRACE` level.
*
* Designate very low priority, often extremely verbose,
* information.
*/
Trace:0,"0":"Trace",
/**
* `DEBUG` level.
*
* Designate lower priority information.
*/
Debug:1,"1":"Debug",
/**
* `INFO` level.
*
* Designate useful information.
*/
Info:2,"2":"Info",
/**
* `WARN` level.
*
* Designate hazardous situations.
*/
Warn:3,"3":"Warn",
/**
* `ERROR` level.
*
* Designate very serious errors.
*/
Error:4,"4":"Error", });
/**
* List of available verification methods.
*/
module.exports.VerificationMethod = Object.freeze({
/**
* The `m.sas.v1` verification method.
*
* SAS means Short Authentication String.
*/
SasV1:0,"0":"SasV1",
/**
* The `m.qr_code.scan.v1` verification method.
*/
QrCodeScanV1:1,"1":"QrCodeScanV1",
/**
* The `m.qr_code.show.v1` verification method.
*/
QrCodeShowV1:2,"2":"QrCodeShowV1",
/**
* The `m.reciprocate.v1` verification method.
*/
ReciprocateV1:3,"3":"ReciprocateV1", });
/**
* An error code for why the process/request was cancelled by the
* user.
*/
module.exports.CancelCode = Object.freeze({
/**
* Unknown cancel code.
*/
Other:0,"0":"Other",
/**
* The user cancelled the verification.
*/
User:1,"1":"User",
/**
* The verification process timed out.
*
* Verification processes can define their own timeout
* parameters.
*/
Timeout:2,"2":"Timeout",
/**
* The device does not know about the given transaction ID.
*/
UnknownTransaction:3,"3":"UnknownTransaction",
/**
* The device does not know how to handle the requested method.
*
* Should be sent for `m.key.verification.start` messages and
* messages defined by individual verification processes.
*/
UnknownMethod:4,"4":"UnknownMethod",
/**
* The device received an unexpected message.
*
* Typically raised when one of the parties is handling the
* verification out of order.
*/
UnexpectedMessage:5,"5":"UnexpectedMessage",
/**
* The key was not verified.
*/
KeyMismatch:6,"6":"KeyMismatch",
/**
* The expected user did not match the user verified.
*/
UserMismatch:7,"7":"UserMismatch",
/**
* The message received was invalid.
*/
InvalidMessage:8,"8":"InvalidMessage",
/**
* An `m.key.verification.request` was accepted by a different
* device.
*
* The device receiving this error can ignore the verification
* request.
*/
Accepted:9,"9":"Accepted",
/**
* The device receiving this error can ignore the verification
* request.
*/
MismatchedCommitment:10,"10":"MismatchedCommitment",
/**
* The SAS did not match.
*/
MismatchedSas:11,"11":"MismatchedSas", });
/**
* An enum over the different key types a device can have.
*
* Currently devices have a curve25519 and ed25519 keypair. The keys
* transport format is a base64 encoded string, any unknown key type
* will be left as such a string.
*/
module.exports.DeviceKeyName = Object.freeze({
/**
* The curve25519 device key.
*/
Curve25519:0,"0":"Curve25519",
/**
* The ed25519 device key.
*/
Ed25519:1,"1":"Ed25519",
/**
* An unknown device key.
*/
Unknown:2,"2":"Unknown", });
/**
* An encryption algorithm to be used to encrypt messages sent to a
* room.
*/
module.exports.EncryptionAlgorithm = Object.freeze({
/**
* Olm version 1 using Curve25519, AES-256, and SHA-256.
*/
OlmV1Curve25519AesSha2:0,"0":"OlmV1Curve25519AesSha2",
/**
* Megolm version 1 using AES-256 and SHA-256.
*/
MegolmV1AesSha2:1,"1":"MegolmV1AesSha2", });
/**
* The verification state of the device that sent an event to us.
*/
module.exports.VerificationState = Object.freeze({
/**
* The device is trusted.
*/
Trusted:0,"0":"Trusted",
/**
* The device is not trusted.
*/
Untrusted:1,"1":"Untrusted",
/**
* The device is not known to us.
*/
UnknownDevice:2,"2":"UnknownDevice", });
/**
* The basic key algorithm names in the specification.
*/
module.exports.DeviceKeyAlgorithmName = Object.freeze({
/**
* The Ed25519 signature algorithm.
*/
Ed25519:0,"0":"Ed25519",
/**
* The Curve25519 ECDH algorithm.
*/
Curve25519:1,"1":"Curve25519",
/**
* The Curve25519 ECDH algorithm, but the key also contains
* signatures.
*/
SignedCurve25519:2,"2":"SignedCurve25519",
/**
* An unknown device key algorithm.
*/
Unknown:3,"3":"Unknown", });
const AttachmentFinalization = new FinalizationRegistry(ptr => wasm.__wbg_attachment_free(ptr));
/**
* A type to encrypt and to decrypt anything that can fit in an
* `Uint8Array`, usually big buffer.
*/
class Attachment {
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
AttachmentFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_attachment_free(ptr);
}
/**
* Encrypt the content of the `Uint8Array`.
*
* It produces an `EncryptedAttachment`, which can be used to
* retrieve the media encryption information, or the encrypted
* data.
* @param {Uint8Array} array
* @returns {EncryptedAttachment}
*/
static encrypt(array) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(array, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.attachment_encrypt(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return EncryptedAttachment.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Decrypt an `EncryptedAttachment`.
*
* The encrypted attachment can be created manually, or from the
* `encrypt` method.
*
* **Warning**: The encrypted attachment can be used only
* **once**! The encrypted data will still be present, but the
* media encryption info (which contain secrets) will be
* destroyed. It is still possible to get a JSON-encoded backup
* by calling `EncryptedAttachment.mediaEncryptionInfo`.
* @param {EncryptedAttachment} attachment
* @returns {Uint8Array}
*/
static decrypt(attachment) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(attachment, EncryptedAttachment);
wasm.attachment_decrypt(retptr, attachment.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
var r3 = getInt32Memory0()[retptr / 4 + 3];
if (r3) {
throw takeObject(r2);
}
var v0 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v0;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
}
module.exports.Attachment = Attachment;
const CancelInfoFinalization = new FinalizationRegistry(ptr => wasm.__wbg_cancelinfo_free(ptr));
/**
* Information about the cancellation of a verification request or
* verification flow.
*/
class CancelInfo {
static __wrap(ptr) {
const obj = Object.create(CancelInfo.prototype);
obj.ptr = ptr;
CancelInfoFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
CancelInfoFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_cancelinfo_free(ptr);
}
/**
* Get the human readable reason of the cancellation.
* @returns {string}
*/
reason() {
const ret = wasm.cancelinfo_reason(this.ptr);
return takeObject(ret);
}
/**
* Get the `CancelCode` that cancelled this verification.
* @returns {number}
*/
cancelCode() {
const ret = wasm.cancelinfo_cancelCode(this.ptr);
return ret >>> 0;
}
/**
* Was the verification cancelled by us?
* @returns {boolean}
*/
cancelledbyUs() {
const ret = wasm.cancelinfo_cancelledbyUs(this.ptr);
return ret !== 0;
}
}
module.exports.CancelInfo = CancelInfo;
const CrossSigningKeyExportFinalization = new FinalizationRegistry(ptr => wasm.__wbg_crosssigningkeyexport_free(ptr));
/**
* A struct containing private cross signing keys that can be backed
* up or uploaded to the secret store.
*/
class CrossSigningKeyExport {
static __wrap(ptr) {
const obj = Object.create(CrossSigningKeyExport.prototype);
obj.ptr = ptr;
CrossSigningKeyExportFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
CrossSigningKeyExportFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_crosssigningkeyexport_free(ptr);
}
/**
* The seed of the master key encoded as unpadded base64.
* @returns {string | undefined}
*/
get masterKey() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.crosssigningkeyexport_masterKey(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
if (r0 !== 0) {
v0 = getStringFromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
}
return v0;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* The seed of the self signing key encoded as unpadded base64.
* @returns {string | undefined}
*/
get self_signing_key() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.crosssigningkeyexport_self_signing_key(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
if (r0 !== 0) {
v0 = getStringFromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
}
return v0;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* The seed of the user signing key encoded as unpadded base64.
* @returns {string | undefined}
*/
get userSigningKey() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.crosssigningkeyexport_userSigningKey(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
if (r0 !== 0) {
v0 = getStringFromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
}
return v0;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
}
module.exports.CrossSigningKeyExport = CrossSigningKeyExport;
const CrossSigningStatusFinalization = new FinalizationRegistry(ptr => wasm.__wbg_crosssigningstatus_free(ptr));
/**
* Struct representing the state of our private cross signing keys,
* it shows which private cross signing keys we have locally stored.
*/
class CrossSigningStatus {
static __wrap(ptr) {
const obj = Object.create(CrossSigningStatus.prototype);
obj.ptr = ptr;
CrossSigningStatusFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
CrossSigningStatusFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_crosssigningstatus_free(ptr);
}
/**
* Do we have the master key?
* @returns {boolean}
*/
get hasMaster() {
const ret = wasm.crosssigningstatus_hasMaster(this.ptr);
return ret !== 0;
}
/**
* Do we have the self signing key? This one is necessary to sign
* our own devices.
* @returns {boolean}
*/
get hasSelfSigning() {
const ret = wasm.crosssigningstatus_hasSelfSigning(this.ptr);
return ret !== 0;
}
/**
* Do we have the user signing key? This one is necessary to sign
* other users.
* @returns {boolean}
*/
get hasUserSigning() {
const ret = wasm.crosssigningstatus_hasUserSigning(this.ptr);
return ret !== 0;
}
}
module.exports.CrossSigningStatus = CrossSigningStatus;
const Curve25519PublicKeyFinalization = new FinalizationRegistry(ptr => wasm.__wbg_curve25519publickey_free(ptr));
/**
* A Curve25519 public key.
*/
class Curve25519PublicKey {
static __wrap(ptr) {
const obj = Object.create(Curve25519PublicKey.prototype);
obj.ptr = ptr;
Curve25519PublicKeyFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
Curve25519PublicKeyFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_curve25519publickey_free(ptr);
}
/**
* The number of bytes a Curve25519 public key has.
* @returns {number}
*/
get length() {
const ret = wasm.curve25519publickey_length(this.ptr);
return ret >>> 0;
}
/**
* Serialize an Curve25519 public key to an unpadded base64
* representation.
* @returns {string}
*/
toBase64() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.curve25519publickey_toBase64(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);
}
}
}
module.exports.Curve25519PublicKey = Curve25519PublicKey;
const DecryptedRoomEventFinalization = new FinalizationRegistry(ptr => wasm.__wbg_decryptedroomevent_free(ptr));
/**
* A decrypted room event.
*/
class DecryptedRoomEvent {
static __wrap(ptr) {
const obj = Object.create(DecryptedRoomEvent.prototype);
obj.ptr = ptr;
DecryptedRoomEventFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
DecryptedRoomEventFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_decryptedroomevent_free(ptr);
}
/**
* The JSON-encoded decrypted event.
* @returns {string}
*/
get event() {
const ret = wasm.__wbg_get_decryptedroomevent_event(this.ptr);
return takeObject(ret);
}
/**
* The user ID of the event sender, note this is untrusted data
* unless the `verification_state` is as well trusted.
* @returns {UserId | undefined}
*/
get sender() {
const ret = wasm.decryptedroomevent_sender(this.ptr);
return ret === 0 ? undefined : UserId.__wrap(ret);
}
/**
* The device ID of the device that sent us the event, note this
* is untrusted data unless `verification_state` is as well
* trusted.
* @returns {DeviceId | undefined}
*/
get senderDevice() {
const ret = wasm.decryptedroomevent_senderDevice(this.ptr);
return ret === 0 ? undefined : DeviceId.__wrap(ret);
}
/**
* The Curve25519 key of the device that created the megolm
* decryption key originally.
* @returns {string | undefined}
*/
get senderCurve25519Key() {
const ret = wasm.decryptedroomevent_senderCurve25519Key(this.ptr);
return takeObject(ret);
}
/**
* The signing Ed25519 key that have created the megolm key that
* was used to decrypt this session.
* @returns {string | undefined}
*/
get senderClaimedEd25519Key() {
const ret = wasm.decryptedroomevent_senderClaimedEd25519Key(this.ptr);
return takeObject(ret);
}
/**
* Chain of Curve25519 keys through which this session was
* forwarded, via `m.forwarded_room_key` events.
* @returns {Array<any>}
*/
get forwardingCurve25519KeyChain() {
const ret = wasm.decryptedroomevent_forwardingCurve25519KeyChain(this.ptr);
return takeObject(ret);
}
/**
* The verification state of the device that sent us the event,
* note this is the state of the device at the time of
* decryption. It may change in the future if a device gets
* verified or deleted.
* @returns {number | undefined}
*/
get verificationState() {
const ret = wasm.decryptedroomevent_verificationState(this.ptr);
return ret === 3 ? undefined : ret;
}
}
module.exports.DecryptedRoomEvent = DecryptedRoomEvent;
const DeviceFinalization = new FinalizationRegistry(ptr => wasm.__wbg_device_free(ptr));
/**
* A device represents a E2EE capable client of an user.
*/
class Device {
static __wrap(ptr) {
const obj = Object.create(Device.prototype);
obj.ptr = ptr;
DeviceFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
DeviceFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_device_free(ptr);
}
/**
* Request an interactive verification with this device.
* @param {Array<any> | undefined} methods
* @returns {Promise<any>}
*/
requestVerification(methods) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.device_requestVerification(retptr, this.ptr, isLikeNone(methods) ? 0 : addHeapObject(methods));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Is this device considered to be verified.
*
* This method returns true if either the `is_locally_trusted`
* method returns `true` or if the `is_cross_signing_trusted`
* method returns `true`.
* @returns {boolean}
*/
isVerified() {
const ret = wasm.device_isVerified(this.ptr);
return ret !== 0;
}
/**
* Is this device considered to be verified using cross signing.
* @returns {boolean}
*/
isCrossSigningTrusted() {
const ret = wasm.device_isCrossSigningTrusted(this.ptr);
return ret !== 0;
}
/**
* Set the local trust state of the device to the given state.
*
* This won’t affect any cross signing trust state, this only
* sets a flag marking to have the given trust state.
*
* `trust_state` represents the new trust state that should be
* set for the device.
* @param {number} local_state
* @returns {Promise<any>}
*/
setLocalTrust(local_state) {
const ret = wasm.device_setLocalTrust(this.ptr, local_state);
return takeObject(ret);
}
/**
* The user ID of the device owner.
* @returns {UserId}
*/
get userId() {
const ret = wasm.device_userId(this.ptr);
return UserId.__wrap(ret);
}
/**
* The unique ID of the device.
* @returns {DeviceId}
*/
get deviceId() {
const ret = wasm.device_deviceId(this.ptr);
return DeviceId.__wrap(ret);
}
/**
* Get the human readable name of the device.
* @returns {string | undefined}
*/
get displayName() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.device_displayName(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
if (r0 !== 0) {
v0 = getStringFromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
}
return v0;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Get the key of the given key algorithm belonging to this device.
* @param {number} algorithm
* @returns {DeviceKey | undefined}
*/
getKey(algorithm) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.device_getKey(retptr, this.ptr, algorithm);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return r0 === 0 ? undefined : DeviceKey.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Get the Curve25519 key of the given device.
* @returns {Curve25519PublicKey | undefined}
*/
get curve25519Key() {
const ret = wasm.device_curve25519Key(this.ptr);
return ret === 0 ? undefined : Curve25519PublicKey.__wrap(ret);
}
/**
* Get the Ed25519 key of the given device.
* @returns {Ed25519PublicKey | undefined}
*/
get ed25519Key() {
const ret = wasm.device_ed25519Key(this.ptr);
return ret === 0 ? undefined : Ed25519PublicKey.__wrap(ret);
}
/**
* Get a map containing all the device keys.
* @returns {Map<any, any>}
*/
get keys() {
const ret = wasm.device_keys(this.ptr);
return takeObject(ret);
}
/**
* Get a map containing all the device signatures.
* @returns {Signatures}
*/
get signatures() {
const ret = wasm.device_signatures(this.ptr);
return Signatures.__wrap(ret);
}
/**
* Get the trust state of the device.
* @returns {number}
*/
get localTrustState() {
const ret = wasm.device_localTrustState(this.ptr);
return ret >>> 0;
}
/**
* Is the device locally marked as trusted?
* @returns {boolean}
*/
isLocallyTrusted() {
const ret = wasm.device_isLocallyTrusted(this.ptr);
return ret !== 0;
}
/**
* Is the device locally marked as blacklisted?
*
* Blacklisted devices won’t receive any group sessions.
* @returns {boolean}
*/
isBlacklisted() {
const ret = wasm.device_isBlacklisted(this.ptr);
return ret !== 0;
}
/**
* Is the device deleted?
* @returns {boolean}
*/
isDeleted() {
const ret = wasm.device_isDeleted(this.ptr);
return ret !== 0;
}
}
module.exports.Device = Device;
const DeviceIdFinalization = new FinalizationRegistry(ptr => wasm.__wbg_deviceid_free(ptr));
/**
* A Matrix key ID.
*
* Device identifiers in Matrix are completely opaque character
* sequences. This type is provided simply for its semantic value.
*/
class DeviceId {
static __wrap(ptr) {
const obj = Object.create(DeviceId.prototype);
obj.ptr = ptr;
DeviceIdFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
DeviceIdFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_deviceid_free(ptr);
}
/**
* Create a new `DeviceId`.
* @param {string} id
*/
constructor(id) {
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.deviceid_new(ptr0, len0);
return DeviceId.__wrap(ret);
}
/**
* Return the device ID as a string.
* @returns {string}
*/
toString() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.deviceid_toString(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);
}
}
}
module.exports.DeviceId = DeviceId;
const DeviceKeyFinalization = new FinalizationRegistry(ptr => wasm.__wbg_devicekey_free(ptr));
/**
* An enum over the different key types a device can have.
*
* Currently devices have a curve25519 and ed25519 keypair. The keys
* transport format is a base64 encoded string, any unknown key type
* will be left as such a string.
*/
class DeviceKey {
static __wrap(ptr) {
const obj = Object.create(DeviceKey.prototype);
obj.ptr = ptr;
DeviceKeyFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
DeviceKeyFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_devicekey_free(ptr);
}
/**
* Get the name of the device key.
* @returns {number}
*/
get name() {
const ret = wasm.devicekey_name(this.ptr);
return ret >>> 0;
}
/**
* Get the value associated to the `Curve25519` device key name.
* @returns {Curve25519PublicKey | undefined}
*/
get curve25519() {
const ret = wasm.devicekey_curve25519(this.ptr);
return ret === 0 ? undefined : Curve25519PublicKey.__wrap(ret);
}
/**
* Get the value associated to the `Ed25519` device key name.
* @returns {Ed25519PublicKey | undefined}
*/
get ed25519() {
const ret = wasm.devicekey_ed25519(this.ptr);
return ret === 0 ? undefined : Ed25519PublicKey.__wrap(ret);
}
/**
* Get the value associated to the `Unknown` device key name.
* @returns {string | undefined}
*/
get unknown() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.devicekey_unknown(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
if (r0 !== 0) {
v0 = getStringFromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
}
return v0;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Convert the `DeviceKey` into a base64 encoded string.
* @returns {string}
*/
toBase64() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.devicekey_toBase64(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);
}
}
}
module.exports.DeviceKey = DeviceKey;
const DeviceKeyAlgorithmFinalization = new FinalizationRegistry(ptr => wasm.__wbg_devicekeyalgorithm_free(ptr));
/**
* The basic key algorithms in the specification.
*/
class DeviceKeyAlgorithm {
static __wrap(ptr) {
const obj = Object.create(DeviceKeyAlgorithm.prototype);
obj.ptr = ptr;
DeviceKeyAlgorithmFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
DeviceKeyAlgorithmFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_devicekeyalgorithm_free(ptr);
}
/**
* Read the device key algorithm's name. If the name is
* `Unknown`, one may be interested by the `to_string` method to
* read the original name.
* @returns {number}
*/
get name() {
const ret = wasm.devicekeyalgorithm_name(this.ptr);
return ret >>> 0;
}
/**
* Return the device key algorithm as a string.
* @returns {string}
*/
toString() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.devicekeyalgorithm_toString(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);
}
}
}
module.exports.DeviceKeyAlgorithm = DeviceKeyAlgorithm;
const DeviceKeyIdFinalization = new FinalizationRegistry(ptr => wasm.__wbg_devicekeyid_free(ptr));
/**
* A Matrix device key ID.
*
* A key algorithm and a device ID, combined with a ‘:’.
*/
class DeviceKeyId {
static __wrap(ptr) {
const obj = Object.create(DeviceKeyId.prototype);
obj.ptr = ptr;
DeviceKeyIdFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
DeviceKeyIdFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_devicekeyid_free(ptr);
}
/**
* Parse/validate and create a new `DeviceKeyId`.
* @param {string} id
*/
constructor(id) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.devicekeyid_new(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return DeviceKeyId.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Returns key algorithm of the device key ID.
* @returns {DeviceKeyAlgorithm}
*/
get algorithm() {
const ret = wasm.devicekeyid_algorithm(this.ptr);
return DeviceKeyAlgorithm.__wrap(ret);
}
/**
* Returns device ID of the device key ID.
* @returns {DeviceId}
*/
get deviceId() {
const ret = wasm.devicekeyid_deviceId(this.ptr);
return DeviceId.__wrap(ret);
}
/**
* Return the device key ID as a string.
* @returns {string}
*/
toString() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.devicekeyid_toString(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);
}
}
}
module.exports.DeviceKeyId = DeviceKeyId;
const DeviceListsFinalization = new FinalizationRegistry(ptr => wasm.__wbg_devicelists_free(ptr));
/**
* Information on E2E device updates.
*/
class DeviceLists {
static __wrap(ptr) {
const obj = Object.create(DeviceLists.prototype);
obj.ptr = ptr;
DeviceListsFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
DeviceListsFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_devicelists_free(ptr);
}
/**
* Create an empty `DeviceLists`.
*
* `changed` and `left` must be an array of `UserId`.
* @param {Array<any> | undefined} changed
* @param {Array<any> | undefined} left
*/
constructor(changed, left) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.devicelists_new(retptr, isLikeNone(changed) ? 0 : addHeapObject(changed), isLikeNone(left) ? 0 : addHeapObject(left));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return DeviceLists.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Returns true if there are no device list updates.
* @returns {boolean}
*/
isEmpty() {
const ret = wasm.devicelists_isEmpty(this.ptr);
return ret !== 0;
}
/**
* List of users who have updated their device identity keys or
* who now share an encrypted room with the client since the
* previous sync
* @returns {Array<any>}
*/
get changed() {
const ret = wasm.devicelists_changed(this.ptr);
return takeObject(ret);
}
/**
* List of users who no longer share encrypted rooms since the
* previous sync response.
* @returns {Array<any>}
*/
get left() {
const ret = wasm.devicelists_left(this.ptr);
return takeObject(ret);
}
}
module.exports.DeviceLists = DeviceLists;
const Ed25519PublicKeyFinalization = new FinalizationRegistry(ptr => wasm.__wbg_ed25519publickey_free(ptr));
/**
* An Ed25519 public key, used to verify digital signatures.
*/
class Ed25519PublicKey {
static __wrap(ptr) {
const obj = Object.create(Ed25519PublicKey.prototype);
obj.ptr = ptr;
Ed25519PublicKeyFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
Ed25519PublicKeyFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_ed25519publickey_free(ptr);
}
/**
* The number of bytes an Ed25519 public key has.
* @returns {number}
*/
get length() {
const ret = wasm.ed25519publickey_length(this.ptr);
return ret >>> 0;
}
/**
* Serialize an Ed25519 public key to an unpadded base64
* representation.
* @returns {string}
*/
toBase64() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.ed25519publickey_toBase64(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);
}
}
}
module.exports.Ed25519PublicKey = Ed25519PublicKey;
const Ed25519SignatureFinalization = new FinalizationRegistry(ptr => wasm.__wbg_ed25519signature_free(ptr));
/**
* An Ed25519 digital signature, can be used to verify the
* authenticity of a message.
*/
class Ed25519Signature {
static __wrap(ptr) {
const obj = Object.create(Ed25519Signature.prototype);
obj.ptr = ptr;
Ed25519SignatureFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
Ed25519SignatureFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_ed25519signature_free(ptr);
}
/**
* Try to create an Ed25519 signature from an unpadded base64
* representation.
* @param {string} signature
*/
constructor(signature) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.ed25519signature_new(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return Ed25519Signature.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Serialize a Ed25519 signature to an unpadded base64
* representation.
* @returns {string}
*/
toBase64() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.ed25519signature_toBase64(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);
}
}
}
module.exports.Ed25519Signature = Ed25519Signature;
const EmojiFinalization = new FinalizationRegistry(ptr => wasm.__wbg_emoji_free(ptr));
/**
* An emoji that is used for interactive verification using a short
* auth string.
*
* This will contain a single emoji and description from the list of
* emojis from [the specification].
*
* [the specification]: https://spec.matrix.org/unstable/client-server-api/#sas-method-emoji
*/
class Emoji {
static __wrap(ptr) {
const obj = Object.create(Emoji.prototype);
obj.ptr = ptr;
EmojiFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
EmojiFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_emoji_free(ptr);