Interfaces
Auth
Sandbox Auth interface intentionally limited to implemented behavior.
Indexable
[key: string]: unknown
Properties
| Property | Modifier | Type |
|---|---|---|
app | readonly | SandboxAdminApp |
Methods
createCustomToken()
createCustomToken(uid: string, developerClaims?: object): Promise<string>;
Parameters
| Parameter | Type |
|---|---|
uid | string |
developerClaims? | object |
Returns
Promise<string>
createUser()
createUser(properties: CreateRequest): Promise<UserRecord>;
Parameters
| Parameter | Type |
|---|---|
properties | CreateRequest |
Returns
Promise<UserRecord>
deleteUser()
deleteUser(uid: string): Promise<void>;
Parameters
| Parameter | Type |
|---|---|
uid | string |
Returns
Promise<void>
getUser()
getUser(uid: string): Promise<UserRecord>;
Parameters
| Parameter | Type |
|---|---|
uid | string |
Returns
Promise<UserRecord>
getUserByEmail()
getUserByEmail(email: string): Promise<UserRecord>;
Parameters
| Parameter | Type |
|---|---|
email | string |
Returns
Promise<UserRecord>
listUsers()
listUsers(maxResults?: number, pageToken?: string): Promise<ListUsersResult>;
Parameters
| Parameter | Type |
|---|---|
maxResults? | number |
pageToken? | string |
Returns
Promise<ListUsersResult>
setCustomUserClaims()
setCustomUserClaims(uid: string, customUserClaims: object): Promise<void>;
Parameters
| Parameter | Type |
|---|---|
uid | string |
customUserClaims | object |
Returns
Promise<void>
updateUser()
updateUser(uid: string, properties: UpdateRequest): Promise<UserRecord>;
Parameters
| Parameter | Type |
|---|---|
uid | string |
properties | UpdateRequest |
Returns
Promise<UserRecord>
verifyIdToken()
verifyIdToken(idToken: string, checkRevoked?: boolean): Promise<DecodedIdToken>;
Parameters
| Parameter | Type |
|---|---|
idToken | string |
checkRevoked? | boolean |
Returns
Promise<DecodedIdToken>
CreateRequest
Properties
| Property | Type |
|---|---|
disabled? | boolean |
displayName? | string |
email? | string |
emailVerified? | boolean |
password? | string |
phoneNumber? | string |
photoURL? | string |
uid? | string |
DecodedIdToken
Extends
Record<string,unknown>
Indexable
[key: string]: unknown
Properties
ListUsersResult
Properties
| Property | Type |
|---|---|
pageToken? | string |
users | UserRecord[] |
UpdateRequest
Extends
Omit<CreateRequest,"uid">
Properties
UserInfo
Properties
| Property | Type |
|---|---|
displayName? | string |
email? | string |
phoneNumber? | string |
photoURL? | string |
providerId | string |
uid | string |
Methods
toJSON()
toJSON(): Record<string, unknown>;
Returns
Record<string, unknown>
UserMetadata
Properties
Methods
toJSON()
toJSON(): Record<string, unknown>;
Returns
Record<string, unknown>
UserRecord
Properties
| Property | Modifier | Type |
|---|---|---|
customClaims? | readonly | Record<string, unknown> |
disabled | readonly | boolean |
displayName? | readonly | string |
email? | readonly | string |
emailVerified | readonly | boolean |
metadata | readonly | UserMetadata |
phoneNumber? | readonly | string |
photoURL? | readonly | string |
providerData | readonly | UserInfo[] |
tenantId | readonly | string |
uid | readonly | string |
Methods
toJSON()
toJSON(): Record<string, unknown>;
Returns
Record<string, unknown>
Variables
SANDBOX_TOKEN_PREFIX
const SANDBOX_TOKEN_PREFIX: "pyric-sandbox-custom" = "pyric-sandbox-custom";
Token format minted by createCustomToken and parsed by
verifyIdToken. Exported as a constant so tests can lock the shape.
Layout: pyric-sandbox-custom:${uid}:${jsonClaims}
- The prefix lets
verifyIdTokenreject foreign tokens with a clear “not a sandbox token” error rather than NaN’ing out. uidis colon-free per the auto-uid format above.jsonClaimsis the JSON-stringified developer claims (or{}when none were provided). Round-trips losslessly throughJSON.parse.
NOT a JWT. NOT signed. Do not use this token format to talk to any real Firebase service — it only round-trips through this same sandbox backend.
Functions
getAuth()
function getAuth(app?: SandboxAdminApp): Auth;
Return an Auth handle for the given app — or for the DEFAULT app when
called with no argument (mirrors firebase-admin’s no-arg getAuth():
resolves '[DEFAULT]' through pyric-admin/app’s registry and throws
app/no-app when nothing has been initialized). Local sandboxes use the
in-memory store; remote sandboxes relay to the browser-hosted worker.
Parameters
| Parameter | Type |
|---|---|
app? | SandboxAdminApp |
Returns
Example
import { initializeApp } from 'pyric-admin/app';
import { initializeSandbox } from 'pyric/sandbox';
import { getAuth } from 'pyric-admin/auth';
const sandbox = initializeSandbox();
const app = initializeApp({ sandbox });
const auth = getAuth(app);
const user = await auth.createUser({ uid: 'alice', email: 'a@e.com' });
const token = await auth.createCustomToken(user.uid, { role: 'admin' });
const decoded = await auth.verifyIdToken(token);
console.log(decoded.uid, decoded.role); // 'alice' 'admin'