@dyne/interfacer-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +264 -0
- package/dist/index.cjs +2352 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1092 -0
- package/dist/index.d.ts +1092 -0
- package/dist/index.js +2275 -0
- package/dist/index.js.map +1 -0
- package/package.json +75 -0
- package/src/zenflows-crypto/src/keypairoomClient-8-9-10-11-12.zen +127 -0
- package/src/zenflows-crypto/src/keypairoomClientRecreateKeys.zen +67 -0
- package/src/zenflows-crypto/src/sign_graphql.zen +30 -0
- package/src/zenflows-crypto/src/verify_graphql.zen +44 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
# Copyright (C) 2022-2023 Dyne.org foundation <foundation@dyne.org>.
|
|
3
|
+
#
|
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
|
5
|
+
# it under the terms of the GNU Affero General Public License as
|
|
6
|
+
# published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
# License, or (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU Affero General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
|
|
17
|
+
Scenario 'ecdh': Create the key
|
|
18
|
+
Scenario 'ethereum': Create key
|
|
19
|
+
Scenario 'reflow': Create the key
|
|
20
|
+
Scenario 'eddsa': Create the key
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Loading the user name from data
|
|
24
|
+
Given my name is in a 'string' named 'username'
|
|
25
|
+
|
|
26
|
+
# Loading the answers from 3 secret questions. The user will have to pick the 3 challenges from a list
|
|
27
|
+
# and have to remember the questions - the order is not important cause Zenroom will sort alphabetically
|
|
28
|
+
# the data in input
|
|
29
|
+
#
|
|
30
|
+
# NOTE: the challenges will never be communicated to the server or to anybody else!
|
|
31
|
+
Given I have a 'string dictionary' named 'userChallenges'
|
|
32
|
+
|
|
33
|
+
# Loading the individual challenges, in order to have them hashed
|
|
34
|
+
# and the hashes OPTIONALLY stored by the server, to improve regeneration of the keypair
|
|
35
|
+
Given I have a 'string' named 'whereParentsMet' in 'userChallenges'
|
|
36
|
+
Given I have a 'string' named 'nameFirstPet' in 'userChallenges'
|
|
37
|
+
Given I have a 'string' named 'whereHomeTown' in 'userChallenges'
|
|
38
|
+
Given I have a 'string' named 'nameFirstTeacher' in 'userChallenges'
|
|
39
|
+
Given I have a 'string' named 'nameMotherMaid' in 'userChallenges'
|
|
40
|
+
|
|
41
|
+
# Loading the pbkdf received from the server, containing a signed hash of known data
|
|
42
|
+
Given that I have a 'base64' named 'seedServerSideShard.HMAC'
|
|
43
|
+
|
|
44
|
+
# Save the backup for mnemonic dump, before factoring with the salt
|
|
45
|
+
# it is shortened to 16 bytes by hashing sha512 the KDF and taking the first 16 bytes
|
|
46
|
+
When I create the key derivation of 'userChallenges'
|
|
47
|
+
and I create the hash of 'key derivation' using 'sha512'
|
|
48
|
+
and I split the leftmost '16' bytes of 'hash'
|
|
49
|
+
and I delete the 'key derivation'
|
|
50
|
+
and I delete the 'hash'
|
|
51
|
+
and I rename the 'leftmost' to 'seed'
|
|
52
|
+
|
|
53
|
+
# Hash again the user's challenges with salt for the seed root
|
|
54
|
+
When I rename 'seedServerSideShard.HMAC' to 'salt'
|
|
55
|
+
and I create the key derivation of 'seed' with password 'salt'
|
|
56
|
+
and I rename the 'key derivation' to 'seed.root'
|
|
57
|
+
|
|
58
|
+
# In the following flow the order should NOT be changed
|
|
59
|
+
|
|
60
|
+
When I create the hash of 'seed.root'
|
|
61
|
+
When I rename the 'hash' to 'seed.ecdh'
|
|
62
|
+
|
|
63
|
+
When I create the hash of 'seed.ecdh'
|
|
64
|
+
When I rename the 'hash' to 'seed.eddsa'
|
|
65
|
+
|
|
66
|
+
When I create the hash of 'seed.eddsa'
|
|
67
|
+
When I rename the 'hash' to 'seed.ethereum'
|
|
68
|
+
|
|
69
|
+
When I create the hash of 'seed.ethereum'
|
|
70
|
+
When I rename the 'hash' to 'seed.reflow'
|
|
71
|
+
|
|
72
|
+
When I create the hash of 'seed.reflow'
|
|
73
|
+
When I rename the 'hash' to 'seed.bitcoin'
|
|
74
|
+
|
|
75
|
+
# end of the sorted creation flow
|
|
76
|
+
|
|
77
|
+
When I create the ecdh key with secret key 'seed.ecdh'
|
|
78
|
+
When I create the eddsa key with secret key 'seed.eddsa'
|
|
79
|
+
When I create the ethereum key with secret key 'seed.ethereum'
|
|
80
|
+
When I create the reflow key with secret key 'seed.reflow'
|
|
81
|
+
When I create the bitcoin key with secret key 'seed.bitcoin'
|
|
82
|
+
|
|
83
|
+
When I create the ecdh public key
|
|
84
|
+
When I create the eddsa public key
|
|
85
|
+
When I create the ethereum address
|
|
86
|
+
When I create the reflow public key
|
|
87
|
+
When I create the bitcoin public key
|
|
88
|
+
|
|
89
|
+
# Creating the hashes of the single challenges, to OPTIONALLY help
|
|
90
|
+
# regeneration of the keypair
|
|
91
|
+
|
|
92
|
+
# When I create the 'base64 dictionary'
|
|
93
|
+
# and I rename the 'base64 dictionary' to 'hashedAnswers'
|
|
94
|
+
|
|
95
|
+
# When I create the key derivation of 'whereParentsMet'
|
|
96
|
+
# and I rename the 'key derivation' to 'whereParentsMet.kdf'
|
|
97
|
+
# When I move 'whereParentsMet.kdf' in 'hashedAnswers'
|
|
98
|
+
|
|
99
|
+
# When I create the key derivation of 'nameFirstPet'
|
|
100
|
+
# and I rename the 'key derivation' to 'nameFirstPet.kdf'
|
|
101
|
+
# When I move 'nameFirstPet.kdf' in 'hashedAnswers'
|
|
102
|
+
|
|
103
|
+
# When I create the key derivation of 'whereHomeTown'
|
|
104
|
+
# and I rename the 'key derivation' to 'whereHomeTown.kdf'
|
|
105
|
+
# When I move 'whereHomeTown.kdf' in 'hashedAnswers'
|
|
106
|
+
|
|
107
|
+
# When I create the key derivation of 'nameFirstTeacher'
|
|
108
|
+
# and I rename the 'key derivation' to 'nameFirstTeacher.kdf'
|
|
109
|
+
# When I move 'nameFirstTeacher.kdf' in 'hashedAnswers'
|
|
110
|
+
|
|
111
|
+
# When I create the key derivation of 'nameMotherMaid'
|
|
112
|
+
# and I rename the 'key derivation' to 'nameMotherMaid.kdf'
|
|
113
|
+
# When I move 'nameMotherMaid.kdf' in 'hashedAnswers'
|
|
114
|
+
|
|
115
|
+
# this prints the hashes of the challenges
|
|
116
|
+
# Then print the 'hashedAnswers'
|
|
117
|
+
|
|
118
|
+
Then print the 'keyring'
|
|
119
|
+
|
|
120
|
+
# This prints the seed for the private keys as mnemonic
|
|
121
|
+
Then print the 'seed' as 'mnemonic'
|
|
122
|
+
|
|
123
|
+
Then print the 'ecdh public key' as 'base58'
|
|
124
|
+
Then print the 'eddsa public key' as 'base58'
|
|
125
|
+
Then print the 'ethereum address'
|
|
126
|
+
Then print the 'reflow public key' as 'base58'
|
|
127
|
+
Then print the 'bitcoin public key' as 'base58'
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
# Copyright (C) 2022-2023 Dyne.org foundation <foundation@dyne.org>.
|
|
3
|
+
#
|
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
|
5
|
+
# it under the terms of the GNU Affero General Public License as
|
|
6
|
+
# published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
# License, or (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU Affero General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
|
|
17
|
+
Scenario 'ecdh': Create the key
|
|
18
|
+
Scenario 'ethereum': Create key
|
|
19
|
+
Scenario 'reflow': Create the key
|
|
20
|
+
Scenario 'eddsa': Create the key
|
|
21
|
+
|
|
22
|
+
# here we load the seed as a mnemonic
|
|
23
|
+
Given I have a 'mnemonic' named 'seed'
|
|
24
|
+
and I have a 'base64' named 'seedServerSideShard.HMAC'
|
|
25
|
+
|
|
26
|
+
When I rename 'seedServerSideShard.HMAC' to 'salt'
|
|
27
|
+
and I create the key derivation of 'seed' with password 'salt'
|
|
28
|
+
and I rename the 'key derivation' to 'seed.root'
|
|
29
|
+
|
|
30
|
+
# SKs generation
|
|
31
|
+
# In this flow the order should NOT be changed
|
|
32
|
+
When I create the hash of 'seed.root'
|
|
33
|
+
When I rename the 'hash' to 'seed.ecdh'
|
|
34
|
+
When I create the hash of 'seed.ecdh'
|
|
35
|
+
When I rename the 'hash' to 'seed.eddsa'
|
|
36
|
+
When I create the hash of 'seed.eddsa'
|
|
37
|
+
When I rename the 'hash' to 'seed.ethereum'
|
|
38
|
+
When I create the hash of 'seed.ethereum'
|
|
39
|
+
When I rename the 'hash' to 'seed.reflow'
|
|
40
|
+
When I create the hash of 'seed.reflow'
|
|
41
|
+
When I rename the 'hash' to 'seed.bitcoin'
|
|
42
|
+
|
|
43
|
+
When I create the ecdh key with secret key 'seed.ecdh'
|
|
44
|
+
When I create the eddsa key with secret key 'seed.eddsa'
|
|
45
|
+
When I create the ethereum key with secret key 'seed.ethereum'
|
|
46
|
+
When I create the reflow key with secret key 'seed.reflow'
|
|
47
|
+
When I create the bitcoin key with secret key 'seed.bitcoin'
|
|
48
|
+
|
|
49
|
+
# PKs generation
|
|
50
|
+
When I create the ecdh public key
|
|
51
|
+
When I create the eddsa public key
|
|
52
|
+
When I create the ethereum address
|
|
53
|
+
When I create the reflow public key
|
|
54
|
+
When I create the bitcoin public key
|
|
55
|
+
|
|
56
|
+
# This prints the keyring containing the SKs
|
|
57
|
+
Then print the 'keyring'
|
|
58
|
+
|
|
59
|
+
# This prints the PKs, one object each
|
|
60
|
+
Then print the 'ecdh public key' as 'base58'
|
|
61
|
+
Then print the 'eddsa public key' as 'base58'
|
|
62
|
+
Then print the 'ethereum address'
|
|
63
|
+
Then print the 'reflow public key' as 'base58'
|
|
64
|
+
Then print the 'bitcoin public key' as 'base58'
|
|
65
|
+
|
|
66
|
+
# This prints the seed for the private keys as mnemonic
|
|
67
|
+
Then print the 'seed' as 'mnemonic'
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
# Copyright (C) 2022-2023 Dyne.org foundation <foundation@dyne.org>.
|
|
3
|
+
#
|
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
|
5
|
+
# it under the terms of the GNU Affero General Public License as
|
|
6
|
+
# published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
# License, or (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU Affero General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
|
|
17
|
+
Scenario eddsa: sign a graph query
|
|
18
|
+
Given I have a 'base64' named 'gql'
|
|
19
|
+
Given I have the 'keyring'
|
|
20
|
+
|
|
21
|
+
# Fix Apollo's mingling with query string
|
|
22
|
+
When I remove spaces in 'gql'
|
|
23
|
+
and I compact ascii strings in 'gql'
|
|
24
|
+
|
|
25
|
+
When I create the eddsa signature of 'gql'
|
|
26
|
+
And I create the hash of 'gql'
|
|
27
|
+
|
|
28
|
+
Then print 'eddsa signature' as 'base64'
|
|
29
|
+
Then print 'gql' as 'base64'
|
|
30
|
+
Then print 'hash' as 'hex'
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
# Copyright (C) 2022-2023 Dyne.org foundation <foundation@dyne.org>.
|
|
3
|
+
#
|
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
|
5
|
+
# it under the terms of the GNU Affero General Public License as
|
|
6
|
+
# published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
# License, or (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU Affero General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
|
|
17
|
+
Scenario eddsa: verify the signature of a graph query
|
|
18
|
+
|
|
19
|
+
Given I have a 'base64' named 'gql'
|
|
20
|
+
Given I have a 'base64' named 'eddsa signature'
|
|
21
|
+
Given I have a 'base58' named 'eddsa public key'
|
|
22
|
+
|
|
23
|
+
# check that the graph query is reentrant
|
|
24
|
+
# When I create the count of char '{' found in 'graphql'
|
|
25
|
+
# and I rename 'count' to 'open'
|
|
26
|
+
# and I create the count of char '}' found in 'graphql'
|
|
27
|
+
# and I remove 'count'
|
|
28
|
+
# and I remove 'open'
|
|
29
|
+
# When I create the count of char '(' found in 'graphql'
|
|
30
|
+
# and I rename 'count' to 'open'
|
|
31
|
+
# and I create the count of char ')' found in 'graphql'
|
|
32
|
+
# and I remove 'count'
|
|
33
|
+
# and I remove 'open'
|
|
34
|
+
# When I create the count of char '[' found in 'graphql'
|
|
35
|
+
# and I rename 'count' to 'open'
|
|
36
|
+
# and I create the count of char ']' found in 'graphql'
|
|
37
|
+
# and I verify 'count' is equal to 'open'
|
|
38
|
+
|
|
39
|
+
# Fix Apollo's mingling with query string
|
|
40
|
+
When I remove spaces in 'gql'
|
|
41
|
+
and I compact ascii strings in 'gql'
|
|
42
|
+
When I verify the 'gql' has a eddsa signature in 'eddsa signature' by 'eddsa public key'
|
|
43
|
+
|
|
44
|
+
Then print the string '1'
|