@dfinity/authentication
Advanced tools
Comparing version 0.0.0-pre.identity-provider.12 to 0.0.0-pre.identity-provider.13
@@ -1,5 +0,5 @@ | ||
import { Transport, IdentityProviderIndicator } from "../idp-agent/transport"; | ||
import { AuthenticationResponseUrlDetectedEvent } from "../id-dom-events"; | ||
import { BootstrapChangeIdentityCommand } from "../bootstrap-messages/BootstrapChangeIdentityCommand"; | ||
import { IdentityProviderAgent, SendAuthenticationRequestCommand } from "../idp-agent/idp-agent"; | ||
import { Transport, IdentityProviderIndicator } from '../idp-agent/transport'; | ||
import { AuthenticationResponseUrlDetectedEvent } from '../id-dom-events'; | ||
import { BootstrapChangeIdentityCommand } from '../bootstrap-messages/BootstrapChangeIdentityCommand'; | ||
import { IdentityProviderAgent, SendAuthenticationRequestCommand } from '../idp-agent/idp-agent'; | ||
declare type ReceiveAuthenticationResponseCommand = { | ||
@@ -10,3 +10,11 @@ url: URL; | ||
declare type UseSessionCommand = { | ||
authenticationResponse: string; | ||
/** | ||
* ic-id-protocol AuthenticationResponse as a URL string. | ||
* This is the result of an oauth2 flow initiated by sendAuthenticationRequest. | ||
* If this is undefined, a whole authentication can't really complete, | ||
* but it can be useful for ic-id relying parties to model a | ||
* Session and it's keyPair in order to create an AuthenticationRequest, | ||
* and only later the authenticationResponse is updated (if received). | ||
*/ | ||
authenticationResponse?: string; | ||
identity: { | ||
@@ -13,0 +21,0 @@ sign(challenge: ArrayBuffer): Promise<ArrayBuffer>; |
@@ -41,4 +41,4 @@ "use strict"; | ||
__classPrivateFieldGet(this, _transport).send({ | ||
to: "document", | ||
message: id_dom_events_1.AuthenticationResponseUrlDetectedEvent(command) | ||
to: 'document', | ||
message: id_dom_events_1.AuthenticationResponseUrlDetectedEvent(command), | ||
}); | ||
@@ -50,12 +50,16 @@ } | ||
async useSession(command) { | ||
if (!command.authenticationResponse) { | ||
__classPrivateFieldGet(this, _log).call(this, 'debug', 'useSession called without authenticationResponse. Will NOT send BootstrapChangeIdentityCommand.'); | ||
return; | ||
} | ||
const message = { | ||
type: BootstrapChangeIdentityCommand_1.BootstrapChangeIdentityCommandIdentifier, | ||
detail: command, | ||
detail: Object.assign(Object.assign({}, command), { authenticationResponse: command.authenticationResponse }), | ||
}; | ||
const envelope = { | ||
to: "document", | ||
to: 'document', | ||
message, | ||
}; | ||
__classPrivateFieldGet(this, _log).call(this, 'debug', 'useSession sending to document', envelope); | ||
__classPrivateFieldGet(this, _transport).send(envelope); | ||
await __classPrivateFieldGet(this, _transport).send(envelope); | ||
} | ||
@@ -62,0 +66,0 @@ } |
@@ -1,3 +0,3 @@ | ||
export { Authenticator } from "./Authenticator"; | ||
import * as AuthenticatorModule from "./Authenticator"; | ||
export { Authenticator } from './Authenticator'; | ||
import * as AuthenticatorModule from './Authenticator'; | ||
export declare const authenticator: AuthenticatorModule.Authenticator; |
@@ -1,2 +0,2 @@ | ||
import { CustomEventWithDetail } from "./CustomEventWithDetail"; | ||
import { CustomEventWithDetail } from './CustomEventWithDetail'; | ||
export declare const AuthenticationResponseUrlDetectedEventIdentifier: "https://internetcomputer.org/ns/authentication/AuthenticationResponseUrlDetectedEvent"; | ||
@@ -3,0 +3,0 @@ export declare type AuthenticationResponseUrlDetectedEvent = { |
@@ -1,2 +0,2 @@ | ||
import { CustomEventWithDetail } from "./CustomEventWithDetail"; | ||
import { CustomEventWithDetail } from './CustomEventWithDetail'; | ||
export declare const IdentityRequestedEventIdentifier: "https://internetcomputer.org/ns/authentication/IdentityRequestedEvent"; | ||
@@ -3,0 +3,0 @@ /** |
@@ -19,3 +19,5 @@ "use strict"; | ||
if (!identity) { | ||
console.warn(`Cannot determine identity from bootstrapIdentityChannel MessageEvent`, { event }); | ||
console.warn(`Cannot determine identity from bootstrapIdentityChannel MessageEvent`, { | ||
event, | ||
}); | ||
return; | ||
@@ -22,0 +24,0 @@ } |
@@ -1,4 +0,4 @@ | ||
export * from "./CustomEventWithDetail"; | ||
export * from "./IdentityRequestedEvent"; | ||
export * from "./SignerAvailableEvent"; | ||
export * from "./AuthenticationResponseUrlDetectedEvent"; | ||
export * from './CustomEventWithDetail'; | ||
export * from './IdentityRequestedEvent'; | ||
export * from './SignerAvailableEvent'; | ||
export * from './AuthenticationResponseUrlDetectedEvent'; |
@@ -1,2 +0,2 @@ | ||
import { CustomEventWithDetail } from "./CustomEventWithDetail"; | ||
import { CustomEventWithDetail } from './CustomEventWithDetail'; | ||
export declare const SignerAvailableEventIdentifier: "https://internetcomputer.org/ns/authentication/SignerAvailableEvent"; | ||
@@ -3,0 +3,0 @@ declare type SignFunction = (challenge: ArrayBuffer) => Promise<ArrayBuffer>; |
@@ -151,3 +151,5 @@ "use strict"; | ||
async sign(challenge) { | ||
const blob = (challenge instanceof buffer_1.Buffer) ? agent_1.blobFromBuffer(challenge) : agent_1.blobFromUint8Array(new Uint8Array(challenge)); | ||
const blob = challenge instanceof buffer_1.Buffer | ||
? agent_1.blobFromBuffer(challenge) | ||
: agent_1.blobFromUint8Array(new Uint8Array(challenge)); | ||
const signature = tweetnacl.sign.detached(blob, this._privateKey); | ||
@@ -154,0 +156,0 @@ return agent_1.blobFromUint8Array(signature); |
@@ -29,4 +29,4 @@ "use strict"; | ||
location: { | ||
href: "https://example.com/" | ||
} | ||
href: 'https://example.com/', | ||
}, | ||
}); | ||
@@ -49,5 +49,5 @@ return agent; | ||
return agent_1.blobFromHex(samplePublicKeyHex); | ||
} | ||
} | ||
} | ||
}, | ||
}, | ||
}, | ||
}, | ||
@@ -90,4 +90,4 @@ redirectUri, | ||
publicKey: ed25519_1.Ed25519KeyIdentity.generate().getPublicKey(), | ||
} | ||
} | ||
}, | ||
}, | ||
}; | ||
@@ -123,4 +123,4 @@ await agent.sendAuthenticationRequest(sendAuthenticationRequestCommand); | ||
publicKey: ed25519_1.Ed25519KeyIdentity.generate().getPublicKey(), | ||
} | ||
} | ||
}, | ||
}, | ||
}; | ||
@@ -127,0 +127,0 @@ await agent.sendAuthenticationRequest(sendAuthenticationRequestCommand); |
@@ -1,2 +0,2 @@ | ||
export { SendAuthenticationRequestCommand } from "./idp-agent"; | ||
export { SendAuthenticationRequestCommand } from './idp-agent'; | ||
import * as idp from './idp-agent'; | ||
@@ -3,0 +3,0 @@ /** |
export * as request from './request'; | ||
export * as response from './response'; | ||
export { AuthenticationRequest } from "./request"; | ||
export { AuthenticationResponse } from "./response"; | ||
export * as oauth2 from "./oauth2"; | ||
export * as scope from "./scope"; | ||
export { AuthenticationRequest } from './request'; | ||
export { AuthenticationResponse } from './response'; | ||
export * as oauth2 from './oauth2'; | ||
export * as scope from './scope'; |
@@ -10,2 +10,2 @@ export { Ed25519KeyIdentity, Ed25519PublicKey } from './identity/ed25519'; | ||
export * from './bootstrap-messages/BootstrapChangeIdentityCommand'; | ||
export { authenticator, Authenticator } from "./authenticator"; | ||
export { authenticator, Authenticator } from './authenticator'; |
{ | ||
"name": "@dfinity/authentication", | ||
"version": "0.0.0-pre.identity-provider.12", | ||
"version": "0.0.0-pre.identity-provider.13", | ||
"main": ".tsc-out/packages/authentication/src/index.js", | ||
@@ -20,3 +20,3 @@ "types": ".tsc-out/packages/authentication/src/index.d.ts", | ||
"@types/jest": "^24.0.18", | ||
"@dfinity/agent": "0.0.0-pre.identity-provider.12", | ||
"@dfinity/agent": "file:../agent", | ||
"asn1.js": "^5.4.1", | ||
@@ -23,0 +23,0 @@ "base32.js": "^0.1.0", |
Sorry, the diff of this file is not supported yet
247865
66
2535
- Removed@dfinity/agent@0.0.0-pre.identity-provider.12(transitive)
Updated@dfinity/agent@file:../agent