{"_id":"@chaireblockchainulaval/bnaas-connect","_rev":"4-de9b01602204d1170d805875b6b22bdb","name":"@chaireblockchainulaval/bnaas-connect","dist-tags":{"latest":"0.3.5"},"versions":{"0.3.2":{"name":"@chaireblockchainulaval/bnaas-connect","version":"0.3.2","keywords":["bnaas","oauth","pkce","notarial","sdk"],"license":"UNLICENSED","_id":"@chaireblockchainulaval/bnaas-connect@0.3.2","maintainers":[{"name":"besionisrael","email":"sionisrael2@gmail.com"}],"homepage":"https://github.com/ChaireBlockchainULaval/bnaas-connect#readme","bugs":{"url":"https://github.com/ChaireBlockchainULaval/bnaas-connect/issues"},"dist":{"shasum":"c9574ea1091a5600975bc17de51d250c0402e7d5","tarball":"https://registry.npmjs.org/@chaireblockchainulaval/bnaas-connect/-/bnaas-connect-0.3.2.tgz","fileCount":8,"integrity":"sha512-C8pNRsBNrrVqyXobKubH0MPKzM24+KVaI6Hp8GIErs1d7GbbN+ZblfcsijEqjR53Jor/l4WnwjRI0h+hUiNUUQ==","signatures":[{"sig":"MEUCIQCpQxVNETKx/gpj4xcBf7vHyhsgJup4UqkuQ6kzwNiZfQIgUA3WVIE36nztoC/4W+a7D/scnrA1dyEtpYxsAIsS/LI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51667},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"46e489d3694ac390fd4352d2076568e2561a6101","scripts":{"build":"tsup","prepublishOnly":"npm run build"},"_npmUser":{"name":"besionisrael","email":"sionisrael2@gmail.com"},"repository":{"url":"git+https://github.com/ChaireBlockchainULaval/bnaas-connect.git","type":"git"},"_npmVersion":"11.13.0","description":"SDK « Se connecter avec BNAAS » — obtention d'un jeton d'identité notariale via OAuth 2.0 + PKCE (popup ou redirection).","directories":{},"sideEffects":false,"_nodeVersion":"24.17.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/bnaas-connect_0.3.2_1786993615991_0.8633022449393897","host":"s3://npm-registry-packages-npm-production"}},"0.3.3":{"name":"@chaireblockchainulaval/bnaas-connect","version":"0.3.3","keywords":["bnaas","oauth","pkce","notarial","sdk"],"license":"UNLICENSED","_id":"@chaireblockchainulaval/bnaas-connect@0.3.3","maintainers":[{"name":"besionisrael","email":"sionisrael2@gmail.com"}],"homepage":"https://github.com/ChaireBlockchainULaval/bnaas-connect#readme","bugs":{"url":"https://github.com/ChaireBlockchainULaval/bnaas-connect/issues"},"dist":{"shasum":"7fdea20fdeeba5a6fd96ef8ac51f06eccf68ec6c","tarball":"https://registry.npmjs.org/@chaireblockchainulaval/bnaas-connect/-/bnaas-connect-0.3.3.tgz","fileCount":8,"integrity":"sha512-ht0VHBwne74dI9y579UvGjC3H715Yo4qsJaz+Dkevt01ipJ9Sl5bN5NZFm/y1L4RwVvLgneSfaLLbXNCOlix2g==","signatures":[{"sig":"MEUCIGSL3gZi5n4UKZJIYVzMhmCViOVTlRlZ1EHg2IO7mJPlAiEAs8FWF4wn9L8lHLi85HtiT750gZiuMHJZrCoaxmiHUh8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@chaireblockchainulaval%2fbnaas-connect@0.3.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":51946},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"61a4e7877e0874328a007cfeffd7c0b25300c8a8","scripts":{"build":"tsup","prepublishOnly":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:064df1b5-6179-475c-ab61-e2b76c2bb286"}},"repository":{"url":"git+https://github.com/ChaireBlockchainULaval/bnaas-connect.git","type":"git"},"_npmVersion":"12.0.2","description":"SDK « Se connecter avec BNAAS » — obtention d'un jeton d'identité notariale via OAuth 2.0 + PKCE (popup ou redirection).","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/bnaas-connect_0.3.3_1786994904553_0.23284065697049394","host":"s3://npm-registry-packages-npm-production"}},"0.3.4":{"name":"@chaireblockchainulaval/bnaas-connect","version":"0.3.4","keywords":["bnaas","oauth","pkce","notarial","sdk"],"license":"UNLICENSED","_id":"@chaireblockchainulaval/bnaas-connect@0.3.4","maintainers":[{"name":"besionisrael","email":"sionisrael2@gmail.com"}],"homepage":"https://github.com/ChaireBlockchainULaval/bnaas-connect#readme","bugs":{"url":"https://github.com/ChaireBlockchainULaval/bnaas-connect/issues"},"dist":{"shasum":"f445bd400f5c2705f48ef58901d58a66f26c8170","tarball":"https://registry.npmjs.org/@chaireblockchainulaval/bnaas-connect/-/bnaas-connect-0.3.4.tgz","fileCount":8,"integrity":"sha512-MH4AcyMqq3WLqJe7vUMwRuL2ZmK1fAuJgkM6zUbL0m/BE2Fttt8MwPPj/dcLsfvRPg3LUsy6sFUMD+fHdA0BhA==","signatures":[{"sig":"MEUCIQC6j93CxEPKcV7TXHlezdXwJvLQWITCvMazJqSgxczAYAIgTz6MtOtgY9RrHLsSF3DB2zmS0tqMHgEvqErOSL9uvO4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@chaireblockchainulaval%2fbnaas-connect@0.3.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":50718},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"319d9cd4a7e34f2e43f19e3dee74e00ef455cbdf","scripts":{"build":"tsup","prepublishOnly":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:064df1b5-6179-475c-ab61-e2b76c2bb286"}},"repository":{"url":"git+https://github.com/ChaireBlockchainULaval/bnaas-connect.git","type":"git"},"_npmVersion":"12.0.2","description":"SDK « Se connecter avec BNAAS » — obtention d'un jeton d'identité notariale via OAuth 2.0 + PKCE (popup ou redirection).","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/bnaas-connect_0.3.4_1786995658532_0.6046560717396541","host":"s3://npm-registry-packages-npm-production"}},"0.3.5":{"name":"@chaireblockchainulaval/bnaas-connect","version":"0.3.5","description":"SDK « Se connecter avec BNAAS » — obtention d'un jeton d'identité notariale via OAuth 2.0 + PKCE (popup ou redirection).","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"sideEffects":false,"scripts":{"build":"tsup","prepublishOnly":"npm run build"},"keywords":["bnaas","oauth","pkce","notarial","sdk"],"license":"UNLICENSED","publishConfig":{"registry":"https://registry.npmjs.org","access":"public"},"repository":{"type":"git","url":"git+https://github.com/ChaireBlockchainULaval/bnaas-connect.git"},"devDependencies":{"tsup":"^8.3.5","typescript":"^5.6.3"},"gitHead":"c4cef07d2bfa93212491fbc61cfccff04656448a","_id":"@chaireblockchainulaval/bnaas-connect@0.3.5","bugs":{"url":"https://github.com/ChaireBlockchainULaval/bnaas-connect/issues"},"homepage":"https://github.com/ChaireBlockchainULaval/bnaas-connect#readme","_nodeVersion":"24.19.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-Ev9RVoqPIW+/UZm9ZTKTdViFfvJj3tKt72lwWmVbDCagcP5ID/UZmrVXqUiLXihhSyTkhHC7Db0PCrY8O+biqw==","shasum":"2888a9c55d8df8e021e89ec61dcdf28e2debf30e","tarball":"https://registry.npmjs.org/@chaireblockchainulaval/bnaas-connect/-/bnaas-connect-0.3.5.tgz","fileCount":8,"unpackedSize":52946,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@chaireblockchainulaval%2fbnaas-connect@0.3.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGf3wbX6DXIiiadAj65KxLTuaeWsMKaVTQ2Jh/0j+ap/AiB9KEVSKPoVDBjxTUJTueokd1Rveq9dD4ITiUPQX3gqDw=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:064df1b5-6179-475c-ab61-e2b76c2bb286"}},"directories":{},"maintainers":[{"name":"besionisrael","email":"sionisrael2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bnaas-connect_0.3.5_1787153976044_0.05314819351449973"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-17T19:06:55.795Z","modified":"2026-08-19T15:39:36.622Z","0.3.2":"2026-08-17T19:06:56.154Z","0.3.3":"2026-08-17T19:28:24.738Z","0.3.4":"2026-08-17T19:40:58.692Z","0.3.5":"2026-08-19T15:39:36.197Z"},"bugs":{"url":"https://github.com/ChaireBlockchainULaval/bnaas-connect/issues"},"license":"UNLICENSED","homepage":"https://github.com/ChaireBlockchainULaval/bnaas-connect#readme","keywords":["bnaas","oauth","pkce","notarial","sdk"],"repository":{"type":"git","url":"git+https://github.com/ChaireBlockchainULaval/bnaas-connect.git"},"description":"SDK « Se connecter avec BNAAS » — obtention d'un jeton d'identité notariale via OAuth 2.0 + PKCE (popup ou redirection).","maintainers":[{"name":"besionisrael","email":"sionisrael2@gmail.com"}],"readme":"# @chaireblockchainulaval/bnaas-connect\n\nSDK « Se connecter avec BNAAS » pour applications tierces. Obtient un **jeton\nd'identité notariale** via OAuth 2.0 (Authorization Code + PKCE), sans copier-coller.\n\n- TypeScript, **aucune dépendance runtime** (`crypto.subtle` natif). Navigateur uniquement.\n- Popup par défaut, **repli automatique en redirection** si la popup est bloquée ou si un\n  login interactif est nécessaire.\n\n> Guide d'intégration complet : **[docs/GUIDE-PARTENAIRE.md](docs/GUIDE-PARTENAIRE.md)**.\n> Contribution / publication du paquet (mainteneurs BNAAS) : **[CONTRIBUTING.md](CONTRIBUTING.md)**.\n\n## Prérequis (fournis par BNAAS)\n\nTon application doit être **enregistrée** auprès de BNAAS :\n- app registration Entra avec les rôles requis ;\n- entrée côté BNAAS (`client_id` = app id Entra) avec l'**allowlist** des origines et\n  des `redirect_uri`.\n\nBNAAS te communique alors : ton `client_id`, l'URL du portail et l'URL du Gateway.\n\n## Installation\n\nPaquet **public sur npm** — aucun token ni `.npmrc` requis :\n\n```bash\nnpm install @chaireblockchainulaval/bnaas-connect\n```\n\n## Usage — popup (recommandé)\n\n```ts\nimport { connect } from '@chaireblockchainulaval/bnaas-connect';\n\nasync function obtenirJeton() {\n  try {\n    const { token, expires_at, sub } = await connect({\n      clientId:    'APP_ID_ENTRA_DU_TIERS',\n      redirectUri: 'https://mon-appli.example/callback', // doit être dans l'allowlist\n      portalUrl:   'https://app.test.bnaas.ca',          // optionnel (défaut : test)\n      apiUrl:      'https://api.test.bnaas.ca',           // optionnel (défaut : test)\n    });\n    // token : jeton d'identité notariale (15 min, usage unique).\n    //         À placer dans l'en-tête X-Notarial-Identity-Token des appels notariaux.\n    // sub   : identifiant stable et global du notaire — sert à lier/dédoublonner\n    //         le compte côté ton application (à indexer, jamais le token).\n  } catch (e) {\n    if ((e as Error).message === 'access_denied') { /* le notaire a refusé */ }\n    else if ((e as Error).message === 'popup_closed') { /* fenêtre fermée */ }\n    else { /* autre erreur */ }\n  }\n}\n```\n\n## Page de callback (à faire une fois)\n\nSur la page servie à ton `redirectUri`, appelle `handleRedirectCallback()` au chargement.\nC'est ce qui couvre le cas où le notaire **n'a pas de session BNAAS active** (login\ninteractif dans la popup, puis relais du code à la fenêtre d'origine) ainsi que le repli\nen redirection pleine page :\n\n```ts\nimport { handleRedirectCallback } from '@chaireblockchainulaval/bnaas-connect';\n\n// Au chargement de la page redirect_uri :\nconst result = await handleRedirectCallback();\nif (result) {\n  // Redirection pleine page : result = { token, expires_at }.\n  // (Cas popup : le code est relayé automatiquement à la fenêtre d'origine,\n  //  cette page se referme seule — rien de plus à faire.)\n}\n```\n\nPour forcer le mode redirection dès le départ :\n\n```ts\nawait connect({ clientId, redirectUri, preferRedirect: true });\n```\n\n## Sécurité\n\n- **PKCE (S256)** : le `code_verifier` ne quitte jamais ton application.\n- **`state`** anti-CSRF, vérifié à la réception.\n- **Origine vérifiée** : en popup, seuls les messages du portail sont acceptés.\n- Le **jeton ne transite jamais** dans le canal de retour — uniquement un code court, à\n  usage unique, échangé ensuite contre le jeton.\n\n## API\n\n- `connect(options): Promise<{ token, expires_at, sub }>`\n- `handleRedirectCallback(): Promise<{ token, expires_at, sub } | null>`\n\n**Options** : `clientId`, `redirectUri` (requis) ; `portalUrl`, `apiUrl`, `preferRedirect`\n(optionnels).\n\n**Résultat** :\n- `token` — jeton d'identité notariale (15 min, usage unique) ;\n- `expires_at` — expiration ISO 8601 ;\n- `sub` — identifiant stable et global du notaire, à utiliser pour lier/dédoublonner les\n  comptes côté application (à indexer, jamais le `token`).\n","readmeFilename":"README.md"}