Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Gateway MsgApi SDK - Java

License

NotificationsYou must be signed in to change notification settings

simmac/threema-msgapi-sdk-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Version:1.1.3-CE

An automatically created documentation of this SDK can be foundhere.

Notes about this version

This is a fork of theoriginal repo after it was announced that it is no longer maintained by Threema.As this is the community version of the Threema Gateway Java SDK it may contain additional changes compared to the official one downloadable from the Threema website. If you are looking for an exact mirror of the downloadable Threema version you can switch to the branchofficial.

The contributors of this repository are not affiliated with Threema or the Threema GmbH.

Installation

NOTE: This instructions are copied fromhttps://gateway.threema.ch/en/developer/howto/create-keys/java.

Install Java:

If you don't have a Java runtime installed yet, go tojava.com to download one for your platform.

Download and unzip the Java API tool:

You can either download theprecompiled .jar file or clone the repository and build the tool on your own

Generate a keypair by running the tool

Open a shell (on Windows open the command line) and go to the directory where you have extracted the ZIP.Create a new private and public key by typing the following command:java -jar threema-msgapi-tool.jar -g privateKey.txt publicKey.txtA new key pair will be generated. The private key will be saved in privateKey.txt and the public key in publicKey.txt. Both keys are formatted in hexadecimal with a prefix that indicates the key type.IMPORTANT: Create a backup (or preferrably multiple backups) of your private key! If you lose it, your custom Threema ID will be unusable. We have no way to recover lost private keys for you, and it is also not possible to assign a new key to an existing ID.

Request custom Threema ID and submit key

Log in to your profile on the Threema Gateway website, click on "ID" in the navigation bar and then "Request Threema ID".Choose End-to-End mode, enter the desired ID, and copy & paste thepublic key from the publicKey.txt file.

Wait for review

Wait until your custom Threema ID has been reviewed and accepted. As this is a manual process, it may take several days.

When your ID has been accepted, you will receive an API secret for authentication with the service.

Console client usage

###Local operations (no network communication)####Encryptjava -jar threema-msgapi-tool.jar -e Encrypt standard input using the given sender private key and recipient public key. Prints two lines to standard output: first the nonce (hex), and then the box (hex).

####Decryptjava -jar threema-msgapi-tool.jar -d Decrypt standard input using the given recipient private key and sender public key. The nonce must be given on the command line, and the box (hex) on standard input. Prints the decrypted message to standard output.

####Hash Email Addressjava -jar threema-msgapi-tool.jar -h -e Hash an email address for identity lookup. Prints the hash in hex.

####Hash Phone Numberjava -jar threema-msgapi-tool.jar -h -p Hash a phone number for identity lookup. Prints the hash in hex.

####Generate Key Pairjava -jar threema-msgapi-tool.jar -g Generate a new key pair and write the private and public keys to the respective files (in hex).

####Derive Public Keyjava -jar threema-msgapi-tool.jar -p Derive the public key that corresponds with the given private key.

###Network operations####Send Simple Messagejava -jar threema-msgapi-tool.jar -s Send a message from standard input with server-side encryption to the given ID. 'from' is the API identity and 'secret' is the API secret. Returns the message ID on success.

####Send End-to-End Encrypted Text Messagejava -jar threema-msgapi-tool.jar -S Encrypt standard input and send the message to the given ID. 'from' is the API identity and 'secret' is the API secret. Prints the message ID on success.

####Send End-to-End Encrypted Image Messagejava -jar threema-msgapi-tool.jar -S -i Encrypt standard input and send the message to the given ID. 'from' is the API identity and 'secret' is the API secret. Prints the message ID on success.

####Send End-to-End Encrypted File Messagejava -jar threema-msgapi-tool.jar -S -f [thumbnail]Encrypt the file (and thumbnail) and send a file message to the given ID. 'from' is the API identity and 'secret' is the API secret. Prints the message ID on success.

####ID Lookup By Email Addressjava -jar threema-msgapi-tool.jar -l -e Lookup the ID linked to the given email address (will be hashed locally).

####ID Lookup By Phone Numberjava -jar threema-msgapi-tool.jar -l -p Lookup the ID linked to the given phone number (will be hashed locally).

####Fetch Public Keyjava -jar threema-msgapi-tool.jar -l -k Lookup the public key for the given ID.

####Fetch Capabilityjava -jar threema-msgapi-tool.jar -c Fetch the capability of a Threema ID

####Decrypt and downloadjava -jar threema-msgapi-tool.jar -D [outputFolder]Decrypt a box (box from the stdin) message and download (if the message is a image or file message) the file(s) to the defined directory

Feature Levels

LevelTextCapabilitiesImageFileCredits
1X
2XXXX
3XXXXX

You can see the implemented feature level by invoking the following command:

$ java -jar threema-msgapi-tool.jar -v

Contributing

Nice to see you want to contribute. We may periodically send patches to Threema to make it possible for them to implement them in the official SDK version.

Other platforms (PHP and Python)

All repositories on GitHub are no longer maintained by the Threema GmbH. However, the community has forked the repositories of all platforms and they are now maintained unofficially.

You can find the PHP repository atrugk/threema-msgapi-sdk-php
and the Python repository atlgrahl/threema-msgapi-sdk-python.


[8]ページ先頭

©2009-2025 Movatter.jp