Skip to content

Commit

Permalink
greenlight: rename device_{key/cert} to developer_{key/cert}
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed May 30, 2024
1 parent cda0710 commit 8deca36
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 46 deletions.
4 changes: 2 additions & 2 deletions libs/sdk-bindings/src/breez_sdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ enum Network {
};

dictionary GreenlightCredentials {
sequence<u8> device_key;
sequence<u8> device_cert;
sequence<u8> developer_key;
sequence<u8> developer_cert;
};

dictionary GreenlightDeviceCredentials {
Expand Down
12 changes: 6 additions & 6 deletions libs/sdk-core/src/bridge_generated.io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,8 @@ impl Wire2Api<ConnectRequest> for wire_ConnectRequest {
impl Wire2Api<GreenlightCredentials> for wire_GreenlightCredentials {
fn wire2api(self) -> GreenlightCredentials {
GreenlightCredentials {
device_key: self.device_key.wire2api(),
device_cert: self.device_cert.wire2api(),
developer_key: self.developer_key.wire2api(),
developer_cert: self.developer_cert.wire2api(),
}
}
}
Expand Down Expand Up @@ -1172,8 +1172,8 @@ pub struct wire_ConnectRequest {
#[repr(C)]
#[derive(Clone)]
pub struct wire_GreenlightCredentials {
device_key: *mut wire_uint_8_list,
device_cert: *mut wire_uint_8_list,
developer_key: *mut wire_uint_8_list,
developer_cert: *mut wire_uint_8_list,
}

#[repr(C)]
Expand Down Expand Up @@ -1568,8 +1568,8 @@ impl Default for wire_ConnectRequest {
impl NewWithNullPtr for wire_GreenlightCredentials {
fn new_with_null_ptr() -> Self {
Self {
device_key: core::ptr::null_mut(),
device_cert: core::ptr::null_mut(),
developer_key: core::ptr::null_mut(),
developer_cert: core::ptr::null_mut(),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-core/src/bridge_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,8 @@ impl rust2dart::IntoIntoDart<FiatCurrency> for FiatCurrency {
impl support::IntoDart for GreenlightCredentials {
fn into_dart(self) -> support::DartAbi {
vec![
self.device_key.into_into_dart().into_dart(),
self.device_cert.into_into_dart().into_dart(),
self.developer_key.into_into_dart().into_dart(),
self.developer_cert.into_into_dart().into_dart(),
]
.into_dart()
}
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-core/src/greenlight/node_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ impl Greenlight {
Some(creds) => {
debug!("registering with credentials");
Nobody {
cert: creds.device_cert,
key: creds.device_key,
cert: creds.developer_cert,
key: creds.developer_key,
..Default::default()
}
}
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-core/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,8 @@ pub enum EnvironmentType {
/// Client-specific credentials to connect to and manage a Greenlight node in the cloud
#[derive(Clone, Serialize, Deserialize)]
pub struct GreenlightCredentials {
pub device_key: Vec<u8>,
pub device_cert: Vec<u8>,
pub developer_key: Vec<u8>,
pub developer_cert: Vec<u8>,
}

/// Device credentials used to authenticate to Greenlight with the current device.
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-flutter/ios/Classes/bridge_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ typedef struct wire_uint_8_list {
} wire_uint_8_list;

typedef struct wire_GreenlightCredentials {
struct wire_uint_8_list *device_key;
struct wire_uint_8_list *device_cert;
struct wire_uint_8_list *developer_key;
struct wire_uint_8_list *developer_cert;
} wire_GreenlightCredentials;

typedef struct wire_GreenlightNodeConfig {
Expand Down
20 changes: 10 additions & 10 deletions libs/sdk-flutter/lib/bridge_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,12 @@ class FiatCurrency {

/// Client-specific credentials to connect to and manage a Greenlight node in the cloud
class GreenlightCredentials {
final Uint8List deviceKey;
final Uint8List deviceCert;
final Uint8List developerKey;
final Uint8List developerCert;

const GreenlightCredentials({
required this.deviceKey,
required this.deviceCert,
required this.developerKey,
required this.developerCert,
});
}

Expand Down Expand Up @@ -3458,8 +3458,8 @@ class BreezSdkCoreImpl implements BreezSdkCore {
final arr = raw as List<dynamic>;
if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
return GreenlightCredentials(
deviceKey: _wire2api_uint_8_list(arr[0]),
deviceCert: _wire2api_uint_8_list(arr[1]),
developerKey: _wire2api_uint_8_list(arr[0]),
developerCert: _wire2api_uint_8_list(arr[1]),
);
}

Expand Down Expand Up @@ -4900,8 +4900,8 @@ class BreezSdkCorePlatform extends FlutterRustBridgeBase<BreezSdkCoreWire> {

void _api_fill_to_wire_greenlight_credentials(
GreenlightCredentials apiObj, wire_GreenlightCredentials wireObj) {
wireObj.device_key = api2wire_uint_8_list(apiObj.deviceKey);
wireObj.device_cert = api2wire_uint_8_list(apiObj.deviceCert);
wireObj.developer_key = api2wire_uint_8_list(apiObj.developerKey);
wireObj.developer_cert = api2wire_uint_8_list(apiObj.developerCert);
}

void _api_fill_to_wire_greenlight_node_config(
Expand Down Expand Up @@ -6529,9 +6529,9 @@ final class wire_uint_8_list extends ffi.Struct {
}

final class wire_GreenlightCredentials extends ffi.Struct {
external ffi.Pointer<wire_uint_8_list> device_key;
external ffi.Pointer<wire_uint_8_list> developer_key;

external ffi.Pointer<wire_uint_8_list> device_cert;
external ffi.Pointer<wire_uint_8_list> developer_cert;
}

final class wire_GreenlightNodeConfig extends ffi.Struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,25 +633,25 @@ fun asGreenlightCredentials(greenlightCredentials: ReadableMap): GreenlightCrede
if (!validateMandatoryFields(
greenlightCredentials,
arrayOf(
"deviceKey",
"deviceCert",
"developerKey",
"developerCert",
),
)
) {
return null
}
val deviceKey = greenlightCredentials.getArray("deviceKey")?.let { asUByteList(it) }!!
val deviceCert = greenlightCredentials.getArray("deviceCert")?.let { asUByteList(it) }!!
val developerKey = greenlightCredentials.getArray("developerKey")?.let { asUByteList(it) }!!
val developerCert = greenlightCredentials.getArray("developerCert")?.let { asUByteList(it) }!!
return GreenlightCredentials(
deviceKey,
deviceCert,
developerKey,
developerCert,
)
}

fun readableMapOf(greenlightCredentials: GreenlightCredentials): ReadableMap {
return readableMapOf(
"deviceKey" to readableArrayOf(greenlightCredentials.deviceKey),
"deviceCert" to readableArrayOf(greenlightCredentials.deviceCert),
"developerKey" to readableArrayOf(greenlightCredentials.developerKey),
"developerCert" to readableArrayOf(greenlightCredentials.developerCert),
)
}

Expand Down
16 changes: 8 additions & 8 deletions libs/sdk-react-native/ios/BreezSDKMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -691,23 +691,23 @@ enum BreezSDKMapper {
}

static func asGreenlightCredentials(greenlightCredentials: [String: Any?]) throws -> GreenlightCredentials {
guard let deviceKey = greenlightCredentials["deviceKey"] as? [UInt8] else {
throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "deviceKey", typeName: "GreenlightCredentials"))
guard let developerKey = greenlightCredentials["developerKey"] as? [UInt8] else {
throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "developerKey", typeName: "GreenlightCredentials"))
}
guard let deviceCert = greenlightCredentials["deviceCert"] as? [UInt8] else {
throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "deviceCert", typeName: "GreenlightCredentials"))
guard let developerCert = greenlightCredentials["developerCert"] as? [UInt8] else {
throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "developerCert", typeName: "GreenlightCredentials"))
}

return GreenlightCredentials(
deviceKey: deviceKey,
deviceCert: deviceCert
developerKey: developerKey,
developerCert: developerCert
)
}

static func dictionaryOf(greenlightCredentials: GreenlightCredentials) -> [String: Any?] {
return [
"deviceKey": greenlightCredentials.deviceKey,
"deviceCert": greenlightCredentials.deviceCert,
"developerKey": greenlightCredentials.developerKey,
"developerCert": greenlightCredentials.developerCert,
]
}

Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-react-native/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ export interface FiatCurrency {
}

export interface GreenlightCredentials {
deviceKey: number[]
deviceCert: number[]
developerKey: number[]
developerCert: number[]
}

export interface GreenlightDeviceCredentials {
Expand Down
4 changes: 2 additions & 2 deletions tools/sdk-cli/src/command_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ pub(crate) async fn handle_command(
let cert = fs::read(partner_cert.unwrap())?;
let key = fs::read(partner_key.unwrap())?;
partner_credentials = Some(GreenlightCredentials {
device_cert: cert,
device_key: key,
developer_cert: cert,
developer_key: key,
})
}

Expand Down

0 comments on commit 8deca36

Please sign in to comment.