Class: SelfCrypto::OutboundSession
- Defined in:
- ext/self_crypto/session.c
Instance Method Summary collapse
Methods inherited from Session
#decrypt, #encrypt, from_pickle, #has_received_message, #id, #last_error, #to_pickle, #will_receive?
Constructor Details
#initialize(account, identity, one_time_key) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'ext/self_crypto/session.c', line 45 static VALUE initialize_outbound(VALUE self, VALUE account, VALUE identity, VALUE one_time_key) { size_t size; OlmSession *this; OlmAccount *a; Data_Get_Struct(self, OlmSession, this); Data_Get_Struct(account, OlmAccount, a); size = olm_create_outbound_session_random_length(this); if(rb_obj_is_instance_of(account, rb_eval_string("SelfCrypto::Account")) != Qtrue){ rb_raise(rb_eTypeError, "account must be an instance of SelfCrypto::Account"); } if(rb_obj_is_kind_of(identity, rb_eval_string("String")) != Qtrue){ rb_raise(rb_eTypeError, "identity must be kind of String"); } if(rb_obj_is_kind_of(one_time_key, rb_eval_string("String")) != Qtrue){ rb_raise(rb_eTypeError, "one_time_key must be kind of String"); } if(olm_create_outbound_session(this, a, RSTRING_PTR(identity), RSTRING_LEN(identity), RSTRING_PTR(one_time_key), RSTRING_LEN(one_time_key), RSTRING_PTR(get_random(size)), size ) == olm_error()){ raise_olm_error(olm_session_last_error(this)); } return self; } |