Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Olm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
Olm
Commits
974e0984
Commit
974e0984
authored
9 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
Update the javascript bindings and demo to match the format of the identity key JSON
parent
3a382aec
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/olm/account.hh
+1
-1
1 addition, 1 deletion
include/olm/account.hh
javascript/demo.html
+8
-2
8 additions, 2 deletions
javascript/demo.html
javascript/olm_post.js
+18
-3
18 additions, 3 deletions
javascript/olm_post.js
src/account.cpp
+1
-1
1 addition, 1 deletion
src/account.cpp
with
28 additions
and
7 deletions
include/olm/account.hh
+
1
−
1
View file @
974e0984
...
@@ -96,7 +96,7 @@ struct Account {
...
@@ -96,7 +96,7 @@ struct Account {
std
::
uint8_t
const
*
device_id
,
std
::
size_t
device_id_length
,
std
::
uint8_t
const
*
device_id
,
std
::
size_t
device_id_length
,
std
::
uint64_t
valid_after_ts
,
std
::
uint64_t
valid_after_ts
,
std
::
uint64_t
valid_until_ts
,
std
::
uint64_t
valid_until_ts
,
std
::
uint8_t
*
identity_
keys
,
std
::
size_t
identity_
keys
_length
std
::
uint8_t
*
identity_
json
,
std
::
size_t
identity_
json
_length
);
);
OneTimeKey
const
*
lookup_key
(
OneTimeKey
const
*
lookup_key
(
...
...
This diff is collapsed.
Click to expand it.
javascript/demo.html
+
8
−
2
View file @
974e0984
...
@@ -29,10 +29,16 @@ document.addEventListener("DOMContentLoaded", function (event) {
...
@@ -29,10 +29,16 @@ document.addEventListener("DOMContentLoaded", function (event) {
tasks
.
push
([
"
alice
"
,
"
Creating account
"
,
function
()
{
alice
.
create
()
}]);
tasks
.
push
([
"
alice
"
,
"
Creating account
"
,
function
()
{
alice
.
create
()
}]);
tasks
.
push
([
"
bob
"
,
"
Creating account
"
,
function
()
{
bob
.
create
()
}]);
tasks
.
push
([
"
bob
"
,
"
Creating account
"
,
function
()
{
bob
.
create
()
}]);
tasks
.
push
([
"
alice
"
,
"
Create outbound session
"
,
function
()
{
tasks
.
push
([
"
alice
"
,
"
Create outbound session
"
,
function
()
{
var
bobs_keys_1
=
JSON
.
parse
(
bob
.
identity_keys
())[
0
];
var
bobs_id_keys
=
JSON
.
parse
(
bob
.
identity_keys
(
"
bob
"
,
"
bob_device
"
,
0
,
0
));
var
bobs_curve25519_key
;
for
(
key
in
bobs_id_keys
.
keys
)
{
if
(
key
.
startsWith
(
"
curve25519:
"
))
{
bobs_curve25519_key
=
bobs_id_keys
.
keys
[
key
];
}
}
var
bobs_keys_2
=
JSON
.
parse
(
bob
.
one_time_keys
())[
1
];
var
bobs_keys_2
=
JSON
.
parse
(
bob
.
one_time_keys
())[
1
];
a_session
.
create_outbound
(
a_session
.
create_outbound
(
alice
,
bobs_
keys_1
[
1
]
,
bobs_keys_2
[
0
],
bobs_keys_2
[
1
]
alice
,
bobs_
curve25519_key
,
bobs_keys_2
[
0
],
bobs_keys_2
[
1
]
);
);
}]);
}]);
tasks
.
push
([
"
alice
"
,
"
Encrypt first message
"
,
function
()
{
tasks
.
push
([
"
alice
"
,
"
Encrypt first message
"
,
function
()
{
...
...
This diff is collapsed.
Click to expand it.
javascript/olm_post.js
+
18
−
3
View file @
974e0984
...
@@ -63,13 +63,28 @@ Account.prototype['create'] = restore_stack(function() {
...
@@ -63,13 +63,28 @@ Account.prototype['create'] = restore_stack(function() {
);
);
});
});
Account
.
prototype
[
'
identity_keys
'
]
=
restore_stack
(
function
()
{
Account
.
prototype
[
'
identity_keys
'
]
=
restore_stack
(
function
(
user_id
,
device_id
,
valid_after
,
valid_until
)
{
var
user_id_array
=
array_from_string
(
user_id
);
var
device_id_array
=
array_from_string
(
device_id
);
var
keys_length
=
account_method
(
var
keys_length
=
account_method
(
Module
[
'
_olm_account_identity_keys_length
'
]
Module
[
'
_olm_account_identity_keys_length
'
]
)(
this
.
ptr
);
)(
this
.
ptr
,
user_id_array
.
length
,
device_id_array
.
length
,
valid_after
,
valid_after
/
Math
.
pow
(
2
,
32
),
valid_until
,
valid_until
/
Math
.
pow
(
2
,
32
)
);
var
user_id_buffer
=
stack
(
user_id_array
);
var
device_id_buffer
=
stack
(
device_id_array
);
var
keys
=
stack
(
keys_length
);
var
keys
=
stack
(
keys_length
);
account_method
(
Module
[
'
_olm_account_identity_keys
'
])(
account_method
(
Module
[
'
_olm_account_identity_keys
'
])(
this
.
ptr
,
keys
,
keys_length
this
.
ptr
,
user_id_buffer
,
user_id_array
.
length
,
device_id_buffer
,
device_id_array
.
length
,
valid_after
,
valid_after
/
Math
.
pow
(
2
,
32
),
valid_until
,
valid_until
/
Math
.
pow
(
2
,
32
),
keys
,
keys_length
);
);
return
Pointer_stringify
(
keys
,
keys_length
);
return
Pointer_stringify
(
keys
,
keys_length
);
});
});
...
...
This diff is collapsed.
Click to expand it.
src/account.cpp
+
1
−
1
View file @
974e0984
...
@@ -170,8 +170,8 @@ std::size_t olm::Account::get_identity_json_length(
...
@@ -170,8 +170,8 @@ std::size_t olm::Account::get_identity_json_length(
std
::
size_t
olm
::
Account
::
get_identity_json
(
std
::
size_t
olm
::
Account
::
get_identity_json
(
std
::
uint8_t
const
*
user_id
,
std
::
size_t
user_id_length
,
std
::
uint8_t
const
*
user_id
,
std
::
size_t
user_id_length
,
std
::
uint8_t
const
*
device_id
,
std
::
size_t
device_id_length
,
std
::
uint8_t
const
*
device_id
,
std
::
size_t
device_id_length
,
std
::
uint64_t
valid_until_ts
,
std
::
uint64_t
valid_after_ts
,
std
::
uint64_t
valid_after_ts
,
std
::
uint64_t
valid_until_ts
,
std
::
uint8_t
*
identity_json
,
std
::
size_t
identity_json_length
std
::
uint8_t
*
identity_json
,
std
::
size_t
identity_json_length
)
{
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment