This guide establishes the rules shared by every platform. Continue with one platform guide for package and code details.
1. Choose the supported wrapper
Section titled “1. Choose the supported wrapper”| Application | Supported integration | Avoid |
|---|---|---|
| Android | Android AAR with Kotlin or Java API | Raw JNI |
| iOS | P2PSdk Swift package | Copied C-to-Swift wrappers |
| Electron | @p2psdk/electron in the main process | Node wrapper in a renderer |
| Node.js host | @p2psdk/node | Custom ffi-napi declarations |
| Windows WPF | P2PSdk.P2P.Wpf and P2PSdk.P2P | Raw P/Invoke |
| Other approved Windows host | P2PSdk.P2P | Direct C ABI unless required |
| Linux native | Stable C ABI | Rust internals |
macOS and Unity wrappers are not part of SDK 1.0.0.
2. Obtain onboarding inputs
Section titled “2. Obtain onboarding inputs”Your onboarding bundle must contain:
| Input | Purpose | Handling |
|---|---|---|
SDK 1.0.0 package or artifact | Application build | Keep wrapper and native binary together |
| Application API key | SDK initialization | May be embedded by the app owner; do not log it |
| Consent page URL | SDK-owned consent window | Public HTTPS URL |
| Consent revoke URL | User revoke action | Public HTTPS URL |
| Consent version | Scopes stored decisions | Change only with a coordinated rollout |
| Receipt verification public key | Local accepted-decision verification | Public key; never substitute a private key |
The onboarding environment also provides the service endpoints used internally by the SDK. Product code does not configure discovery tokens, connection URLs, reconnect delays, DNS policy, or transport credentials.
3. Add one platform package
Section titled “3. Add one platform package”Follow the package-access instructions supplied during onboarding, then open the matching guide:
4. Implement the lifecycle
Section titled “4. Implement the lifecycle”connect() starts the SDK supervisor. It does not wait for onboarding services, authentication, or transport setup to finish. Update UI and business state only from the connected/disconnected callbacks, wrapper events, or isOnline observation.
Create one SDK instance per logical peer, give it one clear owner, and keep it alive for the entire period the peer should remain active.
5. Add a revoke action
Section titled “5. Add a revoke action”Disconnecting pauses a reusable instance. Revoking is a user-consent operation: after the remote revoke succeeds, the wrapper marks the local decision revoked and closes the active instance. A failed revoke keeps the current decision and instance intact so the user can retry.
6. Run the acceptance flow
Section titled “6. Run the acceptance flow”- Start from a clean install or empty consent store.
- Decline and confirm that no SDK instance is returned.
- Accept and confirm that an instance is returned only after local receipt verification.
- Call
connect()and wait for the connected event. - Interrupt network access and record the disconnected reason.
- Restore network access and confirm automatic reconnection.
- Revoke consent and confirm the instance becomes unusable.
- Shut down and verify no SDK call occurs after close, free, or dispose.
Continue with Testing your integration for the full release matrix.