@shuttle.technology/authorization 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +191 -0
- package/README.md +1124 -2
- package/dist/accountLists.d.ts +28 -0
- package/dist/accountLists.js +27 -0
- package/dist/aesGcmSiv.d.ts +14 -0
- package/dist/aesGcmSiv.js +160 -0
- package/dist/auth.d.ts +68 -0
- package/dist/auth.js +189 -0
- package/dist/balances.d.ts +31 -0
- package/dist/balances.js +44 -0
- package/dist/canonicalize.d.ts +19 -0
- package/dist/canonicalize.js +107 -0
- package/dist/client.d.ts +152 -0
- package/dist/client.js +781 -0
- package/dist/clientTypes.d.ts +56 -0
- package/dist/clientTypes.js +5 -0
- package/dist/configuration.d.ts +48 -0
- package/dist/configuration.js +72 -0
- package/dist/consentDebit.d.ts +36 -0
- package/dist/consentDebit.js +95 -0
- package/dist/credentials.d.ts +116 -0
- package/dist/credentials.js +315 -0
- package/dist/debitPermissionWire.d.ts +90 -0
- package/dist/debitPermissionWire.js +118 -0
- package/dist/debitPermissions.d.ts +39 -0
- package/dist/debitPermissions.js +117 -0
- package/dist/deviceKey.d.ts +13 -0
- package/dist/deviceKey.js +28 -0
- package/dist/deviceRecovery.d.ts +40 -0
- package/dist/deviceRecovery.js +143 -0
- package/dist/deviceShare.d.ts +9 -0
- package/dist/deviceShare.js +24 -0
- package/dist/deviceShareEnvelope.d.ts +13 -0
- package/dist/deviceShareEnvelope.js +139 -0
- package/dist/deviceShares.d.ts +91 -0
- package/dist/deviceShares.js +204 -0
- package/dist/errors.d.ts +280 -0
- package/dist/errors.js +85 -0
- package/dist/linkedChecks.d.ts +17 -0
- package/dist/linkedChecks.js +31 -0
- package/dist/linkedRecovery.d.ts +40 -0
- package/dist/linkedRecovery.js +49 -0
- package/dist/linkedRegistrations.d.ts +11 -0
- package/dist/linkedRegistrations.js +109 -0
- package/dist/linkedSendDisplay.d.ts +73 -0
- package/dist/linkedSendDisplay.js +84 -0
- package/dist/linkedWalletSignals.d.ts +22 -0
- package/dist/linkedWalletSignals.js +101 -0
- package/dist/linkedWallets.d.ts +401 -0
- package/dist/linkedWallets.js +436 -0
- package/dist/me.d.ts +27 -0
- package/dist/me.js +30 -0
- package/dist/mediatedOperation.d.ts +27 -0
- package/dist/mediatedOperation.js +68 -0
- package/dist/mobile.d.ts +64 -0
- package/dist/mobile.js +69 -0
- package/dist/modeC.d.ts +131 -0
- package/dist/modeC.js +248 -0
- package/dist/modeCLinked.d.ts +207 -0
- package/dist/modeCLinked.js +270 -0
- package/dist/pages.d.ts +22 -0
- package/dist/pages.js +45 -0
- package/dist/poll.d.ts +15 -0
- package/dist/poll.js +76 -0
- package/dist/redirects.d.ts +45 -0
- package/dist/redirects.js +108 -0
- package/dist/requestGrant.d.ts +169 -0
- package/dist/requestGrant.js +243 -0
- package/dist/sends.d.ts +89 -0
- package/dist/sends.js +127 -0
- package/dist/serviceGrants.d.ts +52 -0
- package/dist/serviceGrants.js +46 -0
- package/dist/slice4.d.ts +187 -0
- package/dist/slice4.js +299 -0
- package/dist/streams.d.ts +212 -0
- package/dist/streams.js +282 -0
- package/dist/trackedWallets.d.ts +53 -0
- package/dist/trackedWallets.js +104 -0
- package/dist/transferStatus.d.ts +45 -0
- package/dist/transferStatus.js +43 -0
- package/dist/walletCreateGrant.d.ts +62 -0
- package/dist/walletCreateGrant.js +89 -0
- package/dist/walletDisplayParts.d.ts +17 -0
- package/dist/walletDisplayParts.js +47 -0
- package/dist/walletEvents.d.ts +43 -0
- package/dist/walletEvents.js +97 -0
- package/dist/walletLimits.d.ts +65 -0
- package/dist/walletLimits.js +102 -0
- package/dist/walletOperations.d.ts +209 -0
- package/dist/walletOperations.js +317 -0
- package/dist/webRenewal.d.ts +92 -0
- package/dist/webRenewal.js +179 -0
- package/package.json +65 -3
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// RFC 8785 JSON Canonicalization Scheme (source §2.5). Mode C hashes the
|
|
2
|
+
// normalized OperationCreate and signs the closed proof payload over exactly
|
|
3
|
+
// these bytes, so the client canonicalizes locally and never accepts a
|
|
4
|
+
// server-, backend- or library-supplied serialization of either value.
|
|
5
|
+
//
|
|
6
|
+
// The implementation is deliberately closed rather than general: only the JSON
|
|
7
|
+
// value forms the two Mode C documents contain are accepted, and every other
|
|
8
|
+
// input is a local fault instead of a best-effort approximation. In particular
|
|
9
|
+
// a JSON number is accepted only as a safe integer, because the closed payload
|
|
10
|
+
// carries integer NumericDate seconds and nothing else; a fractional or
|
|
11
|
+
// out-of-range number would otherwise be canonicalized through a rounding rule
|
|
12
|
+
// this package has no requirement to own.
|
|
13
|
+
import { ClientFlowError } from "./auth.js";
|
|
14
|
+
/**
|
|
15
|
+
* MaxCanonicalDepth bounds nesting. The Mode C request nests one object inside
|
|
16
|
+
* another and the proof payload is flat, so this bound is far above every
|
|
17
|
+
* accepted document and exists only to keep a hostile value from recursing.
|
|
18
|
+
*/
|
|
19
|
+
export const MaxCanonicalDepth = 8;
|
|
20
|
+
/** canonicalJSON returns the RFC 8785 canonical serialization of value. */
|
|
21
|
+
export function canonicalJSON(value) {
|
|
22
|
+
return serialize(value, 0);
|
|
23
|
+
}
|
|
24
|
+
/** canonicalJSONBytes returns the UTF-8 bytes canonicalJSON produces. */
|
|
25
|
+
export function canonicalJSONBytes(value) {
|
|
26
|
+
return new TextEncoder().encode(canonicalJSON(value));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* sha256HexLower is the lowercase hexadecimal SHA-256 digest Mode C uses for
|
|
30
|
+
* `request_hash`. Uppercase hexadecimal is a different value and the server
|
|
31
|
+
* rejects it, so the alphabet is fixed here.
|
|
32
|
+
*/
|
|
33
|
+
export async function sha256HexLower(crypto, bytes) {
|
|
34
|
+
if (!crypto?.subtle || typeof crypto.subtle.digest !== "function")
|
|
35
|
+
throw new ClientFlowError("runtime_capability_unavailable");
|
|
36
|
+
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
|
|
37
|
+
let result = "";
|
|
38
|
+
for (const octet of digest)
|
|
39
|
+
result += lowerHex[octet >>> 4] + lowerHex[octet & 15];
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
const lowerHex = "0123456789abcdef";
|
|
43
|
+
function serialize(value, depth) {
|
|
44
|
+
if (depth > MaxCanonicalDepth)
|
|
45
|
+
throw new ClientFlowError("noncanonical_value");
|
|
46
|
+
if (value === null)
|
|
47
|
+
return "null";
|
|
48
|
+
switch (typeof value) {
|
|
49
|
+
case "boolean":
|
|
50
|
+
return value ? "true" : "false";
|
|
51
|
+
case "number":
|
|
52
|
+
return serializeNumber(value);
|
|
53
|
+
case "string":
|
|
54
|
+
return serializeString(value);
|
|
55
|
+
case "object":
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
throw new ClientFlowError("noncanonical_value");
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(value)) {
|
|
61
|
+
const items = value;
|
|
62
|
+
return "[" + items.map((item) => serialize(item, depth + 1)).join(",") + "]";
|
|
63
|
+
}
|
|
64
|
+
const object = value;
|
|
65
|
+
const members = Object.keys(object).sort(compareUTF16);
|
|
66
|
+
const encoded = members.map((member) => {
|
|
67
|
+
const child = object[member];
|
|
68
|
+
if (child === undefined)
|
|
69
|
+
throw new ClientFlowError("noncanonical_value");
|
|
70
|
+
return serializeString(member) + ":" + serialize(child, depth + 1);
|
|
71
|
+
});
|
|
72
|
+
return "{" + encoded.join(",") + "}";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* serializeNumber accepts only a safe integer. RFC 8785 serializes numbers
|
|
76
|
+
* through the ECMAScript Number-to-String algorithm, which `String` performs
|
|
77
|
+
* exactly for this range, including -0 as "0".
|
|
78
|
+
*/
|
|
79
|
+
function serializeNumber(value) {
|
|
80
|
+
if (!Number.isSafeInteger(value))
|
|
81
|
+
throw new ClientFlowError("noncanonical_value");
|
|
82
|
+
return String(value);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* serializeString uses the ECMAScript JSON string serialization RFC 8785
|
|
86
|
+
* §3.2.2.2 requires. A lone surrogate is not valid Unicode text, so it is
|
|
87
|
+
* refused here instead of being escaped into a document the server would then
|
|
88
|
+
* canonicalize differently.
|
|
89
|
+
*/
|
|
90
|
+
function serializeString(value) {
|
|
91
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
92
|
+
const unit = value.charCodeAt(index);
|
|
93
|
+
if (unit < 0xd800 || unit > 0xdfff)
|
|
94
|
+
continue;
|
|
95
|
+
const next = index + 1 < value.length ? value.charCodeAt(index + 1) : 0;
|
|
96
|
+
if (unit >= 0xdc00 || next < 0xdc00 || next > 0xdfff)
|
|
97
|
+
throw new ClientFlowError("noncanonical_value");
|
|
98
|
+
index += 1;
|
|
99
|
+
}
|
|
100
|
+
return JSON.stringify(value);
|
|
101
|
+
}
|
|
102
|
+
/** compareUTF16 orders member names by UTF-16 code unit as RFC 8785 §3.2.3 requires. */
|
|
103
|
+
function compareUTF16(left, right) {
|
|
104
|
+
if (left < right)
|
|
105
|
+
return -1;
|
|
106
|
+
return left > right ? 1 : 0;
|
|
107
|
+
}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { type ClientChannel, type IdentityMethod } from "./auth.ts";
|
|
2
|
+
import { type Session } from "./credentials.ts";
|
|
3
|
+
import { type ClientConfiguration, type ClientSettings, type PublicClientConfiguration } from "./configuration.ts";
|
|
4
|
+
import { type SessionProjection, type WalletProjection } from "./accountLists.ts";
|
|
5
|
+
import { type ServiceGrantInput, type ServiceGrantPage, type ServiceGrantTarget } from "./serviceGrants.ts";
|
|
6
|
+
import { type AccountIdentity, type ConfirmationChallenge, type HostedIdentityFlow, type IdentityVerificationMethod, type LocalOperation, type LocalOperationCreate, type LocalOperationResult, type PasskeyBootstrapResult, type VerifiedIdentityResult } from "./slice4.ts";
|
|
7
|
+
import { type MeProjection } from "./me.ts";
|
|
8
|
+
import { type HostedSignIn } from "./redirects.ts";
|
|
9
|
+
import { type MobileBrowserBridge, type MobileSecureStorage } from "./mobile.ts";
|
|
10
|
+
export type { MobileAssociationInput, MobileAssociationVerification, MobileBrowserBridge, MobileSecureStorage } from "./mobile.ts";
|
|
11
|
+
import { StreamsReads } from "./streams.ts";
|
|
12
|
+
import { LinkedWallets } from "./linkedWallets.ts";
|
|
13
|
+
export { DebitPermissions, LinkedWallets, MaxDebitAssets, MaxDebitRecipients, eventOfTransaction, isWalletLimitRefusal, resumeCursor, sendEvents, transferFinal, WalletLimitRefusals } from "./linkedWallets.ts";
|
|
14
|
+
export type { AssetBalance, LinkedWalletBalances, NetworkBalanceStatus, NetworkBalances, ListedSend, SendPage, TransferOutcome, TransferState, TransferStatus, WalletConnection, LinkedWallet, WalletLinkChallenge, WalletLinkAssertion, LinkedRegistrationCreate, LinkedRegistrationOperation, LinkedRegistrationDisplay, LinkedRegistrationPurgedDisplay, LinkedRegistrationResult, LinkedRegistrationListOptions, LinkedEventsOptions, LinkedStreamsRegistration, LinkedStreamsRegistrationList, LinkedSendInput, LinkedReplaceInput, LinkedSendDisplay, ReplaceAction, LinkedTransportKey, LimitAsset, WalletCeiling, WalletLimitRefusal, WalletLimits, WalletLimitsDisplay, WalletLimitsInput, DebitAsset, DebitAssetBound, DebitPermission, DebitPermissionDisplay, DebitPermissionInput, DebitPermissionList, DebitPermissionRevokeDisplay, DebitPermissionState, DebitShareKeys } from "./linkedWallets.ts";
|
|
15
|
+
import { type UserWalletOperation, type UserWalletOperationCreate, type WalletResult } from "./walletOperations.ts";
|
|
16
|
+
import { type WalletCreateInput } from "./walletCreateGrant.ts";
|
|
17
|
+
export type { ConsentDebitOutcome, DebitTerms } from "./consentDebit.ts";
|
|
18
|
+
export type { WalletCreateGrant, WalletCreateGrantOutcome, WalletCreateInput } from "./walletCreateGrant.ts";
|
|
19
|
+
import { type PageOptions } from "./pages.ts";
|
|
20
|
+
export type { PageOptions } from "./pages.ts";
|
|
21
|
+
export type { ClientConfiguration, ClientSettings, PublicClientConfiguration } from "./configuration.ts";
|
|
22
|
+
export type { SessionProjection, WalletProjection } from "./accountLists.ts";
|
|
23
|
+
export type { AccountServiceGrant, ServiceGrantInput, ServiceGrantPage, ServiceGrantState, ServiceGrantTarget } from "./serviceGrants.ts";
|
|
24
|
+
export { AuthorizationErrorCodes, AuthorizationErrorContracts, ModeCRefusals, isAuthorizationErrorCode, isModeCRefusal } from "./errors.ts";
|
|
25
|
+
export type { AuthorizationErrorCode, AuthorizationErrorContract, ModeCRefusal } from "./errors.ts";
|
|
26
|
+
export type { MeProjection, MeWallet } from "./me.ts";
|
|
27
|
+
export { AuthorizationError, ClientFlowError, isAuthorizationError } from "./auth.ts";
|
|
28
|
+
export { webRenewalRequiresNavigation } from "./webRenewal.ts";
|
|
29
|
+
export type { AuthIntent, ClientChannel, IdentityMethod, NextAction } from "./auth.ts";
|
|
30
|
+
export type { HostedSignIn } from "./redirects.ts";
|
|
31
|
+
export { pollAuthoritative } from "./poll.ts";
|
|
32
|
+
export type { PollDisposition, PollOptions, PollResult } from "./poll.ts";
|
|
33
|
+
export type { AccountIdentity, ConfirmationChallenge, HostedIdentityFlow, IdentityVerificationMethod, LocalOperation, LocalOperationCreate, LocalOperationResult, PasskeyBootstrapResult, ResultRecipient, ServiceReadScope, VerifiedIdentityResult, } from "./slice4.ts";
|
|
34
|
+
export { MaxTransferCommentBytes, MaxWalletMessageBytes, ReplaceActions, transferComment, walletMaterialPurged } from "./walletOperations.ts";
|
|
35
|
+
export type { UserWalletAuthorizationBasis, UserWalletDisplay, UserWalletEffectState, UserWalletOperation, UserWalletOperationCreate, UserWalletOperationKind, UserWalletPurgedDisplay, UserWalletState, WalletResult, WalletResultKind, DeviceSharePackage, } from "./walletOperations.ts";
|
|
36
|
+
export type { AuthAttempt, ClientDependencies, FetchLike, FetchRequest, FetchResponse, MobileDependencies, WebDependencies } from "./clientTypes.ts";
|
|
37
|
+
import { type DeviceShareStore } from "./deviceShares.ts";
|
|
38
|
+
export type { DeviceRecoveryOptions, DeviceShareRecord, DeviceShareStore } from "./deviceShares.ts";
|
|
39
|
+
import type { ClientDependencies, FetchLike, AuthAttempt } from "./clientTypes.ts";
|
|
40
|
+
export type { Session } from "./credentials.ts";
|
|
41
|
+
type NormalizedDependencies = {
|
|
42
|
+
fetch: FetchLike;
|
|
43
|
+
crypto: Crypto;
|
|
44
|
+
now: () => number;
|
|
45
|
+
launch: (url: string, signal?: AbortSignal) => Promise<string | void>;
|
|
46
|
+
secureStorage?: MobileSecureStorage;
|
|
47
|
+
browserBridge?: MobileBrowserBridge;
|
|
48
|
+
deviceShares?: DeviceShareStore;
|
|
49
|
+
};
|
|
50
|
+
export declare function initializeAuthorizationClient(settings: ClientSettings, dependencies: ClientDependencies): Promise<AuthorizationClient>;
|
|
51
|
+
export declare class AuthorizationClient {
|
|
52
|
+
#private;
|
|
53
|
+
readonly capabilities: {
|
|
54
|
+
mode: "mode_b";
|
|
55
|
+
channel: ClientChannel;
|
|
56
|
+
methods: readonly IdentityMethod[];
|
|
57
|
+
};
|
|
58
|
+
readonly publicConfiguration?: PublicClientConfiguration;
|
|
59
|
+
constructor(configuration: ClientConfiguration, dependencies: NormalizedDependencies, publicConfiguration?: PublicClientConfiguration);
|
|
60
|
+
get hasSession(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* signup and login open the hosted sign-in page (on mobile: verify the app link, open the system browser,
|
|
63
|
+
* exchange what it hands back and resolve with the session). Given a method, they begin that attempt.
|
|
64
|
+
*/
|
|
65
|
+
signup(): Promise<HostedSignIn>;
|
|
66
|
+
signup(method: IdentityMethod): Promise<AuthAttempt>;
|
|
67
|
+
login(): Promise<HostedSignIn>;
|
|
68
|
+
login(method: IdentityMethod): Promise<AuthAttempt>;
|
|
69
|
+
bootstrapPasskey(signal?: AbortSignal): Promise<HostedIdentityFlow>;
|
|
70
|
+
verifyIdentity(method: IdentityVerificationMethod, signal?: AbortSignal): Promise<HostedIdentityFlow>;
|
|
71
|
+
completePasskeyBootstrap(callbackUri: string, signal?: AbortSignal): Promise<PasskeyBootstrapResult>;
|
|
72
|
+
/** identities lists the account's own active sign-in methods; a passkey names its credential. */
|
|
73
|
+
identities(signal?: AbortSignal): Promise<AccountIdentity[]>;
|
|
74
|
+
completeIdentityVerification(callbackUri: string, signal?: AbortSignal): Promise<VerifiedIdentityResult>;
|
|
75
|
+
createOperation(create: LocalOperationCreate, idempotencyKey: string, signal?: AbortSignal): Promise<LocalOperation>;
|
|
76
|
+
createIdentityLink(verifiedIdentityHandle: string, idempotencyKey: string, signal?: AbortSignal): Promise<LocalOperation>;
|
|
77
|
+
createIdentityUnlink(identityId: string, idempotencyKey: string, signal?: AbortSignal): Promise<LocalOperation>;
|
|
78
|
+
createSessionRevocation(sessionId: string, idempotencyKey: string, signal?: AbortSignal): Promise<LocalOperation>;
|
|
79
|
+
/** createServiceGrant asks to give one service read access to one of the account's wallets, or to change it; the person confirms it with a passkey. */
|
|
80
|
+
createServiceGrant(input: ServiceGrantInput, idempotencyKey: string, signal?: AbortSignal): Promise<LocalOperation>;
|
|
81
|
+
/** revokeServiceGrant asks to withdraw the grant of one service on one wallet (`enabled: false`); the person confirms it with a passkey. */
|
|
82
|
+
revokeServiceGrant(target: ServiceGrantTarget, idempotencyKey: string, signal?: AbortSignal): Promise<LocalOperation>;
|
|
83
|
+
/** serviceGrants lists the grants the account gave services, in every state, newest first. */
|
|
84
|
+
serviceGrants(input?: AbortSignal | PageOptions): Promise<ServiceGrantPage>;
|
|
85
|
+
operation(operationId: string, signal?: AbortSignal): Promise<LocalOperation>;
|
|
86
|
+
challengeOperation(operationId: string, credentialId: string, signal?: AbortSignal): Promise<ConfirmationChallenge>;
|
|
87
|
+
completeOperationConfirmation(callbackUri: string, signal?: AbortSignal): Promise<LocalOperation>;
|
|
88
|
+
/** createWalletOperation admits one Mode B wallet intent, its closed body checked locally first (source §1.3, §2.2). */
|
|
89
|
+
createWalletOperation(create: UserWalletOperationCreate, idempotencyKey: string, signal?: AbortSignal): Promise<UserWalletOperation>;
|
|
90
|
+
/** Without recipientPublicKey the SDK makes the device key and keeps the share (deviceShares.ts); grant opens the wallet to a service in the same confirmation (walletCreateGrant.ts). */
|
|
91
|
+
createWallet(input: WalletCreateInput, idempotencyKey: string, signal?: AbortSignal): Promise<UserWalletOperation>;
|
|
92
|
+
signWithWallet(input: {
|
|
93
|
+
walletId: string;
|
|
94
|
+
network: string;
|
|
95
|
+
messageBase64url: string;
|
|
96
|
+
}, idempotencyKey: string, signal?: AbortSignal): Promise<UserWalletOperation>;
|
|
97
|
+
sendFromWallet(input: {
|
|
98
|
+
walletId: string;
|
|
99
|
+
network: string;
|
|
100
|
+
recipient: string;
|
|
101
|
+
amountRaw: string;
|
|
102
|
+
maxFeeRaw: string;
|
|
103
|
+
}, idempotencyKey: string, signal?: AbortSignal): Promise<UserWalletOperation>;
|
|
104
|
+
exportWallet(input: {
|
|
105
|
+
walletId: string;
|
|
106
|
+
recipientPublicKey: string;
|
|
107
|
+
}, idempotencyKey: string, signal?: AbortSignal): Promise<UserWalletOperation>;
|
|
108
|
+
recoverWallet(input: {
|
|
109
|
+
walletId: string;
|
|
110
|
+
expectedGeneration: string;
|
|
111
|
+
recipientPublicKey: string;
|
|
112
|
+
}, idempotencyKey: string, signal?: AbortSignal): Promise<UserWalletOperation>;
|
|
113
|
+
/** walletOperation reads the safe wallet status on GET /v1/operations/{operation_id}. */
|
|
114
|
+
walletOperation(operationId: string, signal?: AbortSignal): Promise<UserWalletOperation>;
|
|
115
|
+
/** challengeWalletOperation is challengeOperation: the wallet and local challenges are one closed response. */
|
|
116
|
+
challengeWalletOperation(operationId: string, credentialId: string, signal?: AbortSignal): Promise<ConfirmationChallenge>;
|
|
117
|
+
completeWalletOperationConfirmation(callbackUri: string, signal?: AbortSignal): Promise<UserWalletOperation>;
|
|
118
|
+
/** executeWalletOperation claims one confirmed wallet effect: 202, or 200 for an exact replay, with the same operation. */
|
|
119
|
+
executeWalletOperation(operationId: string, version: string, idempotencyKey: string, signal?: AbortSignal): Promise<UserWalletOperation>;
|
|
120
|
+
/** walletOperationResult reads the protected wallet output for its frozen recipient. */
|
|
121
|
+
walletOperationResult(operationId: string, signal?: AbortSignal): Promise<WalletResult>;
|
|
122
|
+
executeOperation(operationId: string, version: string, idempotencyKey: string, signal?: AbortSignal): Promise<LocalOperation>;
|
|
123
|
+
/** HTTP-only Auth-owned links and session-authorized Streams registration. */
|
|
124
|
+
linkedWallets(): LinkedWallets;
|
|
125
|
+
/**
|
|
126
|
+
* streams binds the authorized Streams reads (source §2.6, `./streams`) to this session's protected GET;
|
|
127
|
+
* each read's `idempotencyKey` is forwarded unchanged on the GET and any 401 retry.
|
|
128
|
+
*/
|
|
129
|
+
streams(): StreamsReads;
|
|
130
|
+
operationResult(operationId: string, signal?: AbortSignal): Promise<LocalOperationResult>;
|
|
131
|
+
cancel(attemptId: string): "local_canceled";
|
|
132
|
+
/** exchangeHandoff exchanges the redirect back for the session; a signal ends only this caller's wait, never the exchange. */
|
|
133
|
+
exchangeHandoff(callbackUri: string, signal?: AbortSignal): Promise<Session>;
|
|
134
|
+
/** restoreSession is the top-level restore on the web (webRenewal.ts); on mobile it is refreshSession. */
|
|
135
|
+
restoreSession(signal?: AbortSignal): Promise<Session>;
|
|
136
|
+
/** refreshSession renews in the background: on the web from the provider's cookie, on mobile with the stored refresh token. */
|
|
137
|
+
refreshSession(signal?: AbortSignal): Promise<Session>;
|
|
138
|
+
/** logout ends the session here at once and asks the provider to end it; a signal ends only this caller's wait, never the revocation. */
|
|
139
|
+
logout(signal?: AbortSignal): Promise<{
|
|
140
|
+
localCleared: true;
|
|
141
|
+
serverDisposition: "server_revoked" | "server_unconfirmed";
|
|
142
|
+
}>;
|
|
143
|
+
/**
|
|
144
|
+
* accessToken is the session's access token for the app's own backend, renewed first when it has
|
|
145
|
+
* less than 30 seconds to live or a read was refused with it. Never store it or put it in a URL.
|
|
146
|
+
*/
|
|
147
|
+
accessToken(signal?: AbortSignal): Promise<string>;
|
|
148
|
+
me(signal?: AbortSignal): Promise<MeProjection>;
|
|
149
|
+
sessions(input?: AbortSignal | PageOptions): Promise<SessionProjection>;
|
|
150
|
+
/** wallets pages the account's own wallets, kind "wallet" in me(), which lists them with the linked ones. */
|
|
151
|
+
wallets(input?: AbortSignal | PageOptions): Promise<WalletProjection>;
|
|
152
|
+
}
|