@trinsic/trinsic
Advanced tools
Comparing version 1.6.1-rc1 to 1.6.1-rc2
@@ -9,4 +9,4 @@ "use strict"; | ||
const proto_1 = require("./proto"); | ||
const okapi_1 = require("@trinsic/okapi"); | ||
const base64url_1 = __importDefault(require("base64url")); | ||
const OkapiProvider_1 = require("./OkapiProvider"); | ||
class AccountService extends ServiceBase_1.default { | ||
@@ -26,6 +26,3 @@ constructor(options) { | ||
let cloned = proto_1.AccountProfile.fromPartial(profile); | ||
const result = await okapi_1.Oberon.blindToken({ | ||
blinding: [securityCode], | ||
token: cloned.authToken, | ||
}); | ||
const result = await (0, OkapiProvider_1.blindOberon)(cloned, securityCode); | ||
cloned.authToken = result.token; | ||
@@ -47,6 +44,3 @@ cloned.protection = proto_1.TokenProtection.fromPartial({ | ||
let cloned = proto_1.AccountProfile.fromPartial(profile); | ||
const result = await okapi_1.Oberon.unblindToken({ | ||
token: cloned.authToken, | ||
blinding: [securityCode], | ||
}); | ||
const result = await (0, OkapiProvider_1.unblindOberon)(cloned, securityCode); | ||
cloned.authToken = result.token; | ||
@@ -91,6 +85,6 @@ cloned.protection = proto_1.TokenProtection.fromPartial({ | ||
authCode = AccountService.convertToUtf8(authCode); | ||
let hashed = await okapi_1.Hashing.blake3Hash({ data: authCode }); | ||
let digest = await (0, OkapiProvider_1.blake3HashRequest)(authCode); | ||
let response = await this.client.loginConfirm({ | ||
challenge: challenge, | ||
confirmationCodeHashed: hashed.digest, | ||
confirmationCodeHashed: digest, | ||
}); | ||
@@ -97,0 +91,0 @@ if (response.profile === undefined) { |
@@ -7,6 +7,6 @@ "use strict"; | ||
const proto_1 = require("./proto"); | ||
const okapi_1 = require("@trinsic/okapi"); | ||
const nice_grpc_common_1 = require("nice-grpc-common"); | ||
const base64url_1 = __importDefault(require("base64url")); | ||
const nice_grpc_web_1 = require("nice-grpc-web"); | ||
const OkapiProvider_1 = require("./OkapiProvider"); | ||
class ServiceBase { | ||
@@ -35,21 +35,11 @@ constructor(options = proto_1.ServiceOptions.fromPartial({})) { | ||
} | ||
const requestData = request; | ||
let requestHash = new Uint8Array(); | ||
if (requestData.length > 0) { | ||
let hashResponse = await okapi_1.Hashing.blake3Hash({ data: requestData }); | ||
requestHash = hashResponse.digest; | ||
} | ||
const requestHash = await (0, OkapiProvider_1.blake3HashRequest)(request); | ||
const timestamp = Date.now(); | ||
let nonce = { timestamp: timestamp, requestHash: requestHash }; | ||
const nonceUint8 = proto_1.Nonce.encode(nonce).finish(); | ||
let proof = await okapi_1.Oberon.createProof({ | ||
data: profile.authData, | ||
nonce: nonceUint8, | ||
token: profile.authToken, | ||
blinding: [], | ||
}); | ||
const proof = await (0, OkapiProvider_1.oberonProofRequest)(profile, nonceUint8); | ||
const metadata = new nice_grpc_common_1.Metadata(); | ||
metadata.append("authorization", `Oberon ` + | ||
`ver=1,` + | ||
`proof=${(0, base64url_1.default)(Buffer.from(proof.proof))},` + | ||
`proof=${(0, base64url_1.default)(Buffer.from(proof))},` + | ||
`data=${(0, base64url_1.default)(Buffer.from(profile.authData))},` + | ||
@@ -56,0 +46,0 @@ `nonce=${(0, base64url_1.default)(Buffer.from(nonceUint8))}`); |
{ | ||
"name": "@trinsic/trinsic", | ||
"version": "1.6.1-rc1", | ||
"version": "1.6.1-rc2", | ||
"description": "Node and Browser wrapper for the Trinsic services", | ||
"browser": { | ||
"@trinsic/okapi-node": "@trinsic/okapi-web" | ||
}, | ||
"main": "lib/index.js", | ||
@@ -37,3 +40,4 @@ "types": "lib/index.d.ts", | ||
"@improbable-eng/grpc-web-node-http-transport": "^0.15.0", | ||
"@trinsic/okapi": "1.6.0", | ||
"@trinsic/okapi-node": "^1.6.1-rc1", | ||
"@trinsic/okapi-web": "^1.6.1-rc1", | ||
"assert": "^2.0.0", | ||
@@ -40,0 +44,0 @@ "base64url": "^3.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1072790
77
16332
13
+ Added@protobufjs/aspromise@1.1.2(transitive)
+ Added@protobufjs/base64@1.1.2(transitive)
+ Added@protobufjs/codegen@2.0.4(transitive)
+ Added@protobufjs/eventemitter@1.1.0(transitive)
+ Added@protobufjs/fetch@1.1.0(transitive)
+ Added@protobufjs/float@1.0.2(transitive)
+ Added@protobufjs/inquire@1.1.0(transitive)
+ Added@protobufjs/path@1.1.2(transitive)
+ Added@protobufjs/pool@1.1.0(transitive)
+ Added@protobufjs/utf8@1.1.0(transitive)
+ Added@trinsic/okapi-node@1.6.2(transitive)
+ Added@types/node@22.10.2(transitive)
+ Addedprotobufjs@7.4.0(transitive)
+ Addedundici-types@6.20.0(transitive)
- Removed@trinsic/okapi@1.6.0
- Removed@trinsic/okapi@1.6.0(transitive)