Skip to content
Merged
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ documentation over training-data recall. If context7 is unavailable, use officia
package sources and note the fallback; do not block ordinary repo work just to install extra
tooling.

Wallet-import HPKE and attestation verification use Bouncy Castle and CBOR Java, with versions
owned by `gradle/libs.versions.toml`; consult their pinned-version APIs before changing the crypto,
certificate, CBOR, or COSE boundaries.

---

## Project Overview
Expand Down
98 changes: 95 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,35 @@ omsWallet.wallet.signOut()
Keystore cleanup fails. Handle `OMSWalletStorageException` to report or retry a
persistent cleanup failure.

### Import a Wallet

Configure wallet import with audited AWS Nitro Enclave PCR0 measurements. The SDK rejects all-zero
debug measurements, verifies the attestation and request/response binding, and encrypts plaintext
keys locally before import.

```kotlin
val omsWallet =
OMSWallet(
context = context,
publishableKey = "your-publishable-key",
walletImport = WalletImportConfiguration(
trustedPcr0s = listOf("your-audited-48-byte-pcr0-hex"),
),
)

val imported =
omsWallet.wallet.importWallet(
privateKey = WalletImportPrivateKey.Ethereum("0x..."),
reference = "Imported wallet",
)
println(imported.wallet.keyOrigin == WalletKeyOrigin.Imported)
```

Ethereum imports accept 32 raw bytes or hexadecimal text. Solana imports accept a 32-byte seed,
64-byte keypair, or base58 text. The SDK does not persist plaintext imported keys. For
caller-managed HPKE, use `getWalletImportRecipientKey` followed by `importEncryptedWallet`; both
responses remain attestation verified.

## Core Workflows

### Sign and Verify Messages
Expand All @@ -358,6 +387,17 @@ val verifyResult = omsWallet.wallet.isValidMessageSignature(
)
```

For a selected Solana wallet, off-chain messages use the Solana-specific methods and do not require
a cluster:

```kotlin
val signature = omsWallet.wallet.signSolanaMessage("hello from Solana")
val valid = omsWallet.wallet.isValidSolanaMessageSignature(
message = "hello from Solana",
signature = signature,
)
```

### Sign Typed Data

```kotlin
Expand Down Expand Up @@ -464,6 +504,17 @@ tokenBalances.balances.forEach { balance ->
}
```

Query native SOL and fungible token balances through the Solana indexer gateway:

```kotlin
val result =
omsWallet.indexer.getSolanaBalances(
walletAddress = "solana-wallet-address",
networks = listOf(SolanaNetwork.Mainnet, SolanaNetwork.Devnet),
)
result.balances.forEach(::println)
```

Pass `includeMetadata = true` when you need token contract details or NFT/token
metadata from `balance.contractInfo` and `balance.tokenMetadata`.

Expand Down Expand Up @@ -555,6 +606,19 @@ To refresh a transaction later:
val status = omsWallet.wallet.getTransactionStatus(txnId = txResult.txnId)
```

For a selected Solana wallet, amounts are smallest units (lamports for SOL and base units for SPL
tokens):

```kotlin
val result =
omsWallet.wallet.sendSolanaTransfer(
network = SolanaNetwork.Devnet,
asset = "SOL",
to = "solana-recipient-address",
amount = BigInteger("1000000"),
)
```

## Reference

### Errors
Expand Down Expand Up @@ -603,12 +667,40 @@ val scopedIdToken =

val credentials = omsWallet.wallet.listAccess(pageSize = 25u)
omsWallet.wallet.listAccessPages(pageSize = 25u).collect { page ->
println(page.credentials)
println(page.grants)
}

credentials
.firstOrNull { !it.isCaller }
?.let { omsWallet.wallet.revokeAccess(targetCredentialId = it.credentialId) }
.firstOrNull { !it.credential.isCaller }
?.let { omsWallet.wallet.revokeAccess(credentialId = it.credential.credentialId) }
```

For an owner-approved smart session, inspect the remote credential before showing consent, then
authorize bounded EVM transfer grants. Backend credential registration and execution stay outside
this SDK surface.

```kotlin
val credentialId = "remote-credential-id"
val metadata = omsWallet.wallet.inspectRemoteCredential(credentialId)
showConsentScreen(metadata)

val session =
omsWallet.wallet.authorizeRemoteAccess(
credentialId = credentialId,
network = Network.POLYGON,
grants =
listOf(
SmartSessionGrant.NativeTransfer(
to = "0x1111111111111111111111111111111111111111",
limit = BigInteger("1000000000000000"),
),
),
expiresAt = "2099-01-01T00:00:00Z",
)

val details = omsWallet.wallet.getRemoteAccessSession(session.sessionId)
val usage = omsWallet.wallet.getRemoteAccessSessionUsage(session.sessionId, Network.POLYGON)
omsWallet.wallet.revokeAccess(credentialId, session.sessionId)
```

## API Reference
Expand Down
47 changes: 45 additions & 2 deletions docs/api-groups.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,30 @@ technology.polygon.omswallet.OMSWalletSessionState = OMSWalletSessionState
technology.polygon.omswallet.OMSWalletSessionExpiredEvent = OMSWalletSessionExpiredEvent
technology.polygon.omswallet.models.WalletType = WalletType
technology.polygon.omswallet.models.Wallet = Wallet
technology.polygon.omswallet.models.WalletKeyOrigin = WalletKeyOrigin
technology.polygon.omswallet.models.Page = Page
technology.polygon.omswallet.models.CredentialInfo = CredentialInfo
technology.polygon.omswallet.models.ListAccessResponse = ListAccessResponse
technology.polygon.omswallet.WalletImportConfiguration = WalletImportConfiguration
technology.polygon.omswallet.models.WalletImportCipherSuite = WalletImportCipherSuite
technology.polygon.omswallet.models.WalletImportPrivateKey = WalletImportPrivateKey
technology.polygon.omswallet.models.WalletImportPrivateKey.Ethereum = WalletImportPrivateKey.Ethereum
technology.polygon.omswallet.models.WalletImportPrivateKey.EthereumBytes = WalletImportPrivateKey.EthereumBytes
technology.polygon.omswallet.models.WalletImportPrivateKey.Solana = WalletImportPrivateKey.Solana
technology.polygon.omswallet.models.WalletImportPrivateKey.SolanaBytes = WalletImportPrivateKey.SolanaBytes
technology.polygon.omswallet.models.WalletImportRecipientKey = WalletImportRecipientKey
technology.polygon.omswallet.models.EncryptedWalletImportKeyMaterial = EncryptedWalletImportKeyMaterial
technology.polygon.omswallet.models.WalletCredential = WalletCredential
technology.polygon.omswallet.models.RemoteCredentialMetadata = RemoteCredentialMetadata
technology.polygon.omswallet.models.SmartSessionGrant = SmartSessionGrant
technology.polygon.omswallet.models.SmartSessionGrant.NativeTransfer = SmartSessionGrant.NativeTransfer
technology.polygon.omswallet.models.SmartSessionGrant.Erc20Transfer = SmartSessionGrant.Erc20Transfer
technology.polygon.omswallet.models.AccessGrantType = AccessGrantType
technology.polygon.omswallet.models.AccessGrant = AccessGrant
technology.polygon.omswallet.models.AccessGrant.Direct = AccessGrant.Direct
technology.polygon.omswallet.models.AccessGrant.Remote = AccessGrant.Remote
technology.polygon.omswallet.models.AccessGrantPage = AccessGrantPage
technology.polygon.omswallet.models.AuthorizedRemoteAccess = AuthorizedRemoteAccess
technology.polygon.omswallet.models.RemoteAccessSession = RemoteAccessSession
technology.polygon.omswallet.models.SmartSessionGrantUsage = SmartSessionGrantUsage
technology.polygon.omswallet.wallet.CustomOidcProviderConfig = CustomOidcProviderConfig
technology.polygon.omswallet.wallet.OmsRelayOidcProvider = OmsRelayOidcProvider
technology.polygon.omswallet.wallet.OmsRelayOidcProviders = OmsRelayOidcProviders
Expand Down Expand Up @@ -42,10 +63,17 @@ technology.polygon.omswallet.wallet.WalletClient#handleOidcRedirectCallback = Wa
technology.polygon.omswallet.wallet.WalletClient#completeEmailAuth = WalletClient.completeEmailAuth
technology.polygon.omswallet.wallet.WalletClient#useWallet = WalletClient.useWallet
technology.polygon.omswallet.wallet.WalletClient#createWallet = WalletClient.createWallet
technology.polygon.omswallet.wallet.WalletClient#importWallet = WalletClient.importWallet
technology.polygon.omswallet.wallet.WalletClient#getWalletImportRecipientKey = WalletClient.getWalletImportRecipientKey
technology.polygon.omswallet.wallet.WalletClient#importEncryptedWallet = WalletClient.importEncryptedWallet
technology.polygon.omswallet.wallet.WalletClient#listWallets = WalletClient.listWallets
technology.polygon.omswallet.wallet.WalletClient#inspectRemoteCredential = WalletClient.inspectRemoteCredential
technology.polygon.omswallet.wallet.WalletClient#authorizeRemoteAccess = WalletClient.authorizeRemoteAccess
technology.polygon.omswallet.wallet.WalletClient#listAccess = WalletClient.listAccess
technology.polygon.omswallet.wallet.WalletClient#listAccessPages = WalletClient.listAccessPages
technology.polygon.omswallet.wallet.WalletClient#listAccessPage = WalletClient.listAccessPage
technology.polygon.omswallet.wallet.WalletClient#getRemoteAccessSession = WalletClient.getRemoteAccessSession
technology.polygon.omswallet.wallet.WalletClient#getRemoteAccessSessionUsage = WalletClient.getRemoteAccessSessionUsage
technology.polygon.omswallet.wallet.WalletClient#getIdToken = WalletClient.getIdToken
technology.polygon.omswallet.wallet.WalletClient#revokeAccess = WalletClient.revokeAccess

Expand All @@ -64,17 +92,29 @@ technology.polygon.omswallet.models.SendTransactionResponse = SendTransactionRes
technology.polygon.omswallet.models.TransactionStatusResolution = TransactionStatusResolution
technology.polygon.omswallet.models.TransactionStatusPollingOptions = TransactionStatusPollingOptions
technology.polygon.omswallet.wallet.WalletClient#signMessage = WalletClient.signMessage
technology.polygon.omswallet.wallet.WalletClient#signSolanaMessage = WalletClient.signSolanaMessage
technology.polygon.omswallet.wallet.WalletClient#signTypedData = WalletClient.signTypedData
technology.polygon.omswallet.wallet.WalletClient#isValidMessageSignature = WalletClient.isValidMessageSignature
technology.polygon.omswallet.wallet.WalletClient#isValidSolanaMessageSignature = WalletClient.isValidSolanaMessageSignature
technology.polygon.omswallet.wallet.WalletClient#isValidTypedDataSignature = WalletClient.isValidTypedDataSignature
technology.polygon.omswallet.wallet.WalletClient#sendTransaction = WalletClient.sendTransaction
technology.polygon.omswallet.wallet.WalletClient#sendSolanaTransfer = WalletClient.sendSolanaTransfer
technology.polygon.omswallet.wallet.WalletClient#callContract = WalletClient.callContract
technology.polygon.omswallet.wallet.WalletClient#getTransactionStatus = WalletClient.getTransactionStatus

[Indexer]
technology.polygon.omswallet.indexer.IndexerClient = IndexerClient
technology.polygon.omswallet.indexer.IndexerClient#getBalances = IndexerClient.getBalances
technology.polygon.omswallet.indexer.IndexerClient#getTransactionHistory = IndexerClient.getTransactionHistory
technology.polygon.omswallet.indexer.IndexerClient#getSolanaBalances = IndexerClient.getSolanaBalances
technology.polygon.omswallet.models.SolanaVerificationStatus = SolanaVerificationStatus
technology.polygon.omswallet.models.SolanaVerificationSource = SolanaVerificationSource
technology.polygon.omswallet.models.SolanaTokenProgram = SolanaTokenProgram
technology.polygon.omswallet.models.SolanaBalance = SolanaBalance
technology.polygon.omswallet.models.SolanaBalance.Native = SolanaBalance.Native
technology.polygon.omswallet.models.SolanaBalance.FungibleToken = SolanaBalance.FungibleToken
technology.polygon.omswallet.models.SolanaNetworkError = SolanaNetworkError
technology.polygon.omswallet.models.SolanaBalancesResult = SolanaBalancesResult
technology.polygon.omswallet.models.TokenBalancesPageRequest = TokenBalancesPageRequest
technology.polygon.omswallet.models.IndexerNetworkType = IndexerNetworkType
technology.polygon.omswallet.models.ContractVerificationStatus = ContractVerificationStatus
Expand All @@ -94,6 +134,8 @@ technology.polygon.omswallet.models.TransactionHistoryResult = TransactionHistor
[Networks, types, and errors]
technology.polygon.omswallet.Network = Network
technology.polygon.omswallet.OMSWalletNetworks = OMSWalletNetworks
technology.polygon.omswallet.SolanaNetwork = SolanaNetwork
technology.polygon.omswallet.SolanaNetworks = SolanaNetworks
technology.polygon.omswallet.OMSWalletErrorCode = OMSWalletErrorCode
technology.polygon.omswallet.OMSWalletOperation = OMSWalletOperation
technology.polygon.omswallet.OMSWalletUpstreamService = OMSWalletUpstreamService
Expand All @@ -106,5 +148,6 @@ technology.polygon.omswallet.OMSWalletTransactionException = OMSWalletTransactio
technology.polygon.omswallet.OMSWalletSelectionException = OMSWalletSelectionException
technology.polygon.omswallet.OMSWalletValidationException = OMSWalletValidationException
technology.polygon.omswallet.OMSWalletStorageException = OMSWalletStorageException
technology.polygon.omswallet.OMSWalletAttestationException = OMSWalletAttestationException
technology.polygon.omswallet.utils#formatUnits = formatUnits
technology.polygon.omswallet.utils#parseUnits = parseUnits
Loading
Loading