DOCS / QUICKSTART: OIDC/OAUTH
Quickstart: OIDC/OAuth
Use an OIDC/OAuth identity to approve an exact message with PairKey’s hosted signers. The configured browser example uses Google sign-in; ordinary off-chain signing needs no Solana wallet or registration transaction.
When to use OIDC/OAuth
Choose this source when users should control keys through an existing identity provider such as Google or a configured enterprise issuer. The issuer, audience and subject form the stable identity. Changing OAuth client ID changes the audience and therefore selects another PairKey key family.
Stable identity, fresh authorization
The OIDC/OAuth account does not directly sign destination transactions. For each approval, the SDK creates a fresh ephemeral Ed25519 key and derives a nonce from its public binding. The provider issues an ID token containing that nonce, and the ephemeral key signs the exact PairKey request. The stable PairKey destination key remains unchanged.
OIDC/OAuth identity → token binds ephemeral approval key
ephemeral approval key → authorizes one exact request
PairKey threshold key → signs the destination payload
PairKey requires an issuer-signed OIDC ID token bound to a short-lived Ed25519 key. An OAuth access token by itself does not authorize a PairKey request. Other providers need their issuer, audience and HTTPS verification keys pinned by the operator.
Open the live demo → Select OIDC/OAuth as the source. The Google browser flow is a preview; account selection has been observed, while an end-to-end Google-authorized signature is still awaiting live acceptance. Access depends on the Google OAuth app’s publishing status and test-user list. This option appears when the operator has enabled Google in /api/v2/config.
Try one exact message
- Select a Google account. PairKey uses Google’s stable subject identifier, issuer and this site’s client ID to establish your namespace.
- Choose Solana, EVM, Zcash, NEAR, Bitcoin or Sui and a path, then load the derived public key.
- Write a message of at most 256 UTF-8 bytes and select Prepare Google approval.
- Continue with the same Google account again. This second ID token includes a fresh nonce tied to your namespace and a short-lived Ed25519 key. Both signers independently verify the token and the exact request before signing.
- Inspect the signature and receipts, then select Verify signature. Message signing does not broadcast a destination transaction.
Why Google appears twice
The binding includes the identity’s subject, which is learned at first sign-in. The first token selects the namespace; it cannot approve signing. The second token must name the same subject and carry the nonce derived from the bound ephemeral key. In this demo, a fresh key and token are requested for each message. The private key stays in browser memory; hosted v2 sessions are deferred.
Only the public recovery record is saved in this browser tab. Neither Google ID token nor the ephemeral private key is written to the audit trail or recovery storage. After a reload, recover a submitted job from its saved public record; prepare a new request if no job was submitted.
Integrate your own application
Install @pairkey/sdk and @solana/web3.js, then use your own Google Web OAuth client. Configure your site as an authorized JavaScript origin, and have the PairKey operator pin your exact issuer, client ID audience and HTTPS JWKS URL. The audience is part of the namespace identity: changing the client ID changes derived keys. No Google client secret belongs in browser code.
import {PairKeyClient} from '@pairkey/sdk';
const identity = {Oidc: {issuer, audience, subject}};
const pairkey = new PairKeyClient({web3, storage: localStorage});
await pairkey.connect({
source: 'oidc', identity, namespace: 'user/alice/treasury',
// Obtain a new provider ID token for this exact binding nonce.
getIdToken: ({nonce}) => obtainGoogleIdToken({nonce})
});
await pairkey.key({chain: 'near', path: [0]});
const signed = await pairkey.signTransaction({
chain: 'near', path: [0], transaction: borshUnsignedNearTransaction
});The SDK creates the ephemeral key before preparing each request and supplies its nonce to getIdToken. It saves the public recovery record before requesting authorization or submitting the job. The ID token and ephemeral private key remain outside recovery storage. See the SDK source on GitHub, SDK sequence, and policy management.
Optional rules and costs
Google login authorizes an exact message even without saved rules. Optional PairKey rules are stored on Solana and independently read by both signers. Editing those rules requires a separate Solana fee payer and transaction; the fee payer does not become the OIDC/OAuth identity owner. Ordinary off-chain message approval sends no Solana authorization transaction. Service and destination costs are separate.