@oxy.so/contracts 6.9.0 → 6.11.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/dist/cjs/client/identityProof.js +10 -0
- package/dist/cjs/client/index.js +18 -5
- package/dist/cjs/client/organizationIdentityKey.js +114 -0
- package/dist/cjs/client/userResponse.js +12 -1
- package/dist/cjs/index.js +30 -26
- package/dist/cjs/organizationIdentityKey.js +96 -0
- package/dist/cjs/userResponse.js +2 -0
- package/dist/esm/client/identityProof.js +10 -0
- package/dist/esm/client/index.js +2 -1
- package/dist/esm/client/organizationIdentityKey.js +109 -0
- package/dist/esm/client/userResponse.js +11 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/organizationIdentityKey.js +87 -0
- package/dist/esm/userResponse.js +2 -0
- package/dist/types/client/identityProof.d.ts +10 -0
- package/dist/types/client/index.d.ts +3 -1
- package/dist/types/client/organizationIdentityKey.d.ts +96 -0
- package/dist/types/client/userResponse.d.ts +11 -0
- package/dist/types/identityProof.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/organizationIdentityKey.d.ts +82 -0
- package/package.json +1 -1
|
@@ -25,6 +25,16 @@ exports.IDENTITY_PROOF_ACTIONS = {
|
|
|
25
25
|
* (ADR 0029 D3).
|
|
26
26
|
*/
|
|
27
27
|
link: 'link_identity',
|
|
28
|
+
/**
|
|
29
|
+
* Give an organization its first identity key (ADR 0061 D4). Signed by the
|
|
30
|
+
* acting owner's or admin's own root and by the new key.
|
|
31
|
+
*/
|
|
32
|
+
organizationKeyCreate: 'organization_key_create',
|
|
33
|
+
/**
|
|
34
|
+
* Replace an organization's identity key (ADR 0061 D7). Signed by the actor's
|
|
35
|
+
* root and the new key, and by the current key when the device holds it.
|
|
36
|
+
*/
|
|
37
|
+
organizationKeyReplace: 'organization_key_replace',
|
|
28
38
|
};
|
|
29
39
|
exports.IDENTITY_PROOF_ACTION_VALUES = Object.values(exports.IDENTITY_PROOF_ACTIONS);
|
|
30
40
|
exports.HEX_DIGEST = /^[0-9a-f]{64}$/;
|
package/dist/cjs/client/index.js
CHANGED
|
@@ -30,11 +30,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
30
30
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.isLanguageTag = exports.hasCampaignControlCharacters = exports.CAMPAIGN_CLICK_ID_MAX_LENGTH = exports.CAMPAIGN_LABEL_MAX_LENGTH = exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = exports.appAttestKeyResponseCheck = exports.appAssertionResponseCheck = exports.appAssertionChallengeResponseCheck = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = exports.ERASURE_REQUEST_DEADLINE_DAYS = void 0;
|
|
33
|
+
exports.ORGANIZATION_KEY_PROOF_ACTION_VALUES = exports.ORGANIZATION_KEY_PROOF_ACTIONS = exports.ORGANIZATION_KEY_OPERATIONS = exports.ORGANIZATION_KEY_ERROR_CODES = exports.executeAgentKeyOperationCheck = exports.agentVerifyRequestCheck = exports.agentProofClaimsCheck = exports.agentKeyOperationResultCheck = exports.agentKeyOperationCheck = exports.agentKeyOperationChallengeCheck = exports.agentKeyListResponseCheck = exports.agentChallengeRequestCheck = exports.AGENT_PROOF_TTL_MS = exports.AGENT_PROOF_AUDIENCE = exports.AGENT_PROOF_ACTIONS = exports.ACCOUNT_AUTH_METHODS = exports.emailVerificationStartResponseCheck = exports.emailVerificationConfirmResponseCheck = exports.emailTicketCheck = exports.emailAddressCheck = exports.EMAIL_VERIFICATION_PURPOSES = exports.EMAIL_VERIFICATION_ERROR_CODES = exports.EMAIL_TICKET_TTL_MS = exports.EMAIL_CODE_TTL_MS = exports.EMAIL_CODE_MAX_ATTEMPTS = exports.EMAIL_CODE_LENGTH = exports.isPlainTextTitle = exports.accountTitleCheck = exports.accountNamePolicyForKind = exports.ACCOUNT_TITLE_MAX_LENGTH = exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = exports.ACCOUNT_NAME_POLICY_BY_KIND = exports.newlyAddedRetiredCategories = exports.kindAcceptsAccountCategories = exports.isSelectableAccountCategoryId = exports.isOperatorSwitchTargetKind = exports.isMemberOperatedKind = exports.isDelegatedActAsEligibleKind = exports.isAccountKind = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.MAX_ACCOUNT_CATEGORIES = exports.CHILD_ACCOUNT_KINDS = exports.ACCOUNT_KINDS = exports.ACCOUNT_CATEGORY_KINDS = exports.ACCOUNT_CATEGORY_IDS = exports.parseContract = exports.formatCheckPath = exports.checkContract = exports.ContractCheckError = void 0;
|
|
34
|
+
exports.ORGANIZATION_STATUSES = exports.ORGANIZATION_NAME_MAX_LENGTH = exports.ORGANIZATION_ERROR_CODES = exports.ORGANIZATION_CLAIM_STATUSES = exports.ORGANIZATION_CLAIM_DECISIONS = exports.ORGANIZATION_ALIAS_KINDS = exports.canonicalJson = exports.buildIdentityProofMessage = exports.IDENTITY_PROOF_VERSION = exports.IDENTITY_PROOF_DOMAIN = exports.IDENTITY_PROOF_CHALLENGE_TTL_MS = exports.IDENTITY_PROOF_AUDIENCE = exports.IDENTITY_PROOF_ACTION_VALUES = exports.IDENTITY_PROOF_ACTIONS = exports.IDENTITY_ERROR_CODES = exports.parseIdentityLinkQrPayload = exports.identityLinkStateCheck = exports.identityLinkCreateResponseCheck = exports.buildIdentityLinkQrPayload = exports.IDENTITY_LINK_STATUSES = exports.IDENTITY_LINK_QR_PREFIX = exports.sessionAccountsChangedEventCheck = exports.deviceTokenMintResponseCheck = exports.deviceSessionSyncCheck = exports.deviceSessionStateCheck = exports.deviceRegisterResponseCheck = exports.deviceJoinResponseCheck = exports.deviceJoinCodeResponseCheck = exports.holderContextEvidenceV1ResponseCheck = exports.holderContextEvidenceV1RequestCheck = exports.deviceContextTokenV1ResponseCheck = exports.deviceContextTokenV1RequestCheck = exports.deviceBackgroundCredentialResponseCheck = exports.activeTokenCheck = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceDirectorySyncCheck = exports.deviceDirectoryCheck = exports.deviceActivateResponseCheck = exports.normalizeDomainName = exports.DOMAIN_NAME_MAX_LENGTH = exports.signedRecordEnvelopeCheck = exports.externalIdentityReferenceCheck = exports.loginResultCheck = exports.isLoopbackOrigin = exports.organizationKeyProofClaims = exports.organizationKeyPayload = exports.organizationKeyChallengeRequestCheck = exports.organizationKeyChallengeCheck = exports.organizationKeyApplyRequestCheck = exports.organizationIdentityKeyStateCheck = void 0;
|
|
35
|
+
exports.supervisionContactsResponseCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.profileAccessInputCheck = exports.profileAccessDecisionCheck = exports.SUPERVISION_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SUPERVISION_CHANGED_EVENT = exports.SUPERVISED_ACTIONS = exports.SAFETY_POLICY_VERSION = exports.PURCHASE_APPROVAL_STATUSES = exports.isFullReputationBalance = exports.recommendationRequestCheck = exports.subscriptionCreditGrantsResponseCheck = exports.subjectProductAccessQueryCheck = exports.subjectProductAccessCheck = exports.productSubscriptionsResponseCheck = exports.productSubscriptionPortalResponseCheck = exports.productSubscriptionPortalRequestCheck = exports.productSubscriptionCancellationResultCheck = exports.productPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = exports.cancelProductSubscriptionCheck = exports.updateOrganizationCheck = exports.organizationNameCheck = exports.organizationListCheck = exports.organizationImportBatchResultCheck = exports.organizationExternalResolutionCheck = exports.organizationExternalCheck = exports.organizationCurationResultCheck = exports.organizationClaimReviewCheck = exports.organizationClaimListCheck = exports.organizationClaimInputCheck = exports.organizationClaimDetailCheck = exports.organizationClaimCheck = exports.organizationCheck = exports.organizationBatchCheck = exports.createOrganizationCheck = exports.ORGANIZATION_TYPES = void 0;
|
|
36
|
+
exports.userNameCheck = exports.usernameCheckForAccountKind = exports.usernameCheck = exports.stripDisallowedUsernameCharacters = exports.botUsernameCheck = exports.applyBotUsernameSuffix = exports.USERNAME_PATTERN_SOURCE = exports.USERNAME_MIN_LENGTH = exports.USERNAME_MAX_LENGTH = exports.USERNAME_INVALID_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.NUMERIC_USERNAME_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.BOT_USERNAME_INVALID_MESSAGE = exports.totpEnrollResponseCheck = exports.totpBackupCodesResponseCheck = exports.signInMethodsCheck = exports.secondFactorRequiredCheck = exports.reauthProofCheck = exports.normalizeEmailSignInCode = exports.isSecondFactorRequired = exports.isEmailSignInChooseAccount = exports.emailSignInStartResponseCheck = exports.emailSignInPendingCheck = exports.emailSignInLinkResponseCheck = exports.emailSignInChooseAccountCheck = exports.TOTP_PERIOD_SECONDS = exports.TOTP_DIGITS = exports.TOTP_BACKUP_CODE_COUNT = exports.SIGN_IN_ERROR_CODES = exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.SIGN_IN_IDENTIFIER_MAX_LENGTH = exports.SECOND_FACTOR_CODE_MAX_LENGTH = exports.REAUTH_ACTIONS = exports.PASSWORD_MIN_LENGTH = exports.PASSWORD_MAX_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.EMAIL_ACCOUNTS_MAX = exports.CONSOLE_USE_CASES = exports.CONSOLE_TERMS_VERSION = exports.publicApplicationCheck = exports.supervisionStateCheck = exports.supervisionReviewInputCheck = exports.supervisionInviteInputCheck = exports.supervisionInvitationCheck = void 0;
|
|
37
|
+
exports.isLanguageTag = exports.hasCampaignControlCharacters = exports.CAMPAIGN_CLICK_ID_MAX_LENGTH = exports.CAMPAIGN_LABEL_MAX_LENGTH = exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = exports.appAttestKeyResponseCheck = exports.appAssertionResponseCheck = exports.appAssertionChallengeResponseCheck = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = exports.ERASURE_REQUEST_DEADLINE_DAYS = exports.COUNTER_NOTICE_STATEMENTS = exports.COUNTER_NOTICE_STATEMENT_VERSION = exports.CONTENT_CLAIM_STATES = exports.CONTENT_CLAIM_REFERENCE_PATTERN = exports.CONTENT_CLAIM_LIMITS = exports.CONTENT_CLAIM_KINDS = exports.CONTENT_CLAIM_ERROR_CODES = exports.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS = exports.CLOSED_CONTENT_CLAIM_STATES = exports.CLAIMANT_RELATIONSHIPS = exports.PROFILE_LINK_TITLE_MAX = exports.PROFILE_LINKS_MAX = void 0;
|
|
38
38
|
var check_1 = require("./check");
|
|
39
39
|
Object.defineProperty(exports, "ContractCheckError", { enumerable: true, get: function () { return check_1.ContractCheckError; } });
|
|
40
40
|
Object.defineProperty(exports, "checkContract", { enumerable: true, get: function () { return check_1.checkContract; } });
|
|
@@ -86,6 +86,17 @@ Object.defineProperty(exports, "agentKeyOperationResultCheck", { enumerable: tru
|
|
|
86
86
|
Object.defineProperty(exports, "agentProofClaimsCheck", { enumerable: true, get: function () { return agentKeys_1.agentProofClaimsCheck; } });
|
|
87
87
|
Object.defineProperty(exports, "agentVerifyRequestCheck", { enumerable: true, get: function () { return agentKeys_1.agentVerifyRequestCheck; } });
|
|
88
88
|
Object.defineProperty(exports, "executeAgentKeyOperationCheck", { enumerable: true, get: function () { return agentKeys_1.executeAgentKeyOperationCheck; } });
|
|
89
|
+
var organizationIdentityKey_1 = require("./organizationIdentityKey");
|
|
90
|
+
Object.defineProperty(exports, "ORGANIZATION_KEY_ERROR_CODES", { enumerable: true, get: function () { return organizationIdentityKey_1.ORGANIZATION_KEY_ERROR_CODES; } });
|
|
91
|
+
Object.defineProperty(exports, "ORGANIZATION_KEY_OPERATIONS", { enumerable: true, get: function () { return organizationIdentityKey_1.ORGANIZATION_KEY_OPERATIONS; } });
|
|
92
|
+
Object.defineProperty(exports, "ORGANIZATION_KEY_PROOF_ACTIONS", { enumerable: true, get: function () { return organizationIdentityKey_1.ORGANIZATION_KEY_PROOF_ACTIONS; } });
|
|
93
|
+
Object.defineProperty(exports, "ORGANIZATION_KEY_PROOF_ACTION_VALUES", { enumerable: true, get: function () { return organizationIdentityKey_1.ORGANIZATION_KEY_PROOF_ACTION_VALUES; } });
|
|
94
|
+
Object.defineProperty(exports, "organizationIdentityKeyStateCheck", { enumerable: true, get: function () { return organizationIdentityKey_1.organizationIdentityKeyStateCheck; } });
|
|
95
|
+
Object.defineProperty(exports, "organizationKeyApplyRequestCheck", { enumerable: true, get: function () { return organizationIdentityKey_1.organizationKeyApplyRequestCheck; } });
|
|
96
|
+
Object.defineProperty(exports, "organizationKeyChallengeCheck", { enumerable: true, get: function () { return organizationIdentityKey_1.organizationKeyChallengeCheck; } });
|
|
97
|
+
Object.defineProperty(exports, "organizationKeyChallengeRequestCheck", { enumerable: true, get: function () { return organizationIdentityKey_1.organizationKeyChallengeRequestCheck; } });
|
|
98
|
+
Object.defineProperty(exports, "organizationKeyPayload", { enumerable: true, get: function () { return organizationIdentityKey_1.organizationKeyPayload; } });
|
|
99
|
+
Object.defineProperty(exports, "organizationKeyProofClaims", { enumerable: true, get: function () { return organizationIdentityKey_1.organizationKeyProofClaims; } });
|
|
89
100
|
var capabilityBindings_1 = require("../capabilityBindings");
|
|
90
101
|
Object.defineProperty(exports, "isLoopbackOrigin", { enumerable: true, get: function () { return capabilityBindings_1.isLoopbackOrigin; } });
|
|
91
102
|
var deviceBoot_1 = require("./deviceBoot");
|
|
@@ -249,6 +260,8 @@ Object.defineProperty(exports, "usernameCheck", { enumerable: true, get: functio
|
|
|
249
260
|
Object.defineProperty(exports, "usernameCheckForAccountKind", { enumerable: true, get: function () { return username_1.usernameCheckForAccountKind; } });
|
|
250
261
|
var userResponse_1 = require("./userResponse");
|
|
251
262
|
Object.defineProperty(exports, "userNameCheck", { enumerable: true, get: function () { return userResponse_1.userNameCheck; } });
|
|
263
|
+
Object.defineProperty(exports, "PROFILE_LINKS_MAX", { enumerable: true, get: function () { return userResponse_1.PROFILE_LINKS_MAX; } });
|
|
264
|
+
Object.defineProperty(exports, "PROFILE_LINK_TITLE_MAX", { enumerable: true, get: function () { return userResponse_1.PROFILE_LINK_TITLE_MAX; } });
|
|
252
265
|
var contentClaims_1 = require("./contentClaims");
|
|
253
266
|
Object.defineProperty(exports, "CLAIMANT_RELATIONSHIPS", { enumerable: true, get: function () { return contentClaims_1.CLAIMANT_RELATIONSHIPS; } });
|
|
254
267
|
Object.defineProperty(exports, "CLOSED_CONTENT_CLAIM_STATES", { enumerable: true, get: function () { return contentClaims_1.CLOSED_CONTENT_CLAIM_STATES; } });
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* An organization's identity key (ADR 0061), without Zod. Schemas:
|
|
4
|
+
* `../organizationIdentityKey.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
|
|
7
|
+
*
|
|
8
|
+
* An organization's key is its DID `#key-1`: the key Peable derives the
|
|
9
|
+
* organization's FairCoin receive addresses from. It is created in Commons by an
|
|
10
|
+
* owner or admin and never signs anybody in. A change is ONE identity proof
|
|
11
|
+
* ceremony (ADR 0024 D7): the server's challenge, then the same claims signed by
|
|
12
|
+
* the actor's own root, by the new key and (to replace) by the current key when
|
|
13
|
+
* the device holds it. The claims differ only in `rootPublicKey`, so no
|
|
14
|
+
* signature can stand in for another.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.organizationIdentityKeyStateCheck = exports.organizationKeyApplyRequestCheck = exports.organizationKeyChallengeCheck = exports.organizationKeyChallengeRequestCheck = exports.ORGANIZATION_KEY_ERROR_CODES = exports.ORGANIZATION_KEY_PROOF_ACTION_VALUES = exports.ORGANIZATION_KEY_PROOF_ACTIONS = exports.ORGANIZATION_KEY_OPERATIONS = void 0;
|
|
18
|
+
exports.organizationKeyPayload = organizationKeyPayload;
|
|
19
|
+
exports.organizationKeyProofClaims = organizationKeyProofClaims;
|
|
20
|
+
const check_1 = require("./check");
|
|
21
|
+
const identityProof_1 = require("./identityProof");
|
|
22
|
+
/** `create`: an organization without a key gets one. `replace`: a new key takes the current one's place. */
|
|
23
|
+
exports.ORGANIZATION_KEY_OPERATIONS = ['create', 'replace'];
|
|
24
|
+
/** The identity-proof action each operation is signed under. */
|
|
25
|
+
exports.ORGANIZATION_KEY_PROOF_ACTIONS = {
|
|
26
|
+
create: identityProof_1.IDENTITY_PROOF_ACTIONS.organizationKeyCreate,
|
|
27
|
+
replace: identityProof_1.IDENTITY_PROOF_ACTIONS.organizationKeyReplace,
|
|
28
|
+
};
|
|
29
|
+
exports.ORGANIZATION_KEY_PROOF_ACTION_VALUES = [
|
|
30
|
+
exports.ORGANIZATION_KEY_PROOF_ACTIONS.create,
|
|
31
|
+
exports.ORGANIZATION_KEY_PROOF_ACTIONS.replace,
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Stable error codes of the organization-key routes (`error.code`). The proof,
|
|
35
|
+
* key-in-use and already-linked refusals use `IDENTITY_ERROR_CODES`.
|
|
36
|
+
*/
|
|
37
|
+
exports.ORGANIZATION_KEY_ERROR_CODES = {
|
|
38
|
+
/** The caller is not an owner or admin of a claimed, active organization. */
|
|
39
|
+
forbidden: 'ORGANIZATION_KEY_FORBIDDEN',
|
|
40
|
+
/** The signing person has no root of their own (only a Commons account can do this). */
|
|
41
|
+
actorRootRequired: 'ORGANIZATION_KEY_ACTOR_ROOT_REQUIRED',
|
|
42
|
+
/** `replace` on an organization without a key. */
|
|
43
|
+
noKey: 'ORGANIZATION_KEY_MISSING',
|
|
44
|
+
/** The key was already used, by this or another account, and is never reused. */
|
|
45
|
+
keyUsed: 'ORGANIZATION_KEY_USED',
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The payload whose digest every signature of one operation binds. Both sides
|
|
49
|
+
* build it here, so the client and the verifier digest the same object.
|
|
50
|
+
*/
|
|
51
|
+
function organizationKeyPayload(input) {
|
|
52
|
+
return {
|
|
53
|
+
operation: input.operation,
|
|
54
|
+
accountId: input.accountId,
|
|
55
|
+
publicKey: input.publicKey,
|
|
56
|
+
previousPublicKey: input.previousPublicKey,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** The claims one signer (`rootPublicKey`) signs for `challenge`. */
|
|
60
|
+
function organizationKeyProofClaims(challenge, rootPublicKey) {
|
|
61
|
+
return {
|
|
62
|
+
action: challenge.action,
|
|
63
|
+
subject: challenge.accountId,
|
|
64
|
+
actor: challenge.actorId,
|
|
65
|
+
rootPublicKey,
|
|
66
|
+
payloadDigest: challenge.payloadDigest,
|
|
67
|
+
expectedRevision: null,
|
|
68
|
+
audience: challenge.audience,
|
|
69
|
+
challenge: challenge.challenge,
|
|
70
|
+
expiresAt: challenge.expiresAt,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/* -------------------------------------------------------------------------- */
|
|
74
|
+
/* Checks */
|
|
75
|
+
/* -------------------------------------------------------------------------- */
|
|
76
|
+
const publicKey = (0, check_1.string)(check_1.trim, (0, check_1.minLength)(1), (0, check_1.maxLength)(130));
|
|
77
|
+
const signature = (0, check_1.string)(check_1.trim, (0, check_1.minLength)(1), (0, check_1.maxLength)(512));
|
|
78
|
+
const challengeHex = (0, check_1.string)((0, check_1.pattern)(identityProof_1.CHALLENGE));
|
|
79
|
+
const timestamp = (0, check_1.number)(check_1.int, check_1.positive);
|
|
80
|
+
exports.organizationKeyChallengeRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)({ operation: (0, check_1.oneOf)(exports.ORGANIZATION_KEY_OPERATIONS), publicKey }));
|
|
81
|
+
exports.organizationKeyChallengeCheck = (0, check_1.exact)()((0, check_1.strictObject)({
|
|
82
|
+
operation: (0, check_1.oneOf)(exports.ORGANIZATION_KEY_OPERATIONS),
|
|
83
|
+
action: (0, check_1.oneOf)(exports.ORGANIZATION_KEY_PROOF_ACTION_VALUES),
|
|
84
|
+
accountId: (0, check_1.string)((0, check_1.minLength)(1)),
|
|
85
|
+
actorId: (0, check_1.string)((0, check_1.minLength)(1)),
|
|
86
|
+
actorPublicKey: (0, check_1.string)((0, check_1.minLength)(1)),
|
|
87
|
+
publicKey: (0, check_1.string)((0, check_1.minLength)(1)),
|
|
88
|
+
previousPublicKey: (0, check_1.nullable)((0, check_1.string)((0, check_1.minLength)(1))),
|
|
89
|
+
payloadDigest: (0, check_1.string)((0, check_1.pattern)(identityProof_1.HEX_DIGEST)),
|
|
90
|
+
audience: (0, check_1.literal)(identityProof_1.IDENTITY_PROOF_AUDIENCE),
|
|
91
|
+
challenge: challengeHex,
|
|
92
|
+
expiresAt: timestamp,
|
|
93
|
+
}));
|
|
94
|
+
exports.organizationKeyApplyRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)({
|
|
95
|
+
operation: (0, check_1.oneOf)(exports.ORGANIZATION_KEY_OPERATIONS),
|
|
96
|
+
publicKey,
|
|
97
|
+
challenge: challengeHex,
|
|
98
|
+
expiresAt: timestamp,
|
|
99
|
+
actorSignature: signature,
|
|
100
|
+
keySignature: signature,
|
|
101
|
+
previousKeySignature: (0, check_1.optional)(signature),
|
|
102
|
+
}));
|
|
103
|
+
exports.organizationIdentityKeyStateCheck = (0, check_1.exact)()((0, check_1.strictObject)({
|
|
104
|
+
accountId: (0, check_1.string)((0, check_1.minLength)(1)),
|
|
105
|
+
publicKey: (0, check_1.nullable)((0, check_1.string)((0, check_1.minLength)(1))),
|
|
106
|
+
keys: (0, check_1.array)((0, check_1.strictObject)({
|
|
107
|
+
publicKey: (0, check_1.string)((0, check_1.minLength)(1)),
|
|
108
|
+
method: (0, check_1.oneOf)(exports.ORGANIZATION_KEY_OPERATIONS),
|
|
109
|
+
linkedByUserId: (0, check_1.nullable)((0, check_1.string)()),
|
|
110
|
+
previousKeyProven: check_1.boolean,
|
|
111
|
+
linkedAt: (0, check_1.string)(check_1.datetime),
|
|
112
|
+
retiredAt: (0, check_1.nullable)((0, check_1.string)(check_1.datetime)),
|
|
113
|
+
})),
|
|
114
|
+
}));
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.userNameCheck = void 0;
|
|
8
|
+
exports.PROFILE_LINK_TITLE_MAX = exports.PROFILE_LINKS_MAX = exports.userNameCheck = void 0;
|
|
9
9
|
const check_1 = require("./check");
|
|
10
10
|
exports.userNameCheck = (0, check_1.exact)()((0, check_1.looseObject)({
|
|
11
11
|
first: (0, check_1.optional)((0, check_1.string)()),
|
|
@@ -13,3 +13,14 @@ exports.userNameCheck = (0, check_1.exact)()((0, check_1.looseObject)({
|
|
|
13
13
|
full: (0, check_1.optional)((0, check_1.string)()),
|
|
14
14
|
displayName: (0, check_1.optional)((0, check_1.string)()),
|
|
15
15
|
}));
|
|
16
|
+
/**
|
|
17
|
+
* Most links a profile may show. Enforced by the server on every write that
|
|
18
|
+
* carries `linksMetadata` (see `user.service.ts`), and by the editor.
|
|
19
|
+
*/
|
|
20
|
+
exports.PROFILE_LINKS_MAX = 10;
|
|
21
|
+
/**
|
|
22
|
+
* Longest title an editor may give a profile link, in characters. Not enforced
|
|
23
|
+
* by the server: titles are scraped from remote pages, and a stored title longer
|
|
24
|
+
* than this must still round-trip through a profile write.
|
|
25
|
+
*/
|
|
26
|
+
exports.PROFILE_LINK_TITLE_MAX = 40;
|
package/dist/cjs/index.js
CHANGED
|
@@ -26,20 +26,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.USERNAME_MAX_LENGTH = exports.USERNAME_MIN_LENGTH = exports.applyBotUsernameSuffix = exports.stripDisallowedUsernameCharacters = exports.isValidUsername = exports.usernameSchemaForAccountKind = exports.usernameSchema = exports.financialEffectAttributionSchema = exports.attributeFinancialEffect = exports.accountKindActsAsItself = exports.accountKindActorNature = exports.accountActorNatureSchema = exports.accountActorChainSchema = exports.accountActorChainFromSession = exports.KIND_INDEPENDENT_ACCOUNT_DIMENSIONS = exports.FINANCIAL_EFFECT_DIRECTIONS = exports.ACCOUNT_SUBJECT_CONTRACT_VERSION = exports.ACCOUNT_ACTOR_NATURES = exports.parseAvatarCharacter = exports.avatarCharacterSchema = exports.avatarCharacterFor = exports.AVATAR_PICKABLE_SHAPES = exports.AVATAR_PICKABLE_COLORS = exports.AVATAR_EYE_SPACING = exports.isPlainTextTitle = exports.accountTitleSchema = exports.accountNamePolicyForKind = exports.ACCOUNT_TITLE_MAX_LENGTH = exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = exports.ACCOUNT_NAME_POLICY_BY_KIND = exports.accountNameSchema = exports.createAccountRequestSchema = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.newlyAddedRetiredCategories = exports.MAX_ACCOUNT_CATEGORIES = exports.kindAcceptsAccountCategories = exports.isSelectableAccountCategoryId = exports.accountCategoryIdSchema = exports.accountCategoriesSchema = exports.ACCOUNT_CATEGORY_KINDS = exports.ACCOUNT_CATEGORY_IDS = exports.isMemberOperatedKind = exports.isOperatorSwitchTargetKind = exports.isDelegatedActAsEligibleKind = exports.isAccountKind = exports.childAccountKindSchema = exports.CHILD_ACCOUNT_KINDS = exports.accountKindSchema = exports.ACCOUNT_KINDS = void 0;
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.applicationAccountTotalSchema = exports.applicationAccountRegistrationResponseSchema = exports.applicationAccountRegistrationRequestSchema = exports.APPLICATION_ACCOUNT_TOTAL_MAX_AGE_SECONDS = exports.APPLICATION_ACCOUNT_REGISTRATION_BATCH_MAX = exports.campaignAttributionSchema = exports.safeNumberCheck = exports.integerCheck = exports.urlCheck = exports.isoDateTime = exports.utf16Length = exports.utf16MaxLength = exports.utf16MinLength = exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = exports.productPlanCatalogueSchema = exports.personalPlanCatalogueSchema = exports.personalPlanDisplayPriceSchema = exports.productSubscriptionCancellationResultSchema = exports.cancelProductSubscriptionSchema = exports.subscriptionCreditGrantsResponseSchema = exports.subscriptionCreditGrantSchema = exports.productSubscriptionsResponseSchema = exports.productSubscriptionSummarySchema = exports.isLoopbackOrigin = exports.inputSatisfiesCapabilityLimits = exports.canonicalCapabilityJson = exports.meteredGenerationSchema = exports.subjectProductAccessSchema = exports.productOfferSegmentSchema = exports.subjectProductGrantSnapshotSchema = exports.productAccessGrantSchema = exports.productSubscriptionSourceSchema = exports.productOfferSchema = exports.productBenefitSchema = exports.subjectProductAccessQuerySchema = void 0;
|
|
29
|
+
exports.appAffinityEventTypeSchema = exports.appUserSignalIngestSchema = exports.appInterestInputSchema = exports.appEndorsementInputSchema = exports.recommendationResponseSchema = exports.recommendationItemSchema = exports.recommendationCountSchema = exports.recommendationRequestSchema = exports.recommendationSignalWeightsSchema = exports.recommendationBoostSchema = exports.recommendationExcludeTypeSchema = exports.oxyServiceEventsHeartbeatSchema = exports.oxySessionRevocationEventSchema = exports.OXY_SERVICE_EVENTS_FORBIDDEN = exports.OXY_SERVICE_EVENTS_STALE_AFTER_MS = exports.OXY_SERVICE_EVENTS_HEARTBEAT_MS = exports.OXY_SERVICE_EVENTS_HEARTBEAT_EVENT = exports.OXY_SESSION_REVOKED_EVENT = exports.OXY_SERVICE_EVENTS_NAMESPACE = exports.oxyUserInvalidationEventSchema = exports.isPublishedOxyUserChangeReason = exports.OXY_PUBLISHED_USER_CHANGE_REASONS = exports.OXY_USER_CHANGE_REASONS = exports.OXY_USER_INVALIDATION_CHANNEL = exports.inboxEmailPushDataSchema = exports.INBOX_EMAIL_PUSH_TYPE = exports.INBOX_EMAIL_PUSH_CHANNEL = exports.IDENTITY_APPROVAL_PUSH_CHANNEL = exports.commonsDenyReasonSchema = exports.COMMONS_DENY_REASONS = exports.sessionStatusSchema = exports.publicApplicationSchema = exports.applicationTypeSchema = exports.safeParseContract = exports.resolveUserId = exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.dateOfBirthSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = exports.PROFILE_LINK_TITLE_MAX = exports.PROFILE_LINKS_MAX = exports.NUMERIC_USERNAME_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.BOT_USERNAME_INVALID_MESSAGE = exports.USERNAME_INVALID_MESSAGE = void 0;
|
|
30
|
+
exports.reputationInfluenceContextSchema = exports.reputationTargetEntityTypeSchema = exports.trustTierSchema = exports.reputationTransactionStatusSchema = exports.reputationCategorySchema = exports.REPUTATION_INFLUENCE_CONTEXTS = exports.REPUTATION_TARGET_ENTITY_TYPES = exports.TRUST_TIERS = exports.REPUTATION_TRANSACTION_STATUSES = exports.REPUTATION_CATEGORIES = exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = exports.validationVoteResultSchema = exports.validationRequestSummarySchema = exports.validationOpenResultSchema = exports.validationOpenRequestSchema = exports.validationVerdictRecordSchema = exports.realLifeAttestationResultSchema = exports.realLifeAttestationRecordSchema = exports.signedPublicCardSchema = exports.publicCardSchema = exports.logPageResponseSchema = exports.chainHeadResponseSchema = exports.oxySignedRecordTypeSchema = exports.exportBundleSchema = exports.exportFinancialSectionSchema = exports.exportUsageReservationSchema = exports.exportLedgerEntrySchema = exports.exportUsageReceiptSchema = exports.exportAttestationSchema = exports.authMethodsResponseSchema = exports.authMethodEntrySchema = exports.domainVerificationInstructionsSchema = exports.resourceDomainOwnershipResponseSchema = exports.resourceDomainOwnershipRequestSchema = exports.domainVerificationRequestSchema = exports.verifiedDomainSchema = exports.signedRecordEnvelopeSchema = exports.didDocumentSchema = exports.didServiceSchema = exports.verificationMethodSchema = exports.appAffinityEventsIngestSchema = exports.appAffinityEventSchema = void 0;
|
|
31
|
+
exports.reverseModerationEffectResultSchema = exports.applyModerationDecisionResultSchema = exports.moderationEffectSchema = exports.reverseModerationEffectSchema = exports.finalizeModerationDecisionSchema = exports.moderationDecisionEventSchema = exports.moderationPolicyVersionsSchema = exports.moderationDecisionEventSubjectSchema = exports.moderationFindingSchema = exports.applicationModerationStandingSchema = exports.identityBindingStatusSchema = exports.identityBindingTypeSchema = exports.personhoodStatusSchema = exports.contributionTierSchema = exports.conductStandingSchema = exports.conductStrikeStatusSchema = exports.moderationEffectSkipReasonSchema = exports.moderationEffectStatusSchema = exports.moderationEffectTypeSchema = exports.moderationDecisionStatusSchema = exports.moderationAttributionSchema = exports.moderationFindingScopeSchema = exports.moderationSeveritySchema = exports.APPLICATION_MODERATION_STANDINGS = exports.IDENTITY_BINDING_STATUSES = exports.IDENTITY_BINDING_TYPES = exports.PERSONHOOD_STATUSES = exports.CONTRIBUTION_TIERS = exports.CONDUCT_STANDINGS = exports.CONDUCT_STRIKE_STATUSES = exports.MODERATION_EFFECT_SKIP_REASONS = exports.MODERATION_EFFECT_STATUSES = exports.MODERATION_EFFECT_TYPES = exports.MODERATION_DECISION_STATUSES = exports.MODERATION_ATTRIBUTIONS = exports.MODERATION_FINDING_SCOPES = exports.MODERATION_SEVERITIES = exports.isFullReputationBalance = exports.awardReputationSchema = exports.reputationInfluenceResultSchema = exports.reputationLeaderboardEntrySchema = exports.reputationLeaderboardUserSchema = exports.reputationRulesResponseSchema = exports.reputationRuleSchema = exports.reputationBalanceSchema = exports.reputationBalanceSummarySchema = exports.reputationReliabilitySchema = exports.reputationInfluenceSchema = exports.reputationBalanceBreakdownSchema = exports.reputationTransactionSchema = void 0;
|
|
32
|
+
exports.rotateKeyCompleteResponseSchema = exports.rotateKeyCompleteRequestSchema = exports.rotateKeyChallengeResponseSchema = exports.loginResultSchema = exports.mcpOAuthConsentResponseSchema = exports.mcpOAuthClientInfoResponseSchema = exports.mcpOAuthConsentContextSchema = exports.mcpOAuthWriteActionSchema = exports.mcpOAuthClientApplicationSchema = exports.oauthAuthorizeCodeResponseSchema = exports.oauthConsentDecisionSchema = exports.deviceDirectorySyncSchema = exports.deviceActivateResponseSchema = exports.deviceActivateRequestSchema = exports.deviceDirectorySchema = exports.devicePrincipalSchema = exports.deviceAccountContextSchema = exports.deviceDirectoryProfileSchema = exports.deviceContextRelationshipSchema = exports.sessionAccountsChangedEventSchema = exports.sessionAccountsChangedReasonSchema = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceJoinResponseSchema = exports.deviceJoinRequestSchema = exports.deviceJoinCodeResponseSchema = exports.deviceJoinCodeRequestSchema = exports.deviceRegisterResponseSchema = exports.deviceProofSchema = exports.deviceBackgroundTokenResponseSchema = exports.deviceBackgroundTokenRequestSchema = exports.deviceBackgroundCredentialResponseSchema = exports.holderContextEvidenceV1ResponseSchema = exports.holderContextEvidenceV1RequestSchema = exports.deviceContextTokenV1ResponseSchema = exports.deviceContextTokenV1RequestSchema = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = exports.applicationModerationTrustSchema = exports.reputationContextualInfluenceSchema = exports.reputationReviewingSchema = exports.reputationReportingSchema = exports.reputationConductSchema = exports.reputationContributionSchema = exports.reputationPersonhoodSchema = exports.identityBindingSchema = exports.registerIdentityBindingSchema = void 0;
|
|
33
|
+
exports.emailAddressSchema = exports.EMAIL_VERIFICATION_ERROR_CODES = exports.EMAIL_TICKET_TTL_MS = exports.EMAIL_CODE_MAX_ATTEMPTS = exports.EMAIL_CODE_TTL_MS = exports.EMAIL_CODE_LENGTH = exports.EMAIL_VERIFICATION_PURPOSES = exports.updateRolloutPatchSchema = exports.promoteRequestSchema = exports.rollbackToEmbeddedRequestSchema = exports.rollbackRequestSchema = exports.updateListResponseSchema = exports.channelListResponseSchema = exports.channelSchema = exports.rollbackToEmbeddedEntrySchema = exports.createUpdateResponseSchema = exports.updateSchema = exports.createUpdateRequestSchema = exports.updateAssetRefSchema = exports.assetCompleteResponseSchema = exports.assetCompleteResultItemSchema = exports.assetCompleteRequestSchema = exports.assetInitResponseSchema = exports.assetUploadTicketSchema = exports.assetInitRequestSchema = exports.assetInitItemSchema = exports.rolloutPercentSchema = exports.runtimeVersionSchema = exports.channelNameSchema = exports.sha256HexSchema = exports.updateAssetStatusSchema = exports.updateStatusSchema = exports.updatePlatformSchema = exports.identityRootStatusSchema = exports.identityProofChallengeResponseSchema = exports.identityProofChallengeRequestSchema = exports.identityProofSchema = exports.buildIdentityProofMessage = exports.canonicalJson = exports.IDENTITY_ERROR_CODES = exports.IDENTITY_PROOF_ACTION_VALUES = exports.IDENTITY_PROOF_ACTIONS = exports.IDENTITY_PROOF_CHALLENGE_TTL_MS = exports.IDENTITY_PROOF_AUDIENCE = exports.IDENTITY_PROOF_DOMAIN = exports.IDENTITY_PROOF_VERSION = exports.backupStatusResponseSchema = exports.backupUploadRequestSchema = exports.encryptedBackupEnvelopeSchema = exports.backupLookupIdSchema = void 0;
|
|
34
|
+
exports.signInMethodsSchema = exports.emailSetRequestSchema = exports.emailChangeStartRequestSchema = exports.signInMethodRemoveRequestSchema = exports.passwordSetRequestSchema = exports.reauthEmailStartRequestSchema = exports.REAUTH_ACTIONS = exports.reauthProofSchema = exports.isSecondFactorRequired = exports.signUpRequestSchema = exports.secondFactorRequiredSchema = exports.secondFactorSignInRequestSchema = exports.passwordSignInRequestSchema = exports.isEmailSignInChooseAccount = exports.emailSignInChooseRequestSchema = exports.emailSignInChooseAccountSchema = exports.emailSignInAccountOptionSchema = exports.EMAIL_ACCOUNTS_MAX = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.emailSignInPendingSchema = exports.emailSignInLinkResponseSchema = exports.emailSignInLinkRequestSchema = exports.emailSignInCollectRequestSchema = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = exports.normalizeEmailSignInCode = exports.emailSignInCodeSchema = exports.emailSignInConfirmRequestSchema = exports.emailSignInStartResponseSchema = exports.emailSignInStartRequestSchema = exports.secondFactorCodeSchema = exports.newPasswordSchema = exports.passwordInputSchema = exports.signInIdentifierSchema = exports.SIGN_IN_ERROR_CODES = exports.TOTP_BACKUP_CODE_COUNT = exports.TOTP_PERIOD_SECONDS = exports.TOTP_DIGITS = exports.SIGN_IN_IDENTIFIER_MAX_LENGTH = exports.SECOND_FACTOR_CODE_MAX_LENGTH = exports.PASSWORD_MAX_LENGTH = exports.PASSWORD_MIN_LENGTH = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.emailVerificationConfirmResponseSchema = exports.emailVerificationConfirmRequestSchema = exports.emailVerificationStartResponseSchema = exports.emailVerificationStartRequestSchema = exports.emailTicketSchema = void 0;
|
|
35
|
+
exports.USAGE_SOURCES = exports.usageUnitSchema = exports.USAGE_UNITS = exports.moneySchema = exports.exactDecimalSchema = exports.INFERENCE_MONEY_SCALE = exports.currencyCodeSchema = exports.RESERVED_ALIA_PUBLISHER = exports.inferenceFundingTierSchema = exports.inferenceRegionSchema = exports.deploymentIdSchema = exports.inferenceProviderSlugSchema = exports.routingProfileSlugSchema = exports.routingProfileIdSchema = exports.modelReferenceSchema = exports.modelRevisionLabelSchema = exports.modelIdSchema = exports.modelSlugSchema = exports.publisherSlugSchema = exports.sha256DigestSchema = exports.inferenceHttpsUrlSchema = exports.inferenceDateSchema = exports.inferenceTimestampSchema = exports.inferenceEnvironmentSchema = exports.idempotencyKeySchema = exports.generationIdSchema = exports.requestIdSchema = exports.oxyCredentialIdSchema = exports.oxyApplicationIdSchema = exports.delegatedUserIdSchema = exports.oxyAccountIdSchema = exports.INFERENCE_CONTRACT_VERSION = exports.transparencyCheckpointListSchema = exports.transparencyInclusionProofSchema = exports.transparencyCheckpointSchema = exports.transparencyAnchorSchema = exports.transparencyCheckpointSignatureSchema = exports.identityLinkCompleteRequestSchema = exports.identityLinkProofRequestSchema = exports.identityLinkStateSchema = exports.identityLinkCreateResponseSchema = exports.parseIdentityLinkQrPayload = exports.buildIdentityLinkQrPayload = exports.identityLinkIdSchema = exports.IDENTITY_LINK_QR_PREFIX = exports.IDENTITY_LINK_STATUSES = exports.totpBackupCodesResponseSchema = exports.totpReauthRequestSchema = exports.totpConfirmRequestSchema = exports.totpEnrollResponseSchema = void 0;
|
|
36
|
+
exports.catalogueServingProviderSummarySchema = exports.cataloguePublisherSummarySchema = exports.routingProfileSchema = exports.routingProfileCandidateSchema = exports.modelDeploymentSchema = exports.inferenceProviderSchema = exports.modelRevisionSchema = exports.catalogueModelSchema = exports.modelPublisherSchema = exports.modelSafetyMetadataSchema = exports.modelEvaluationResultSchema = exports.modelDeprecationSchema = exports.commercialPermissionSchema = exports.availabilityScopeSchema = exports.inferenceDataPolicySchema = exports.modelProvenanceSchema = exports.modelLicenseSchema = exports.modelCapabilitiesSchema = exports.modelRealtimeCapabilitiesSchema = exports.realtimeSessionTransportSchema = exports.realtimeSessionKindSchema = exports.inferenceApiFormatSchema = exports.modelPowerClassSchema = exports.powerLevelSchema = exports.reasoningEffortSchema = exports.inferenceOutputModalitySchema = exports.inferenceModalitySchema = exports.priceSnapshotSchema = exports.priceVersionSchema = exports.priceVersionStatusSchema = exports.embeddingResponseSchema = exports.embeddingFailureSchema = exports.embeddingSuccessSchema = exports.embeddingUsageSchema = exports.embeddingVectorSchema = exports.inferenceErrorSchema = exports.providerErrorPassthroughSchema = exports.safeErrorTextSchema = exports.upstreamErrorCategorySchema = exports.inferenceErrorCodeSchema = exports.NON_RETRYABLE_INFERENCE_ERROR_CODES = exports.INFERENCE_ERROR_CODES = exports.inferenceAttributionSchema = exports.authenticatedPrincipalSchema = exports.billingPrincipalSchema = exports.inferenceScopeSchema = exports.INFERENCE_SCOPES = exports.unitPriceSchema = exports.usageQuantitySchema = exports.usageSourceSchema = void 0;
|
|
37
|
+
exports.inferenceStreamEventSchema = exports.inferenceStreamDoneEventSchema = exports.inferenceFinishReasonSchema = exports.inferenceStreamErrorEventSchema = exports.inferenceStreamRouteSwitchEventSchema = exports.inferenceRouteSwitchReasonSchema = exports.inferenceRouteSwitchDetailSchema = exports.inferenceStreamUsageEventSchema = exports.inferenceStreamToolCallEventSchema = exports.inferenceStreamAudioEventSchema = exports.MAX_INFERENCE_AUDIO_BYTES = exports.inferenceAudioMediaTypeSchema = exports.inferenceStreamDeltaEventSchema = exports.inferenceStreamStartEventSchema = exports.inferenceAudioOutputParametersSchema = exports.inferenceSpeechParametersSchema = exports.inferenceRequestSchema = exports.clientRequestMetadataSchema = exports.responseFormatSchema = exports.toolChoiceSchema = exports.toolDefinitionSchema = exports.inferenceReasoningSchema = exports.samplingParametersSchema = exports.inferenceInputSchema = exports.inferenceMessageSchema = exports.inferenceMessageRoleSchema = exports.inferenceToolCallSchema = exports.inferenceContentPartSchema = exports.inferenceContentSourceSchema = exports.modelDocumentationSchema = exports.modelReleaseIngestionResultSchema = exports.modelReleaseIngestionRequestSchema = exports.modelLineDeclarationSchema = exports.modelGpaiDocumentationSchema = exports.modelDownstreamDocumentationSchema = exports.SYSTEMIC_RISK_COMPUTE_THRESHOLD_FLOPS = exports.trainingComputeFlopsSchema = exports.modelSystemicRiskTierSchema = exports.modelDistributionMethodSchema = exports.aliaModelReleaseManifestSchema = exports.aliaReleaseSignatureSchema = exports.aliaReleaseArtifactSchema = exports.authorizedRouteSchema = exports.effectiveSameModelDeployment = exports.routingPolicyReferenceSchema = exports.routingPolicySchema = exports.routingFallbackPolicySchema = exports.routingPolicyScopeSchema = exports.routingTargetSchema = exports.modelCatalogueEntrySchema = void 0;
|
|
38
|
+
exports.realtimeTranscriptDoneEventSchema = exports.realtimeTranscriptDeltaEventSchema = exports.realtimeTranscriptSourceSchema = exports.realtimeOutputAudioDoneEventSchema = exports.realtimeOutputAudioDeltaEventSchema = exports.realtimeResponseCreatedEventSchema = exports.realtimeInputAudioClearedEventSchema = exports.realtimeInputAudioCommittedEventSchema = exports.realtimeSpeechStoppedEventSchema = exports.realtimeSpeechStartedEventSchema = exports.realtimeItemTruncatedEventSchema = exports.realtimeItemDeletedEventSchema = exports.realtimeItemDoneEventSchema = exports.realtimeItemAddedEventSchema = exports.realtimeCommandAcceptedEventSchema = exports.realtimeSessionResumedEventSchema = exports.realtimeSessionUpdatedEventSchema = exports.realtimeSessionCreatedEventSchema = exports.realtimeClientCommandSchema = exports.realtimeSessionCloseCommandSchema = exports.realtimeSessionResumeCommandSchema = exports.realtimeResponseCancelCommandSchema = exports.realtimeResponseCreateCommandSchema = exports.realtimeInputAudioClearCommandSchema = exports.realtimeInputAudioCommitCommandSchema = exports.realtimeInputAudioAppendCommandSchema = exports.realtimeItemTruncateCommandSchema = exports.realtimeItemDeleteCommandSchema = exports.realtimeItemCreateCommandSchema = exports.realtimeSessionUpdateCommandSchema = exports.realtimeResponseParametersSchema = exports.realtimeConversationItemSchema = exports.realtimeContentPartSchema = exports.realtimeSessionRequestSchema = exports.realtimeClientMetadataSchema = exports.realtimeSessionLimitsSchema = exports.realtimeSessionConfigUpdateSchema = exports.realtimeSessionConfigSchema = exports.realtimeTranslationSchema = exports.realtimeInputTranscriptionSchema = exports.realtimeTurnDetectionSchema = exports.realtimeOutputModalitySchema = exports.realtimeAudioFormatSchema = exports.realtimeResponseIdSchema = exports.realtimeItemIdSchema = exports.realtimeCommandIdSchema = exports.MAX_REALTIME_RESUME_WINDOW_MS = exports.MAX_REALTIME_SESSION_AUDIO_BYTES = exports.MAX_REALTIME_SESSION_DURATION_MS = exports.MAX_REALTIME_AUDIO_FRAME_BASE64_LENGTH = void 0;
|
|
39
|
+
exports.accountBillingStateSchema = exports.billingProfileSchema = exports.autoRechargeSchema = exports.billingProfileStatusSchema = exports.BILLING_PROFILE_STATUSES = exports.billingModeSchema = exports.BILLING_MODES = exports.providerConnectionSchema = exports.providerConnectionStatusSchema = exports.providerConnectionValidationSchema = exports.providerCredentialCustodyStateSchema = exports.providerCredentialValidationDeploymentSchema = exports.providerCredentialValidationOperationSchema = exports.kaanaCredentialValidationOutcomeSchema = exports.kaanaCredentialValidationFailureCodeSchema = exports.kaanaCredentialValidationOutcomeStateSchema = exports.kaanaCredentialValidationTaskSchema = exports.kaanaCredentialOutcomeSchema = exports.kaanaCredentialConflictOutcomeSchema = exports.kaanaCredentialAppliedOutcomeSchema = exports.kaanaCredentialOutcomeRequestSchema = exports.kaanaCredentialRevokeOutcomeRequestSchema = exports.kaanaCredentialRotateOutcomeRequestSchema = exports.kaanaCredentialCreateOutcomeRequestSchema = exports.kaanaCredentialMutationSchema = exports.kaanaCredentialRevokeMutationSchema = exports.kaanaCredentialRotateMutationSchema = exports.kaanaCredentialCreateMutationSchema = exports.kaanaCredentialIdentitySchema = exports.kaanaCredentialOperationActionSchema = exports.kaanaCredentialOperationIdSchema = exports.kaanaCredentialHandleSchema = exports.providerConnectionScopeSchema = exports.usageRefundSchema = exports.usageRefundReasonSchema = exports.usageRefundSubjectSchema = exports.usageReceiptSchema = exports.normalizedUsageReportSchema = exports.inferenceRequestOutcomeSchema = exports.usageReservationSchema = exports.usageReservationStatusSchema = exports.usageReservationRequestSchema = exports.realtimeServerEventSchema = exports.realtimeSessionClosedEventSchema = exports.realtimeSessionCloseReasonSchema = exports.realtimeErrorEventSchema = exports.realtimeResponseDoneEventSchema = exports.realtimeResponseStatusSchema = exports.realtimeToolCallEventSchema = exports.realtimeTextDeltaEventSchema = void 0;
|
|
40
|
+
exports.capabilityTicketRequestSchema = exports.capabilityCoordinatorSchema = exports.executionAuthorizationRefSchema = exports.capabilityCatalogBindingSchema = exports.grantLimitSchema = exports.toolGrantOverrideSchema = exports.resourceRefSchema = exports.firstPartyTaskInputSchema = exports.firstPartyExecutionAuthorizationInputSchema = exports.foregroundExecutionAuthorizationInputSchema = exports.executionActorRefSchema = exports.actorRefSchema = exports.capabilityPackageSchema = exports.autonomyLevelSchema = exports.CAPABILITY_PACKAGES = exports.AUTONOMY_LEVELS = exports.costCenterUsageSchema = exports.providerCostSourceSchema = exports.PROVIDER_COST_SOURCES = exports.inferenceEconomicTreatmentSchema = exports.INFERENCE_ECONOMIC_TREATMENTS = exports.productEntitlementSchema = exports.costCenterSpendSchema = exports.costCenterSchema = exports.costCenterStatusSchema = exports.COST_CENTER_STATUSES = exports.payAsYouGoEntitlementSchema = exports.productPlanSchema = exports.planAllowanceSchema = exports.LIVE_PRODUCT_PLAN_STATUSES = exports.productPlanStatusSchema = exports.PRODUCT_PLAN_STATUSES = exports.reconciliationReportSchema = exports.reconciliationRunSchema = exports.reconciliationDiscrepancySchema = exports.reconciliationRunStatusSchema = exports.RECONCILIATION_RUN_STATUSES = exports.reconciliationDiscrepancyKindSchema = exports.RECONCILIATION_DISCREPANCY_KINDS = exports.autoRechargeAttemptSchema = exports.autoRechargeStatusSchema = exports.AUTO_RECHARGE_STATUSES = exports.externalPaymentSchema = exports.externalPaymentKindSchema = exports.EXTERNAL_PAYMENT_KINDS = exports.externalPaymentProviderSchema = exports.EXTERNAL_PAYMENT_PROVIDERS = exports.billingInvoiceSchema = exports.billingInvoiceStatusSchema = exports.BILLING_INVOICE_STATUSES = void 0;
|
|
41
|
+
exports.inboxThreadSummaryResponseSchema = exports.inboxSmartRepliesResponseSchema = exports.inboxNaturalSearchResponseSchema = exports.inboxInferenceTextResponseSchema = exports.inboxMessageInferenceParamsSchema = exports.inboxNaturalSearchRequestSchema = exports.INBOX_DAILY_BRIEF_SECTIONS = exports.inboxDailyBriefResponseSchema = exports.inboxDailyBriefRequestSchema = exports.inboxComposeRequestSchema = exports.emailAgentContextSchema = exports.emailContextMessageSchema = exports.emailContextMailboxSchema = exports.emailContextAddressSchema = exports.resolveCatalogInvocation = exports.matchCatalogInvocation = exports.findOverlappingCatalogInvocations = exports.catalogInvocationTemplatesEquivalent = exports.catalogInvocationsOverlap = exports.catalogInvocationPathParameters = exports.normalizedAppEventSchema = exports.catalogRegistrationSchema = exports.appCapabilityCatalogSchema = exports.CATALOG_INTERNAL_TRANSPORTS = exports.catalogFeatureSchema = exports.catalogEventSchema = exports.catalogToolSchema = exports.catalogToolAllowsActor = exports.catalogToolActors = exports.catalogToolActorTypeSchema = exports.CATALOG_TOOL_DEFAULT_ACTORS = exports.CATALOG_TOOL_ACTOR_TYPES = exports.auditEventSchema = exports.auditResultSchema = exports.policyDecisionSchema = exports.invocationPrincipalSchema = exports.capabilityTicketClaimsSchema = exports.automationDefinitionSchema = exports.automationDataFlowSchema = exports.automationActorSelectionSchema = exports.automationTriggerSchema = exports.agentAvailabilitySchema = exports.applicationAgentSchema = exports.applicationAgentWriteSchema = exports.applicationAgentAvailabilitySchema = exports.APPLICATION_AGENT_AVAILABILITIES = exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema = exports.AGENT_REQUESTER_CEILING_AUTONOMY = exports.delegationGrantSchema = void 0;
|
|
42
|
+
exports.applicationAccountTotalSchema = exports.applicationAccountRegistrationResponseSchema = exports.applicationAccountRegistrationRequestSchema = exports.APPLICATION_ACCOUNT_TOTAL_MAX_AGE_SECONDS = exports.APPLICATION_ACCOUNT_REGISTRATION_BATCH_MAX = exports.campaignAttributionSchema = exports.safeNumberCheck = exports.integerCheck = exports.urlCheck = exports.isoDateTime = exports.utf16Length = exports.utf16MaxLength = exports.utf16MinLength = exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = exports.productPlanCatalogueSchema = exports.personalPlanCatalogueSchema = exports.personalPlanDisplayPriceSchema = exports.productSubscriptionCancellationResultSchema = exports.cancelProductSubscriptionSchema = exports.subscriptionCreditGrantsResponseSchema = exports.subscriptionCreditGrantSchema = exports.productSubscriptionsResponseSchema = exports.productSubscriptionSummarySchema = exports.isLoopbackOrigin = exports.inputSatisfiesCapabilityLimits = exports.canonicalCapabilityJson = exports.meteredGenerationSchema = exports.subjectProductAccessSchema = exports.productOfferSegmentSchema = exports.subjectProductGrantSnapshotSchema = exports.productAccessGrantSchema = exports.productSubscriptionSourceSchema = exports.productOfferSchema = exports.productBenefitSchema = exports.subjectProductAccessQuerySchema = exports.productDefinitionSchema = exports.inboxInferenceStreamEventSchema = void 0;
|
|
43
43
|
var accountGraph_1 = require("./accountGraph");
|
|
44
44
|
Object.defineProperty(exports, "ACCOUNT_KINDS", { enumerable: true, get: function () { return accountGraph_1.ACCOUNT_KINDS; } });
|
|
45
45
|
Object.defineProperty(exports, "accountKindSchema", { enumerable: true, get: function () { return accountGraph_1.accountKindSchema; } });
|
|
@@ -99,20 +99,23 @@ Object.defineProperty(exports, "USERNAME_INVALID_MESSAGE", { enumerable: true, g
|
|
|
99
99
|
Object.defineProperty(exports, "BOT_USERNAME_INVALID_MESSAGE", { enumerable: true, get: function () { return username_1.BOT_USERNAME_INVALID_MESSAGE; } });
|
|
100
100
|
Object.defineProperty(exports, "RESERVED_USERNAME_MESSAGE", { enumerable: true, get: function () { return username_1.RESERVED_USERNAME_MESSAGE; } });
|
|
101
101
|
Object.defineProperty(exports, "NUMERIC_USERNAME_MESSAGE", { enumerable: true, get: function () { return username_1.NUMERIC_USERNAME_MESSAGE; } });
|
|
102
|
-
var userResponse_1 = require("./userResponse");
|
|
102
|
+
var userResponse_1 = require("./client/userResponse");
|
|
103
|
+
Object.defineProperty(exports, "PROFILE_LINKS_MAX", { enumerable: true, get: function () { return userResponse_1.PROFILE_LINKS_MAX; } });
|
|
104
|
+
Object.defineProperty(exports, "PROFILE_LINK_TITLE_MAX", { enumerable: true, get: function () { return userResponse_1.PROFILE_LINK_TITLE_MAX; } });
|
|
105
|
+
var userResponse_2 = require("./userResponse");
|
|
103
106
|
// Schemas
|
|
104
|
-
Object.defineProperty(exports, "userNameSchema", { enumerable: true, get: function () { return
|
|
105
|
-
Object.defineProperty(exports, "userRelationshipSchema", { enumerable: true, get: function () { return
|
|
106
|
-
Object.defineProperty(exports, "themePreferenceSchema", { enumerable: true, get: function () { return
|
|
107
|
-
Object.defineProperty(exports, "dateOfBirthSchema", { enumerable: true, get: function () { return
|
|
108
|
-
Object.defineProperty(exports, "userResponseSchema", { enumerable: true, get: function () { return
|
|
109
|
-
Object.defineProperty(exports, "userProfileUpdateSchema", { enumerable: true, get: function () { return
|
|
110
|
-
Object.defineProperty(exports, "currentUserResponseSchema", { enumerable: true, get: function () { return
|
|
111
|
-
Object.defineProperty(exports, "deviceLinkedSessionSchema", { enumerable: true, get: function () { return
|
|
112
|
-
Object.defineProperty(exports, "deviceLinkedSessionsResponseSchema", { enumerable: true, get: function () { return
|
|
107
|
+
Object.defineProperty(exports, "userNameSchema", { enumerable: true, get: function () { return userResponse_2.userNameSchema; } });
|
|
108
|
+
Object.defineProperty(exports, "userRelationshipSchema", { enumerable: true, get: function () { return userResponse_2.userRelationshipSchema; } });
|
|
109
|
+
Object.defineProperty(exports, "themePreferenceSchema", { enumerable: true, get: function () { return userResponse_2.themePreferenceSchema; } });
|
|
110
|
+
Object.defineProperty(exports, "dateOfBirthSchema", { enumerable: true, get: function () { return userResponse_2.dateOfBirthSchema; } });
|
|
111
|
+
Object.defineProperty(exports, "userResponseSchema", { enumerable: true, get: function () { return userResponse_2.userResponseSchema; } });
|
|
112
|
+
Object.defineProperty(exports, "userProfileUpdateSchema", { enumerable: true, get: function () { return userResponse_2.userProfileUpdateSchema; } });
|
|
113
|
+
Object.defineProperty(exports, "currentUserResponseSchema", { enumerable: true, get: function () { return userResponse_2.currentUserResponseSchema; } });
|
|
114
|
+
Object.defineProperty(exports, "deviceLinkedSessionSchema", { enumerable: true, get: function () { return userResponse_2.deviceLinkedSessionSchema; } });
|
|
115
|
+
Object.defineProperty(exports, "deviceLinkedSessionsResponseSchema", { enumerable: true, get: function () { return userResponse_2.deviceLinkedSessionsResponseSchema; } });
|
|
113
116
|
// Helpers
|
|
114
|
-
Object.defineProperty(exports, "resolveUserId", { enumerable: true, get: function () { return
|
|
115
|
-
Object.defineProperty(exports, "safeParseContract", { enumerable: true, get: function () { return
|
|
117
|
+
Object.defineProperty(exports, "resolveUserId", { enumerable: true, get: function () { return userResponse_2.resolveUserId; } });
|
|
118
|
+
Object.defineProperty(exports, "safeParseContract", { enumerable: true, get: function () { return userResponse_2.safeParseContract; } });
|
|
116
119
|
var sessionStatus_1 = require("./sessionStatus");
|
|
117
120
|
// Schemas
|
|
118
121
|
Object.defineProperty(exports, "applicationTypeSchema", { enumerable: true, get: function () { return sessionStatus_1.applicationTypeSchema; } });
|
|
@@ -886,6 +889,7 @@ Object.defineProperty(exports, "canonicalCapabilityJson", { enumerable: true, ge
|
|
|
886
889
|
Object.defineProperty(exports, "inputSatisfiesCapabilityLimits", { enumerable: true, get: function () { return capabilityBindings_1.inputSatisfiesCapabilityLimits; } });
|
|
887
890
|
Object.defineProperty(exports, "isLoopbackOrigin", { enumerable: true, get: function () { return capabilityBindings_1.isLoopbackOrigin; } });
|
|
888
891
|
__exportStar(require("./agentKeys"), exports);
|
|
892
|
+
__exportStar(require("./organizationIdentityKey"), exports);
|
|
889
893
|
var billing_1 = require("./products/billing");
|
|
890
894
|
Object.defineProperty(exports, "productSubscriptionSummarySchema", { enumerable: true, get: function () { return billing_1.productSubscriptionSummarySchema; } });
|
|
891
895
|
Object.defineProperty(exports, "productSubscriptionsResponseSchema", { enumerable: true, get: function () { return billing_1.productSubscriptionsResponseSchema; } });
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.organizationIdentityKeyStateSchema = exports.organizationKeyApplyRequestSchema = exports.organizationKeyChallengeSchema = exports.organizationKeyChallengeRequestSchema = exports.organizationKeyProofClaims = exports.organizationKeyPayload = exports.ORGANIZATION_KEY_ERROR_CODES = exports.ORGANIZATION_KEY_PROOF_ACTION_VALUES = exports.ORGANIZATION_KEY_PROOF_ACTIONS = exports.ORGANIZATION_KEY_OPERATIONS = void 0;
|
|
4
|
+
const numberChecks_1 = require("./numberChecks");
|
|
5
|
+
const stringChecks_1 = require("./stringChecks");
|
|
6
|
+
/**
|
|
7
|
+
* An organization's identity key (ADR 0061): its DID `#key-1`, created in
|
|
8
|
+
* Commons by an owner or admin, and the key Peable derives the organization's
|
|
9
|
+
* FairCoin receive addresses from.
|
|
10
|
+
*
|
|
11
|
+
* - `GET /accounts/:id/identity-key` the current key and its history
|
|
12
|
+
* - `POST /accounts/:id/identity-key/challenge` a one-use challenge for one change
|
|
13
|
+
* - `POST /accounts/:id/identity-key` apply it with the signatures
|
|
14
|
+
*
|
|
15
|
+
* No private key or phrase crosses this contract.
|
|
16
|
+
*/
|
|
17
|
+
const zod_1 = require("zod");
|
|
18
|
+
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
19
|
+
// it is re-exported here so the root entry is unchanged.
|
|
20
|
+
const organizationIdentityKey_1 = require("./client/organizationIdentityKey");
|
|
21
|
+
const identityProof_1 = require("./client/identityProof");
|
|
22
|
+
var organizationIdentityKey_2 = require("./client/organizationIdentityKey");
|
|
23
|
+
Object.defineProperty(exports, "ORGANIZATION_KEY_OPERATIONS", { enumerable: true, get: function () { return organizationIdentityKey_2.ORGANIZATION_KEY_OPERATIONS; } });
|
|
24
|
+
Object.defineProperty(exports, "ORGANIZATION_KEY_PROOF_ACTIONS", { enumerable: true, get: function () { return organizationIdentityKey_2.ORGANIZATION_KEY_PROOF_ACTIONS; } });
|
|
25
|
+
Object.defineProperty(exports, "ORGANIZATION_KEY_PROOF_ACTION_VALUES", { enumerable: true, get: function () { return organizationIdentityKey_2.ORGANIZATION_KEY_PROOF_ACTION_VALUES; } });
|
|
26
|
+
Object.defineProperty(exports, "ORGANIZATION_KEY_ERROR_CODES", { enumerable: true, get: function () { return organizationIdentityKey_2.ORGANIZATION_KEY_ERROR_CODES; } });
|
|
27
|
+
Object.defineProperty(exports, "organizationKeyPayload", { enumerable: true, get: function () { return organizationIdentityKey_2.organizationKeyPayload; } });
|
|
28
|
+
Object.defineProperty(exports, "organizationKeyProofClaims", { enumerable: true, get: function () { return organizationIdentityKey_2.organizationKeyProofClaims; } });
|
|
29
|
+
const publicKey = zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(130));
|
|
30
|
+
const signature = zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(512));
|
|
31
|
+
/** `POST /accounts/:id/identity-key/challenge` */
|
|
32
|
+
exports.organizationKeyChallengeRequestSchema = zod_1.z
|
|
33
|
+
.object({ operation: zod_1.z.enum(organizationIdentityKey_1.ORGANIZATION_KEY_OPERATIONS), publicKey })
|
|
34
|
+
.strict();
|
|
35
|
+
/**
|
|
36
|
+
* The challenge and every claim the signers sign
|
|
37
|
+
* (`organizationKeyProofClaims(challenge, signerPublicKey)`).
|
|
38
|
+
*/
|
|
39
|
+
exports.organizationKeyChallengeSchema = zod_1.z
|
|
40
|
+
.object({
|
|
41
|
+
operation: zod_1.z.enum(organizationIdentityKey_1.ORGANIZATION_KEY_OPERATIONS),
|
|
42
|
+
action: zod_1.z.enum(organizationIdentityKey_1.ORGANIZATION_KEY_PROOF_ACTION_VALUES),
|
|
43
|
+
/** The organization (the proof's `subject`). */
|
|
44
|
+
accountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
45
|
+
/** The signed-in person performing it (the proof's `actor`). */
|
|
46
|
+
actorId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
47
|
+
/** The actor's own root, which signs `actorSignature`. */
|
|
48
|
+
actorPublicKey: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
49
|
+
/** The new key, canonical (lowercase, uncompressed). */
|
|
50
|
+
publicKey: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
51
|
+
/** The key it replaces, or `null` for `create`. */
|
|
52
|
+
previousPublicKey: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).nullable(),
|
|
53
|
+
payloadDigest: zod_1.z.string().regex(identityProof_1.HEX_DIGEST),
|
|
54
|
+
audience: zod_1.z.literal(identityProof_1.IDENTITY_PROOF_AUDIENCE),
|
|
55
|
+
challenge: zod_1.z.string().regex(identityProof_1.CHALLENGE),
|
|
56
|
+
/** Unix milliseconds. */
|
|
57
|
+
expiresAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
58
|
+
})
|
|
59
|
+
.strict();
|
|
60
|
+
/** `POST /accounts/:id/identity-key` */
|
|
61
|
+
exports.organizationKeyApplyRequestSchema = zod_1.z
|
|
62
|
+
.object({
|
|
63
|
+
operation: zod_1.z.enum(organizationIdentityKey_1.ORGANIZATION_KEY_OPERATIONS),
|
|
64
|
+
publicKey,
|
|
65
|
+
challenge: zod_1.z.string().regex(identityProof_1.CHALLENGE),
|
|
66
|
+
expiresAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
67
|
+
/** By the actor's own root. */
|
|
68
|
+
actorSignature: signature,
|
|
69
|
+
/** By the new key: proof of possession. */
|
|
70
|
+
keySignature: signature,
|
|
71
|
+
/** By the current key, when replacing and the device holds it. */
|
|
72
|
+
previousKeySignature: signature.optional(),
|
|
73
|
+
})
|
|
74
|
+
.strict();
|
|
75
|
+
/**
|
|
76
|
+
* `GET /accounts/:id/identity-key`, and the answer of a change: the current
|
|
77
|
+
* key (`null` for an organization without one) and every key it has had,
|
|
78
|
+
* oldest first. A retired key is never used again by any account.
|
|
79
|
+
*/
|
|
80
|
+
exports.organizationIdentityKeyStateSchema = zod_1.z
|
|
81
|
+
.object({
|
|
82
|
+
accountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
83
|
+
publicKey: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).nullable(),
|
|
84
|
+
keys: zod_1.z.array(zod_1.z
|
|
85
|
+
.object({
|
|
86
|
+
publicKey: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
87
|
+
method: zod_1.z.enum(organizationIdentityKey_1.ORGANIZATION_KEY_OPERATIONS),
|
|
88
|
+
linkedByUserId: zod_1.z.string().nullable(),
|
|
89
|
+
/** Whether a `replace` was also signed by the key it replaced. */
|
|
90
|
+
previousKeyProven: zod_1.z.boolean(),
|
|
91
|
+
linkedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
92
|
+
retiredAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).nullable(),
|
|
93
|
+
})
|
|
94
|
+
.strict()),
|
|
95
|
+
})
|
|
96
|
+
.strict();
|
package/dist/cjs/userResponse.js
CHANGED
|
@@ -35,6 +35,7 @@ const stringChecks_1 = require("./stringChecks");
|
|
|
35
35
|
* `require()`).
|
|
36
36
|
*/
|
|
37
37
|
const zod_1 = require("zod");
|
|
38
|
+
const userResponse_1 = require("./client/userResponse");
|
|
38
39
|
const identity_1 = require("./identity");
|
|
39
40
|
const accountGraph_1 = require("./accountGraph");
|
|
40
41
|
const avatarCharacter_1 = require("./avatarCharacter");
|
|
@@ -287,6 +288,7 @@ exports.userProfileUpdateSchema = zod_1.z
|
|
|
287
288
|
image: zod_1.z.string().optional(),
|
|
288
289
|
id: zod_1.z.string().optional(),
|
|
289
290
|
}))
|
|
291
|
+
.max(userResponse_1.PROFILE_LINKS_MAX)
|
|
290
292
|
.optional(),
|
|
291
293
|
/**
|
|
292
294
|
* Ordered account locales (`language-REGION`), primary first. Replaces
|
|
@@ -20,6 +20,16 @@ export const IDENTITY_PROOF_ACTIONS = {
|
|
|
20
20
|
* (ADR 0029 D3).
|
|
21
21
|
*/
|
|
22
22
|
link: 'link_identity',
|
|
23
|
+
/**
|
|
24
|
+
* Give an organization its first identity key (ADR 0061 D4). Signed by the
|
|
25
|
+
* acting owner's or admin's own root and by the new key.
|
|
26
|
+
*/
|
|
27
|
+
organizationKeyCreate: 'organization_key_create',
|
|
28
|
+
/**
|
|
29
|
+
* Replace an organization's identity key (ADR 0061 D7). Signed by the actor's
|
|
30
|
+
* root and the new key, and by the current key when the device holds it.
|
|
31
|
+
*/
|
|
32
|
+
organizationKeyReplace: 'organization_key_replace',
|
|
23
33
|
};
|
|
24
34
|
export const IDENTITY_PROOF_ACTION_VALUES = Object.values(IDENTITY_PROOF_ACTIONS);
|
|
25
35
|
export const HEX_DIGEST = /^[0-9a-f]{64}$/;
|
package/dist/esm/client/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { ACCOUNT_CATEGORY_IDS, ACCOUNT_CATEGORY_KINDS, ACCOUNT_KINDS, CHILD_ACCO
|
|
|
19
19
|
export { ACCOUNT_NAME_POLICY_BY_KIND, ACCOUNT_TITLE_DISALLOWED_SOURCE, ACCOUNT_TITLE_MAX_LENGTH, accountNamePolicyForKind, accountTitleCheck, isPlainTextTitle, } from './accountName.js';
|
|
20
20
|
export { EMAIL_CODE_LENGTH, EMAIL_CODE_MAX_ATTEMPTS, EMAIL_CODE_TTL_MS, EMAIL_TICKET_TTL_MS, EMAIL_VERIFICATION_ERROR_CODES, EMAIL_VERIFICATION_PURPOSES, emailAddressCheck, emailTicketCheck, emailVerificationConfirmResponseCheck, emailVerificationStartResponseCheck, } from './accountEmail.js';
|
|
21
21
|
export { ACCOUNT_AUTH_METHODS, AGENT_PROOF_ACTIONS, AGENT_PROOF_AUDIENCE, AGENT_PROOF_TTL_MS, agentChallengeRequestCheck, agentKeyListResponseCheck, agentKeyOperationChallengeCheck, agentKeyOperationCheck, agentKeyOperationResultCheck, agentProofClaimsCheck, agentVerifyRequestCheck, executeAgentKeyOperationCheck, } from './agentKeys.js';
|
|
22
|
+
export { ORGANIZATION_KEY_ERROR_CODES, ORGANIZATION_KEY_OPERATIONS, ORGANIZATION_KEY_PROOF_ACTIONS, ORGANIZATION_KEY_PROOF_ACTION_VALUES, organizationIdentityKeyStateCheck, organizationKeyApplyRequestCheck, organizationKeyChallengeCheck, organizationKeyChallengeRequestCheck, organizationKeyPayload, organizationKeyProofClaims, } from './organizationIdentityKey.js';
|
|
22
23
|
export { isLoopbackOrigin } from '../capabilityBindings.js';
|
|
23
24
|
export { loginResultCheck } from './deviceBoot.js';
|
|
24
25
|
export { externalIdentityReferenceCheck } from './externalIdentity.js';
|
|
@@ -37,7 +38,7 @@ export { publicApplicationCheck } from './sessionStatus.js';
|
|
|
37
38
|
export { CONSOLE_TERMS_VERSION, CONSOLE_USE_CASES, } from './consoleOnboarding.js';
|
|
38
39
|
export { EMAIL_ACCOUNTS_MAX, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_SIGNIN_LINK_TTL_MS, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, REAUTH_ACTIONS, SECOND_FACTOR_CODE_MAX_LENGTH, SIGN_IN_IDENTIFIER_MAX_LENGTH, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGN_IN_ERROR_CODES, TOTP_BACKUP_CODE_COUNT, TOTP_DIGITS, TOTP_PERIOD_SECONDS, emailSignInChooseAccountCheck, emailSignInLinkResponseCheck, emailSignInPendingCheck, emailSignInStartResponseCheck, isEmailSignInChooseAccount, isSecondFactorRequired, normalizeEmailSignInCode, reauthProofCheck, secondFactorRequiredCheck, signInMethodsCheck, totpBackupCodesResponseCheck, totpEnrollResponseCheck, } from './signIn.js';
|
|
39
40
|
export { BOT_USERNAME_INVALID_MESSAGE, BOT_USERNAME_SUFFIX, NUMERIC_USERNAME_MESSAGE, RESERVED_USERNAMES, RESERVED_USERNAME_MESSAGE, USERNAME_INVALID_MESSAGE, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, applyBotUsernameSuffix, botUsernameCheck, stripDisallowedUsernameCharacters, usernameCheck, usernameCheckForAccountKind, } from './username.js';
|
|
40
|
-
export { userNameCheck } from './userResponse.js';
|
|
41
|
+
export { userNameCheck, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './userResponse.js';
|
|
41
42
|
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims.js';
|
|
42
43
|
export { APP_ASSERTION_CHALLENGE_PURPOSES, APP_ASSERTION_ERROR_CODES, APP_ASSERTION_PLATFORMS, OXY_APP_ASSERTION_AUDIENCE, OXY_APP_ASSERTION_HEADER, OXY_APP_ASSERTION_TTL_SECONDS, OXY_APP_ASSERTION_TYPE, appAssertionChallengeResponseCheck, appAssertionResponseCheck, appAttestKeyResponseCheck, } from './appAssertions.js';
|
|
43
44
|
export { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS, FREE_USER_PROFILE_COLOR_PRESETS, } from '../profileColors.generated.js';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An organization's identity key (ADR 0061), without Zod. Schemas:
|
|
3
|
+
* `../organizationIdentityKey.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
|
|
6
|
+
*
|
|
7
|
+
* An organization's key is its DID `#key-1`: the key Peable derives the
|
|
8
|
+
* organization's FairCoin receive addresses from. It is created in Commons by an
|
|
9
|
+
* owner or admin and never signs anybody in. A change is ONE identity proof
|
|
10
|
+
* ceremony (ADR 0024 D7): the server's challenge, then the same claims signed by
|
|
11
|
+
* the actor's own root, by the new key and (to replace) by the current key when
|
|
12
|
+
* the device holds it. The claims differ only in `rootPublicKey`, so no
|
|
13
|
+
* signature can stand in for another.
|
|
14
|
+
*/
|
|
15
|
+
import { array, boolean, datetime, exact, int, literal, maxLength, minLength, nullable, number, oneOf, optional, pattern, positive, strictObject, string, trim, } from './check.js';
|
|
16
|
+
import { CHALLENGE, HEX_DIGEST, IDENTITY_PROOF_ACTIONS, IDENTITY_PROOF_AUDIENCE, } from './identityProof.js';
|
|
17
|
+
/** `create`: an organization without a key gets one. `replace`: a new key takes the current one's place. */
|
|
18
|
+
export const ORGANIZATION_KEY_OPERATIONS = ['create', 'replace'];
|
|
19
|
+
/** The identity-proof action each operation is signed under. */
|
|
20
|
+
export const ORGANIZATION_KEY_PROOF_ACTIONS = {
|
|
21
|
+
create: IDENTITY_PROOF_ACTIONS.organizationKeyCreate,
|
|
22
|
+
replace: IDENTITY_PROOF_ACTIONS.organizationKeyReplace,
|
|
23
|
+
};
|
|
24
|
+
export const ORGANIZATION_KEY_PROOF_ACTION_VALUES = [
|
|
25
|
+
ORGANIZATION_KEY_PROOF_ACTIONS.create,
|
|
26
|
+
ORGANIZATION_KEY_PROOF_ACTIONS.replace,
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Stable error codes of the organization-key routes (`error.code`). The proof,
|
|
30
|
+
* key-in-use and already-linked refusals use `IDENTITY_ERROR_CODES`.
|
|
31
|
+
*/
|
|
32
|
+
export const ORGANIZATION_KEY_ERROR_CODES = {
|
|
33
|
+
/** The caller is not an owner or admin of a claimed, active organization. */
|
|
34
|
+
forbidden: 'ORGANIZATION_KEY_FORBIDDEN',
|
|
35
|
+
/** The signing person has no root of their own (only a Commons account can do this). */
|
|
36
|
+
actorRootRequired: 'ORGANIZATION_KEY_ACTOR_ROOT_REQUIRED',
|
|
37
|
+
/** `replace` on an organization without a key. */
|
|
38
|
+
noKey: 'ORGANIZATION_KEY_MISSING',
|
|
39
|
+
/** The key was already used, by this or another account, and is never reused. */
|
|
40
|
+
keyUsed: 'ORGANIZATION_KEY_USED',
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The payload whose digest every signature of one operation binds. Both sides
|
|
44
|
+
* build it here, so the client and the verifier digest the same object.
|
|
45
|
+
*/
|
|
46
|
+
export function organizationKeyPayload(input) {
|
|
47
|
+
return {
|
|
48
|
+
operation: input.operation,
|
|
49
|
+
accountId: input.accountId,
|
|
50
|
+
publicKey: input.publicKey,
|
|
51
|
+
previousPublicKey: input.previousPublicKey,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** The claims one signer (`rootPublicKey`) signs for `challenge`. */
|
|
55
|
+
export function organizationKeyProofClaims(challenge, rootPublicKey) {
|
|
56
|
+
return {
|
|
57
|
+
action: challenge.action,
|
|
58
|
+
subject: challenge.accountId,
|
|
59
|
+
actor: challenge.actorId,
|
|
60
|
+
rootPublicKey,
|
|
61
|
+
payloadDigest: challenge.payloadDigest,
|
|
62
|
+
expectedRevision: null,
|
|
63
|
+
audience: challenge.audience,
|
|
64
|
+
challenge: challenge.challenge,
|
|
65
|
+
expiresAt: challenge.expiresAt,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/* -------------------------------------------------------------------------- */
|
|
69
|
+
/* Checks */
|
|
70
|
+
/* -------------------------------------------------------------------------- */
|
|
71
|
+
const publicKey = string(trim, minLength(1), maxLength(130));
|
|
72
|
+
const signature = string(trim, minLength(1), maxLength(512));
|
|
73
|
+
const challengeHex = string(pattern(CHALLENGE));
|
|
74
|
+
const timestamp = number(int, positive);
|
|
75
|
+
export const organizationKeyChallengeRequestCheck = exact()(strictObject({ operation: oneOf(ORGANIZATION_KEY_OPERATIONS), publicKey }));
|
|
76
|
+
export const organizationKeyChallengeCheck = exact()(strictObject({
|
|
77
|
+
operation: oneOf(ORGANIZATION_KEY_OPERATIONS),
|
|
78
|
+
action: oneOf(ORGANIZATION_KEY_PROOF_ACTION_VALUES),
|
|
79
|
+
accountId: string(minLength(1)),
|
|
80
|
+
actorId: string(minLength(1)),
|
|
81
|
+
actorPublicKey: string(minLength(1)),
|
|
82
|
+
publicKey: string(minLength(1)),
|
|
83
|
+
previousPublicKey: nullable(string(minLength(1))),
|
|
84
|
+
payloadDigest: string(pattern(HEX_DIGEST)),
|
|
85
|
+
audience: literal(IDENTITY_PROOF_AUDIENCE),
|
|
86
|
+
challenge: challengeHex,
|
|
87
|
+
expiresAt: timestamp,
|
|
88
|
+
}));
|
|
89
|
+
export const organizationKeyApplyRequestCheck = exact()(strictObject({
|
|
90
|
+
operation: oneOf(ORGANIZATION_KEY_OPERATIONS),
|
|
91
|
+
publicKey,
|
|
92
|
+
challenge: challengeHex,
|
|
93
|
+
expiresAt: timestamp,
|
|
94
|
+
actorSignature: signature,
|
|
95
|
+
keySignature: signature,
|
|
96
|
+
previousKeySignature: optional(signature),
|
|
97
|
+
}));
|
|
98
|
+
export const organizationIdentityKeyStateCheck = exact()(strictObject({
|
|
99
|
+
accountId: string(minLength(1)),
|
|
100
|
+
publicKey: nullable(string(minLength(1))),
|
|
101
|
+
keys: array(strictObject({
|
|
102
|
+
publicKey: string(minLength(1)),
|
|
103
|
+
method: oneOf(ORGANIZATION_KEY_OPERATIONS),
|
|
104
|
+
linkedByUserId: nullable(string()),
|
|
105
|
+
previousKeyProven: boolean,
|
|
106
|
+
linkedAt: string(datetime),
|
|
107
|
+
retiredAt: nullable(string(datetime)),
|
|
108
|
+
})),
|
|
109
|
+
}));
|
|
@@ -10,3 +10,14 @@ export const userNameCheck = exact()(looseObject({
|
|
|
10
10
|
full: optional(string()),
|
|
11
11
|
displayName: optional(string()),
|
|
12
12
|
}));
|
|
13
|
+
/**
|
|
14
|
+
* Most links a profile may show. Enforced by the server on every write that
|
|
15
|
+
* carries `linksMetadata` (see `user.service.ts`), and by the editor.
|
|
16
|
+
*/
|
|
17
|
+
export const PROFILE_LINKS_MAX = 10;
|
|
18
|
+
/**
|
|
19
|
+
* Longest title an editor may give a profile link, in characters. Not enforced
|
|
20
|
+
* by the server: titles are scraped from remote pages, and a stored title longer
|
|
21
|
+
* than this must still round-trip through a profile write.
|
|
22
|
+
*/
|
|
23
|
+
export const PROFILE_LINK_TITLE_MAX = 40;
|
package/dist/esm/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { ACCOUNT_NAME_POLICY_BY_KIND, ACCOUNT_TITLE_DISALLOWED_SOURCE, ACCOUNT_T
|
|
|
14
14
|
export { AVATAR_EYE_SPACING, AVATAR_PICKABLE_COLORS, AVATAR_PICKABLE_SHAPES, avatarCharacterFor, avatarCharacterSchema, parseAvatarCharacter, } from './avatarCharacter.js';
|
|
15
15
|
export { ACCOUNT_ACTOR_NATURES, ACCOUNT_SUBJECT_CONTRACT_VERSION, FINANCIAL_EFFECT_DIRECTIONS, KIND_INDEPENDENT_ACCOUNT_DIMENSIONS, accountActorChainFromSession, accountActorChainSchema, accountActorNatureSchema, accountKindActorNature, accountKindActsAsItself, attributeFinancialEffect, financialEffectAttributionSchema, } from './accountSubject.js';
|
|
16
16
|
export { usernameSchema, usernameSchemaForAccountKind, isValidUsername, stripDisallowedUsernameCharacters, applyBotUsernameSuffix, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH, USERNAME_INVALID_MESSAGE, BOT_USERNAME_INVALID_MESSAGE, RESERVED_USERNAME_MESSAGE, NUMERIC_USERNAME_MESSAGE, } from './username.js';
|
|
17
|
+
export { PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './client/userResponse.js';
|
|
17
18
|
export {
|
|
18
19
|
// Schemas
|
|
19
20
|
userNameSchema, userRelationshipSchema, themePreferenceSchema, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema,
|
|
@@ -198,6 +199,7 @@ export { productDefinitionSchema, subjectProductAccessQuerySchema, productBenefi
|
|
|
198
199
|
export { meteredGenerationSchema } from './inference/economics.js';
|
|
199
200
|
export { canonicalCapabilityJson, inputSatisfiesCapabilityLimits, isLoopbackOrigin, } from './capabilityBindings.js';
|
|
200
201
|
export * from './agentKeys.js';
|
|
202
|
+
export * from './organizationIdentityKey.js';
|
|
201
203
|
export { productSubscriptionSummarySchema, productSubscriptionsResponseSchema, subscriptionCreditGrantSchema, subscriptionCreditGrantsResponseSchema, cancelProductSubscriptionSchema, productSubscriptionCancellationResultSchema, } from './products/billing.js';
|
|
202
204
|
export { personalPlanDisplayPriceSchema, personalPlanCatalogueSchema, productPlanCatalogueSchema, } from './products/plans.js';
|
|
203
205
|
export * from './products/checkout.js';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
2
|
+
import { isoDateTime, utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
3
|
+
/**
|
|
4
|
+
* An organization's identity key (ADR 0061): its DID `#key-1`, created in
|
|
5
|
+
* Commons by an owner or admin, and the key Peable derives the organization's
|
|
6
|
+
* FairCoin receive addresses from.
|
|
7
|
+
*
|
|
8
|
+
* - `GET /accounts/:id/identity-key` the current key and its history
|
|
9
|
+
* - `POST /accounts/:id/identity-key/challenge` a one-use challenge for one change
|
|
10
|
+
* - `POST /accounts/:id/identity-key` apply it with the signatures
|
|
11
|
+
*
|
|
12
|
+
* No private key or phrase crosses this contract.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
16
|
+
// it is re-exported here so the root entry is unchanged.
|
|
17
|
+
import { ORGANIZATION_KEY_OPERATIONS, ORGANIZATION_KEY_PROOF_ACTION_VALUES, } from './client/organizationIdentityKey.js';
|
|
18
|
+
import { CHALLENGE, HEX_DIGEST, IDENTITY_PROOF_AUDIENCE } from './client/identityProof.js';
|
|
19
|
+
export { ORGANIZATION_KEY_OPERATIONS, ORGANIZATION_KEY_PROOF_ACTIONS, ORGANIZATION_KEY_PROOF_ACTION_VALUES, ORGANIZATION_KEY_ERROR_CODES, organizationKeyPayload, organizationKeyProofClaims, } from './client/organizationIdentityKey.js';
|
|
20
|
+
const publicKey = z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(130));
|
|
21
|
+
const signature = z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(512));
|
|
22
|
+
/** `POST /accounts/:id/identity-key/challenge` */
|
|
23
|
+
export const organizationKeyChallengeRequestSchema = z
|
|
24
|
+
.object({ operation: z.enum(ORGANIZATION_KEY_OPERATIONS), publicKey })
|
|
25
|
+
.strict();
|
|
26
|
+
/**
|
|
27
|
+
* The challenge and every claim the signers sign
|
|
28
|
+
* (`organizationKeyProofClaims(challenge, signerPublicKey)`).
|
|
29
|
+
*/
|
|
30
|
+
export const organizationKeyChallengeSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
operation: z.enum(ORGANIZATION_KEY_OPERATIONS),
|
|
33
|
+
action: z.enum(ORGANIZATION_KEY_PROOF_ACTION_VALUES),
|
|
34
|
+
/** The organization (the proof's `subject`). */
|
|
35
|
+
accountId: z.string().check(utf16MinLength(1)),
|
|
36
|
+
/** The signed-in person performing it (the proof's `actor`). */
|
|
37
|
+
actorId: z.string().check(utf16MinLength(1)),
|
|
38
|
+
/** The actor's own root, which signs `actorSignature`. */
|
|
39
|
+
actorPublicKey: z.string().check(utf16MinLength(1)),
|
|
40
|
+
/** The new key, canonical (lowercase, uncompressed). */
|
|
41
|
+
publicKey: z.string().check(utf16MinLength(1)),
|
|
42
|
+
/** The key it replaces, or `null` for `create`. */
|
|
43
|
+
previousPublicKey: z.string().check(utf16MinLength(1)).nullable(),
|
|
44
|
+
payloadDigest: z.string().regex(HEX_DIGEST),
|
|
45
|
+
audience: z.literal(IDENTITY_PROOF_AUDIENCE),
|
|
46
|
+
challenge: z.string().regex(CHALLENGE),
|
|
47
|
+
/** Unix milliseconds. */
|
|
48
|
+
expiresAt: z.number().check(integerCheck()).positive(),
|
|
49
|
+
})
|
|
50
|
+
.strict();
|
|
51
|
+
/** `POST /accounts/:id/identity-key` */
|
|
52
|
+
export const organizationKeyApplyRequestSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
operation: z.enum(ORGANIZATION_KEY_OPERATIONS),
|
|
55
|
+
publicKey,
|
|
56
|
+
challenge: z.string().regex(CHALLENGE),
|
|
57
|
+
expiresAt: z.number().check(integerCheck()).positive(),
|
|
58
|
+
/** By the actor's own root. */
|
|
59
|
+
actorSignature: signature,
|
|
60
|
+
/** By the new key: proof of possession. */
|
|
61
|
+
keySignature: signature,
|
|
62
|
+
/** By the current key, when replacing and the device holds it. */
|
|
63
|
+
previousKeySignature: signature.optional(),
|
|
64
|
+
})
|
|
65
|
+
.strict();
|
|
66
|
+
/**
|
|
67
|
+
* `GET /accounts/:id/identity-key`, and the answer of a change: the current
|
|
68
|
+
* key (`null` for an organization without one) and every key it has had,
|
|
69
|
+
* oldest first. A retired key is never used again by any account.
|
|
70
|
+
*/
|
|
71
|
+
export const organizationIdentityKeyStateSchema = z
|
|
72
|
+
.object({
|
|
73
|
+
accountId: z.string().check(utf16MinLength(1)),
|
|
74
|
+
publicKey: z.string().check(utf16MinLength(1)).nullable(),
|
|
75
|
+
keys: z.array(z
|
|
76
|
+
.object({
|
|
77
|
+
publicKey: z.string().check(utf16MinLength(1)),
|
|
78
|
+
method: z.enum(ORGANIZATION_KEY_OPERATIONS),
|
|
79
|
+
linkedByUserId: z.string().nullable(),
|
|
80
|
+
/** Whether a `replace` was also signed by the key it replaced. */
|
|
81
|
+
previousKeyProven: z.boolean(),
|
|
82
|
+
linkedAt: z.string().check(isoDateTime()),
|
|
83
|
+
retiredAt: z.string().check(isoDateTime()).nullable(),
|
|
84
|
+
})
|
|
85
|
+
.strict()),
|
|
86
|
+
})
|
|
87
|
+
.strict();
|
package/dist/esm/userResponse.js
CHANGED
|
@@ -30,6 +30,7 @@ import { isoDateTime } from './stringChecks.js';
|
|
|
30
30
|
* `require()`).
|
|
31
31
|
*/
|
|
32
32
|
import { z } from 'zod';
|
|
33
|
+
import { PROFILE_LINKS_MAX } from './client/userResponse.js';
|
|
33
34
|
import { verifiedDomainSchema } from './identity.js';
|
|
34
35
|
import { accountCategoriesSchema, accountKindSchema } from './accountGraph.js';
|
|
35
36
|
import { avatarCharacterSchema } from './avatarCharacter.js';
|
|
@@ -282,6 +283,7 @@ export const userProfileUpdateSchema = z
|
|
|
282
283
|
image: z.string().optional(),
|
|
283
284
|
id: z.string().optional(),
|
|
284
285
|
}))
|
|
286
|
+
.max(PROFILE_LINKS_MAX)
|
|
285
287
|
.optional(),
|
|
286
288
|
/**
|
|
287
289
|
* Ordered account locales (`language-REGION`), primary first. Replaces
|
|
@@ -20,6 +20,16 @@ export declare const IDENTITY_PROOF_ACTIONS: {
|
|
|
20
20
|
* (ADR 0029 D3).
|
|
21
21
|
*/
|
|
22
22
|
readonly link: "link_identity";
|
|
23
|
+
/**
|
|
24
|
+
* Give an organization its first identity key (ADR 0061 D4). Signed by the
|
|
25
|
+
* acting owner's or admin's own root and by the new key.
|
|
26
|
+
*/
|
|
27
|
+
readonly organizationKeyCreate: "organization_key_create";
|
|
28
|
+
/**
|
|
29
|
+
* Replace an organization's identity key (ADR 0061 D7). Signed by the actor's
|
|
30
|
+
* root and the new key, and by the current key when the device holds it.
|
|
31
|
+
*/
|
|
32
|
+
readonly organizationKeyReplace: "organization_key_replace";
|
|
23
33
|
};
|
|
24
34
|
export type IdentityProofAction = (typeof IDENTITY_PROOF_ACTIONS)[keyof typeof IDENTITY_PROOF_ACTIONS];
|
|
25
35
|
export declare const IDENTITY_PROOF_ACTION_VALUES: [IdentityProofAction, ...IdentityProofAction[]];
|
|
@@ -19,6 +19,8 @@ export { ACCOUNT_CATEGORY_IDS, ACCOUNT_CATEGORY_KINDS, ACCOUNT_KINDS, CHILD_ACCO
|
|
|
19
19
|
export { ACCOUNT_NAME_POLICY_BY_KIND, ACCOUNT_TITLE_DISALLOWED_SOURCE, ACCOUNT_TITLE_MAX_LENGTH, accountNamePolicyForKind, accountTitleCheck, isPlainTextTitle, } from './accountName';
|
|
20
20
|
export { EMAIL_CODE_LENGTH, EMAIL_CODE_MAX_ATTEMPTS, EMAIL_CODE_TTL_MS, EMAIL_TICKET_TTL_MS, EMAIL_VERIFICATION_ERROR_CODES, EMAIL_VERIFICATION_PURPOSES, emailAddressCheck, emailTicketCheck, emailVerificationConfirmResponseCheck, emailVerificationStartResponseCheck, } from './accountEmail';
|
|
21
21
|
export { ACCOUNT_AUTH_METHODS, AGENT_PROOF_ACTIONS, AGENT_PROOF_AUDIENCE, AGENT_PROOF_TTL_MS, agentChallengeRequestCheck, agentKeyListResponseCheck, agentKeyOperationChallengeCheck, agentKeyOperationCheck, agentKeyOperationResultCheck, agentProofClaimsCheck, agentVerifyRequestCheck, executeAgentKeyOperationCheck, } from './agentKeys';
|
|
22
|
+
export { ORGANIZATION_KEY_ERROR_CODES, ORGANIZATION_KEY_OPERATIONS, ORGANIZATION_KEY_PROOF_ACTIONS, ORGANIZATION_KEY_PROOF_ACTION_VALUES, organizationIdentityKeyStateCheck, organizationKeyApplyRequestCheck, organizationKeyChallengeCheck, organizationKeyChallengeRequestCheck, organizationKeyPayload, organizationKeyProofClaims, } from './organizationIdentityKey';
|
|
23
|
+
export type { OrganizationKeyErrorCode, OrganizationKeyOperation, OrganizationKeyProofAction, } from './organizationIdentityKey';
|
|
22
24
|
export { isLoopbackOrigin } from '../capabilityBindings';
|
|
23
25
|
export { loginResultCheck } from './deviceBoot';
|
|
24
26
|
export { externalIdentityReferenceCheck } from './externalIdentity';
|
|
@@ -37,7 +39,7 @@ export { publicApplicationCheck } from './sessionStatus';
|
|
|
37
39
|
export { CONSOLE_TERMS_VERSION, CONSOLE_USE_CASES, type ConsoleUseCaseId, } from './consoleOnboarding';
|
|
38
40
|
export { EMAIL_ACCOUNTS_MAX, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_SIGNIN_LINK_TTL_MS, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, REAUTH_ACTIONS, SECOND_FACTOR_CODE_MAX_LENGTH, SIGN_IN_IDENTIFIER_MAX_LENGTH, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGN_IN_ERROR_CODES, TOTP_BACKUP_CODE_COUNT, TOTP_DIGITS, TOTP_PERIOD_SECONDS, emailSignInChooseAccountCheck, emailSignInLinkResponseCheck, emailSignInPendingCheck, emailSignInStartResponseCheck, isEmailSignInChooseAccount, isSecondFactorRequired, normalizeEmailSignInCode, reauthProofCheck, secondFactorRequiredCheck, signInMethodsCheck, totpBackupCodesResponseCheck, totpEnrollResponseCheck, } from './signIn';
|
|
39
41
|
export { BOT_USERNAME_INVALID_MESSAGE, BOT_USERNAME_SUFFIX, NUMERIC_USERNAME_MESSAGE, RESERVED_USERNAMES, RESERVED_USERNAME_MESSAGE, USERNAME_INVALID_MESSAGE, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, applyBotUsernameSuffix, botUsernameCheck, stripDisallowedUsernameCharacters, usernameCheck, usernameCheckForAccountKind, } from './username';
|
|
40
|
-
export { userNameCheck } from './userResponse';
|
|
42
|
+
export { userNameCheck, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './userResponse';
|
|
41
43
|
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims';
|
|
42
44
|
export { APP_ASSERTION_CHALLENGE_PURPOSES, APP_ASSERTION_ERROR_CODES, APP_ASSERTION_PLATFORMS, OXY_APP_ASSERTION_AUDIENCE, OXY_APP_ASSERTION_HEADER, OXY_APP_ASSERTION_TTL_SECONDS, OXY_APP_ASSERTION_TYPE, appAssertionChallengeResponseCheck, appAssertionResponseCheck, appAttestKeyResponseCheck, } from './appAssertions';
|
|
43
45
|
export { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS, FREE_USER_PROFILE_COLOR_PRESETS, } from '../profileColors.generated';
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An organization's identity key (ADR 0061), without Zod. Schemas:
|
|
3
|
+
* `../organizationIdentityKey.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
|
|
6
|
+
*
|
|
7
|
+
* An organization's key is its DID `#key-1`: the key Peable derives the
|
|
8
|
+
* organization's FairCoin receive addresses from. It is created in Commons by an
|
|
9
|
+
* owner or admin and never signs anybody in. A change is ONE identity proof
|
|
10
|
+
* ceremony (ADR 0024 D7): the server's challenge, then the same claims signed by
|
|
11
|
+
* the actor's own root, by the new key and (to replace) by the current key when
|
|
12
|
+
* the device holds it. The claims differ only in `rootPublicKey`, so no
|
|
13
|
+
* signature can stand in for another.
|
|
14
|
+
*/
|
|
15
|
+
import type { OrganizationKeyChallenge } from '../organizationIdentityKey';
|
|
16
|
+
import { type IdentityProofClaims } from './identityProof';
|
|
17
|
+
/** `create`: an organization without a key gets one. `replace`: a new key takes the current one's place. */
|
|
18
|
+
export declare const ORGANIZATION_KEY_OPERATIONS: readonly ["create", "replace"];
|
|
19
|
+
export type OrganizationKeyOperation = (typeof ORGANIZATION_KEY_OPERATIONS)[number];
|
|
20
|
+
/** The identity-proof action each operation is signed under. */
|
|
21
|
+
export declare const ORGANIZATION_KEY_PROOF_ACTIONS: {
|
|
22
|
+
readonly create: "organization_key_create";
|
|
23
|
+
readonly replace: "organization_key_replace";
|
|
24
|
+
};
|
|
25
|
+
export declare const ORGANIZATION_KEY_PROOF_ACTION_VALUES: readonly ["organization_key_create", "organization_key_replace"];
|
|
26
|
+
export type OrganizationKeyProofAction = (typeof ORGANIZATION_KEY_PROOF_ACTION_VALUES)[number];
|
|
27
|
+
/**
|
|
28
|
+
* Stable error codes of the organization-key routes (`error.code`). The proof,
|
|
29
|
+
* key-in-use and already-linked refusals use `IDENTITY_ERROR_CODES`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const ORGANIZATION_KEY_ERROR_CODES: {
|
|
32
|
+
/** The caller is not an owner or admin of a claimed, active organization. */
|
|
33
|
+
readonly forbidden: "ORGANIZATION_KEY_FORBIDDEN";
|
|
34
|
+
/** The signing person has no root of their own (only a Commons account can do this). */
|
|
35
|
+
readonly actorRootRequired: "ORGANIZATION_KEY_ACTOR_ROOT_REQUIRED";
|
|
36
|
+
/** `replace` on an organization without a key. */
|
|
37
|
+
readonly noKey: "ORGANIZATION_KEY_MISSING";
|
|
38
|
+
/** The key was already used, by this or another account, and is never reused. */
|
|
39
|
+
readonly keyUsed: "ORGANIZATION_KEY_USED";
|
|
40
|
+
};
|
|
41
|
+
export type OrganizationKeyErrorCode = (typeof ORGANIZATION_KEY_ERROR_CODES)[keyof typeof ORGANIZATION_KEY_ERROR_CODES];
|
|
42
|
+
/**
|
|
43
|
+
* The payload whose digest every signature of one operation binds. Both sides
|
|
44
|
+
* build it here, so the client and the verifier digest the same object.
|
|
45
|
+
*/
|
|
46
|
+
export declare function organizationKeyPayload(input: {
|
|
47
|
+
operation: OrganizationKeyOperation;
|
|
48
|
+
accountId: string;
|
|
49
|
+
publicKey: string;
|
|
50
|
+
previousPublicKey: string | null;
|
|
51
|
+
}): {
|
|
52
|
+
operation: OrganizationKeyOperation;
|
|
53
|
+
accountId: string;
|
|
54
|
+
publicKey: string;
|
|
55
|
+
previousPublicKey: string | null;
|
|
56
|
+
};
|
|
57
|
+
/** The claims one signer (`rootPublicKey`) signs for `challenge`. */
|
|
58
|
+
export declare function organizationKeyProofClaims(challenge: OrganizationKeyChallenge, rootPublicKey: string): IdentityProofClaims;
|
|
59
|
+
export declare const organizationKeyChallengeRequestCheck: import("./check").Check<{
|
|
60
|
+
operation: "replace" | "create";
|
|
61
|
+
publicKey: string;
|
|
62
|
+
}>;
|
|
63
|
+
export declare const organizationKeyChallengeCheck: import("./check").Check<{
|
|
64
|
+
operation: "replace" | "create";
|
|
65
|
+
action: "organization_key_create" | "organization_key_replace";
|
|
66
|
+
accountId: string;
|
|
67
|
+
actorId: string;
|
|
68
|
+
actorPublicKey: string;
|
|
69
|
+
publicKey: string;
|
|
70
|
+
previousPublicKey: string | null;
|
|
71
|
+
payloadDigest: string;
|
|
72
|
+
audience: "oxy-api/identity";
|
|
73
|
+
challenge: string;
|
|
74
|
+
expiresAt: number;
|
|
75
|
+
}>;
|
|
76
|
+
export declare const organizationKeyApplyRequestCheck: import("./check").Check<{
|
|
77
|
+
operation: "replace" | "create";
|
|
78
|
+
publicKey: string;
|
|
79
|
+
challenge: string;
|
|
80
|
+
expiresAt: number;
|
|
81
|
+
actorSignature: string;
|
|
82
|
+
keySignature: string;
|
|
83
|
+
previousKeySignature?: string | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
export declare const organizationIdentityKeyStateCheck: import("./check").Check<{
|
|
86
|
+
accountId: string;
|
|
87
|
+
publicKey: string | null;
|
|
88
|
+
keys: {
|
|
89
|
+
publicKey: string;
|
|
90
|
+
method: "replace" | "create";
|
|
91
|
+
linkedByUserId: string | null;
|
|
92
|
+
previousKeyProven: boolean;
|
|
93
|
+
linkedAt: string;
|
|
94
|
+
retiredAt: string | null;
|
|
95
|
+
}[];
|
|
96
|
+
}>;
|
|
@@ -5,3 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { UserNameResponse } from '../userResponse';
|
|
7
7
|
export declare const userNameCheck: import("./check").Check<UserNameResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Most links a profile may show. Enforced by the server on every write that
|
|
10
|
+
* carries `linksMetadata` (see `user.service.ts`), and by the editor.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PROFILE_LINKS_MAX = 10;
|
|
13
|
+
/**
|
|
14
|
+
* Longest title an editor may give a profile link, in characters. Not enforced
|
|
15
|
+
* by the server: titles are scraped from remote pages, and a stored title longer
|
|
16
|
+
* than this must still round-trip through a profile write.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PROFILE_LINK_TITLE_MAX = 40;
|
|
@@ -30,6 +30,8 @@ export type IdentityProof = z.infer<typeof identityProofSchema>;
|
|
|
30
30
|
export declare const identityProofChallengeRequestSchema: z.ZodObject<{
|
|
31
31
|
action: z.ZodEnum<{
|
|
32
32
|
link_identity: "link_identity";
|
|
33
|
+
organization_key_create: "organization_key_create";
|
|
34
|
+
organization_key_replace: "organization_key_replace";
|
|
33
35
|
}>;
|
|
34
36
|
}, z.core.$strip>;
|
|
35
37
|
export type IdentityProofChallengeRequest = z.infer<typeof identityProofChallengeRequestSchema>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export type { AvatarCharacter } from './avatarCharacter';
|
|
|
18
18
|
export { ACCOUNT_ACTOR_NATURES, ACCOUNT_SUBJECT_CONTRACT_VERSION, FINANCIAL_EFFECT_DIRECTIONS, KIND_INDEPENDENT_ACCOUNT_DIMENSIONS, accountActorChainFromSession, accountActorChainSchema, accountActorNatureSchema, accountKindActorNature, accountKindActsAsItself, attributeFinancialEffect, financialEffectAttributionSchema, } from './accountSubject';
|
|
19
19
|
export type { AccountActorChain, AccountActorNature, FinancialEffectAttribution, FinancialEffectDirection, KindIndependentAccountDimension, } from './accountSubject';
|
|
20
20
|
export { usernameSchema, usernameSchemaForAccountKind, isValidUsername, stripDisallowedUsernameCharacters, applyBotUsernameSuffix, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH, USERNAME_INVALID_MESSAGE, BOT_USERNAME_INVALID_MESSAGE, RESERVED_USERNAME_MESSAGE, NUMERIC_USERNAME_MESSAGE, } from './username';
|
|
21
|
+
export { PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './client/userResponse';
|
|
21
22
|
export { userNameSchema, userRelationshipSchema, themePreferenceSchema, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema, resolveUserId, safeParseContract, } from './userResponse';
|
|
22
23
|
export type { UserNameResponse, UserRelationship, ThemePreference, UserResponse, UserProfileUpdate, CurrentUserResponseContract, DeviceLinkedSessionResponse, DeviceLinkedSessionsResponseContract, } from './userResponse';
|
|
23
24
|
export { applicationTypeSchema, publicApplicationSchema, sessionStatusSchema, } from './sessionStatus';
|
|
@@ -127,6 +128,7 @@ export type { ProductDefinition, SubjectProductAccessQuery, SubjectProductGrantS
|
|
|
127
128
|
export { meteredGenerationSchema, type MeteredGeneration } from './inference/economics';
|
|
128
129
|
export { canonicalCapabilityJson, inputSatisfiesCapabilityLimits, isLoopbackOrigin, } from './capabilityBindings';
|
|
129
130
|
export * from './agentKeys';
|
|
131
|
+
export * from './organizationIdentityKey';
|
|
130
132
|
export { productSubscriptionSummarySchema, productSubscriptionsResponseSchema, subscriptionCreditGrantSchema, subscriptionCreditGrantsResponseSchema, cancelProductSubscriptionSchema, productSubscriptionCancellationResultSchema, type ProductSubscriptionSummary, type SubscriptionCreditGrant, type ProductSubscriptionCancellationResult, } from './products/billing';
|
|
131
133
|
export { personalPlanDisplayPriceSchema, personalPlanCatalogueSchema, productPlanCatalogueSchema, type ProductPlanCatalogue, type PersonalPlanCatalogue, } from './products/plans';
|
|
132
134
|
export * from './products/checkout';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An organization's identity key (ADR 0061): its DID `#key-1`, created in
|
|
3
|
+
* Commons by an owner or admin, and the key Peable derives the organization's
|
|
4
|
+
* FairCoin receive addresses from.
|
|
5
|
+
*
|
|
6
|
+
* - `GET /accounts/:id/identity-key` the current key and its history
|
|
7
|
+
* - `POST /accounts/:id/identity-key/challenge` a one-use challenge for one change
|
|
8
|
+
* - `POST /accounts/:id/identity-key` apply it with the signatures
|
|
9
|
+
*
|
|
10
|
+
* No private key or phrase crosses this contract.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
export { ORGANIZATION_KEY_OPERATIONS, ORGANIZATION_KEY_PROOF_ACTIONS, ORGANIZATION_KEY_PROOF_ACTION_VALUES, ORGANIZATION_KEY_ERROR_CODES, organizationKeyPayload, organizationKeyProofClaims, } from './client/organizationIdentityKey';
|
|
14
|
+
export type { OrganizationKeyOperation, OrganizationKeyProofAction, OrganizationKeyErrorCode, } from './client/organizationIdentityKey';
|
|
15
|
+
/** `POST /accounts/:id/identity-key/challenge` */
|
|
16
|
+
export declare const organizationKeyChallengeRequestSchema: z.ZodObject<{
|
|
17
|
+
operation: z.ZodEnum<{
|
|
18
|
+
replace: "replace";
|
|
19
|
+
create: "create";
|
|
20
|
+
}>;
|
|
21
|
+
publicKey: z.ZodString;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export type OrganizationKeyChallengeRequest = z.infer<typeof organizationKeyChallengeRequestSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* The challenge and every claim the signers sign
|
|
26
|
+
* (`organizationKeyProofClaims(challenge, signerPublicKey)`).
|
|
27
|
+
*/
|
|
28
|
+
export declare const organizationKeyChallengeSchema: z.ZodObject<{
|
|
29
|
+
operation: z.ZodEnum<{
|
|
30
|
+
replace: "replace";
|
|
31
|
+
create: "create";
|
|
32
|
+
}>;
|
|
33
|
+
action: z.ZodEnum<{
|
|
34
|
+
organization_key_create: "organization_key_create";
|
|
35
|
+
organization_key_replace: "organization_key_replace";
|
|
36
|
+
}>;
|
|
37
|
+
accountId: z.ZodString;
|
|
38
|
+
actorId: z.ZodString;
|
|
39
|
+
actorPublicKey: z.ZodString;
|
|
40
|
+
publicKey: z.ZodString;
|
|
41
|
+
previousPublicKey: z.ZodNullable<z.ZodString>;
|
|
42
|
+
payloadDigest: z.ZodString;
|
|
43
|
+
audience: z.ZodLiteral<"oxy-api/identity">;
|
|
44
|
+
challenge: z.ZodString;
|
|
45
|
+
expiresAt: z.ZodNumber;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
export type OrganizationKeyChallenge = z.infer<typeof organizationKeyChallengeSchema>;
|
|
48
|
+
/** `POST /accounts/:id/identity-key` */
|
|
49
|
+
export declare const organizationKeyApplyRequestSchema: z.ZodObject<{
|
|
50
|
+
operation: z.ZodEnum<{
|
|
51
|
+
replace: "replace";
|
|
52
|
+
create: "create";
|
|
53
|
+
}>;
|
|
54
|
+
publicKey: z.ZodString;
|
|
55
|
+
challenge: z.ZodString;
|
|
56
|
+
expiresAt: z.ZodNumber;
|
|
57
|
+
actorSignature: z.ZodString;
|
|
58
|
+
keySignature: z.ZodString;
|
|
59
|
+
previousKeySignature: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export type OrganizationKeyApplyRequest = z.infer<typeof organizationKeyApplyRequestSchema>;
|
|
62
|
+
/**
|
|
63
|
+
* `GET /accounts/:id/identity-key`, and the answer of a change: the current
|
|
64
|
+
* key (`null` for an organization without one) and every key it has had,
|
|
65
|
+
* oldest first. A retired key is never used again by any account.
|
|
66
|
+
*/
|
|
67
|
+
export declare const organizationIdentityKeyStateSchema: z.ZodObject<{
|
|
68
|
+
accountId: z.ZodString;
|
|
69
|
+
publicKey: z.ZodNullable<z.ZodString>;
|
|
70
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
71
|
+
publicKey: z.ZodString;
|
|
72
|
+
method: z.ZodEnum<{
|
|
73
|
+
replace: "replace";
|
|
74
|
+
create: "create";
|
|
75
|
+
}>;
|
|
76
|
+
linkedByUserId: z.ZodNullable<z.ZodString>;
|
|
77
|
+
previousKeyProven: z.ZodBoolean;
|
|
78
|
+
linkedAt: z.ZodString;
|
|
79
|
+
retiredAt: z.ZodNullable<z.ZodString>;
|
|
80
|
+
}, z.core.$strict>>;
|
|
81
|
+
}, z.core.$strict>;
|
|
82
|
+
export type OrganizationIdentityKeyState = z.infer<typeof organizationIdentityKeyStateSchema>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/contracts",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.11.0",
|
|
4
4
|
"description": "OxyHQ API contracts — single source of truth for request/response Zod schemas and inferred types, shared by the backend and the client SDKs",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|