diff --git a/snippets/csharp/Production.cs b/snippets/csharp/Production.cs new file mode 100644 index 0000000..63e390a --- /dev/null +++ b/snippets/csharp/Production.cs @@ -0,0 +1,18 @@ +using Breez.Sdk; + +public class ProductionSnippets +{ + public NodeConfig ProductionNodeConfig() { + // ANCHOR: moving-to-production + // Read your Greenlight credentials from secure storage + var deviceKey = new List(); + var deviceCert = new List(); + var greenlightCredentials = new GreenlightCredentials(deviceKey, deviceCert); + + var nodeConfig = new NodeConfig.Greenlight( + new GreenlightNodeConfig(greenlightCredentials, null) + ); + // ANCHOR_END: moving-to-production + return nodeConfig; + } +} diff --git a/snippets/dart_snippets/lib/production.dart b/snippets/dart_snippets/lib/production.dart new file mode 100644 index 0000000..eae8eba --- /dev/null +++ b/snippets/dart_snippets/lib/production.dart @@ -0,0 +1,21 @@ +import 'dart:typed_data'; + +import 'package:breez_sdk/breez_sdk.dart'; +import 'package:breez_sdk/bridge_generated.dart'; + +NodeConfig productionNodeConfig() { + // ANCHOR: moving-to-production + // Read your Greenlight credentials from secure storage + Uint8List deviceKey = Uint8List(); + Uint8List deviceCert = Uint8List(); + GreenlightCredentials greenlightCredentials = GreenlightCredentials(deviceKey, deviceCert); + + NodeConfig nodeConfig = NodeConfig.greenlight( + config: GreenlightNodeConfig( + partnerCredentials: greenlightCredentials, + inviteCode: null, + ), + ); + // ANCHOR_END: moving-to-production + return nodeConfig +} diff --git a/snippets/go/production.go b/snippets/go/production.go new file mode 100644 index 0000000..94e9f63 --- /dev/null +++ b/snippets/go/production.go @@ -0,0 +1,25 @@ +package example + +import ( + "github.com/breez/breez-sdk-go/breez_sdk" +) + +func ProductionNodeConfig() breez_sdk.NodeConfig { + // ANCHOR: moving-to-production + // Read your Greenlight credentials from secure storage + deviceKey := []uint8{} + deviceCert := []uint8{} + greenlightCredentials := breez_sdk.GreenlightCredentials{ + DeviceKey: deviceKey, + DeviceCert: deviceCert, + }; + + nodeConfig := breez_sdk.NodeConfigGreenlight{ + Config: breez_sdk.GreenlightNodeConfig{ + PartnerCredentials: &greenlightCredentials, + InviteCode: nil, + }, + } + // ANCHOR_END: moving-to-production + return nodeConfig +} diff --git a/snippets/kotlin_mpp_lib/shared/src/commonMain/kotlin/com/example/kotlinmpplib/Production.kt b/snippets/kotlin_mpp_lib/shared/src/commonMain/kotlin/com/example/kotlinmpplib/Production.kt new file mode 100644 index 0000000..4fbcb2a --- /dev/null +++ b/snippets/kotlin_mpp_lib/shared/src/commonMain/kotlin/com/example/kotlinmpplib/Production.kt @@ -0,0 +1,16 @@ +package com.example.kotlinmpplib + +import breez_sdk.* +class Production { + fun productionNodeConfig(): NodeConfig { + // ANCHOR: moving-to-production + // Read your Greenlight credentials from secure storage + val deviceKey = emptyList() + val deviceCert = emptyList() + val greenlightCredentials = GreenlightCredentials(deviceKey, deviceCert) + + val nodeConfig = NodeConfig.Greenlight(GreenlightNodeConfig(greenlightCredentials, null)) + // ANCHOR_END: moving-to-production + return nodeConfig + } +} \ No newline at end of file diff --git a/snippets/python/main.py b/snippets/python/main.py index 448b612..28721cb 100755 --- a/snippets/python/main.py +++ b/snippets/python/main.py @@ -14,6 +14,8 @@ from src.fiat_currencies import list_supported_fiat_currencies, get_current_rate from src.lnurl_auth import auth from src.lnurl_pay import pay from src.lnurl_withdraw import withdraw +from src.production import production_node_config +from src.service_status import health_check_status, report_payment_failure import tempfile import os @@ -80,7 +82,12 @@ def main(): # lnurl withdraw withdraw(sdk_services) + # moving to production + production_node_config() + # service status + health_check_status(sdk_services) + report_payment_failure(sdk_services) # use temp_dir, and remove when done: temp_dir.cleanup() diff --git a/snippets/python/src/production.py b/snippets/python/src/production.py new file mode 100644 index 0000000..3603b5a --- /dev/null +++ b/snippets/python/src/production.py @@ -0,0 +1,13 @@ +import breez_sdk + +def production_node_config(): + # ANCHOR: moving-to-production + # Read your Greenlight credentials from secure storage + deviceKey = [] + deviceCert = [] + greenlightCredentials = breez_sdk.GreenlightCredentials(deviceKey, deviceCert) + + node_config = breez_sdk.NodeConfig.GREENLIGHT( + breez_sdk.GreenlightNodeConfig(greenlightCredentials, None)) + # ANCHOR_END: moving-to-production + return node_config diff --git a/snippets/react-native/production.ts b/snippets/react-native/production.ts new file mode 100644 index 0000000..5779551 --- /dev/null +++ b/snippets/react-native/production.ts @@ -0,0 +1,25 @@ +import { + type GreenlightCredentials, + type NodeConfig, + NodeConfigVariant +} from '@breeztech/react-native-breez-sdk' + +const productionNodeConfig = (): NodeConfig => { + // ANCHOR: moving-to-production + // Read your Greenlight credentials from secure storage + const deviceKey: number[] = [] + const deviceCert: number[] = [] + const greenlightCredentials: GreenlightCredentials = { + deviceKey, + deviceCert + } + + const nodeConfig: NodeConfig = { + type: NodeConfigVariant.GREENLIGHT, + config: { + partnerCredentials: greenlightCredentials + } + } + // ANCHOR_END: moving-to-production + return nodeConfig +} diff --git a/snippets/rust/src/main.rs b/snippets/rust/src/main.rs index 5df75ef..83846c7 100644 --- a/snippets/rust/src/main.rs +++ b/snippets/rust/src/main.rs @@ -6,6 +6,7 @@ mod list_payments; mod lnurl_auth; mod lnurl_pay; mod lnurl_withdraw; +mod production; mod receive_onchain; mod receive_payment; mod send_onchain; diff --git a/snippets/rust/src/production.rs b/snippets/rust/src/production.rs new file mode 100644 index 0000000..bc38dea --- /dev/null +++ b/snippets/rust/src/production.rs @@ -0,0 +1,23 @@ +use anyhow::Result; +use breez_sdk_core::*; + + +fn production_node_config() -> Result { + // ANCHOR: moving-to-production + // Read your Greenlight credentials from secure storage + let device_key: Vec = vec![]; + let device_cert: Vec = vec![]; + let greenlight_credentials = GreenlightCredentials { + device_key, + device_cert, + }; + + let node_config = NodeConfig::Greenlight { + config: GreenlightNodeConfig { + partner_credentials: Some(greenlight_credentials), + invite_code: None, + }, + }; + // ANCHOR_END: moving-to-production + Ok(node_config) +} diff --git a/snippets/swift/BreezSDKExamples/Sources/Production.swift b/snippets/swift/BreezSDKExamples/Sources/Production.swift new file mode 100644 index 0000000..03d99c4 --- /dev/null +++ b/snippets/swift/BreezSDKExamples/Sources/Production.swift @@ -0,0 +1,21 @@ +// +// Production.swift +// +// +// Created by dangeross on 29/11/2023. +// + +import BreezSDK + +func productionNodeConfig() -> NodeConfig { + // ANCHOR: moving-to-production + // Read your Greenlight credentials from secure storage + let deviceKey = [UInt8]() + let deviceCert = [UInt8]() + let greenlightCredentials = GreenlightCredentials(deviceKey: deviceKey, deviceCert: deviceCert) + + let nodeConfig = NodeConfig.greenlight( + config: GreenlightNodeConfig(partnerCredentials: greenlightCredentials, inviteCode: nil)) + // ANCHOR_END: moving-to-production + return nodeConfig +} diff --git a/src/guide/production.md b/src/guide/production.md index ec4c0f7..2c702ed 100644 --- a/src/guide/production.md +++ b/src/guide/production.md @@ -1,5 +1,71 @@ # Moving to Production -To move your project to production, you will have to replace the evaluation invite code to a partner certificate issued by Greenlight. +To move your project to production, you will have to replace the evaluation invite code with a partner certificate issued by Greenlight. + + +
Rust
+
+ +```rust,ignore +{{#include ../../snippets/rust/src/production.rs:moving-to-production}} +``` +
+ +
Swift
+
+ +```swift,ignore +{{#include ../../snippets/swift/BreezSDKExamples/Sources/Production.swift:moving-to-production}} +``` +
+ +
Kotlin
+
+ +```kotlin,ignore +{{#include ../../snippets/kotlin_mpp_lib/shared/src/commonMain/kotlin/com/example/kotlinmpplib/Production.kt:moving-to-production}} +``` +
+ +
React Native
+
+ +```typescript +{{#include ../../snippets/react-native/production.ts:moving-to-production}} +``` +
+ +
Dart
+
+ +```dart,ignore +{{#include ../../snippets/dart_snippets/lib/production.dart:moving-to-production}} +``` +
+ +
Python
+
+ +```python,ignore +{{#include ../../snippets/python/src/production.py:moving-to-production}} +``` +
+ +
Go
+
+ +```go,ignore +{{#include ../../snippets/go/production.go:moving-to-production}} +``` +
+ +
C#
+
+ +```cs,ignore +{{#include ../../snippets/csharp/Production.cs:moving-to-production}} +``` +
+
To obtain a certificate for a production environment, please contact Breez via email at contact@breez.technology.