ping-openmls-sdk-react-native-macos 0.7.12 → 0.7.14
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/Frameworks/libping_ffi.a +0 -0
- package/ios/Generated.swift +26 -0
- package/ios/PingNativeModule.m +15 -0
- package/ios/PingNativeModule.swift +42 -0
- package/ios/pingFFI.h +22 -0
- package/package.json +1 -1
- package/src/MessagingClient.ts +34 -0
- package/src/NativePing.ts +9 -0
package/Frameworks/libping_ffi.a
CHANGED
|
Binary file
|
package/ios/Generated.swift
CHANGED
|
@@ -4152,6 +4152,26 @@ public func generateMnemonicPhrase() throws -> String {
|
|
|
4152
4152
|
})
|
|
4153
4153
|
}
|
|
4154
4154
|
|
|
4155
|
+
public func hpkeOpen(sealed: Data, recipientPriv: Data, info: Data) throws -> Data {
|
|
4156
|
+
return try FfiConverterData.lift(rustCallWithError(FfiConverterTypePingError.lift) {
|
|
4157
|
+
uniffi_ping_ffi_fn_func_hpke_open(
|
|
4158
|
+
FfiConverterData.lower(sealed),
|
|
4159
|
+
FfiConverterData.lower(recipientPriv),
|
|
4160
|
+
FfiConverterData.lower(info), $0
|
|
4161
|
+
)
|
|
4162
|
+
})
|
|
4163
|
+
}
|
|
4164
|
+
|
|
4165
|
+
public func hpkeSeal(plaintext: Data, recipientPub: Data, info: Data) throws -> Data {
|
|
4166
|
+
return try FfiConverterData.lift(rustCallWithError(FfiConverterTypePingError.lift) {
|
|
4167
|
+
uniffi_ping_ffi_fn_func_hpke_seal(
|
|
4168
|
+
FfiConverterData.lower(plaintext),
|
|
4169
|
+
FfiConverterData.lower(recipientPub),
|
|
4170
|
+
FfiConverterData.lower(info), $0
|
|
4171
|
+
)
|
|
4172
|
+
})
|
|
4173
|
+
}
|
|
4174
|
+
|
|
4155
4175
|
public func normalizeMnemonicPhrase(phrase: String) throws -> String {
|
|
4156
4176
|
return try FfiConverterString.lift(rustCallWithError(FfiConverterTypePingError.lift) {
|
|
4157
4177
|
uniffi_ping_ffi_fn_func_normalize_mnemonic_phrase(
|
|
@@ -4229,6 +4249,12 @@ private var initializationResult: InitializationResult = {
|
|
|
4229
4249
|
if uniffi_ping_ffi_checksum_func_generate_mnemonic_phrase() != 9754 {
|
|
4230
4250
|
return InitializationResult.apiChecksumMismatch
|
|
4231
4251
|
}
|
|
4252
|
+
if uniffi_ping_ffi_checksum_func_hpke_open() != 21701 {
|
|
4253
|
+
return InitializationResult.apiChecksumMismatch
|
|
4254
|
+
}
|
|
4255
|
+
if uniffi_ping_ffi_checksum_func_hpke_seal() != 7740 {
|
|
4256
|
+
return InitializationResult.apiChecksumMismatch
|
|
4257
|
+
}
|
|
4232
4258
|
if uniffi_ping_ffi_checksum_func_normalize_mnemonic_phrase() != 55353 {
|
|
4233
4259
|
return InitializationResult.apiChecksumMismatch
|
|
4234
4260
|
}
|
package/ios/PingNativeModule.m
CHANGED
|
@@ -155,6 +155,21 @@ RCT_EXTERN_METHOD(openLinkingTicket: (NSArray *)sealed
|
|
|
155
155
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
156
156
|
rejecter: (RCTPromiseRejectBlock)reject)
|
|
157
157
|
|
|
158
|
+
// Generic HPKE-Base seal/open of arbitrary bytes under a caller-supplied `info`.
|
|
159
|
+
// Free functions — one shared HPKE for app-layer envelopes (device-linking auth
|
|
160
|
+
// envelope) so platforms stop hand-rolling HPKE that drifts cross-platform.
|
|
161
|
+
RCT_EXTERN_METHOD(hpkeSeal: (NSArray *)plaintext
|
|
162
|
+
recipientPub: (NSArray *)recipientPub
|
|
163
|
+
info: (NSArray *)info
|
|
164
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
165
|
+
rejecter: (RCTPromiseRejectBlock)reject)
|
|
166
|
+
|
|
167
|
+
RCT_EXTERN_METHOD(hpkeOpen: (NSArray *)sealed
|
|
168
|
+
recipientPriv: (NSArray *)recipientPriv
|
|
169
|
+
info: (NSArray *)info
|
|
170
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
171
|
+
rejecter: (RCTPromiseRejectBlock)reject)
|
|
172
|
+
|
|
158
173
|
RCT_EXTERN_METHOD(revokeDevice: (NSArray *)deviceId
|
|
159
174
|
nowMs: (double)nowMs
|
|
160
175
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
@@ -709,6 +709,48 @@ public final class PingNative: RCTEventEmitter {
|
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
+
/// Generic HPKE-Base seal of arbitrary bytes ([CR-3] auth-envelope sharing).
|
|
713
|
+
/// Free function — like `openLinkingTicket`, no `client` needed. One shared
|
|
714
|
+
/// HPKE so the desktop link host stops hand-rolling HPKE that drifts.
|
|
715
|
+
@objc(hpkeSeal:recipientPub:info:resolver:rejecter:)
|
|
716
|
+
public func hpkeSealNative(
|
|
717
|
+
_ plaintextBytes: NSArray,
|
|
718
|
+
recipientPub recipientPubBytes: NSArray,
|
|
719
|
+
info infoBytes: NSArray,
|
|
720
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
721
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
722
|
+
) {
|
|
723
|
+
do {
|
|
724
|
+
let plaintext = try TypeBridge.decodeBytesOrThrow(plaintextBytes, field: "plaintext")
|
|
725
|
+
let pub = try TypeBridge.decodeBytesOrThrow(recipientPubBytes, field: "recipientPub")
|
|
726
|
+
let info = try TypeBridge.decodeBytesOrThrow(infoBytes, field: "info")
|
|
727
|
+
let out = try hpkeSeal(plaintext: plaintext, recipientPub: pub, info: info)
|
|
728
|
+
resolve(TypeBridge.encodeBytes(out))
|
|
729
|
+
} catch {
|
|
730
|
+
reject("HpkeSealFailed", String(describing: error), error)
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/// Generic HPKE-Base open — inverse of `hpkeSeal`.
|
|
735
|
+
@objc(hpkeOpen:recipientPriv:info:resolver:rejecter:)
|
|
736
|
+
public func hpkeOpenNative(
|
|
737
|
+
_ sealedBytes: NSArray,
|
|
738
|
+
recipientPriv recipientPrivBytes: NSArray,
|
|
739
|
+
info infoBytes: NSArray,
|
|
740
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
741
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
742
|
+
) {
|
|
743
|
+
do {
|
|
744
|
+
let sealed = try TypeBridge.decodeBytesOrThrow(sealedBytes, field: "sealed")
|
|
745
|
+
let priv = try TypeBridge.decodeBytesOrThrow(recipientPrivBytes, field: "recipientPriv")
|
|
746
|
+
let info = try TypeBridge.decodeBytesOrThrow(infoBytes, field: "info")
|
|
747
|
+
let out = try hpkeOpen(sealed: sealed, recipientPriv: priv, info: info)
|
|
748
|
+
resolve(TypeBridge.encodeBytes(out))
|
|
749
|
+
} catch {
|
|
750
|
+
reject("HpkeOpenFailed", String(describing: error), error)
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
|
|
712
754
|
/// Revoke a device ([CR-2]). Returns the array of Commit envelopes the SDK
|
|
713
755
|
/// produced — one per conversation the device was a locally-known leaf in.
|
|
714
756
|
/// Empty array means the device wasn't locally known (scope limit per CR-2).
|
package/ios/pingFFI.h
CHANGED
|
@@ -572,6 +572,16 @@ RustBuffer uniffi_ping_ffi_fn_func_generate_identity_export(RustCallStatus *_Non
|
|
|
572
572
|
#define UNIFFI_FFIDEF_UNIFFI_PING_FFI_FN_FUNC_GENERATE_MNEMONIC_PHRASE
|
|
573
573
|
RustBuffer uniffi_ping_ffi_fn_func_generate_mnemonic_phrase(RustCallStatus *_Nonnull out_status
|
|
574
574
|
|
|
575
|
+
);
|
|
576
|
+
#endif
|
|
577
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_PING_FFI_FN_FUNC_HPKE_OPEN
|
|
578
|
+
#define UNIFFI_FFIDEF_UNIFFI_PING_FFI_FN_FUNC_HPKE_OPEN
|
|
579
|
+
RustBuffer uniffi_ping_ffi_fn_func_hpke_open(RustBuffer sealed, RustBuffer recipient_priv, RustBuffer info, RustCallStatus *_Nonnull out_status
|
|
580
|
+
);
|
|
581
|
+
#endif
|
|
582
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_PING_FFI_FN_FUNC_HPKE_SEAL
|
|
583
|
+
#define UNIFFI_FFIDEF_UNIFFI_PING_FFI_FN_FUNC_HPKE_SEAL
|
|
584
|
+
RustBuffer uniffi_ping_ffi_fn_func_hpke_seal(RustBuffer plaintext, RustBuffer recipient_pub, RustBuffer info, RustCallStatus *_Nonnull out_status
|
|
575
585
|
);
|
|
576
586
|
#endif
|
|
577
587
|
#ifndef UNIFFI_FFIDEF_UNIFFI_PING_FFI_FN_FUNC_NORMALIZE_MNEMONIC_PHRASE
|
|
@@ -907,6 +917,18 @@ uint16_t uniffi_ping_ffi_checksum_func_generate_identity_export(void
|
|
|
907
917
|
#define UNIFFI_FFIDEF_UNIFFI_PING_FFI_CHECKSUM_FUNC_GENERATE_MNEMONIC_PHRASE
|
|
908
918
|
uint16_t uniffi_ping_ffi_checksum_func_generate_mnemonic_phrase(void
|
|
909
919
|
|
|
920
|
+
);
|
|
921
|
+
#endif
|
|
922
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_PING_FFI_CHECKSUM_FUNC_HPKE_OPEN
|
|
923
|
+
#define UNIFFI_FFIDEF_UNIFFI_PING_FFI_CHECKSUM_FUNC_HPKE_OPEN
|
|
924
|
+
uint16_t uniffi_ping_ffi_checksum_func_hpke_open(void
|
|
925
|
+
|
|
926
|
+
);
|
|
927
|
+
#endif
|
|
928
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_PING_FFI_CHECKSUM_FUNC_HPKE_SEAL
|
|
929
|
+
#define UNIFFI_FFIDEF_UNIFFI_PING_FFI_CHECKSUM_FUNC_HPKE_SEAL
|
|
930
|
+
uint16_t uniffi_ping_ffi_checksum_func_hpke_seal(void
|
|
931
|
+
|
|
910
932
|
);
|
|
911
933
|
#endif
|
|
912
934
|
#ifndef UNIFFI_FFIDEF_UNIFFI_PING_FFI_CHECKSUM_FUNC_NORMALIZE_MNEMONIC_PHRASE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ping-openmls-sdk-react-native-macos",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.14",
|
|
4
4
|
"description": "Real MLS for React Native macOS apps — wraps the ping-openmls-sdk Rust core via UniFFI.",
|
|
5
5
|
"homepage": "https://github.com/AMP-Media-Development/ping-openmls-sdk",
|
|
6
6
|
"license": "Apache-2.0",
|
package/src/MessagingClient.ts
CHANGED
|
@@ -400,6 +400,40 @@ export class MessagingClient {
|
|
|
400
400
|
return decodeLinkingTicket(raw);
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
+
/**
|
|
404
|
+
* Generic HPKE-Base seal of `plaintext` to `recipientPub` (32-byte X25519)
|
|
405
|
+
* under `info`. One shared HPKE implementation so app layers (e.g. the
|
|
406
|
+
* device-linking auth envelope) stop hand-rolling per-platform HPKE that
|
|
407
|
+
* drifts and breaks cross-platform. Mirrors the wasm SDK's
|
|
408
|
+
* `MessagingClient.hpkeSeal`.
|
|
409
|
+
*/
|
|
410
|
+
static async hpkeSeal(
|
|
411
|
+
plaintext: Uint8Array,
|
|
412
|
+
recipientPub: Uint8Array,
|
|
413
|
+
info: Uint8Array,
|
|
414
|
+
): Promise<Uint8Array> {
|
|
415
|
+
const out = await NativePing.hpkeSeal(
|
|
416
|
+
Array.from(plaintext),
|
|
417
|
+
Array.from(recipientPub),
|
|
418
|
+
Array.from(info),
|
|
419
|
+
);
|
|
420
|
+
return Uint8Array.from(out);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** Generic HPKE-Base open — inverse of {@link hpkeSeal}. `info` must match the sender. */
|
|
424
|
+
static async hpkeOpen(
|
|
425
|
+
sealed: Uint8Array,
|
|
426
|
+
recipientPriv: Uint8Array,
|
|
427
|
+
info: Uint8Array,
|
|
428
|
+
): Promise<Uint8Array> {
|
|
429
|
+
const out = await NativePing.hpkeOpen(
|
|
430
|
+
Array.from(sealed),
|
|
431
|
+
Array.from(recipientPriv),
|
|
432
|
+
Array.from(info),
|
|
433
|
+
);
|
|
434
|
+
return Uint8Array.from(out);
|
|
435
|
+
}
|
|
436
|
+
|
|
403
437
|
/**
|
|
404
438
|
* Admit a freshly-linked device to every chat in `entries` — one Commit +
|
|
405
439
|
* Welcome per chat, with per-chat outcomes. Host calls this AFTER
|
package/src/NativePing.ts
CHANGED
|
@@ -213,6 +213,15 @@ export interface Spec extends TurboModule {
|
|
|
213
213
|
newDevicePriv: number[],
|
|
214
214
|
): Promise<Record<string, unknown>>;
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Generic HPKE-Base seal/open of arbitrary bytes under a caller-supplied
|
|
218
|
+
* `info`. One shared HPKE for app-layer envelopes (e.g. device-linking auth
|
|
219
|
+
* envelope) so platforms stop hand-rolling HPKE that drifts cross-platform.
|
|
220
|
+
* `recipientPub`/`recipientPriv` are 32-byte X25519 keys.
|
|
221
|
+
*/
|
|
222
|
+
hpkeSeal(plaintext: number[], recipientPub: number[], info: number[]): Promise<number[]>;
|
|
223
|
+
hpkeOpen(sealed: number[], recipientPriv: number[], info: number[]): Promise<number[]>;
|
|
224
|
+
|
|
216
225
|
/**
|
|
217
226
|
* Revoke a device ([CR-2]). Returns one Commit envelope per conversation the
|
|
218
227
|
* device was a locally-known leaf in. Empty array means the device wasn't locally
|