当前位置: 首页>>代码示例>>Java>>正文


Java KeyHelper.generateRegistrationId方法代码示例

本文整理汇总了Java中org.whispersystems.libsignal.util.KeyHelper.generateRegistrationId方法的典型用法代码示例。如果您正苦于以下问题:Java KeyHelper.generateRegistrationId方法的具体用法?Java KeyHelper.generateRegistrationId怎么用?Java KeyHelper.generateRegistrationId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.whispersystems.libsignal.util.KeyHelper的用法示例。


在下文中一共展示了KeyHelper.generateRegistrationId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createNewIdentity

import org.whispersystems.libsignal.util.KeyHelper; //导入方法依赖的package包/类
public void createNewIdentity() {
    IdentityKeyPair identityKey = KeyHelper.generateIdentityKeyPair();
    int registrationId = KeyHelper.generateRegistrationId(false);
    signalProtocolStore = new JsonSignalProtocolStore(identityKey, registrationId);
    groupStore = new JsonGroupStore();
    registered = false;
    save();
}
 
开发者ID:AsamK,项目名称:signal-cli,代码行数:9,代码来源:Manager.java

示例2: handleSmsRegistrationIntent

import org.whispersystems.libsignal.util.KeyHelper; //导入方法依赖的package包/类
private void handleSmsRegistrationIntent(Intent intent) {
  markAsVerifying(true);

  String  number         = intent.getStringExtra(NUMBER_EXTRA);
  boolean supportsGcm    = intent.getBooleanExtra(GCM_SUPPORTED_EXTRA, true);
  int     registrationId = TextSecurePreferences.getLocalRegistrationId(this);
  boolean supportsVideo  = TextSecurePreferences.isWebrtcCallingEnabled(this) || !supportsGcm;

  if (registrationId == 0) {
    registrationId = KeyHelper.generateRegistrationId(false);
    TextSecurePreferences.setLocalRegistrationId(this, registrationId);
  }

  String password     = Util.getSecret(18);
  String signalingKey = Util.getSecret(52);

  try {
    initializeChallengeListener();

    setState(new RegistrationState(RegistrationState.STATE_CONNECTING, number));
    SignalServiceAccountManager accountManager = AccountManagerFactory.createManager(this, number, password);
    accountManager.requestSmsVerificationCode();

    setState(new RegistrationState(RegistrationState.STATE_VERIFYING, number));
    String challenge = waitForChallenge();
    accountManager.verifyAccountWithCode(challenge, signalingKey, registrationId, true, supportsVideo, !supportsGcm);

    handleCommonRegistration(accountManager, number, password, signalingKey, supportsGcm);
    markAsVerified(number, password, signalingKey);

    setState(new RegistrationState(RegistrationState.STATE_COMPLETE, number));
    broadcastComplete(true);
  } catch (ExpectationFailedException efe) {
    Log.w("RegistrationService", efe);
    setState(new RegistrationState(RegistrationState.STATE_MULTI_REGISTERED, number));
    broadcastComplete(false);
  } catch (UnsupportedOperationException uoe) {
    Log.w("RegistrationService", uoe);
    setState(new RegistrationState(RegistrationState.STATE_GCM_UNSUPPORTED, number));
    broadcastComplete(false);
  } catch (AccountVerificationTimeoutException avte) {
    Log.w("RegistrationService", avte);
    setState(new RegistrationState(RegistrationState.STATE_TIMEOUT, number, password));
    broadcastComplete(false);
  } catch (IOException e) {
    Log.w("RegistrationService", e);
    setState(new RegistrationState(RegistrationState.STATE_NETWORK_ERROR, number));
    broadcastComplete(false);
  } finally {
    shutdownChallengeListener();
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:53,代码来源:RegistrationService.java

示例3: handleSmsRegistrationIntent

import org.whispersystems.libsignal.util.KeyHelper; //导入方法依赖的package包/类
private void handleSmsRegistrationIntent(Intent intent) {
  markAsVerifying(true);

  String  number         = intent.getStringExtra(NUMBER_EXTRA);
  boolean supportsGcm    = false;
  int     registrationId = KeyHelper.generateRegistrationId(false);
  TextSecurePreferences.setLocalRegistrationId(this, registrationId);
  SessionUtil.archiveAllSessions(this);

  try {
    String password     = Util.getSecret(18);
    String signalingKey = Util.getSecret(52);

    initializeChallengeListener();

    setState(new RegistrationState(RegistrationState.STATE_CONNECTING, number));
    SignalServiceAccountManager accountManager = AccountManagerFactory.createManager(this, number, password);
    accountManager.requestSmsVerificationCode();

    setState(new RegistrationState(RegistrationState.STATE_VERIFYING, number));
    String challenge = waitForChallenge();
    accountManager.verifyAccountWithCode(challenge, signalingKey, registrationId, !supportsGcm);

    handleCommonRegistration(accountManager, number, password, signalingKey, supportsGcm);
    markAsVerified(number, password, signalingKey);

    setState(new RegistrationState(RegistrationState.STATE_COMPLETE, number));
    broadcastComplete(true);
  } catch (ExpectationFailedException efe) {
    Log.w("RegistrationService", efe);
    setState(new RegistrationState(RegistrationState.STATE_MULTI_REGISTERED, number));
    broadcastComplete(false);
  } catch (UnsupportedOperationException uoe) {
    Log.w("RegistrationService", uoe);
    setState(new RegistrationState(RegistrationState.STATE_GCM_UNSUPPORTED, number));
    broadcastComplete(false);
  } catch (AccountVerificationTimeoutException avte) {
    Log.w("RegistrationService", avte);
    setState(new RegistrationState(RegistrationState.STATE_TIMEOUT, number));
    broadcastComplete(false);
  } catch (IOException e) {
    Log.w("RegistrationService", e);
    setState(new RegistrationState(RegistrationState.STATE_NETWORK_ERROR, number));
    broadcastComplete(false);
  } finally {
    shutdownChallengeListener();
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:49,代码来源:RegistrationService.java

示例4: generateRegistrationId

import org.whispersystems.libsignal.util.KeyHelper; //导入方法依赖的package包/类
private static int generateRegistrationId() {
	Log.i(Config.LOGTAG, AxolotlService.LOGPREFIX + " : " + "Generating axolotl registration ID...");
	return KeyHelper.generateRegistrationId(true);
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:5,代码来源:SQLiteAxolotlStore.java

示例5: generateLocalRegistrationId

import org.whispersystems.libsignal.util.KeyHelper; //导入方法依赖的package包/类
private int generateLocalRegistrationId() {
    final int rid = KeyHelper.generateRegistrationId(false);
    SignalPreferences.setLocalRegistrationId(rid);
    return rid;
}
 
开发者ID:toshiapp,项目名称:toshi-android-client,代码行数:6,代码来源:ProtocolStore.java

示例6: generateRegistrationId

import org.whispersystems.libsignal.util.KeyHelper; //导入方法依赖的package包/类
private static int generateRegistrationId() {
    Log.i(Config.LOGTAG, AxolotlService.LOGPREFIX + " : " + "Generating axolotl registration ID...");
    return KeyHelper.generateRegistrationId(true);
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:5,代码来源:SQLiteAxolotlStore.java

示例7: generateRegistrationId

import org.whispersystems.libsignal.util.KeyHelper; //导入方法依赖的package包/类
private static int generateRegistrationId() {
  return KeyHelper.generateRegistrationId(false);
}
 
开发者ID:signalapp,项目名称:libsignal-protocol-java,代码行数:4,代码来源:TestInMemorySignalProtocolStore.java


注:本文中的org.whispersystems.libsignal.util.KeyHelper.generateRegistrationId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。