@oxy.so/services 14.5.0 → 14.6.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/android/src/main/java/so/oxy/identity/OxyIdentityModule.kt +55 -0
- package/ios/OxyIdentityModule.swift +13 -0
- package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts +11 -0
- package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/identityCrypto.d.ts +11 -0
- package/lib/typescript/module/ui/utils/identityCrypto.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -28,6 +28,15 @@ import expo.modules.kotlin.modules.ModuleDefinition
|
|
|
28
28
|
* | `proveIdentity(challenge)` | `proveIdentity` | `{ publicKey, signature, timestamp }` |
|
|
29
29
|
* | `deriveScopedSeed(info)` | `deriveScopedSeed` | seed hex |
|
|
30
30
|
* | `signSocialReceive(index, digest)` | `signSocialReceive` | `{ signature, publicKey }` |
|
|
31
|
+
* | `describeOrganization(accountId)` | `describe` + `accountId` | `{ v, publicKey, accountId }` |
|
|
32
|
+
* | `deriveOrganizationScopedSeed(info, accountId)` | `deriveScopedSeed` + `accountId` | `{ seed, accountId }` |
|
|
33
|
+
* | `signOrganizationSocialReceive(index, digest, accountId)` | `signSocialReceive` + `accountId` | `{ signature, publicKey, accountId }` |
|
|
34
|
+
*
|
|
35
|
+
* The organization functions (ADR 0061 D6) ask for an organization key Commons
|
|
36
|
+
* holds, by the organization's account id. Commons echoes `accountId` in its
|
|
37
|
+
* answer, and an answer that does not echo the id asked for is `null`: a Commons
|
|
38
|
+
* that predates organization keys ignores the extra and answers for the
|
|
39
|
+
* PERSONAL identity, which must never be taken for an organization's.
|
|
31
40
|
*
|
|
32
41
|
* Every failure — Commons not installed, no identity, the caller refused, an
|
|
33
42
|
* exception — resolves `null`, and the JS side (`@oxy.so/protocol`'s
|
|
@@ -83,8 +92,53 @@ class OxyIdentityModule : Module() {
|
|
|
83
92
|
else mapOf(KEY_SIGNATURE to signature, KEY_PUBLIC_KEY to publicKey)
|
|
84
93
|
}
|
|
85
94
|
}
|
|
95
|
+
|
|
96
|
+
AsyncFunction("describeOrganization") { accountId: String ->
|
|
97
|
+
ask(METHOD_DESCRIBE, organizationExtras(accountId)) { bundle ->
|
|
98
|
+
val publicKey = bundle.getString(KEY_PUBLIC_KEY)
|
|
99
|
+
if (publicKey.isNullOrEmpty() || !echoes(bundle, accountId)) null
|
|
100
|
+
else mapOf(
|
|
101
|
+
KEY_VERSION to bundle.getInt(KEY_VERSION),
|
|
102
|
+
KEY_PUBLIC_KEY to publicKey,
|
|
103
|
+
KEY_ACCOUNT_ID to accountId,
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
AsyncFunction("deriveOrganizationScopedSeed") { info: String, accountId: String ->
|
|
109
|
+
val extras = organizationExtras(accountId).apply { putString(KEY_INFO, info) }
|
|
110
|
+
ask(METHOD_DERIVE_SCOPED_SEED, extras) { bundle ->
|
|
111
|
+
val seed = bundle.getString(KEY_SEED)
|
|
112
|
+
if (seed.isNullOrEmpty() || !echoes(bundle, accountId)) null
|
|
113
|
+
else mapOf(KEY_SEED to seed, KEY_ACCOUNT_ID to accountId)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
AsyncFunction("signOrganizationSocialReceive") { index: Int, digest: String, accountId: String ->
|
|
118
|
+
val extras = organizationExtras(accountId).apply {
|
|
119
|
+
putInt(KEY_INDEX, index)
|
|
120
|
+
putString(KEY_DIGEST, digest)
|
|
121
|
+
}
|
|
122
|
+
ask(METHOD_SIGN_SOCIAL_RECEIVE, extras) { bundle ->
|
|
123
|
+
val signature = bundle.getString(KEY_SIGNATURE)
|
|
124
|
+
val publicKey = bundle.getString(KEY_PUBLIC_KEY)
|
|
125
|
+
if (signature.isNullOrEmpty() || publicKey.isNullOrEmpty() || !echoes(bundle, accountId)) null
|
|
126
|
+
else mapOf(
|
|
127
|
+
KEY_SIGNATURE to signature,
|
|
128
|
+
KEY_PUBLIC_KEY to publicKey,
|
|
129
|
+
KEY_ACCOUNT_ID to accountId,
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
86
133
|
}
|
|
87
134
|
|
|
135
|
+
private fun organizationExtras(accountId: String): Bundle =
|
|
136
|
+
Bundle().apply { putString(KEY_ACCOUNT_ID, accountId) }
|
|
137
|
+
|
|
138
|
+
/** Whether Commons answered for the organization asked for, not for the person. */
|
|
139
|
+
private fun echoes(bundle: Bundle, accountId: String): Boolean =
|
|
140
|
+
bundle.getString(KEY_ACCOUNT_ID) == accountId
|
|
141
|
+
|
|
88
142
|
/**
|
|
89
143
|
* Call [method] on the first Commons authority that answers, and read the
|
|
90
144
|
* answer with [read]. An authority that is absent, refuses, or throws is
|
|
@@ -116,6 +170,7 @@ class OxyIdentityModule : Module() {
|
|
|
116
170
|
private const val KEY_SEED = "seed"
|
|
117
171
|
private const val KEY_INDEX = "index"
|
|
118
172
|
private const val KEY_DIGEST = "digest"
|
|
173
|
+
private const val KEY_ACCOUNT_ID = "accountId"
|
|
119
174
|
|
|
120
175
|
/**
|
|
121
176
|
* Commons hosts its identity at "${applicationId}.identity": the prod app
|
|
@@ -28,5 +28,18 @@ public class OxyIdentityModule: Module {
|
|
|
28
28
|
AsyncFunction("signSocialReceive") { (_ index: Int, _ digest: String) -> [String: String]? in
|
|
29
29
|
return nil
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
// Organization keys (ADR 0061 D6) are in the same keychain group on iOS.
|
|
33
|
+
AsyncFunction("describeOrganization") { (_ accountId: String) -> [String: String]? in
|
|
34
|
+
return nil
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
AsyncFunction("deriveOrganizationScopedSeed") { (_ info: String, _ accountId: String) -> [String: String]? in
|
|
38
|
+
return nil
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
AsyncFunction("signOrganizationSocialReceive") { (_ index: Int, _ digest: String, _ accountId: String) -> [String: String]? in
|
|
42
|
+
return nil
|
|
43
|
+
}
|
|
31
44
|
}
|
|
32
45
|
}
|
|
@@ -15,6 +15,17 @@ export declare const loadIdentityCrypto: () => Promise<{
|
|
|
15
15
|
IdentityUnavailableError: typeof import("@oxy.so/core/crypto").IdentityUnavailableError;
|
|
16
16
|
readIdentityMarker: typeof import("@oxy.so/core/crypto").readIdentityMarker;
|
|
17
17
|
updateIdentityMarker: typeof import("@oxy.so/core/crypto").updateIdentityMarker;
|
|
18
|
+
generateOrganizationKey: typeof import("@oxy.so/core/crypto").generateOrganizationKey;
|
|
19
|
+
organizationKeyFromPhrase: typeof import("@oxy.so/core/crypto").organizationKeyFromPhrase;
|
|
20
|
+
storeOrganizationKey: typeof import("@oxy.so/core/crypto").storeOrganizationKey;
|
|
21
|
+
getOrganizationPublicKey: typeof import("@oxy.so/core/crypto").getOrganizationPublicKey;
|
|
22
|
+
getOrganizationPrivateKey: typeof import("@oxy.so/core/crypto").getOrganizationPrivateKey;
|
|
23
|
+
getOrganizationRecoveryPhrase: typeof import("@oxy.so/core/crypto").getOrganizationRecoveryPhrase;
|
|
24
|
+
listOrganizationKeys: typeof import("@oxy.so/core/crypto").listOrganizationKeys;
|
|
25
|
+
deleteOrganizationKey: typeof import("@oxy.so/core/crypto").deleteOrganizationKey;
|
|
26
|
+
syncOrganizationKeys: typeof import("@oxy.so/core/crypto").syncOrganizationKeys;
|
|
27
|
+
isOrganizationAccountId: typeof import("@oxy.so/core/crypto").isOrganizationAccountId;
|
|
28
|
+
isHealthyOrganizationKeyPair: typeof import("@oxy.so/core/crypto").isHealthyOrganizationKeyPair;
|
|
18
29
|
SignatureService: typeof import("@oxy.so/core/crypto").SignatureService;
|
|
19
30
|
RecoveryPhraseService: typeof import("@oxy.so/core/crypto").RecoveryPhraseService;
|
|
20
31
|
BACKUP_KDF_ENCRYPTION_INFO: "oxy-backup-encryption-key";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC"}
|
|
@@ -15,6 +15,17 @@ export declare const loadIdentityCrypto: () => Promise<{
|
|
|
15
15
|
IdentityUnavailableError: typeof import("@oxy.so/core/crypto").IdentityUnavailableError;
|
|
16
16
|
readIdentityMarker: typeof import("@oxy.so/core/crypto").readIdentityMarker;
|
|
17
17
|
updateIdentityMarker: typeof import("@oxy.so/core/crypto").updateIdentityMarker;
|
|
18
|
+
generateOrganizationKey: typeof import("@oxy.so/core/crypto").generateOrganizationKey;
|
|
19
|
+
organizationKeyFromPhrase: typeof import("@oxy.so/core/crypto").organizationKeyFromPhrase;
|
|
20
|
+
storeOrganizationKey: typeof import("@oxy.so/core/crypto").storeOrganizationKey;
|
|
21
|
+
getOrganizationPublicKey: typeof import("@oxy.so/core/crypto").getOrganizationPublicKey;
|
|
22
|
+
getOrganizationPrivateKey: typeof import("@oxy.so/core/crypto").getOrganizationPrivateKey;
|
|
23
|
+
getOrganizationRecoveryPhrase: typeof import("@oxy.so/core/crypto").getOrganizationRecoveryPhrase;
|
|
24
|
+
listOrganizationKeys: typeof import("@oxy.so/core/crypto").listOrganizationKeys;
|
|
25
|
+
deleteOrganizationKey: typeof import("@oxy.so/core/crypto").deleteOrganizationKey;
|
|
26
|
+
syncOrganizationKeys: typeof import("@oxy.so/core/crypto").syncOrganizationKeys;
|
|
27
|
+
isOrganizationAccountId: typeof import("@oxy.so/core/crypto").isOrganizationAccountId;
|
|
28
|
+
isHealthyOrganizationKeyPair: typeof import("@oxy.so/core/crypto").isHealthyOrganizationKeyPair;
|
|
18
29
|
SignatureService: typeof import("@oxy.so/core/crypto").SignatureService;
|
|
19
30
|
RecoveryPhraseService: typeof import("@oxy.so/core/crypto").RecoveryPhraseService;
|
|
20
31
|
BACKUP_KDF_ENCRYPTION_INFO: "oxy-backup-encryption-key";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/services",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.6.0",
|
|
4
4
|
"description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -176,14 +176,14 @@
|
|
|
176
176
|
"delete-dts.js": "find ./lib/commonjs ./lib/module \\( -name '*.d.js*' -o -name '*.d.ts' \\) -delete"
|
|
177
177
|
},
|
|
178
178
|
"dependencies": {
|
|
179
|
-
"@oxy.so/contracts": "^6.
|
|
179
|
+
"@oxy.so/contracts": "^6.11.0",
|
|
180
180
|
"color": "^5.0.3",
|
|
181
181
|
"@peable.to/sdk": "^3.0.0"
|
|
182
182
|
},
|
|
183
183
|
"devDependencies": {
|
|
184
184
|
"@expo/app-integrity": "~58.0.2",
|
|
185
185
|
"@expo/vector-icons": "^15.1.1",
|
|
186
|
-
"@oxy.so/core": "7.
|
|
186
|
+
"@oxy.so/core": "7.25.0",
|
|
187
187
|
"@react-native-async-storage/async-storage": "^3.1.1",
|
|
188
188
|
"@react-native-community/netinfo": "^12.0.1",
|
|
189
189
|
"@react-native/babel-preset": "^0.88.1",
|