Libomemo.js 0.0.1 – OMEMO crypto library for JavaScript

neustradamus1 pts0 comments

Release 0.0.1 · conversejs/libomemo.js · GitHub

//releases/show" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

//releases/show;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

conversejs

libomemo.js

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>11

0.0.1

Latest

Latest

Compare

Choose a tag to compare

Sorry, something went wrong.

Filter

Loading

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

No results found

View all tags

jcbrand

released this

15 May 13:26

&middot;

5 commits

to master<br>since this release

v0.0.1

This tag was signed with the committer’s verified signature .

jcbrand<br>JC Brand

GPG key ID: D48D88C41B3A34E6

Verified

Learn about vigilant mode.

7aab601

This commit was signed with the committer’s verified signature .

jcbrand<br>JC Brand

GPG key ID: D48D88C41B3A34E6

Verified

Learn about vigilant mode.

Note: This version still targets XMPP OMEMO version 0.3.0. Support for the latest version of OMEMO will be added in a subsequent release.

Here follows a breakdown of changes made to the original libsignal-protocol-javascript which this library is a fork of:

Breaking: Multiple public functions converted to async

Many functions were converted from returning plain Promises to being async functions. This changes how validation errors are surfaced:

Validation errors no longer throw synchronously. Previously, passing invalid arguments would throw a TypeError immediately. These errors are now returned as rejected promises.

Synchronous try/catch no longer works. Code like this will silently miss the error and produce an unhandled rejection:

// TypeError is never caught here<br>try {<br>KeyHelper.generatePreKey("bad");<br>} catch (e) {<br>// never reached

Callers must handle the returned promise. Always use .then()/.catch() or await:

// Correct usage<br>try {<br>await KeyHelper.generatePreKey(keyId);<br>} catch (e) {<br>// handles validation errors and crypto failures

Affected functions

KeyHelper:

KeyHelper.generateSignedPreKey(identityKeyPair, keyId)

KeyHelper.generatePreKey(keyId)

Curve.async:

Curve.async.generateKeyPair()

Curve.async.createKeyPair(privKey)

Curve.async.calculateAgreement(pubKey, privKey)

Curve.async.verifySignature(pubKey, msg, sig)

Curve.async.calculateSignature(privKey, message)

FingerprintGenerator:

FingerprintGenerator.prototype.createFor(localIdentifier, localIdentityKey, remoteIdentifier, remoteIdentityKey)

SessionCipher:

SessionCipher.prototype.decryptWhisperMessage(buffer, encoding)

SessionCipher.prototype.getRemoteRegistrationId()

SessionCipher.prototype.hasOpenSession()

SessionCipher.prototype.closeOpenSessionForDevice()

SessionCipher.prototype.deleteAllSessionsForDevice()

crypto.js exports:

encrypt(key, data, iv)

decrypt(key, data, iv)

sign(key, data)

HKDFInternal(input, salt, info)

verifyMAC(data, key, mac, length)

internalCrypto.createKeyPair(privKey)

internalCrypto.ECDHE(pubKey, privKey)

internalCrypto.Ed25519Sign(privKey, message)

internalCrypto.Ed25519Verify(pubKey, msg, sig)

createKeyPair(privKey)

ECDHE(pubKey, privKey)

Ed25519Sign(privKey, message)

Ed25519Verify(pubKey, msg, sig)

Full TypeScript Rewrite

All source files have been migrated from JavaScript to TypeScript with strict type checking. The library now ships bundled .d.ts type declarations.

Module System

ES modules with named exports are now the primary distribution format.

UMD bundle available as libomemo.umd.js with a libomemo global (replaces the old libsignal global).

The Internal namespace has been removed. All functionality is exported directly.

Package Renamed

Package name is now libomemo.js (was libsignal-protocol-javascript).

Repository moved to github:conversejs/libomemo.js.

Removed Dependencies

dcodeIO.ByteBuffer — removed. Use util.toString() and util.toArrayBuffer() or native TextEncoder/Uint8Array.

Long — removed.

dcodeIO.ProtoBuf — replaced with protobufjs v8. Proto files are loaded from string variables at build time (no network fetch needed).

OMEMOAddress (formerly SignalProtocolAddress)

Renamed from SignalProtocolAddress to OMEMOAddress.

Added static OMEMOAddress.fromString(encodedAddress)...

privkey async libomemo curve pubkey prototype

Related Articles