@oxy.so/core 7.26.0 → 7.28.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/api/identity.js +19 -2
- package/dist/cjs/crypto/identityDerivations.js +6 -0
- package/dist/cjs/crypto/index.js +6 -3
- package/dist/cjs/i18n/locales/compact/es-ES.generated.js +1 -1
- package/dist/cjs/i18n/locales/en-US.js +14 -0
- package/dist/cjs/i18n/locales/es-ES.js +14 -0
- package/dist/esm/api/identity.js +19 -2
- package/dist/esm/crypto/identityDerivations.js +6 -0
- package/dist/esm/crypto/index.js +6 -2
- package/dist/esm/i18n/locales/compact/es-ES.generated.js +1 -1
- package/dist/esm/i18n/locales/en-US.js +14 -0
- package/dist/esm/i18n/locales/es-ES.js +14 -0
- package/dist/types/api/identity.d.ts +18 -1
- package/dist/types/crypto/identityDerivations.d.ts +6 -0
- package/dist/types/crypto/index.d.ts +1 -1
- package/dist/types/i18n/locales/en-US.d.ts +14 -0
- package/dist/types/i18n/locales/es-ES.d.ts +14 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/models/interfaces.d.ts +6 -1
- package/package.json +1 -1
- package/src/api/identity.ts +32 -10
- package/src/crypto/identityDerivations.ts +6 -0
- package/src/crypto/index.ts +5 -2
- package/src/i18n/locales/compact/es-ES.generated.ts +1 -1
- package/src/i18n/locales/en-US.ts +14 -0
- package/src/i18n/locales/es-ES.ts +14 -0
- package/src/index.ts +1 -0
- package/src/models/interfaces.ts +6 -0
package/dist/cjs/api/identity.js
CHANGED
|
@@ -118,9 +118,26 @@ class IdentityApi {
|
|
|
118
118
|
* Resolve the W3C DID document for any user. The API derives it on demand
|
|
119
119
|
* from the account's `authMethods` + `publicKey` — there is no stored
|
|
120
120
|
* document. Public (no auth required); short-TTL cached.
|
|
121
|
+
*
|
|
122
|
+
* `{ fresh: true }` reads the document as it is NOW: it skips (and drops)
|
|
123
|
+
* this client's cached copy, is not joined to an in-flight read, and sends
|
|
124
|
+
* `Cache-Control: no-cache` so no HTTP cache on the way answers for the
|
|
125
|
+
* origin. Use it whenever the answer decides where money goes: `#key-1` is
|
|
126
|
+
* the account's Peable receive key and changes on a rotation or an
|
|
127
|
+
* organization key replacement, and a cached copy would derive an address
|
|
128
|
+
* from the previous key for up to the cache TTL.
|
|
121
129
|
*/
|
|
122
|
-
async resolveDid(userId) {
|
|
123
|
-
|
|
130
|
+
async resolveDid(userId, options = {}) {
|
|
131
|
+
const path = `/u/${encodeURIComponent(userId)}/did.json`;
|
|
132
|
+
if (options.fresh) {
|
|
133
|
+
this.ctx.http.invalidateCache({ keys: [`GET:${path}`] });
|
|
134
|
+
return this.ctx.request('GET', path, undefined, {
|
|
135
|
+
cache: false,
|
|
136
|
+
deduplicate: false,
|
|
137
|
+
headers: { 'Cache-Control': 'no-cache' },
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return this.ctx.request('GET', path, undefined, {
|
|
124
141
|
cache: true,
|
|
125
142
|
cacheTTL: SHORT_TTL,
|
|
126
143
|
});
|
|
@@ -65,6 +65,12 @@ function deriveScopedSeedFromKey(privateKeyHex, info) {
|
|
|
65
65
|
* `HMAC-SHA256(SOCIAL_RECEIVE_CHAIN_CODE_KEY, compressed identity public key)`.
|
|
66
66
|
* Identical to `@fairco.in/core`'s `deriveSocialReceiveSpendingKey`.
|
|
67
67
|
*
|
|
68
|
+
* INTERNAL to `@oxy.so/core` (not exported from `@oxy.so/core/crypto`): the
|
|
69
|
+
* derivation is non-hardened and the chain code is a public function of the
|
|
70
|
+
* identity public key, so `identity = child - I_L mod n` — whoever holds one
|
|
71
|
+
* child private key and the public key holds the identity key. Callers get
|
|
72
|
+
* signatures ({@link signSocialReceiveDigest}), never the child key.
|
|
73
|
+
*
|
|
68
74
|
* @returns the child private key and its compressed public key, lowercase hex.
|
|
69
75
|
*/
|
|
70
76
|
function deriveSocialReceiveKey(privateKeyHex, index) {
|
package/dist/cjs/crypto/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* common chunk, which is the cost the lazy loading exists to avoid.
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.verifySignature = exports.signMessage = exports.loadCommonsIdentityBridge = exports.canonicalize = exports.createContentHasher = exports.solveRegistrationPow = exports.deriveIdentityLinkCode = exports.signIdentityProof = exports.digestIdentityPayload = exports.authChallengeDigest = exports.signSocialReceiveDigest = exports.
|
|
15
|
+
exports.verifySignature = exports.signMessage = exports.loadCommonsIdentityBridge = exports.canonicalize = exports.createContentHasher = exports.solveRegistrationPow = exports.deriveIdentityLinkCode = exports.signIdentityProof = exports.digestIdentityPayload = exports.authChallengeDigest = exports.signSocialReceiveDigest = exports.deriveScopedSeedFromKey = exports.MAX_SOCIAL_RECEIVE_INDEX = exports.SOCIAL_RECEIVE_CHAIN_CODE_KEY = exports.SCOPED_SEED_KDF_SALT = exports.deriveSharedSecret = exports.AEAD_NONCE_LENGTH = exports.AEAD_KEY_LENGTH = exports.decryptAead = exports.encryptAead = exports.hkdfSha256 = exports.BACKUP_KDF_ENCRYPTION_INFO = exports.RecoveryPhraseService = exports.SignatureService = exports.isHealthyOrganizationKeyPair = exports.isOrganizationAccountId = exports.syncOrganizationKeys = exports.deleteOrganizationKey = exports.listOrganizationKeys = exports.getOrganizationRecoveryPhrase = exports.getOrganizationPrivateKey = exports.getOrganizationPublicKey = exports.storeOrganizationKey = exports.organizationKeyFromPhrase = exports.generateOrganizationKey = exports.updateIdentityMarker = exports.readIdentityMarker = exports.IdentityUnavailableError = exports.IdentityPersistError = exports.IdentityAlreadyExistsError = exports.KeyManager = void 0;
|
|
16
16
|
// MUST stay the first import: the shim has to exist before any module below
|
|
17
17
|
// evaluates or draws randomness (see `./polyfill`).
|
|
18
18
|
require("./polyfill");
|
|
@@ -53,13 +53,16 @@ Object.defineProperty(exports, "AEAD_NONCE_LENGTH", { enumerable: true, get: fun
|
|
|
53
53
|
var ecdh_1 = require("./ecdh");
|
|
54
54
|
Object.defineProperty(exports, "deriveSharedSecret", { enumerable: true, get: function () { return ecdh_1.deriveSharedSecret; } });
|
|
55
55
|
// What the identity key computes without leaving its holder: the same functions
|
|
56
|
-
// Commons' identity host implements natively on Android.
|
|
56
|
+
// Commons' identity host implements natively on Android. The social-receive
|
|
57
|
+
// CHILD private key (`deriveSocialReceiveKey`) is deliberately not here: the
|
|
58
|
+
// derivation is non-hardened under a chain code anyone can compute from the
|
|
59
|
+
// public key, so one leaked child private key reveals the identity key. Only
|
|
60
|
+
// signatures (`signSocialReceiveDigest`) leave this module.
|
|
57
61
|
var identityDerivations_1 = require("./identityDerivations");
|
|
58
62
|
Object.defineProperty(exports, "SCOPED_SEED_KDF_SALT", { enumerable: true, get: function () { return identityDerivations_1.SCOPED_SEED_KDF_SALT; } });
|
|
59
63
|
Object.defineProperty(exports, "SOCIAL_RECEIVE_CHAIN_CODE_KEY", { enumerable: true, get: function () { return identityDerivations_1.SOCIAL_RECEIVE_CHAIN_CODE_KEY; } });
|
|
60
64
|
Object.defineProperty(exports, "MAX_SOCIAL_RECEIVE_INDEX", { enumerable: true, get: function () { return identityDerivations_1.MAX_SOCIAL_RECEIVE_INDEX; } });
|
|
61
65
|
Object.defineProperty(exports, "deriveScopedSeedFromKey", { enumerable: true, get: function () { return identityDerivations_1.deriveScopedSeedFromKey; } });
|
|
62
|
-
Object.defineProperty(exports, "deriveSocialReceiveKey", { enumerable: true, get: function () { return identityDerivations_1.deriveSocialReceiveKey; } });
|
|
63
66
|
Object.defineProperty(exports, "signSocialReceiveDigest", { enumerable: true, get: function () { return identityDerivations_1.signSocialReceiveDigest; } });
|
|
64
67
|
Object.defineProperty(exports, "authChallengeDigest", { enumerable: true, get: function () { return identityDerivations_1.authChallengeDigest; } });
|
|
65
68
|
// Identity proofs — the one signed format for operations on a personal root
|